@@ -16,39 +16,39 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $options = ['is_safe' => ['html']]; |
| 18 | 18 | return [ |
| 19 | - new \Twig_SimpleFunction('request_time', [ $this, 'requestTime' ], $options), |
|
| 20 | - new \Twig_SimpleFunction('memory_usage', [ $this, 'requestMemory' ], $options), |
|
| 21 | - new \Twig_SimpleFunction('year', [ $this, 'generateYear' ], $options), |
|
| 22 | - new \Twig_SimpleFunction('msgPrintExists', [ $this, 'intuitionMessagePrintExists' ], $options), |
|
| 23 | - new \Twig_SimpleFunction('msgExists', [ $this, 'intuitionMessageExists' ], $options), |
|
| 24 | - new \Twig_SimpleFunction('msg', [ $this, 'intuitionMessage' ], $options), |
|
| 25 | - new \Twig_SimpleFunction('lang', [ $this, 'getLang' ], $options), |
|
| 26 | - new \Twig_SimpleFunction('langName', [ $this, 'getLangName' ], $options), |
|
| 27 | - new \Twig_SimpleFunction('allLangs', [ $this, 'getAllLangs' ]), |
|
| 28 | - new \Twig_SimpleFunction('isRTL', [ $this, 'intuitionIsRTL' ]), |
|
| 29 | - new \Twig_SimpleFunction('isRTLLang', [ $this, 'intuitionIsRTLLang' ]), |
|
| 30 | - new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]), |
|
| 31 | - new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]), |
|
| 32 | - new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]), |
|
| 33 | - new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]), |
|
| 34 | - new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]), |
|
| 35 | - new \Twig_SimpleFunction('chartColor', [ $this, 'chartColor' ]), |
|
| 36 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
| 37 | - new \Twig_SimpleFunction('isSingleWiki', [ $this, 'isSingleWiki' ]), |
|
| 38 | - new \Twig_SimpleFunction('getReplagThreshold', [ $this, 'getReplagThreshold' ]), |
|
| 39 | - new \Twig_SimpleFunction('loadStylesheetsFromCDN', [ $this, 'loadStylesheetsFromCDN' ]), |
|
| 40 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
| 41 | - new \Twig_SimpleFunction('replag', [ $this, 'replag' ]), |
|
| 42 | - new \Twig_SimpleFunction('link', [ $this, 'link' ]), |
|
| 43 | - new \Twig_SimpleFunction('quote', [ $this, 'quote' ]), |
|
| 44 | - new \Twig_SimpleFunction('bugReportURL', [ $this, 'bugReportURL' ]), |
|
| 19 | + new \Twig_SimpleFunction('request_time', [$this, 'requestTime'], $options), |
|
| 20 | + new \Twig_SimpleFunction('memory_usage', [$this, 'requestMemory'], $options), |
|
| 21 | + new \Twig_SimpleFunction('year', [$this, 'generateYear'], $options), |
|
| 22 | + new \Twig_SimpleFunction('msgPrintExists', [$this, 'intuitionMessagePrintExists'], $options), |
|
| 23 | + new \Twig_SimpleFunction('msgExists', [$this, 'intuitionMessageExists'], $options), |
|
| 24 | + new \Twig_SimpleFunction('msg', [$this, 'intuitionMessage'], $options), |
|
| 25 | + new \Twig_SimpleFunction('lang', [$this, 'getLang'], $options), |
|
| 26 | + new \Twig_SimpleFunction('langName', [$this, 'getLangName'], $options), |
|
| 27 | + new \Twig_SimpleFunction('allLangs', [$this, 'getAllLangs']), |
|
| 28 | + new \Twig_SimpleFunction('isRTL', [$this, 'intuitionIsRTL']), |
|
| 29 | + new \Twig_SimpleFunction('isRTLLang', [$this, 'intuitionIsRTLLang']), |
|
| 30 | + new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']), |
|
| 31 | + new \Twig_SimpleFunction('hash', [$this, 'gitHash']), |
|
| 32 | + new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']), |
|
| 33 | + new \Twig_SimpleFunction('tools', [$this, 'allTools']), |
|
| 34 | + new \Twig_SimpleFunction('color', [$this, 'getColorList']), |
|
| 35 | + new \Twig_SimpleFunction('chartColor', [$this, 'chartColor']), |
|
| 36 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
| 37 | + new \Twig_SimpleFunction('isSingleWiki', [$this, 'isSingleWiki']), |
|
| 38 | + new \Twig_SimpleFunction('getReplagThreshold', [$this, 'getReplagThreshold']), |
|
| 39 | + new \Twig_SimpleFunction('loadStylesheetsFromCDN', [$this, 'loadStylesheetsFromCDN']), |
|
| 40 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
| 41 | + new \Twig_SimpleFunction('replag', [$this, 'replag']), |
|
| 42 | + new \Twig_SimpleFunction('link', [$this, 'link']), |
|
| 43 | + new \Twig_SimpleFunction('quote', [$this, 'quote']), |
|
| 44 | + new \Twig_SimpleFunction('bugReportURL', [$this, 'bugReportURL']), |
|
| 45 | 45 | ]; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function requestTime($decimals = 3) |
| 49 | 49 | { |
| 50 | 50 | |
| 51 | - return number_format(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
| 51 | + return number_format(microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function requestMemory() |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | // TODO: refactor all intuition stuff so it can be used anywhere |
| 69 | 69 | public function intuitionMessageExists($message = "") |
| 70 | 70 | { |
| 71 | - return $this->getIntuition()->msgExists($message, [ "domain" => "xtools" ]); |
|
| 71 | + return $this->getIntuition()->msgExists($message, ["domain" => "xtools"]); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function intuitionMessagePrintExists($message = "", $vars = []) |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | public function intuitionMessage($message = "", $vars = []) |
| 89 | 89 | { |
| 90 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
| 90 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function getLang() |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function getAllLangs() |
| 110 | 110 | { |
| 111 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
| 111 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
| 112 | 112 | |
| 113 | 113 | $languages = array_values(array_unique(array_map( |
| 114 | - function ($filename) { |
|
| 114 | + function($filename) { |
|
| 115 | 115 | return basename($filename, '.json'); |
| 116 | 116 | }, |
| 117 | 117 | $messageFiles |
@@ -168,41 +168,41 @@ discard block |
||
| 168 | 168 | public static function getColorList($num = false) |
| 169 | 169 | { |
| 170 | 170 | $colors = [ |
| 171 | - 0 => '#Cc0000',# '#FF005A', #red '#FF5555', |
|
| 171 | + 0 => '#Cc0000', # '#FF005A', #red '#FF5555', |
|
| 172 | 172 | 1 => '#F7b7b7', |
| 173 | - 2 => '#5c8d20',# '#008800', #green'#55FF55', |
|
| 173 | + 2 => '#5c8d20', # '#008800', #green'#55FF55', |
|
| 174 | 174 | 3 => '#85eD82', |
| 175 | 175 | 4 => '#2E97E0', # blue |
| 176 | 176 | 5 => '#B9E3F9', |
| 177 | - 6 => '#e1711d', # orange |
|
| 177 | + 6 => '#e1711d', # orange |
|
| 178 | 178 | 7 => '#ffc04c', |
| 179 | 179 | 8 => '#FDFF98', # yellow |
| 180 | 180 | 9 => '#5555FF', |
| 181 | 181 | 10 => '#55FFFF', |
| 182 | - 11 => '#0000C0', # |
|
| 183 | - 12 => '#008800', # green |
|
| 182 | + 11 => '#0000C0', # |
|
| 183 | + 12 => '#008800', # green |
|
| 184 | 184 | 13 => '#00C0C0', |
| 185 | - 14 => '#FFAFAF', # rosé |
|
| 186 | - 15 => '#808080', # gray |
|
| 185 | + 14 => '#FFAFAF', # rosé |
|
| 186 | + 15 => '#808080', # gray |
|
| 187 | 187 | 16 => '#00C000', |
| 188 | 188 | 17 => '#404040', |
| 189 | - 18 => '#C0C000', # green |
|
| 189 | + 18 => '#C0C000', # green |
|
| 190 | 190 | 19 => '#C000C0', |
| 191 | - 100 => '#75A3D1', # blue |
|
| 192 | - 101 => '#A679D2', # purple |
|
| 191 | + 100 => '#75A3D1', # blue |
|
| 192 | + 101 => '#A679D2', # purple |
|
| 193 | 193 | 102 => '#660000', |
| 194 | 194 | 103 => '#000066', |
| 195 | - 104 => '#FAFFAF', # caramel |
|
| 195 | + 104 => '#FAFFAF', # caramel |
|
| 196 | 196 | 105 => '#408345', |
| 197 | 197 | 106 => '#5c8d20', |
| 198 | - 107 => '#e1711d', # red |
|
| 199 | - 108 => '#94ef2b', # light green |
|
| 200 | - 109 => '#756a4a', # brown |
|
| 198 | + 107 => '#e1711d', # red |
|
| 199 | + 108 => '#94ef2b', # light green |
|
| 200 | + 109 => '#756a4a', # brown |
|
| 201 | 201 | 110 => '#6f1dab', |
| 202 | 202 | 111 => '#301e30', |
| 203 | 203 | 112 => '#5c9d96', |
| 204 | - 113 => '#a8cd8c', # earth green |
|
| 205 | - 114 => '#f2b3f1', # light purple |
|
| 204 | + 113 => '#a8cd8c', # earth green |
|
| 205 | + 114 => '#f2b3f1', # light purple |
|
| 206 | 206 | 115 => '#9b5828', |
| 207 | 207 | 118 => '#99FFFF', |
| 208 | 208 | 119 => '#99BBFF', |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | 446 => '#06DCFB', |
| 224 | 224 | 447 => '#892EE4', |
| 225 | 225 | 460 => '#99FF66', |
| 226 | - 461 => '#99CC66', # green |
|
| 227 | - 470 => '#CCCC33', # ocker |
|
| 226 | + 461 => '#99CC66', # green |
|
| 227 | + 470 => '#CCCC33', # ocker |
|
| 228 | 228 | 471 => '#CCFF33', |
| 229 | 229 | 480 => '#6699FF', |
| 230 | 230 | 481 => '#66FFFF', |
@@ -239,18 +239,18 @@ discard block |
||
| 239 | 239 | 1198 => '#FF34B3', |
| 240 | 240 | 1199 => '#8B1C62', |
| 241 | 241 | |
| 242 | - '#61a9f3',# blue |
|
| 243 | - '#f381b9',# pink |
|
| 242 | + '#61a9f3', # blue |
|
| 243 | + '#f381b9', # pink |
|
| 244 | 244 | '#61E3A9', |
| 245 | 245 | '#D56DE2', |
| 246 | 246 | '#85eD82', |
| 247 | 247 | '#F7b7b7', |
| 248 | 248 | '#CFDF49', |
| 249 | 249 | '#88d8f2', |
| 250 | - '#07AF7B',# green |
|
| 250 | + '#07AF7B', # green |
|
| 251 | 251 | '#B9E3F9', |
| 252 | 252 | '#FFF3AD', |
| 253 | - '#EF606A',# red |
|
| 253 | + '#EF606A', # red |
|
| 254 | 254 | '#EC8833', |
| 255 | 255 | '#FFF100', |
| 256 | 256 | '#87C9A5', |
@@ -400,8 +400,8 @@ discard block |
||
| 400 | 400 | public function getFilters() |
| 401 | 401 | { |
| 402 | 402 | return [ |
| 403 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
| 404 | - new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]), |
|
| 403 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
| 404 | + new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']), |
|
| 405 | 405 | ]; |
| 406 | 406 | } |
| 407 | 407 | |
@@ -428,9 +428,9 @@ discard block |
||
| 428 | 428 | if (!$denominator) { |
| 429 | 429 | $quotient = $numerator; |
| 430 | 430 | } else { |
| 431 | - $quotient = ( $numerator / $denominator ) * 100; |
|
| 431 | + $quotient = ($numerator / $denominator) * 100; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - return round($quotient, $precision) . '%'; |
|
| 434 | + return round($quotient, $precision).'%'; |
|
| 435 | 435 | } |
| 436 | 436 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $this->stopwatch->start($cacheKey, 'XTools'); |
| 62 | 62 | $api = $this->getMediawikiApi($project); |
| 63 | - $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ]; |
|
| 63 | + $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"]; |
|
| 64 | 64 | $query = new SimpleRequest('query', $params); |
| 65 | 65 | $result = []; |
| 66 | 66 | $res = $api->getRequest($query); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | // Create the API query. |
| 98 | 98 | $api = $this->getMediawikiApi($project); |
| 99 | - $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ]; |
|
| 99 | + $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"]; |
|
| 100 | 100 | $query = new SimpleRequest('query', $params); |
| 101 | 101 | |
| 102 | 102 | // Get the result. |
@@ -65,10 +65,10 @@ |
||
| 65 | 65 | $username = $request->query->get('username'); |
| 66 | 66 | |
| 67 | 67 | if (($project || $queryProject) && $username) { |
| 68 | - $routeParams = [ 'project'=>($project ?: $queryProject), 'username' => $username ]; |
|
| 68 | + $routeParams = ['project'=>($project ?: $queryProject), 'username' => $username]; |
|
| 69 | 69 | return $this->redirectToRoute("EditCounterResult", $routeParams); |
| 70 | 70 | } elseif (!$project && $queryProject) { |
| 71 | - return $this->redirectToRoute("EditCounterProject", [ 'project'=>$queryProject ]); |
|
| 71 | + return $this->redirectToRoute("EditCounterProject", ['project'=>$queryProject]); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $project = ProjectRepository::getProject($queryProject, $this->container); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | protected function getRevisionCounts() |
| 43 | 43 | { |
| 44 | - if (! is_array($this->revisionCounts)) { |
|
| 44 | + if (!is_array($this->revisionCounts)) { |
|
| 45 | 45 | $this->revisionCounts = $this->getRepository() |
| 46 | 46 | ->getRevisionCounts($this->project, $this->user); |
| 47 | 47 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | protected function getRevisionDates() |
| 56 | 56 | { |
| 57 | - if (! is_array($this->revisionDates)) { |
|
| 57 | + if (!is_array($this->revisionDates)) { |
|
| 58 | 58 | $this->revisionDates = $this->getRepository() |
| 59 | 59 | ->getRevisionDates($this->project, $this->user); |
| 60 | 60 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | protected function getPageCounts() |
| 69 | 69 | { |
| 70 | - if (! is_array($this->pageCounts)) { |
|
| 70 | + if (!is_array($this->pageCounts)) { |
|
| 71 | 71 | $this->pageCounts = $this->getRepository() |
| 72 | 72 | ->getPageCounts($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 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function countAllRevisions() |
| 111 | 111 | { |
| 112 | - return $this->countLiveRevisions() + $this->countDeletedRevisions(); |
|
| 112 | + return $this->countLiveRevisions()+$this->countDeletedRevisions(); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function countRevisionsWithoutComments() |
| 130 | 130 | { |
| 131 | - return $this->countAllRevisions() - $this->countRevisionsWithComments(); |
|
| 131 | + return $this->countAllRevisions()-$this->countRevisionsWithComments(); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function countAllPagesEdited() |
| 197 | 197 | { |
| 198 | - return $this->countLivePagesEdited() + $this->countDeletedPagesEdited(); |
|
| 198 | + return $this->countLivePagesEdited()+$this->countDeletedPagesEdited(); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function countPagesCreated() |
| 215 | 215 | { |
| 216 | - return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted(); |
|
| 216 | + return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted(); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
@@ -359,9 +359,9 @@ discard block |
||
| 359 | 359 | public function approvals() |
| 360 | 360 | { |
| 361 | 361 | $logCounts = $this->getLogCounts(); |
| 362 | - $total = $logCounts['review-approve'] + |
|
| 363 | - (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) + |
|
| 364 | - (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) + |
|
| 362 | + $total = $logCounts['review-approve']+ |
|
| 363 | + (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+ |
|
| 364 | + (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+ |
|
| 365 | 365 | (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0); |
| 366 | 366 | return $total; |
| 367 | 367 | } |
@@ -387,8 +387,8 @@ discard block |
||
| 387 | 387 | // Get counts. |
| 388 | 388 | $editCounts = $this->getRepository()->getRevisionCountsAllProjects($user, $project); |
| 389 | 389 | // Sort. |
| 390 | - uasort($editCounts, function ($a, $b) { |
|
| 391 | - return $b['total'] - $a['total']; |
|
| 390 | + uasort($editCounts, function($a, $b) { |
|
| 391 | + return $b['total']-$a['total']; |
|
| 392 | 392 | }); |
| 393 | 393 | // Truncate, and return. |
| 394 | 394 | return array_slice($editCounts, 0, $numProjects); |
@@ -457,14 +457,14 @@ discard block |
||
| 457 | 457 | if (!isset($out['totals'][$ns])) { |
| 458 | 458 | $out['totals'][$ns] = []; |
| 459 | 459 | } |
| 460 | - $out['totals'][$ns][$total['year'] . $total['month']] = $total['count']; |
|
| 460 | + $out['totals'][$ns][$total['year'].$total['month']] = $total['count']; |
|
| 461 | 461 | } |
| 462 | 462 | // Fill in the blanks (where no edits were made in a given month for a namespace). |
| 463 | 463 | for ($y = $out['min_year']; $y <= $out['max_year']; $y++) { |
| 464 | 464 | for ($m = 1; $m <= 12; $m++) { |
| 465 | 465 | foreach ($out['totals'] as $nsId => &$total) { |
| 466 | - if (!isset($total[$y . $m])) { |
|
| 467 | - $total[$y . $m] = 0; |
|
| 466 | + if (!isset($total[$y.$m])) { |
|
| 467 | + $total[$y.$m] = 0; |
|
| 468 | 468 | } |
| 469 | 469 | } |
| 470 | 470 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | 'username' => $username, |
| 56 | 56 | ]); |
| 57 | 57 | } elseif ($projectName != "") { |
| 58 | - return $this->redirectToRoute("TopEditsResults", [ 'project'=>$projectName ]); |
|
| 58 | + return $this->redirectToRoute("TopEditsResults", ['project'=>$projectName]); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // Set default project so we can populate the namespace selector. |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // Get page info about these 100 pages, so we can use their display title. |
| 134 | - $titles = array_map(function ($e) use ($namespaces) { |
|
| 134 | + $titles = array_map(function($e) use ($namespaces) { |
|
| 135 | 135 | // If non-mainspace, prepend namespace to the titles. |
| 136 | 136 | $ns = $e['page_namespace']; |
| 137 | - $nsTitle = $ns > 0 ? $namespaces[$e['page_namespace']] . ':' : ''; |
|
| 138 | - return $nsTitle . $e['page_title']; |
|
| 137 | + $nsTitle = $ns > 0 ? $namespaces[$e['page_namespace']].':' : ''; |
|
| 138 | + return $nsTitle.$e['page_title']; |
|
| 139 | 139 | }, $editData); |
| 140 | 140 | /** @var ApiHelper $apiHelper */ |
| 141 | 141 | $apiHelper = $this->get('app.api_helper'); |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | foreach ($editData as $editDatum) { |
| 147 | 147 | // If non-mainspace, prepend namespace to the titles. |
| 148 | 148 | $ns = $editDatum['page_namespace']; |
| 149 | - $nsTitle = $ns > 0 ? $namespaces[$editDatum['page_namespace']] . ':' : ''; |
|
| 150 | - $pageTitle = $nsTitle . $editDatum['page_title']; |
|
| 149 | + $nsTitle = $ns > 0 ? $namespaces[$editDatum['page_namespace']].':' : ''; |
|
| 150 | + $pageTitle = $nsTitle.$editDatum['page_title']; |
|
| 151 | 151 | $editDatum['displaytitle'] = $displayTitles[$pageTitle]; |
| 152 | 152 | // $editDatum['page_title'] is retained without the namespace |
| 153 | 153 | // so we can link to TopEdits for that page |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | $username = $request->query->get('username'); |
| 28 | 28 | |
| 29 | 29 | if ($projectQuery != "" && $username != "") { |
| 30 | - return $this->redirectToRoute("AdminScoreResult", [ 'project'=>$projectQuery, 'username' => $username ]); |
|
| 30 | + return $this->redirectToRoute("AdminScoreResult", ['project'=>$projectQuery, 'username' => $username]); |
|
| 31 | 31 | } elseif ($projectQuery != "") { |
| 32 | - return $this->redirectToRoute("AdminScoreProject", [ 'project'=>$projectQuery ]); |
|
| 32 | + return $this->redirectToRoute("AdminScoreProject", ['project'=>$projectQuery]); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // Otherwise fall through. |
@@ -67,20 +67,20 @@ discard block |
||
| 67 | 67 | $archiveTable = $lh->getTable("archive", $dbName); |
| 68 | 68 | |
| 69 | 69 | // MULTIPLIERS (to review) |
| 70 | - $ACCT_AGE_MULT = 1.25; # 0 if = 365 jours |
|
| 71 | - $EDIT_COUNT_MULT = 1.25; # 0 if = 10 000 |
|
| 72 | - $USER_PAGE_MULT = 0.1; # 0 if = |
|
| 70 | + $ACCT_AGE_MULT = 1.25; # 0 if = 365 jours |
|
| 71 | + $EDIT_COUNT_MULT = 1.25; # 0 if = 10 000 |
|
| 72 | + $USER_PAGE_MULT = 0.1; # 0 if = |
|
| 73 | 73 | $PATROLS_MULT = 1; # 0 if = |
| 74 | - $BLOCKS_MULT = 1.4; # 0 if = 10 |
|
| 74 | + $BLOCKS_MULT = 1.4; # 0 if = 10 |
|
| 75 | 75 | $AFD_MULT = 1.15; |
| 76 | - $RECENT_ACTIVITY_MULT = 0.9; # 0 if = |
|
| 76 | + $RECENT_ACTIVITY_MULT = 0.9; # 0 if = |
|
| 77 | 77 | $AIV_MULT = 1.15; |
| 78 | - $EDIT_SUMMARIES_MULT = 0.8; # 0 if = |
|
| 79 | - $NAMESPACES_MULT = 1.0; # 0 if = |
|
| 78 | + $EDIT_SUMMARIES_MULT = 0.8; # 0 if = |
|
| 79 | + $NAMESPACES_MULT = 1.0; # 0 if = |
|
| 80 | 80 | $PAGES_CREATED_LIVE_MULT = 1.4; # 0 if = |
| 81 | 81 | $PAGES_CREATED_ARCHIVE_MULT = 1.4; # 0 if = |
| 82 | - $RPP_MULT = 1.15; # 0 if = |
|
| 83 | - $USERRIGHTS_MULT = 0.75; # 0 if = |
|
| 82 | + $RPP_MULT = 1.15; # 0 if = |
|
| 83 | + $USERRIGHTS_MULT = 0.75; # 0 if = |
|
| 84 | 84 | |
| 85 | 85 | // Grab the connection to the replica database (which is separate from the above) |
| 86 | 86 | $conn = $this->get('doctrine')->getManager("replicas")->getConnection(); |
@@ -156,15 +156,15 @@ discard block |
||
| 156 | 156 | $now = new DateTime(); |
| 157 | 157 | $date = new DateTime($value); |
| 158 | 158 | $diff = $date->diff($now); |
| 159 | - $formula = 365*$diff->format("%y")+30*$diff->format("%m")+$diff->format("%d"); |
|
| 159 | + $formula = 365 * $diff->format("%y")+30 * $diff->format("%m")+$diff->format("%d"); |
|
| 160 | 160 | $value = $formula-365; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | if ($key == "id") { |
| 164 | 164 | $id = $value; |
| 165 | 165 | } else { |
| 166 | - $multiplierKey = strtoupper($row["source"] . "_MULT"); |
|
| 167 | - $multiplier = ( isset($$multiplierKey) ? $$multiplierKey : 1 ); |
|
| 166 | + $multiplierKey = strtoupper($row["source"]."_MULT"); |
|
| 167 | + $multiplier = (isset($$multiplierKey) ? $$multiplierKey : 1); |
|
| 168 | 168 | $score = max(min($value * $multiplier, 100), -100); |
| 169 | 169 | $master[$key]["mult"] = $multiplier; |
| 170 | 170 | $master[$key]["value"] = $value; |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | if ($id == 0) { |
| 177 | - $this->addFlash("notice", [ "no-result", $username ]); |
|
| 178 | - return $this->redirectToRoute("AdminScore", [ "project"=>$project ]); |
|
| 177 | + $this->addFlash("notice", ["no-result", $username]); |
|
| 178 | + return $this->redirectToRoute("AdminScore", ["project"=>$project]); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | return $this->render('adminscore/result.html.twig', [ |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | $username = $request->query->get('username'); |
| 32 | 32 | |
| 33 | 33 | if ($projectQuery != "" && $username != "") { |
| 34 | - $routeParams = [ 'project'=>$projectQuery, 'username' => $username ]; |
|
| 34 | + $routeParams = ['project'=>$projectQuery, 'username' => $username]; |
|
| 35 | 35 | return $this->redirectToRoute("SimpleEditCounterResult", $routeParams); |
| 36 | 36 | } elseif ($projectQuery != "") { |
| 37 | - return $this->redirectToRoute("SimpleEditCounterProject", [ 'project'=>$projectQuery ]); |
|
| 37 | + return $this->redirectToRoute("SimpleEditCounterProject", ['project'=>$projectQuery]); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // Otherwise fall through. |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | $resultQuery->execute(); |
| 88 | 88 | |
| 89 | 89 | if ($resultQuery->errorCode() > 0) { |
| 90 | - $this->addFlash("notice", [ "no-result", $username ]); |
|
| 91 | - return $this->redirectToRoute("SimpleEditCounterProject", [ "project"=>$project ]); |
|
| 90 | + $this->addFlash("notice", ["no-result", $username]); |
|
| 91 | + return $this->redirectToRoute("SimpleEditCounterProject", ["project"=>$project]); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Fetch the result data |
@@ -112,16 +112,16 @@ discard block |
||
| 112 | 112 | $rev = $row["value"]; |
| 113 | 113 | } |
| 114 | 114 | if ($row["source"] == "groups") { |
| 115 | - $groups .= $row["value"]. ", "; |
|
| 115 | + $groups .= $row["value"].", "; |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | // Unknown user - If the user is created the $results variable will have 3 entries. |
| 120 | 120 | // This is a workaround to detect non-existent IPs. |
| 121 | 121 | if (count($results) < 3 && $arch == 0 && $rev == 0) { |
| 122 | - $this->addFlash('notice', [ "no-result", $username ]); |
|
| 122 | + $this->addFlash('notice', ["no-result", $username]); |
|
| 123 | 123 | |
| 124 | - return $this->redirectToRoute("SimpleEditCounterProject", [ "project"=>$project ]); |
|
| 124 | + return $this->redirectToRoute("SimpleEditCounterProject", ["project"=>$project]); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // Remove the last comma and space |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | 'project_url' => $url, |
| 152 | 152 | 'id' => $id, |
| 153 | 153 | 'arch' => $arch, |
| 154 | - 'rev' => $rev + $arch, |
|
| 154 | + 'rev' => $rev+$arch, |
|
| 155 | 155 | 'live' => $rev, |
| 156 | 156 | 'groups' => $groups, |
| 157 | 157 | 'globalGroups' => $globalGroups, |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | // Create the query we're going to run against the meta database |
| 79 | 79 | $wikiQuery = $this->client->createQueryBuilder(); |
| 80 | 80 | $wikiQuery |
| 81 | - ->select([ 'dbname', 'name', 'url', 'lang' ]) |
|
| 81 | + ->select(['dbname', 'name', 'url', 'lang']) |
|
| 82 | 82 | ->from('wiki') |
| 83 | 83 | ->where($wikiQuery->expr()->eq('dbname', ':project')) |
| 84 | 84 | // The meta database will have the project's URL stored as https://en.wikipedia.org |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | public function allProjects() |
| 130 | 130 | { |
| 131 | 131 | $wikiQuery = $this->client->createQueryBuilder(); |
| 132 | - $wikiQuery->select([ 'dbName', 'name', 'url' ])->from('wiki'); |
|
| 132 | + $wikiQuery->select(['dbName', 'name', 'url'])->from('wiki'); |
|
| 133 | 133 | $stmt = $wikiQuery->execute(); |
| 134 | 134 | $out = $stmt->fetchAll(); |
| 135 | 135 | return $out; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | // as required by Labs. We combine $table with |
| 153 | 153 | // $table_extension in order to generate the new table name |
| 154 | 154 | if ($this->isLabs() && $table_extension !== null) { |
| 155 | - $table = $table . "_" . $table_extension; |
|
| 155 | + $table = $table."_".$table_extension; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Use the table specified in the table mapping configuration, if present. |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | 'username' => $username, |
| 58 | 58 | ]); |
| 59 | 59 | } elseif ($projectQuery != "") { |
| 60 | - return $this->redirectToRoute("PagesProject", [ 'project'=>$projectQuery ]); |
|
| 60 | + return $this->redirectToRoute("PagesProject", ['project'=>$projectQuery]); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // set default wiki so we can populate the namespace selector |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | JOIN $revisionTable ON page_id = rev_page |
| 184 | 184 | $paJoin |
| 185 | 185 | WHERE $whereRev AND rev_parent_id = '0' $namespaceConditionRev $redirectCondition |
| 186 | - " . ($hasPageAssessments ? "GROUP BY rev_page" : "") . " |
|
| 186 | + ".($hasPageAssessments ? "GROUP BY rev_page" : "")." |
|
| 187 | 187 | ) |
| 188 | 188 | |
| 189 | 189 | UNION |
@@ -267,8 +267,8 @@ discard block |
||
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | if ($total < 1) { |
| 270 | - $this->addFlash("notice", [ "no-result", $username ]); |
|
| 271 | - return $this->redirectToRoute("PagesProject", [ "project"=>$project ]); |
|
| 270 | + $this->addFlash("notice", ["no-result", $username]); |
|
| 271 | + return $this->redirectToRoute("PagesProject", ["project"=>$project]); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | ksort($pagesByNamespaceByDate); |