@@ -57,7 +57,7 @@ |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | // Find the path, and complain if English doesn't exist. |
60 | - $path = $this->container->getParameter('kernel.root_dir') . '/../i18n'; |
|
60 | + $path = $this->container->getParameter('kernel.root_dir').'/../i18n'; |
|
61 | 61 | if (!file_exists("$path/en.json")) { |
62 | 62 | throw new Exception("Language directory doesn't exist: $path"); |
63 | 63 | } |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | $displayTitles = $this->getDisplayTitles($pages); |
120 | 120 | |
121 | 121 | foreach ($pages as $page) { |
122 | - $nsId = (int) $page['page_namespace']; |
|
123 | - $nsTitle = $nsId > 0 ? $this->project->getNamespaces()[$page['page_namespace']] . ':' : ''; |
|
124 | - $pageTitle = $nsTitle . $page['page_title']; |
|
122 | + $nsId = (int)$page['page_namespace']; |
|
123 | + $nsTitle = $nsId > 0 ? $this->project->getNamespaces()[$page['page_namespace']].':' : ''; |
|
124 | + $pageTitle = $nsTitle.$page['page_title']; |
|
125 | 125 | $page['displaytitle'] = $displayTitles[$pageTitle]; |
126 | 126 | |
127 | 127 | // $page['page_title'] is retained without the namespace |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | $namespaces = $this->project->getNamespaces(); |
149 | 149 | |
150 | 150 | // First extract page titles including namespace. |
151 | - $pageTitles = array_map(function ($page) use ($namespaces) { |
|
151 | + $pageTitles = array_map(function($page) use ($namespaces) { |
|
152 | 152 | // If non-mainspace, prepend namespace to the titles. |
153 | 153 | $ns = $page['page_namespace']; |
154 | - $nsTitle = $ns > 0 ? $namespaces[$page['page_namespace']] . ':' : ''; |
|
155 | - return $nsTitle . $page['page_title']; |
|
154 | + $nsTitle = $ns > 0 ? $namespaces[$page['page_namespace']].':' : ''; |
|
155 | + return $nsTitle.$page['page_title']; |
|
156 | 156 | }, $topPages); |
157 | 157 | |
158 | 158 | return $this->getRepository()->getDisplayTitles($this->project, $pageTitles); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | $hasPageAssessments = $this->isLabs() && $project->hasPageAssessments() && $namespace === 0; |
39 | 39 | $paSelect = $hasPageAssessments |
40 | - ? ", ( |
|
40 | + ? ", ( |
|
41 | 41 | SELECT pa_class |
42 | 42 | FROM page_assessments |
43 | 43 | WHERE pa_page_id = page_id |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $hasPageAssessments = $this->isLabs() && $project->hasPageAssessments(); |
93 | 93 | $pageAssessmentsTable = $this->getTableName($project->getDatabaseName(), 'page_assessments'); |
94 | 94 | $paSelect = $hasPageAssessments |
95 | - ? ", ( |
|
95 | + ? ", ( |
|
96 | 96 | SELECT pa_class |
97 | 97 | FROM $pageAssessmentsTable |
98 | 98 | WHERE pa_page_id = e.page_id |
@@ -191,7 +191,7 @@ |
||
191 | 191 | // Send all to the template. |
192 | 192 | return $this->render('topedits/result_article.html.twig', [ |
193 | 193 | 'xtPage' => 'topedits', |
194 | - 'xtTitle' => $user->getUsername() . ' - ' . $page->getTitle(), |
|
194 | + 'xtTitle' => $user->getUsername().' - '.$page->getTitle(), |
|
195 | 195 | 'project' => $project, |
196 | 196 | 'user' => $user, |
197 | 197 | 'page' => $page, |
@@ -52,7 +52,7 @@ |
||
52 | 52 | $userGroupsTable = $project->getTableName('user_groups'); |
53 | 53 | $ufgTable = $project->getTableName('user_former_groups'); |
54 | 54 | |
55 | - $adminGroups = join(array_map(function ($group) { |
|
55 | + $adminGroups = join(array_map(function($group) { |
|
56 | 56 | return "'$group'"; |
57 | 57 | }, $this->getAdminGroups($project)), ','); |
58 | 58 |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | || $projMetadata['url'] == "https://$project" |
150 | 150 | || $projMetadata['url'] == "https://$project.org" |
151 | 151 | || $projMetadata['url'] == "https://www.$project") { |
152 | - $this->log->debug(__METHOD__ . " Using cached data for $project"); |
|
152 | + $this->log->debug(__METHOD__." Using cached data for $project"); |
|
153 | 153 | return $projMetadata; |
154 | 154 | } |
155 | 155 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $optedIn = $this->container->getParameter('opted_in'); |
293 | 293 | // In case there's just one given. |
294 | 294 | if (!is_array($optedIn)) { |
295 | - $optedIn = [ $optedIn ]; |
|
295 | + $optedIn = [$optedIn]; |
|
296 | 296 | } |
297 | 297 | return $optedIn; |
298 | 298 | } |
@@ -339,9 +339,9 @@ |
||
339 | 339 | $conn = $this->getProjectsConnection(); |
340 | 340 | $pageTable = $this->getTableName($project->getDatabaseName(), 'page'); |
341 | 341 | $query = "SELECT page_id " |
342 | - . " FROM $pageTable " |
|
343 | - . " WHERE page_namespace = :ns AND page_title = :title AND page_len > 0 " |
|
344 | - . " LIMIT 1"; |
|
342 | + . " FROM $pageTable " |
|
343 | + . " WHERE page_namespace = :ns AND page_title = :title AND page_len > 0 " |
|
344 | + . " LIMIT 1"; |
|
345 | 345 | $params = [ |
346 | 346 | 'ns' => $namespaceId, |
347 | 347 | 'title' => str_replace(' ', '_', $pageTitle), |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function numDays() |
127 | 127 | { |
128 | - return ($this->end - $this->start) / 60 / 60 / 24; |
|
128 | + return ($this->end-$this->start) / 60 / 60 / 24; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $stats = $this->groupAdminStatsByUsername($stats, $abbreviateGroups); |
155 | 155 | |
156 | 156 | // Resort, as for some reason the SQL isn't doing this properly. |
157 | - uasort($stats, function ($a, $b) { |
|
157 | + uasort($stats, function($a, $b) { |
|
158 | 158 | if ($a['total'] === $b['total']) { |
159 | 159 | return 0; |
160 | 160 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function getNumAdminsWithActions() |
298 | 298 | { |
299 | - return $this->numAdmins() - $this->adminsWithoutActions; |
|
299 | + return $this->numAdmins()-$this->adminsWithoutActions; |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | $promises[] = $promise; |
118 | 118 | |
119 | 119 | // Handle response of $promise asynchronously. |
120 | - $promise->then(function ($response) use ($key, $endpoint) { |
|
121 | - $result = (array) json_decode($response->getBody()->getContents()); |
|
120 | + $promise->then(function($response) use ($key, $endpoint) { |
|
121 | + $result = (array)json_decode($response->getBody()->getContents()); |
|
122 | 122 | |
123 | 123 | $this->getRepository() |
124 | 124 | ->getLog() |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | // We'll log this to see how often it happens. |
136 | 136 | $this->getRepository() |
137 | 137 | ->getLog() |
138 | - ->error("Failed to fetch data for $endpoint via async, " . |
|
138 | + ->error("Failed to fetch data for $endpoint via async, ". |
|
139 | 139 | "re-attempting synchoronously."); |
140 | 140 | } |
141 | 141 | }); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | // Filter out unblocks unless requested. |
193 | 193 | if ($blocksOnly) { |
194 | - $blocks = array_filter($blocks, function ($block) { |
|
194 | + $blocks = array_filter($blocks, function($block) { |
|
195 | 195 | return $block['log_action'] === 'block'; |
196 | 196 | }); |
197 | 197 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function countAllRevisions() |
227 | 227 | { |
228 | - return $this->countLiveRevisions() + $this->countDeletedRevisions(); |
|
228 | + return $this->countLiveRevisions()+$this->countDeletedRevisions(); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function countRevisionsWithoutComments() |
246 | 246 | { |
247 | - return $this->countLiveRevisions() - $this->countRevisionsWithComments(); |
|
247 | + return $this->countLiveRevisions()-$this->countRevisionsWithComments(); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function countAllPagesEdited() |
285 | 285 | { |
286 | - return $this->countLivePagesEdited() + $this->countDeletedPagesEdited(); |
|
286 | + return $this->countLivePagesEdited()+$this->countDeletedPagesEdited(); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | */ |
294 | 294 | public function countPagesCreated() |
295 | 295 | { |
296 | - return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted(); |
|
296 | + return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted(); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | } elseif ($block['log_action'] === 'unblock') { |
434 | 434 | // The last block was lifted. So the duration will be the time from when the |
435 | 435 | // last block was set to the time of the unblock. |
436 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
436 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
437 | 437 | if ($timeSinceLastBlock > $this->longestBlockSeconds) { |
438 | 438 | $this->longestBlockSeconds = $timeSinceLastBlock; |
439 | 439 | |
@@ -444,8 +444,8 @@ discard block |
||
444 | 444 | // The last block was modified. So we will adjust $lastBlock to include |
445 | 445 | // the difference of the duration of the new reblock, and time since the last block. |
446 | 446 | // $lastBlock is left unchanged if its duration was indefinite. |
447 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
448 | - $lastBlock[1] = $timeSinceLastBlock + $duration; |
|
447 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
448 | + $lastBlock[1] = $timeSinceLastBlock+$duration; |
|
449 | 449 | } |
450 | 450 | } |
451 | 451 | |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | } |
456 | 456 | |
457 | 457 | // Test if the last block is still active, and if so use the expiry as the duration. |
458 | - $lastBlockExpiry = $lastBlock[0] + $lastBlock[1]; |
|
458 | + $lastBlockExpiry = $lastBlock[0]+$lastBlock[1]; |
|
459 | 459 | if ($lastBlockExpiry > time() && $lastBlockExpiry > $this->longestBlockSeconds) { |
460 | 460 | $this->longestBlockSeconds = $lastBlock[1]; |
461 | 461 | // Otherwise, test if the duration of the last block is now the longest overall. |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | // If invalid, $duration is left as null. |
497 | 497 | if (strtotime($durationStr)) { |
498 | 498 | $expiry = strtotime($durationStr, $timestamp); |
499 | - $duration = $expiry - $timestamp; |
|
499 | + $duration = $expiry-$timestamp; |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | return [$timestamp, $duration]; |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0; |
574 | 574 | $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0; |
575 | 575 | $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0; |
576 | - return $import + $interwiki + $upload; |
|
576 | + return $import+$interwiki+$upload; |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | /** |
@@ -697,9 +697,9 @@ discard block |
||
697 | 697 | public function approvals() |
698 | 698 | { |
699 | 699 | $logCounts = $this->getLogCounts(); |
700 | - $total = $logCounts['review-approve'] + |
|
701 | - (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) + |
|
702 | - (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) + |
|
700 | + $total = $logCounts['review-approve']+ |
|
701 | + (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+ |
|
702 | + (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+ |
|
703 | 703 | (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0); |
704 | 704 | return $total; |
705 | 705 | } |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | $logCounts = $this->getLogCounts(); |
724 | 724 | $create2 = $logCounts['newusers-create2'] ?: 0; |
725 | 725 | $byemail = $logCounts['newusers-byemail'] ?: 0; |
726 | - return $create2 + $byemail; |
|
726 | + return $create2+$byemail; |
|
727 | 727 | } |
728 | 728 | |
729 | 729 | /** |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | |
776 | 776 | $totals = $this->getRepository()->getMonthCounts($this->project, $this->user); |
777 | 777 | $out = [ |
778 | - 'yearLabels' => [], // labels for years |
|
778 | + 'yearLabels' => [], // labels for years |
|
779 | 779 | 'monthLabels' => [], // labels for months |
780 | 780 | 'totals' => [], // actual totals, grouped by namespace, year and then month |
781 | 781 | ]; |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | $out['totals'][$ns][$total['year']] = []; |
843 | 843 | } |
844 | 844 | |
845 | - $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count']; |
|
845 | + $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count']; |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | return [$out, $firstEdit]; |
@@ -859,8 +859,8 @@ discard block |
||
859 | 859 | private function fillInMonthTotalsAndLabels($out, DatePeriod $dateRange) |
860 | 860 | { |
861 | 861 | foreach ($dateRange as $monthObj) { |
862 | - $year = (int) $monthObj->format('Y'); |
|
863 | - $month = (int) $monthObj->format('n'); |
|
862 | + $year = (int)$monthObj->format('Y'); |
|
863 | + $month = (int)$monthObj->format('n'); |
|
864 | 864 | |
865 | 865 | // Fill in labels |
866 | 866 | $out['monthLabels'][] = $monthObj->format('Y-m'); |
@@ -963,8 +963,8 @@ discard block |
||
963 | 963 | |
964 | 964 | if ($sorted) { |
965 | 965 | // Sort. |
966 | - uasort($this->globalEditCounts, function ($a, $b) { |
|
967 | - return $b['total'] - $a['total']; |
|
966 | + uasort($this->globalEditCounts, function($a, $b) { |
|
967 | + return $b['total']-$a['total']; |
|
968 | 968 | }); |
969 | 969 | } |
970 | 970 | |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | $nsName = $project->getNamespaces()[$revision['page_namespace']]; |
1001 | 1001 | } |
1002 | 1002 | $page = $project->getRepository() |
1003 | - ->getPage($project, $nsName . ':' . $revision['page_title']); |
|
1003 | + ->getPage($project, $nsName.':'.$revision['page_title']); |
|
1004 | 1004 | $edit = new Edit($page, $revision); |
1005 | 1005 | $globalEdits[$edit->getTimestamp()->getTimestamp().'-'.$edit->getId()] = $edit; |
1006 | 1006 | } |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | public function countSmallEdits() |
1042 | 1042 | { |
1043 | 1043 | $editSizeData = $this->getEditSizeData(); |
1044 | - return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0; |
|
1044 | + return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0; |
|
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | /** |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | public function countLargeEdits() |
1052 | 1052 | { |
1053 | 1053 | $editSizeData = $this->getEditSizeData(); |
1054 | - return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0; |
|
1054 | + return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0; |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public function loginAction() |
90 | 90 | { |
91 | 91 | try { |
92 | - list( $next, $token ) = $this->getOauthClient()->initiate(); |
|
92 | + list($next, $token) = $this->getOauthClient()->initiate(); |
|
93 | 93 | } catch (Exception $oauthException) { |
94 | 94 | throw $oauthException; |
95 | 95 | // @TODO Make this work. |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | . '?title=Special:OAuth'; |
157 | 157 | $conf = new ClientConfig($endpoint); |
158 | 158 | $consumerKey = $this->getParameter('oauth_key'); |
159 | - $consumerSecret = $this->getParameter('oauth_secret'); |
|
159 | + $consumerSecret = $this->getParameter('oauth_secret'); |
|
160 | 160 | $conf->setConsumer(new Consumer($consumerKey, $consumerSecret)); |
161 | 161 | $this->oauthClient = new Client($conf); |
162 | 162 | // Callback URL is hardcoded in the consumer registration. |