@@ -389,7 +389,7 @@ |
||
389 | 389 | * The edit previously deemed as having the maximum amount of content added. |
390 | 390 | * This is used to discount content that was reverted. |
391 | 391 | * @var Edit|null |
392 | - */ |
|
392 | + */ |
|
393 | 393 | $prevMaxAddEdit = null; |
394 | 394 | |
395 | 395 | /** |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | $article = $request->query->get('article'); |
85 | 85 | |
86 | 86 | if ($projectQuery != '' && $article != '') { |
87 | - return $this->redirectToRoute('ArticleInfoResult', [ 'project'=>$projectQuery, 'article' => $article ]); |
|
87 | + return $this->redirectToRoute('ArticleInfoResult', ['project'=>$projectQuery, 'article' => $article]); |
|
88 | 88 | } elseif ($article != '') { |
89 | - return $this->redirectToRoute('ArticleInfoProject', [ 'project'=>$projectQuery ]); |
|
89 | + return $this->redirectToRoute('ArticleInfoProject', ['project'=>$projectQuery]); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | if ($projectQuery == '') { |
@@ -188,10 +188,10 @@ discard block |
||
188 | 188 | $userGroupsTable = $this->projectRepo->getTableName($this->dbName, 'user_groups'); |
189 | 189 | $userFromerGroupsTable = $this->projectRepo->getTableName($this->dbName, 'user_former_groups'); |
190 | 190 | $query = "SELECT COUNT(rev_user_text) AS count, rev_user_text AS username, ug_group AS current |
191 | - FROM " . $this->projectRepo->getTableName($this->dbName, 'revision') . " |
|
191 | + FROM " . $this->projectRepo->getTableName($this->dbName, 'revision')." |
|
192 | 192 | LEFT JOIN $userGroupsTable ON rev_user = ug_user |
193 | 193 | LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user |
194 | - WHERE rev_page = " . $this->pageInfo['page']->getId() . " AND (ug_group = 'bot' OR ufg_group = 'bot') |
|
194 | + WHERE rev_page = ".$this->pageInfo['page']->getId()." AND (ug_group = 'bot' OR ufg_group = 'bot') |
|
195 | 195 | GROUP BY rev_user_text"; |
196 | 196 | $res = $this->conn->query($query)->fetchAll(); |
197 | 197 | |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | $sum = 0; |
201 | 201 | foreach ($res as $bot) { |
202 | 202 | $bots[$bot['username']] = [ |
203 | - 'count' => (int) $bot['count'], |
|
203 | + 'count' => (int)$bot['count'], |
|
204 | 204 | 'current' => $bot['current'] === 'bot' |
205 | 205 | ]; |
206 | 206 | $sum += $bot['count']; |
207 | 207 | } |
208 | 208 | |
209 | - uasort($bots, function ($a, $b) { |
|
210 | - return $b['count'] - $a['count']; |
|
209 | + uasort($bots, function($a, $b) { |
|
210 | + return $b['count']-$a['count']; |
|
211 | 211 | }); |
212 | 212 | |
213 | 213 | $this->pageInfo['general']['bot_revision_count'] = $sum; |
@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | |
256 | 256 | if ($info['all'] > 1) { |
257 | 257 | // Number of seconds between first and last edit |
258 | - $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp(); |
|
258 | + $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp(); |
|
259 | 259 | |
260 | 260 | // Average time between edits (in days) |
261 | - $this->pageInfo['editors'][$editor]['atbe'] = $secs / ( 60 * 60 * 24 ); |
|
261 | + $this->pageInfo['editors'][$editor]['atbe'] = $secs / (60 * 60 * 24); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | if (count($info['sizes'])) { |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | // First sort editors array by the amount of text they added |
275 | 275 | $topTenEditorsByAdded = $this->pageInfo['editors']; |
276 | - uasort($topTenEditorsByAdded, function ($a, $b) { |
|
276 | + uasort($topTenEditorsByAdded, function($a, $b) { |
|
277 | 277 | if ($a['added'] === $b['added']) { |
278 | 278 | return 0; |
279 | 279 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | // Then build a new array of top 10 editors by added text, |
284 | 284 | // in the data structure needed for the chart |
285 | - $this->pageInfo['topTenEditorsByAdded'] = array_map(function ($editor) { |
|
285 | + $this->pageInfo['topTenEditorsByAdded'] = array_map(function($editor) { |
|
286 | 286 | $added = $this->pageInfo['editors'][$editor]['added']; |
287 | 287 | return [ |
288 | 288 | 'label' => $editor, |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $title = str_replace(' ', '_', $this->pageInfo['page']->getTitle()); |
307 | 307 | $query = "SELECT log_action, log_type, log_timestamp AS timestamp |
308 | 308 | FROM $loggingTable |
309 | - WHERE log_namespace = '" . $this->pageInfo['page']->getNamespace() . "' |
|
309 | + WHERE log_namespace = '".$this->pageInfo['page']->getNamespace()."' |
|
310 | 310 | AND log_title = '$title' AND log_timestamp > 1 |
311 | 311 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
312 | 312 | $events = $this->conn->query($query)->fetchAll(); |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | |
424 | 424 | if ($revCount === 0) { |
425 | 425 | $firstEdit = $edit; |
426 | - $firstEditMonth = mktime(0, 0, 0, (int) $firstEdit->getMonth(), 1, $firstEdit->getYear()); |
|
426 | + $firstEditMonth = mktime(0, 0, 0, (int)$firstEdit->getMonth(), 1, $firstEdit->getYear()); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | $username = $edit->getUser()->getUsername(); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | $this->stopwatch->start($cacheKey, 'XTools'); |
79 | 79 | $api = $this->getMediawikiApi($project); |
80 | - $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ]; |
|
80 | + $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"]; |
|
81 | 81 | $query = new SimpleRequest('query', $params); |
82 | 82 | $result = []; |
83 | 83 | $res = $api->getRequest($query); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | // Create the API query. |
114 | 114 | $api = $this->getMediawikiApi($project); |
115 | - $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ]; |
|
115 | + $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"]; |
|
116 | 116 | $query = new SimpleRequest('query', $params); |
117 | 117 | |
118 | 118 | // Get the result. |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | { |
157 | 157 | $username = $user->getUsername(); |
158 | 158 | |
159 | - $cacheKey = 'pages.' . $project->getDatabaseName() . '.' |
|
160 | - . $user->getCacheKey() . '.' . $namespace . '.' . $redirects; |
|
159 | + $cacheKey = 'pages.'.$project->getDatabaseName().'.' |
|
160 | + . $user->getCacheKey().'.'.$namespace.'.'.$redirects; |
|
161 | 161 | if ($this->cache->hasItem($cacheKey)) { |
162 | 162 | return $this->cache->getItem($cacheKey)->get(); |
163 | 163 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | JOIN $revisionTable ON page_id = rev_page |
216 | 216 | $paJoin |
217 | 217 | WHERE $whereRev AND rev_parent_id = '0' $namespaceConditionRev $redirectCondition |
218 | - " . ($hasPageAssessments ? 'GROUP BY rev_page' : '') . " |
|
218 | + ".($hasPageAssessments ? 'GROUP BY rev_page' : '')." |
|
219 | 219 | ) |
220 | 220 | |
221 | 221 | UNION |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | protected function getPairData() |
69 | 69 | { |
70 | - if (! is_array($this->pairData)) { |
|
70 | + if (!is_array($this->pairData)) { |
|
71 | 71 | $this->pairData = $this->getRepository() |
72 | 72 | ->getPairData($this->project, $this->user); |
73 | 73 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | protected function getLogCounts() |
82 | 82 | { |
83 | - if (! is_array($this->logCounts)) { |
|
83 | + if (!is_array($this->logCounts)) { |
|
84 | 84 | $this->logCounts = $this->getRepository() |
85 | 85 | ->getLogCounts($this->project, $this->user); |
86 | 86 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function countAllRevisions() |
131 | 131 | { |
132 | - return $this->countLiveRevisions() + $this->countDeletedRevisions(); |
|
132 | + return $this->countLiveRevisions()+$this->countDeletedRevisions(); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function countRevisionsWithoutComments() |
150 | 150 | { |
151 | - return $this->countAllRevisions() - $this->countRevisionsWithComments(); |
|
151 | + return $this->countAllRevisions()-$this->countRevisionsWithComments(); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function countAllPagesEdited() |
189 | 189 | { |
190 | - return $this->countLivePagesEdited() + $this->countDeletedPagesEdited(); |
|
190 | + return $this->countLivePagesEdited()+$this->countDeletedPagesEdited(); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public function countPagesCreated() |
199 | 199 | { |
200 | - return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted(); |
|
200 | + return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted(); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | // Try block just in case there are older, unpredictable formats |
326 | 326 | try { |
327 | 327 | $expiry = strtotime($durationStr, $timestamp); |
328 | - $duration = ($expiry - $timestamp) / (60 * 60 * 24); |
|
328 | + $duration = ($expiry-$timestamp) / (60 * 60 * 24); |
|
329 | 329 | |
330 | 330 | if (!$duration || $duration > $this->longestBlockDays) { |
331 | 331 | $this->longestBlockDays = $duration; |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0; |
410 | 410 | $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0; |
411 | 411 | $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0; |
412 | - return $import + $interwiki + $upload; |
|
412 | + return $import+$interwiki+$upload; |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | /** |
@@ -542,9 +542,9 @@ discard block |
||
542 | 542 | public function approvals() |
543 | 543 | { |
544 | 544 | $logCounts = $this->getLogCounts(); |
545 | - $total = $logCounts['review-approve'] + |
|
546 | - (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) + |
|
547 | - (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) + |
|
545 | + $total = $logCounts['review-approve']+ |
|
546 | + (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+ |
|
547 | + (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+ |
|
548 | 548 | (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0); |
549 | 549 | return $total; |
550 | 550 | } |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | $logCounts = $this->getLogCounts(); |
569 | 569 | $create2 = $logCounts['newusers-create2'] ?: 0; |
570 | 570 | $byemail = $logCounts['newusers-byemail'] ?: 0; |
571 | - return $create2 + $byemail; |
|
571 | + return $create2+$byemail; |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | /** |
@@ -641,14 +641,14 @@ discard block |
||
641 | 641 | if (!isset($out['totals'][$ns])) { |
642 | 642 | $out['totals'][$ns] = []; |
643 | 643 | } |
644 | - $out['totals'][$ns][$total['year'] . $total['month']] = $total['count']; |
|
644 | + $out['totals'][$ns][$total['year'].$total['month']] = $total['count']; |
|
645 | 645 | } |
646 | 646 | // Fill in the blanks (where no edits were made in a given month for a namespace). |
647 | 647 | for ($y = $out['min_year']; $y <= $out['max_year']; $y++) { |
648 | 648 | for ($m = 1; $m <= 12; $m++) { |
649 | 649 | foreach ($out['totals'] as $nsId => &$total) { |
650 | - if (!isset($total[$y . $m])) { |
|
651 | - $total[$y . $m] = 0; |
|
650 | + if (!isset($total[$y.$m])) { |
|
651 | + $total[$y.$m] = 0; |
|
652 | 652 | } |
653 | 653 | } |
654 | 654 | } |
@@ -714,8 +714,8 @@ discard block |
||
714 | 714 | ->globalEditCounts($this->user, $this->project); |
715 | 715 | if ($sorted) { |
716 | 716 | // Sort. |
717 | - uasort($this->globalEditCounts, function ($a, $b) { |
|
718 | - return $b['total'] - $a['total']; |
|
717 | + uasort($this->globalEditCounts, function($a, $b) { |
|
718 | + return $b['total']-$a['total']; |
|
719 | 719 | }); |
720 | 720 | } |
721 | 721 | } |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | $nsName = $project->getNamespaces()[$revision['page_namespace']]; |
754 | 754 | } |
755 | 755 | $page = $project->getRepository() |
756 | - ->getPage($project, $nsName . ':' . $revision['page_title']); |
|
756 | + ->getPage($project, $nsName.':'.$revision['page_title']); |
|
757 | 757 | $edit = new Edit($page, $revision); |
758 | 758 | $globalEdits[$edit->getTimestamp()->getTimestamp().'-'.$edit->getId()] = $edit; |
759 | 759 | } |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | */ |
771 | 771 | protected function getEditSizeData() |
772 | 772 | { |
773 | - if (! is_array($this->editSizeData)) { |
|
773 | + if (!is_array($this->editSizeData)) { |
|
774 | 774 | $this->editSizeData = $this->getRepository() |
775 | 775 | ->getEditSizeData($this->project, $this->user); |
776 | 776 | } |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | public function countSmallEdits() |
795 | 795 | { |
796 | 796 | $editSizeData = $this->getEditSizeData(); |
797 | - return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0; |
|
797 | + return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0; |
|
798 | 798 | } |
799 | 799 | |
800 | 800 | /** |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | public function countLargeEdits() |
805 | 805 | { |
806 | 806 | $editSizeData = $this->getEditSizeData(); |
807 | - return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0; |
|
807 | + return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0; |
|
808 | 808 | } |
809 | 809 | |
810 | 810 | /** |