@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | 'xtSubtitle' => 'tool-es-desc', |
| 93 | 93 | 'xtPage' => 'es', |
| 94 | 94 | 'project' => $theProject, |
| 95 | - 'namespace' => (int) $namespace, |
|
| 95 | + 'namespace' => (int)$namespace, |
|
| 96 | 96 | ] |
| 97 | 97 | ); |
| 98 | 98 | } |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | { |
| 159 | 159 | $dbName = $project->getDatabaseName(); |
| 160 | 160 | |
| 161 | - $cacheKey = 'editsummaryusage.' . $dbName . '.' |
|
| 162 | - . $user->getCacheKey() . '.' . $namespace; |
|
| 161 | + $cacheKey = 'editsummaryusage.'.$dbName.'.' |
|
| 162 | + . $user->getCacheKey().'.'.$namespace; |
|
| 163 | 163 | |
| 164 | 164 | $cache = $this->container->get('cache.app'); |
| 165 | 165 | if ($cache->hasItem($cacheKey)) { |
@@ -246,8 +246,7 @@ discard block |
||
| 246 | 246 | if ($row['rev_minor_edit'] == 0) { |
| 247 | 247 | if ($row['rev_comment'] !== '') { |
| 248 | 248 | isset($monthEditsummaryTotals[$monthkey]) ? |
| 249 | - $monthEditsummaryTotals[$monthkey]++ : |
|
| 250 | - $monthEditsummaryTotals[$monthkey] = 1; |
|
| 249 | + $monthEditsummaryTotals[$monthkey]++ : $monthEditsummaryTotals[$monthkey] = 1; |
|
| 251 | 250 | $totalSummariesMajor++; |
| 252 | 251 | } |
| 253 | 252 | |
@@ -264,8 +263,7 @@ discard block |
||
| 264 | 263 | // If there is a comment, count it |
| 265 | 264 | if ($row['rev_comment'] !== '') { |
| 266 | 265 | isset($monthEditsummaryTotals[$monthkey]) ? |
| 267 | - $monthEditsummaryTotals[$monthkey]++ : |
|
| 268 | - $monthEditsummaryTotals[$monthkey] = 1; |
|
| 266 | + $monthEditsummaryTotals[$monthkey]++ : $monthEditsummaryTotals[$monthkey] = 1; |
|
| 269 | 267 | $totalSummariesMinor++; |
| 270 | 268 | $totalEditsMinor++; |
| 271 | 269 | } else { |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $view = View::create()->setStatusCode(Response::HTTP_OK); |
| 169 | 169 | |
| 170 | 170 | if ($request->query->get('format') === 'html') { |
| 171 | - $edits = array_map(function ($attrs) use ($project, $username) { |
|
| 171 | + $edits = array_map(function($attrs) use ($project, $username) { |
|
| 172 | 172 | $page = $project->getRepository() |
| 173 | 173 | ->getPage($project, $attrs['full_page_title']); |
| 174 | 174 | $pageTitles[] = $attrs['full_page_title']; |
@@ -244,19 +244,19 @@ discard block |
||
| 244 | 244 | $info = $page->getBasicEditingInfo(); |
| 245 | 245 | $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']); |
| 246 | 246 | $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']); |
| 247 | - $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp(); |
|
| 247 | + $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp(); |
|
| 248 | 248 | |
| 249 | 249 | $data = [ |
| 250 | - 'revisions' => (int) $info['num_edits'], |
|
| 251 | - 'editors' => (int) $info['num_editors'], |
|
| 250 | + 'revisions' => (int)$info['num_edits'], |
|
| 251 | + 'editors' => (int)$info['num_editors'], |
|
| 252 | 252 | 'author' => $info['author'], |
| 253 | - 'author_editcount' => (int) $info['author_editcount'], |
|
| 253 | + 'author_editcount' => (int)$info['author_editcount'], |
|
| 254 | 254 | 'created_at' => $creationDateTime->format('Y-m-d'), |
| 255 | 255 | 'created_rev_id' => $info['created_rev_id'], |
| 256 | 256 | 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'), |
| 257 | 257 | 'secs_since_last_edit' => $secsSinceLastEdit, |
| 258 | - 'last_edit_id' => (int) $info['modified_rev_id'], |
|
| 259 | - 'watchers' => (int) $page->getWatchers(), |
|
| 258 | + 'last_edit_id' => (int)$info['modified_rev_id'], |
|
| 259 | + 'watchers' => (int)$page->getWatchers(), |
|
| 260 | 260 | 'pageviews' => $page->getLastPageviews($pageviewsOffset), |
| 261 | 261 | 'pageviews_offset' => $pageviewsOffset, |
| 262 | 262 | ]; |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | $conn = $this->getDoctrine()->getManager('default')->getConnection(); |
| 317 | - $date = date('Y-m-d'); |
|
| 317 | + $date = date('Y-m-d'); |
|
| 318 | 318 | |
| 319 | 319 | // Increment count in timeline |
| 320 | 320 | $existsSql = "SELECT 1 FROM usage_timeline |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | $article = $request->query->get('article'); |
| 82 | 82 | |
| 83 | 83 | if ($projectQuery != '' && $article != '') { |
| 84 | - return $this->redirectToRoute('ArticleInfoResult', [ 'project'=>$projectQuery, 'article' => $article ]); |
|
| 84 | + return $this->redirectToRoute('ArticleInfoResult', ['project'=>$projectQuery, 'article' => $article]); |
|
| 85 | 85 | } elseif ($article != '') { |
| 86 | - return $this->redirectToRoute('ArticleInfoProject', [ 'project'=>$projectQuery ]); |
|
| 86 | + return $this->redirectToRoute('ArticleInfoProject', ['project'=>$projectQuery]); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | if ($projectQuery == '') { |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | $rendered = str_replace('"', '\"', trim($rendered)); |
| 122 | 122 | |
| 123 | 123 | // Uglify temporary file. |
| 124 | - $tmpFile = sys_get_temp_dir() . '/xtools_articleinfo_gadget.js'; |
|
| 124 | + $tmpFile = sys_get_temp_dir().'/xtools_articleinfo_gadget.js'; |
|
| 125 | 125 | $script = "echo \"$rendered\" | tee $tmpFile >/dev/null && "; |
| 126 | - $script .= $this->get('kernel')->getRootDir() . |
|
| 127 | - "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle " . |
|
| 126 | + $script .= $this->get('kernel')->getRootDir(). |
|
| 127 | + "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle ". |
|
| 128 | 128 | "&& rm $tmpFile >/dev/null"; |
| 129 | 129 | $process = new Process($script); |
| 130 | 130 | $process->run(); |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | $rendered = str_replace('\"', '"', trim($rendered)); |
| 144 | 144 | |
| 145 | 145 | // Add comment after uglifying since it removes comments. |
| 146 | - $rendered = "/**\n * This code was automatically generated and should not " . |
|
| 147 | - "be manually edited.\n * For updates, please copy and paste from " . |
|
| 148 | - $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL) . |
|
| 149 | - "\n * Released under GPL v3 license.\n */\n" . $rendered; |
|
| 146 | + $rendered = "/**\n * This code was automatically generated and should not ". |
|
| 147 | + "be manually edited.\n * For updates, please copy and paste from ". |
|
| 148 | + $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL). |
|
| 149 | + "\n * Released under GPL v3 license.\n */\n".$rendered; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | $response = new \Symfony\Component\HttpFoundation\Response($rendered); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $info = $this->getPageInfo(); |
| 82 | 82 | $title = isset($info['title']) ? $info['title'] : $this->unnormalizedPageName; |
| 83 | 83 | $nsName = $this->getNamespaceName(); |
| 84 | - return str_replace($nsName . ':', '', $title); |
|
| 84 | + return str_replace($nsName.':', '', $title); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | { |
| 218 | 218 | // If a user is given, we will not cache the result via instance variable. |
| 219 | 219 | if ($user !== null) { |
| 220 | - return (int) $this->getRepository()->getNumRevisions($this, $user); |
|
| 220 | + return (int)$this->getRepository()->getNumRevisions($this, $user); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | // Return cached value, if present. |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $this->numRevisions = count($this->revisions); |
| 231 | 231 | } else { |
| 232 | 232 | // Otherwise do a COUNT in the event fetching all revisions is not desired. |
| 233 | - $this->numRevisions = (int) $this->getRepository()->getNumRevisions($this); |
|
| 233 | + $this->numRevisions = (int)$this->getRepository()->getNumRevisions($this); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | return $this->numRevisions; |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | { |
| 261 | 261 | $content = $this->getRepository()->getPagesWikitext( |
| 262 | 262 | $this->getProject(), |
| 263 | - [ $this->getTitle() ] |
|
| 263 | + [$this->getTitle()] |
|
| 264 | 264 | ); |
| 265 | 265 | |
| 266 | 266 | return isset($content[$this->getTitle()]) |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | $wikidataInfo = $this->getRepository()->getWikidataInfo($this); |
| 419 | 419 | |
| 420 | - $terms = array_map(function ($entry) { |
|
| 420 | + $terms = array_map(function($entry) { |
|
| 421 | 421 | return $entry['term']; |
| 422 | 422 | }, $wikidataInfo); |
| 423 | 423 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | 'prio' => 2, |
| 429 | 429 | 'name' => 'Wikidata', |
| 430 | 430 | 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n |
| 431 | - 'explanation' => "See: <a target='_blank' " . |
|
| 431 | + 'explanation' => "See: <a target='_blank' ". |
|
| 432 | 432 | "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>", |
| 433 | 433 | ]; |
| 434 | 434 | } |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | 'prio' => 3, |
| 439 | 439 | 'name' => 'Wikidata', |
| 440 | 440 | 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n |
| 441 | - 'explanation' => "See: <a target='_blank' " . |
|
| 441 | + 'explanation' => "See: <a target='_blank' ". |
|
| 442 | 442 | "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>", |
| 443 | 443 | ]; |
| 444 | 444 | } |
@@ -517,8 +517,8 @@ discard block |
||
| 517 | 517 | return 0; |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | - return array_sum(array_map(function ($item) { |
|
| 521 | - return (int) $item['views']; |
|
| 520 | + return array_sum(array_map(function($item) { |
|
| 521 | + return (int)$item['views']; |
|
| 522 | 522 | }, $pageviews['items'])); |
| 523 | 523 | } |
| 524 | 524 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | public function getMaxRevisions() |
| 160 | 160 | { |
| 161 | 161 | if (!isset($this->maxRevisions)) { |
| 162 | - $this->maxRevisions = (int) $this->container->getParameter('app.max_page_revisions'); |
|
| 162 | + $this->maxRevisions = (int)$this->container->getParameter('app.max_page_revisions'); |
|
| 163 | 163 | } |
| 164 | 164 | return $this->maxRevisions; |
| 165 | 165 | } |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | |
| 639 | 639 | if ($revCount === 0) { |
| 640 | 640 | $this->firstEdit = $edit; |
| 641 | - $firstEditMonth = mktime(0, 0, 0, (int) $this->firstEdit->getMonth(), 1, $this->firstEdit->getYear()); |
|
| 641 | + $firstEditMonth = mktime(0, 0, 0, (int)$this->firstEdit->getMonth(), 1, $this->firstEdit->getYear()); |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | $username = $edit->getUser()->getUsername(); |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | $userGroupsTable = $this->getProject()->getTableName('user_groups'); |
| 825 | 825 | $userFromerGroupsTable = $this->getProject()->getTableName('user_former_groups'); |
| 826 | 826 | $sql = "SELECT COUNT(rev_user_text) AS count, rev_user_text AS username, ug_group AS current |
| 827 | - FROM " . $this->getProject()->getTableName('revision') . " |
|
| 827 | + FROM " . $this->getProject()->getTableName('revision')." |
|
| 828 | 828 | LEFT JOIN $userGroupsTable ON rev_user = ug_user |
| 829 | 829 | LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user |
| 830 | 830 | WHERE rev_page = :pageId AND (ug_group = 'bot' OR ufg_group = 'bot') |
@@ -839,14 +839,14 @@ discard block |
||
| 839 | 839 | $sum = 0; |
| 840 | 840 | while ($bot = $resultQuery->fetch()) { |
| 841 | 841 | $bots[$bot['username']] = [ |
| 842 | - 'count' => (int) $bot['count'], |
|
| 842 | + 'count' => (int)$bot['count'], |
|
| 843 | 843 | 'current' => $bot['current'] === 'bot' |
| 844 | 844 | ]; |
| 845 | 845 | $sum += $bot['count']; |
| 846 | 846 | } |
| 847 | 847 | |
| 848 | - uasort($bots, function ($a, $b) { |
|
| 849 | - return $b['count'] - $a['count']; |
|
| 848 | + uasort($bots, function($a, $b) { |
|
| 849 | + return $b['count']-$a['count']; |
|
| 850 | 850 | }); |
| 851 | 851 | |
| 852 | 852 | $this->botRevisionCount = $sum; |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | $title = str_replace(' ', '_', $this->page->getTitle()); |
| 870 | 870 | $sql = "SELECT log_action, log_type, log_timestamp AS timestamp |
| 871 | 871 | FROM $loggingTable |
| 872 | - WHERE log_namespace = '" . $this->page->getNamespace() . "' |
|
| 872 | + WHERE log_namespace = '".$this->page->getNamespace()."' |
|
| 873 | 873 | AND log_title = :title AND log_timestamp > 1 |
| 874 | 874 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
| 875 | 875 | $resultQuery = $this->conn->prepare($sql); |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | |
| 945 | 945 | if ($info['all'] > 1) { |
| 946 | 946 | // Number of seconds/days between first and last edit |
| 947 | - $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp(); |
|
| 947 | + $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp(); |
|
| 948 | 948 | $days = $secs / (60 * 60 * 24); |
| 949 | 949 | |
| 950 | 950 | // Average time between edits (in days) |
@@ -963,7 +963,7 @@ discard block |
||
| 963 | 963 | |
| 964 | 964 | // First sort editors array by the amount of text they added |
| 965 | 965 | $topTenEditorsByAdded = $this->editors; |
| 966 | - uasort($topTenEditorsByAdded, function ($a, $b) { |
|
| 966 | + uasort($topTenEditorsByAdded, function($a, $b) { |
|
| 967 | 967 | if ($a['added'] === $b['added']) { |
| 968 | 968 | return 0; |
| 969 | 969 | } |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | |
| 973 | 973 | // Then build a new array of top 10 editors by added text, |
| 974 | 974 | // in the data structure needed for the chart |
| 975 | - $this->topTenEditorsByAdded = array_map(function ($editor) { |
|
| 975 | + $this->topTenEditorsByAdded = array_map(function($editor) { |
|
| 976 | 976 | $added = $this->editors[$editor]['added']; |
| 977 | 977 | return [ |
| 978 | 978 | 'label' => $editor, |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | // supply as the OFFSET. |
| 149 | 149 | $limitClause = ''; |
| 150 | 150 | if (intval($limit) > 0 && isset($numRevisions)) { |
| 151 | - $offset = $numRevisions - $limit; |
|
| 151 | + $offset = $numRevisions-$limit; |
|
| 152 | 152 | $limitClause = "LIMIT $offset, $limit"; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | |
| 379 | 379 | $wikidataId = ltrim($page->getWikidataId(), 'Q'); |
| 380 | 380 | |
| 381 | - $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . " |
|
| 381 | + $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')." |
|
| 382 | 382 | FROM wikidatawiki_p.wb_items_per_site |
| 383 | 383 | WHERE ips_item_id = :wikidataId"; |
| 384 | 384 | |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | $result = $resultQuery->fetchAll(); |
| 390 | 390 | |
| 391 | - return $count ? (int) $result[0]['count'] : $result; |
|
| 391 | + return $count ? (int)$result[0]['count'] : $result; |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | /** |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | // Transform to associative array by 'type' |
| 430 | 430 | foreach ($res as $row) { |
| 431 | - $data[$row['type'] . '_count'] = $row['value']; |
|
| 431 | + $data[$row['type'].'_count'] = $row['value']; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | return $data; |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | |
| 467 | 467 | $project = $page->getProject()->getDomain(); |
| 468 | 468 | |
| 469 | - $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' . |
|
| 469 | + $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'. |
|
| 470 | 470 | "$project/all-access/user/$title/daily/$start/$end"; |
| 471 | 471 | |
| 472 | 472 | $res = $client->request('GET', $url); |
@@ -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 | if (isset($result)) { |
| 124 | 124 | // Copy result to the class class instance. From here any subsequent |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | // We'll log this to see how often it happens. |
| 132 | 132 | $this->getRepository() |
| 133 | 133 | ->getLog() |
| 134 | - ->error("Failed to fetch data for $endpoint via async, " . |
|
| 134 | + ->error("Failed to fetch data for $endpoint via async, ". |
|
| 135 | 135 | "re-attempting synchoronously."); |
| 136 | 136 | } |
| 137 | 137 | }); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | // Filter out unblocks unless requested. |
| 189 | 189 | if ($blocksOnly) { |
| 190 | - $blocks = array_filter($blocks, function ($block) { |
|
| 190 | + $blocks = array_filter($blocks, function($block) { |
|
| 191 | 191 | return $block['log_action'] === 'block'; |
| 192 | 192 | }); |
| 193 | 193 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public function countAllRevisions() |
| 223 | 223 | { |
| 224 | - return $this->countLiveRevisions() + $this->countDeletedRevisions(); |
|
| 224 | + return $this->countLiveRevisions()+$this->countDeletedRevisions(); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public function countRevisionsWithoutComments() |
| 242 | 242 | { |
| 243 | - return $this->countLiveRevisions() - $this->countRevisionsWithComments(); |
|
| 243 | + return $this->countLiveRevisions()-$this->countRevisionsWithComments(); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | public function countAllPagesEdited() |
| 281 | 281 | { |
| 282 | - return $this->countLivePagesEdited() + $this->countDeletedPagesEdited(); |
|
| 282 | + return $this->countLivePagesEdited()+$this->countDeletedPagesEdited(); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | /** |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | public function countPagesCreated() |
| 291 | 291 | { |
| 292 | - return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted(); |
|
| 292 | + return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted(); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | } elseif ($block['log_action'] === 'unblock') { |
| 430 | 430 | // The last block was lifted. So the duration will be the time from when the |
| 431 | 431 | // last block was set to the time of the unblock. |
| 432 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
| 432 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
| 433 | 433 | if ($timeSinceLastBlock > $this->longestBlockSeconds) { |
| 434 | 434 | $this->longestBlockSeconds = $timeSinceLastBlock; |
| 435 | 435 | |
@@ -440,8 +440,8 @@ discard block |
||
| 440 | 440 | // The last block was modified. So we will adjust $lastBlock to include |
| 441 | 441 | // the difference of the duration of the new reblock, and time since the last block. |
| 442 | 442 | // $lastBlock is left unchanged if its duration was indefinite. |
| 443 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
| 444 | - $lastBlock[1] = $timeSinceLastBlock + $duration; |
|
| 443 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
| 444 | + $lastBlock[1] = $timeSinceLastBlock+$duration; |
|
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | // Test if the last block is still active, and if so use the expiry as the duration. |
| 454 | - $lastBlockExpiry = $lastBlock[0] + $lastBlock[1]; |
|
| 454 | + $lastBlockExpiry = $lastBlock[0]+$lastBlock[1]; |
|
| 455 | 455 | if ($lastBlockExpiry > time() && $lastBlockExpiry > $this->longestBlockSeconds) { |
| 456 | 456 | $this->longestBlockSeconds = $lastBlock[1]; |
| 457 | 457 | // Otherwise, test if the duration of the last block is now the longest overall. |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | // If invalid, $duration is left as null. |
| 493 | 493 | if (strtotime($durationStr)) { |
| 494 | 494 | $expiry = strtotime($durationStr, $timestamp); |
| 495 | - $duration = $expiry - $timestamp; |
|
| 495 | + $duration = $expiry-$timestamp; |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | return [$timestamp, $duration]; |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0; |
| 570 | 570 | $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0; |
| 571 | 571 | $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0; |
| 572 | - return $import + $interwiki + $upload; |
|
| 572 | + return $import+$interwiki+$upload; |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | /** |
@@ -693,9 +693,9 @@ discard block |
||
| 693 | 693 | public function approvals() |
| 694 | 694 | { |
| 695 | 695 | $logCounts = $this->getLogCounts(); |
| 696 | - $total = $logCounts['review-approve'] + |
|
| 697 | - (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) + |
|
| 698 | - (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) + |
|
| 696 | + $total = $logCounts['review-approve']+ |
|
| 697 | + (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+ |
|
| 698 | + (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+ |
|
| 699 | 699 | (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0); |
| 700 | 700 | return $total; |
| 701 | 701 | } |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | $logCounts = $this->getLogCounts(); |
| 720 | 720 | $create2 = $logCounts['newusers-create2'] ?: 0; |
| 721 | 721 | $byemail = $logCounts['newusers-byemail'] ?: 0; |
| 722 | - return $create2 + $byemail; |
|
| 722 | + return $create2+$byemail; |
|
| 723 | 723 | } |
| 724 | 724 | |
| 725 | 725 | /** |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | |
| 772 | 772 | $totals = $this->getRepository()->getMonthCounts($this->project, $this->user); |
| 773 | 773 | $out = [ |
| 774 | - 'yearLabels' => [], // labels for years |
|
| 774 | + 'yearLabels' => [], // labels for years |
|
| 775 | 775 | 'monthLabels' => [], // labels for months |
| 776 | 776 | 'totals' => [], // actual totals, grouped by namespace, year and then month |
| 777 | 777 | ]; |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | $out['totals'][$ns][$total['year']] = []; |
| 800 | 800 | } |
| 801 | 801 | |
| 802 | - $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count']; |
|
| 802 | + $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count']; |
|
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | $dateRange = new DatePeriod( |
@@ -809,8 +809,8 @@ discard block |
||
| 809 | 809 | ); |
| 810 | 810 | |
| 811 | 811 | foreach ($dateRange as $monthObj) { |
| 812 | - $year = (int) $monthObj->format('Y'); |
|
| 813 | - $month = (int) $monthObj->format('n'); |
|
| 812 | + $year = (int)$monthObj->format('Y'); |
|
| 813 | + $month = (int)$monthObj->format('n'); |
|
| 814 | 814 | |
| 815 | 815 | // Fill in labels |
| 816 | 816 | $out['monthLabels'][] = $monthObj->format('Y-m'); |
@@ -926,8 +926,8 @@ discard block |
||
| 926 | 926 | |
| 927 | 927 | if ($sorted) { |
| 928 | 928 | // Sort. |
| 929 | - uasort($this->globalEditCounts, function ($a, $b) { |
|
| 930 | - return $b['total'] - $a['total']; |
|
| 929 | + uasort($this->globalEditCounts, function($a, $b) { |
|
| 930 | + return $b['total']-$a['total']; |
|
| 931 | 931 | }); |
| 932 | 932 | } |
| 933 | 933 | |
@@ -963,7 +963,7 @@ discard block |
||
| 963 | 963 | $nsName = $project->getNamespaces()[$revision['page_namespace']]; |
| 964 | 964 | } |
| 965 | 965 | $page = $project->getRepository() |
| 966 | - ->getPage($project, $nsName . ':' . $revision['page_title']); |
|
| 966 | + ->getPage($project, $nsName.':'.$revision['page_title']); |
|
| 967 | 967 | $edit = new Edit($page, $revision); |
| 968 | 968 | $globalEdits[$edit->getTimestamp()->getTimestamp().'-'.$edit->getId()] = $edit; |
| 969 | 969 | } |
@@ -1004,7 +1004,7 @@ discard block |
||
| 1004 | 1004 | public function countSmallEdits() |
| 1005 | 1005 | { |
| 1006 | 1006 | $editSizeData = $this->getEditSizeData(); |
| 1007 | - return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0; |
|
| 1007 | + return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0; |
|
| 1008 | 1008 | } |
| 1009 | 1009 | |
| 1010 | 1010 | /** |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | public function countLargeEdits() |
| 1015 | 1015 | { |
| 1016 | 1016 | $editSizeData = $this->getEditSizeData(); |
| 1017 | - return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0; |
|
| 1017 | + return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0; |
|
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | 1020 | /** |
@@ -136,7 +136,7 @@ |
||
| 136 | 136 | $isSubRequest = $this->container->get('request_stack')->getParentRequest() !== null; |
| 137 | 137 | |
| 138 | 138 | return $this->render('editCounter/result.html.twig', [ |
| 139 | - 'xtTitle' => $this->user->getUsername() . ' - ' . $this->project->getTitle(), |
|
| 139 | + 'xtTitle' => $this->user->getUsername().' - '.$this->project->getTitle(), |
|
| 140 | 140 | 'xtPage' => 'ec', |
| 141 | 141 | 'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'), |
| 142 | 142 | 'is_sub_request' => $isSubRequest, |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | 'xtSubtitle' => 'tool-autoedits-desc', |
| 87 | 87 | 'xtPage' => 'autoedits', |
| 88 | 88 | 'project' => $project, |
| 89 | - 'namespace' => (int) $namespace, |
|
| 89 | + 'namespace' => (int)$namespace, |
|
| 90 | 90 | 'start' => $startDate, |
| 91 | 91 | 'end' => $endDate, |
| 92 | 92 | ]); |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | // Get individual counts of how many times each tool was used. |
| 158 | 158 | // This also includes a wikilink to the tool. |
| 159 | 159 | $toolCounts = $user->getAutomatedCounts($projectData, $namespace, $start, $end); |
| 160 | - $toolsTotal = array_reduce($toolCounts, function ($a, $b) { |
|
| 161 | - return $a + $b['count']; |
|
| 160 | + $toolsTotal = array_reduce($toolCounts, function($a, $b) { |
|
| 161 | + return $a+$b['count']; |
|
| 162 | 162 | }); |
| 163 | 163 | |
| 164 | 164 | // Query to get combined (semi)automated using for all edits |