@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | $article = $request->query->get('article'); |
81 | 81 | |
82 | 82 | if ($projectQuery != '' && $article != '') { |
83 | - return $this->redirectToRoute('ArticleInfoResult', [ 'project'=>$projectQuery, 'article' => $article ]); |
|
83 | + return $this->redirectToRoute('ArticleInfoResult', ['project'=>$projectQuery, 'article' => $article]); |
|
84 | 84 | } elseif ($article != '') { |
85 | - return $this->redirectToRoute('ArticleInfoProject', [ 'project'=>$projectQuery ]); |
|
85 | + return $this->redirectToRoute('ArticleInfoProject', ['project'=>$projectQuery]); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | if ($projectQuery == '') { |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | $rendered = str_replace('"', '\"', trim($rendered)); |
121 | 121 | |
122 | 122 | // Uglify temporary file. |
123 | - $tmpFile = sys_get_temp_dir() . '/xtools_articleinfo_gadget.js'; |
|
123 | + $tmpFile = sys_get_temp_dir().'/xtools_articleinfo_gadget.js'; |
|
124 | 124 | $script = "echo \"$rendered\" | tee $tmpFile >/dev/null && "; |
125 | - $script .= $this->get('kernel')->getRootDir() . |
|
126 | - "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle " . |
|
125 | + $script .= $this->get('kernel')->getRootDir(). |
|
126 | + "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle ". |
|
127 | 127 | "&& rm $tmpFile >/dev/null"; |
128 | 128 | $process = new Process($script); |
129 | 129 | $process->run(); |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | $rendered = str_replace('\"', '"', trim($rendered)); |
143 | 143 | |
144 | 144 | // Add comment after uglifying since it removes comments. |
145 | - $rendered = "/**\n * This code was automatically generated and should not " . |
|
146 | - "be manually edited.\n * For updates, please copy and paste from " . |
|
147 | - $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL) . |
|
148 | - "\n * Released under GPL v3 license.\n */\n" . $rendered; |
|
145 | + $rendered = "/**\n * This code was automatically generated and should not ". |
|
146 | + "be manually edited.\n * For updates, please copy and paste from ". |
|
147 | + $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL). |
|
148 | + "\n * Released under GPL v3 license.\n */\n".$rendered; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | $response = new \Symfony\Component\HttpFoundation\Response($rendered); |
@@ -245,10 +245,10 @@ discard block |
||
245 | 245 | $userGroupsTable = $this->projectRepo->getTableName($this->dbName, 'user_groups'); |
246 | 246 | $userFromerGroupsTable = $this->projectRepo->getTableName($this->dbName, 'user_former_groups'); |
247 | 247 | $query = "SELECT COUNT(rev_user_text) AS count, rev_user_text AS username, ug_group AS current |
248 | - FROM " . $this->projectRepo->getTableName($this->dbName, 'revision') . " |
|
248 | + FROM " . $this->projectRepo->getTableName($this->dbName, 'revision')." |
|
249 | 249 | LEFT JOIN $userGroupsTable ON rev_user = ug_user |
250 | 250 | LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user |
251 | - WHERE rev_page = " . $this->pageInfo['page']->getId() . " AND (ug_group = 'bot' OR ufg_group = 'bot') |
|
251 | + WHERE rev_page = ".$this->pageInfo['page']->getId()." AND (ug_group = 'bot' OR ufg_group = 'bot') |
|
252 | 252 | GROUP BY rev_user_text"; |
253 | 253 | $res = $this->conn->query($query)->fetchAll(); |
254 | 254 | |
@@ -257,14 +257,14 @@ discard block |
||
257 | 257 | $sum = 0; |
258 | 258 | foreach ($res as $bot) { |
259 | 259 | $bots[$bot['username']] = [ |
260 | - 'count' => (int) $bot['count'], |
|
260 | + 'count' => (int)$bot['count'], |
|
261 | 261 | 'current' => $bot['current'] === 'bot' |
262 | 262 | ]; |
263 | 263 | $sum += $bot['count']; |
264 | 264 | } |
265 | 265 | |
266 | - uasort($bots, function ($a, $b) { |
|
267 | - return $b['count'] - $a['count']; |
|
266 | + uasort($bots, function($a, $b) { |
|
267 | + return $b['count']-$a['count']; |
|
268 | 268 | }); |
269 | 269 | |
270 | 270 | $this->pageInfo['general']['bot_revision_count'] = $sum; |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | |
313 | 313 | if ($info['all'] > 1) { |
314 | 314 | // Number of seconds between first and last edit |
315 | - $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp(); |
|
315 | + $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp(); |
|
316 | 316 | |
317 | 317 | // Average time between edits (in days) |
318 | - $this->pageInfo['editors'][$editor]['atbe'] = $secs / ( 60 * 60 * 24 ); |
|
318 | + $this->pageInfo['editors'][$editor]['atbe'] = $secs / (60 * 60 * 24); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | if (count($info['sizes'])) { |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | // First sort editors array by the amount of text they added |
332 | 332 | $topTenEditorsByAdded = $this->pageInfo['editors']; |
333 | - uasort($topTenEditorsByAdded, function ($a, $b) { |
|
333 | + uasort($topTenEditorsByAdded, function($a, $b) { |
|
334 | 334 | if ($a['added'] === $b['added']) { |
335 | 335 | return 0; |
336 | 336 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | |
340 | 340 | // Then build a new array of top 10 editors by added text, |
341 | 341 | // in the data structure needed for the chart |
342 | - $this->pageInfo['topTenEditorsByAdded'] = array_map(function ($editor) { |
|
342 | + $this->pageInfo['topTenEditorsByAdded'] = array_map(function($editor) { |
|
343 | 343 | $added = $this->pageInfo['editors'][$editor]['added']; |
344 | 344 | return [ |
345 | 345 | 'label' => $editor, |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $title = str_replace(' ', '_', $page->getTitle()); |
365 | 365 | $sql = "SELECT log_action, log_type, log_timestamp AS timestamp |
366 | 366 | FROM $loggingTable |
367 | - WHERE log_namespace = '" . $page->getNamespace() . "' |
|
367 | + WHERE log_namespace = '".$page->getNamespace()."' |
|
368 | 368 | AND log_title = :title AND log_timestamp > 1 |
369 | 369 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
370 | 370 | $resultQuery = $this->conn->prepare($sql); |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | |
490 | 490 | if ($revCount === 0) { |
491 | 491 | $firstEdit = $edit; |
492 | - $firstEditMonth = mktime(0, 0, 0, (int) $firstEdit->getMonth(), 1, $firstEdit->getYear()); |
|
492 | + $firstEditMonth = mktime(0, 0, 0, (int)$firstEdit->getMonth(), 1, $firstEdit->getYear()); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | $username = $edit->getUser()->getUsername(); |