@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | 'quote/all.html.twig', |
| 112 | 112 | [ |
| 113 | 113 | 'base_dir' => realpath( |
| 114 | - $this->getParameter('kernel.root_dir') . '/..' |
|
| 114 | + $this->getParameter('kernel.root_dir').'/..' |
|
| 115 | 115 | ), |
| 116 | 116 | "xtPage" => "bash", |
| 117 | 117 | "quotes" => $quotes, |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | 'quote/view.html.twig', |
| 161 | 161 | [ |
| 162 | 162 | 'base_dir' => realpath( |
| 163 | - $this->getParameter('kernel.root_dir') . '/..' |
|
| 163 | + $this->getParameter('kernel.root_dir').'/..' |
|
| 164 | 164 | ), |
| 165 | 165 | "xtPage" => "bash", |
| 166 | 166 | "text" => $text, |
@@ -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. |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | $resultQuery->execute(); |
| 90 | 90 | |
| 91 | 91 | if ($resultQuery->errorCode() > 0) { |
| 92 | - $this->addFlash("notice", [ "noresult", $username ]); |
|
| 93 | - return $this->redirectToRoute("SimpleEditCounterProject", [ "project"=>$project ]); |
|
| 92 | + $this->addFlash("notice", ["noresult", $username]); |
|
| 93 | + return $this->redirectToRoute("SimpleEditCounterProject", ["project"=>$project]); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | // Fetch the result data |
@@ -114,16 +114,16 @@ discard block |
||
| 114 | 114 | $rev = $row["value"]; |
| 115 | 115 | } |
| 116 | 116 | if ($row["source"] == "groups") { |
| 117 | - $groups .= $row["value"]. ", "; |
|
| 117 | + $groups .= $row["value"].", "; |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // Unknown user - If the user is created the $results variable will have 3 entries. |
| 122 | 122 | // This is a workaround to detect non-existent IPs. |
| 123 | 123 | if (count($results) < 3 && $arch == 0 && $rev == 0) { |
| 124 | - $this->addFlash('notice', [ "noresult", $username ]); |
|
| 124 | + $this->addFlash('notice', ["noresult", $username]); |
|
| 125 | 125 | |
| 126 | - return $this->redirectToRoute("SimpleEditCounterProject", [ "project"=>$project ]); |
|
| 126 | + return $this->redirectToRoute("SimpleEditCounterProject", ["project"=>$project]); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | // Remove the last comma and space |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | 'project_url' => $url, |
| 153 | 153 | 'id' => $id, |
| 154 | 154 | 'arch' => $arch, |
| 155 | - 'rev' => $rev + $arch, |
|
| 155 | + 'rev' => $rev+$arch, |
|
| 156 | 156 | 'live' => $rev, |
| 157 | 157 | 'groups' => $groups, |
| 158 | 158 | 'globalGroups' => $globalGroups, |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | 'username' => $username, |
| 50 | 50 | ]); |
| 51 | 51 | } elseif ($project != "") { |
| 52 | - return $this->redirectToRoute("TopEditsResults", [ 'project'=>$project ]); |
|
| 52 | + return $this->redirectToRoute("TopEditsResults", ['project'=>$project]); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // set default wiki so we can populate the namespace selector |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | // Get page info about these 100 pages, so we can use their display title. |
| 130 | - $titles = array_map(function ($e) { |
|
| 130 | + $titles = array_map(function($e) { |
|
| 131 | 131 | return $e['page_title']; |
| 132 | 132 | }, $editData); |
| 133 | 133 | $displayTitles = $apiHelper->displayTitles($project, $titles); |
@@ -155,8 +155,8 @@ |
||
| 155 | 155 | $rev = $lh->getTable("revision", $dbName); |
| 156 | 156 | $arc = $lh->getTable("archive", $dbName); |
| 157 | 157 | |
| 158 | - $cond_begin = ( $start ) ? " AND rev_timestamp > :start " : null; |
|
| 159 | - $cond_end = ( $end ) ? " AND rev_timestamp < :end ": null; |
|
| 158 | + $cond_begin = ($start) ? " AND rev_timestamp > :start " : null; |
|
| 159 | + $cond_end = ($end) ? " AND rev_timestamp < :end " : null; |
|
| 160 | 160 | |
| 161 | 161 | foreach ($AEBTypes as $toolname => $check) { |
| 162 | 162 | $toolname = $dbh->quote($toolname, \PDO::PARAM_STR); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $this->dbName = $dbName; |
| 72 | 72 | $this->url = $url; |
| 73 | 73 | |
| 74 | - return [ 'dbName' => $dbName, 'wikiName' => $wikiName, 'url' => $url, 'lang' => $lang ]; |
|
| 74 | + return ['dbName' => $dbName, 'wikiName' => $wikiName, 'url' => $url, 'lang' => $lang]; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | // Create the query we're going to run against the meta database |
| 100 | 100 | $wikiQuery = $this->client->createQueryBuilder(); |
| 101 | 101 | $wikiQuery |
| 102 | - ->select([ 'dbname', 'name', 'url', 'lang' ]) |
|
| 102 | + ->select(['dbname', 'name', 'url', 'lang']) |
|
| 103 | 103 | ->from('wiki') |
| 104 | 104 | ->where($wikiQuery->expr()->eq('dbname', ':project')) |
| 105 | 105 | // The meta database will have the project's URL stored as https://en.wikipedia.org |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | public function allProjects() |
| 150 | 150 | { |
| 151 | 151 | $wikiQuery = $this->client->createQueryBuilder(); |
| 152 | - $wikiQuery->select([ 'dbName', 'name', 'url' ])->from('wiki'); |
|
| 152 | + $wikiQuery->select(['dbName', 'name', 'url'])->from('wiki'); |
|
| 153 | 153 | $stmt = $wikiQuery->execute(); |
| 154 | 154 | $out = $stmt->fetchAll(); |
| 155 | 155 | return $out; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $apiPath = $this->container->getParameter('api_path'); |
| 40 | 40 | |
| 41 | 41 | try { |
| 42 | - $this->api = MediawikiApi::newFromApiEndpoint($normalizedProject . $apiPath); |
|
| 42 | + $this->api = MediawikiApi::newFromApiEndpoint($normalizedProject.$apiPath); |
|
| 43 | 43 | } catch (Exception $e) { |
| 44 | 44 | // Do nothing... |
| 45 | 45 | } catch (FatalErrorException $e) { |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | throw new Exception("Unable to find project '$project'"); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - $cacheKey = "siteinfo." . str_replace('/', '_', $normalizedProject); |
|
| 71 | + $cacheKey = "siteinfo.".str_replace('/', '_', $normalizedProject); |
|
| 72 | 72 | if ($this->cacheHas($cacheKey)) { |
| 73 | 73 | return $this->cacheGet($cacheKey); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $this->setUp($normalizedProject); |
| 77 | - $params = [ 'meta'=>'siteinfo', 'siprop'=>'general|namespaces' ]; |
|
| 77 | + $params = ['meta'=>'siteinfo', 'siprop'=>'general|namespaces']; |
|
| 78 | 78 | $query = new SimpleRequest('query', $params); |
| 79 | 79 | |
| 80 | 80 | $result = [ |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | public function groups($project, $username) |
| 139 | 139 | { |
| 140 | 140 | $this->setUp($project); |
| 141 | - $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ]; |
|
| 141 | + $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"]; |
|
| 142 | 142 | $query = new SimpleRequest('query', $params); |
| 143 | 143 | $result = []; |
| 144 | 144 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | public function globalGroups($project, $username) |
| 158 | 158 | { |
| 159 | 159 | $this->setUp($project); |
| 160 | - $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ]; |
|
| 160 | + $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"]; |
|
| 161 | 161 | $query = new SimpleRequest('query', $params); |
| 162 | 162 | $result = []; |
| 163 | 163 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $groups[] = "B"; |
| 206 | 206 | } |
| 207 | 207 | if (in_array("steward", $admin["groups"])) { |
| 208 | - $groups[] = "S" ; |
|
| 208 | + $groups[] = "S"; |
|
| 209 | 209 | } |
| 210 | 210 | if (in_array("checkuser", $admin["groups"])) { |
| 211 | 211 | $groups[] = "CU"; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | if (in_array("bot", $admin["groups"])) { |
| 217 | 217 | $groups[] = "Bot"; |
| 218 | 218 | } |
| 219 | - $result[ $admin["name"] ] = [ |
|
| 219 | + $result[$admin["name"]] = [ |
|
| 220 | 220 | "groups" => implode('/', $groups) |
| 221 | 221 | ]; |
| 222 | 222 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $normalized = []; |
| 292 | 292 | if (isset($result['query']['normalized'])) { |
| 293 | 293 | array_map( |
| 294 | - function ($e) use (&$normalized) { |
|
| 294 | + function($e) use (&$normalized) { |
|
| 295 | 295 | $normalized[$e['to']] = $e['from']; |
| 296 | 296 | }, |
| 297 | 297 | $result['query']['normalized'] |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | ]; |
| 338 | 338 | |
| 339 | 339 | // get assessments for this page from the API |
| 340 | - $assessments = $this->massApi($params, $project, function ($data) { |
|
| 340 | + $assessments = $this->massApi($params, $project, function($data) { |
|
| 341 | 341 | return isset($data['pages'][0]['pageassessments']) ? $data['pages'][0]['pageassessments'] : []; |
| 342 | 342 | }, 'pacontinue')['pages']; |
| 343 | 343 | |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | $classAttrs = $config['class']['Unknown']; |
| 362 | 362 | $assessment['class']['value'] = '???'; |
| 363 | 363 | $assessment['class']['category'] = $classAttrs['category']; |
| 364 | - $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". $classAttrs['badge']; |
|
| 364 | + $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/".$classAttrs['badge']; |
|
| 365 | 365 | } else { |
| 366 | 366 | $classAttrs = $config['class'][$classValue]; |
| 367 | 367 | $assessment['class'] = [ |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | |
| 373 | 373 | // add full URL to badge icon |
| 374 | 374 | if ($classAttrs['badge'] !== '') { |
| 375 | - $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/" . |
|
| 375 | + $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". |
|
| 376 | 376 | $classAttrs['badge']; |
| 377 | 377 | } |
| 378 | 378 | |
@@ -421,9 +421,9 @@ discard block |
||
| 421 | 421 | $config = $this->getAssessmentsConfig(); |
| 422 | 422 | |
| 423 | 423 | if (isset($config[$project]['class'][$class])) { |
| 424 | - return "https://upload.wikimedia.org/wikipedia/commons/" . $config[$project]['class'][$class]['badge']; |
|
| 424 | + return "https://upload.wikimedia.org/wikipedia/commons/".$config[$project]['class'][$class]['badge']; |
|
| 425 | 425 | } elseif (isset($config[$project]['class']['Unknown'])) { |
| 426 | - return "https://upload.wikimedia.org/wikipedia/commons/" . $config[$project]['class']['Unknown']['badge']; |
|
| 426 | + return "https://upload.wikimedia.org/wikipedia/commons/".$config[$project]['class']['Unknown']['badge']; |
|
| 427 | 427 | } else { |
| 428 | 428 | return ""; |
| 429 | 429 | } |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | $query = FluentRequest::factory()->setAction('query')->setParams($requestData); |
| 517 | 517 | $innerPromise = $this->api->getRequestAsync($query); |
| 518 | 518 | |
| 519 | - $innerPromise->then(function ($result) use (&$data) { |
|
| 519 | + $innerPromise->then(function($result) use (&$data) { |
|
| 520 | 520 | // some failures come back as 200s, so we still resolve and let the outer function handle it |
| 521 | 521 | if (isset($result['error']) || !isset($result['query'])) { |
| 522 | 522 | return $data['promise']->resolve($data); |
@@ -16,38 +16,38 @@ 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('msg_footer', [ $this, 'intuitionMessageFooter' ], $options), |
|
| 26 | - new \Twig_SimpleFunction('lang', [ $this, 'getLang' ], $options), |
|
| 27 | - new \Twig_SimpleFunction('langName', [ $this, 'getLangName' ], $options), |
|
| 28 | - new \Twig_SimpleFunction('allLangs', [ $this, 'getAllLangs' ]), |
|
| 29 | - new \Twig_SimpleFunction('isRTL', [ $this, 'intuitionIsRTL' ]), |
|
| 30 | - new \Twig_SimpleFunction('isRTLLang', [ $this, 'intuitionIsRTLLang' ]), |
|
| 31 | - new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]), |
|
| 32 | - new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]), |
|
| 33 | - new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]), |
|
| 34 | - new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]), |
|
| 35 | - new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]), |
|
| 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' ]), |
|
| 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('msg_footer', [$this, 'intuitionMessageFooter'], $options), |
|
| 26 | + new \Twig_SimpleFunction('lang', [$this, 'getLang'], $options), |
|
| 27 | + new \Twig_SimpleFunction('langName', [$this, 'getLangName'], $options), |
|
| 28 | + new \Twig_SimpleFunction('allLangs', [$this, 'getAllLangs']), |
|
| 29 | + new \Twig_SimpleFunction('isRTL', [$this, 'intuitionIsRTL']), |
|
| 30 | + new \Twig_SimpleFunction('isRTLLang', [$this, 'intuitionIsRTLLang']), |
|
| 31 | + new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']), |
|
| 32 | + new \Twig_SimpleFunction('hash', [$this, 'gitHash']), |
|
| 33 | + new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']), |
|
| 34 | + new \Twig_SimpleFunction('tools', [$this, 'allTools']), |
|
| 35 | + new \Twig_SimpleFunction('color', [$this, 'getColorList']), |
|
| 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 | 44 | ]; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function requestTime($decimals = 3) |
| 48 | 48 | { |
| 49 | 49 | |
| 50 | - return number_format(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
| 50 | + return number_format(microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public function requestMemory() |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function linkToWiki($url, $page, $secondary = "") |
| 75 | 75 | { |
| 76 | - $link = $url . "/"; |
|
| 76 | + $link = $url."/"; |
|
| 77 | 77 | |
| 78 | 78 | if ($this->isWMFLabs()) { |
| 79 | 79 | $link .= "wiki/"; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | public function linkToWikiScript($url, $secondary) |
| 92 | 92 | { |
| 93 | - $link = $url . "/"; |
|
| 93 | + $link = $url."/"; |
|
| 94 | 94 | |
| 95 | 95 | if ($this->isWMFLabs()) { |
| 96 | 96 | $link .= "w/"; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | // TODO: refactor all intuition stuff so it can be used anywhere |
| 107 | 107 | public function intuitionMessageExists($message = "") |
| 108 | 108 | { |
| 109 | - return $this->getIntuition()->msgExists($message, [ "domain" => "xtools" ]); |
|
| 109 | + return $this->getIntuition()->msgExists($message, ["domain" => "xtools"]); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function intuitionMessagePrintExists($message = "", $vars = []) |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | public function intuitionMessage($message = "", $vars = []) |
| 127 | 127 | { |
| 128 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
| 128 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | public function intuitionMessageFooter() |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function getAllLangs() |
| 155 | 155 | { |
| 156 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
| 156 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
| 157 | 157 | |
| 158 | 158 | $languages = array_values(array_unique(array_map( |
| 159 | - function ($filename) { |
|
| 159 | + function($filename) { |
|
| 160 | 160 | return basename($filename, '.json'); |
| 161 | 161 | }, |
| 162 | 162 | $messageFiles |
@@ -213,41 +213,41 @@ discard block |
||
| 213 | 213 | public static function getColorList($num = false) |
| 214 | 214 | { |
| 215 | 215 | $colors = [ |
| 216 | - 0 => '#Cc0000',# '#FF005A', #red '#FF5555', |
|
| 216 | + 0 => '#Cc0000', # '#FF005A', #red '#FF5555', |
|
| 217 | 217 | 1 => '#F7b7b7', |
| 218 | - 2 => '#5c8d20',# '#008800', #green'#55FF55', |
|
| 218 | + 2 => '#5c8d20', # '#008800', #green'#55FF55', |
|
| 219 | 219 | 3 => '#85eD82', |
| 220 | 220 | 4 => '#2E97E0', # blue |
| 221 | 221 | 5 => '#B9E3F9', |
| 222 | - 6 => '#e1711d', # orange |
|
| 222 | + 6 => '#e1711d', # orange |
|
| 223 | 223 | 7 => '#ffc04c', |
| 224 | 224 | 8 => '#FDFF98', # yellow |
| 225 | 225 | 9 => '#5555FF', |
| 226 | 226 | 10 => '#55FFFF', |
| 227 | - 11 => '#0000C0', # |
|
| 228 | - 12 => '#008800', # green |
|
| 227 | + 11 => '#0000C0', # |
|
| 228 | + 12 => '#008800', # green |
|
| 229 | 229 | 13 => '#00C0C0', |
| 230 | - 14 => '#FFAFAF', # rosé |
|
| 231 | - 15 => '#808080', # gray |
|
| 230 | + 14 => '#FFAFAF', # rosé |
|
| 231 | + 15 => '#808080', # gray |
|
| 232 | 232 | 16 => '#00C000', |
| 233 | 233 | 17 => '#404040', |
| 234 | - 18 => '#C0C000', # green |
|
| 234 | + 18 => '#C0C000', # green |
|
| 235 | 235 | 19 => '#C000C0', |
| 236 | - 100 => '#75A3D1', # blue |
|
| 237 | - 101 => '#A679D2', # purple |
|
| 236 | + 100 => '#75A3D1', # blue |
|
| 237 | + 101 => '#A679D2', # purple |
|
| 238 | 238 | 102 => '#660000', |
| 239 | 239 | 103 => '#000066', |
| 240 | - 104 => '#FAFFAF', # caramel |
|
| 240 | + 104 => '#FAFFAF', # caramel |
|
| 241 | 241 | 105 => '#408345', |
| 242 | 242 | 106 => '#5c8d20', |
| 243 | - 107 => '#e1711d', # red |
|
| 244 | - 108 => '#94ef2b', # light green |
|
| 245 | - 109 => '#756a4a', # brown |
|
| 243 | + 107 => '#e1711d', # red |
|
| 244 | + 108 => '#94ef2b', # light green |
|
| 245 | + 109 => '#756a4a', # brown |
|
| 246 | 246 | 110 => '#6f1dab', |
| 247 | 247 | 111 => '#301e30', |
| 248 | 248 | 112 => '#5c9d96', |
| 249 | - 113 => '#a8cd8c', # earth green |
|
| 250 | - 114 => '#f2b3f1', # light purple |
|
| 249 | + 113 => '#a8cd8c', # earth green |
|
| 250 | + 114 => '#f2b3f1', # light purple |
|
| 251 | 251 | 115 => '#9b5828', |
| 252 | 252 | 118 => '#99FFFF', |
| 253 | 253 | 119 => '#99BBFF', |
@@ -268,8 +268,8 @@ discard block |
||
| 268 | 268 | 446 => '#06DCFB', |
| 269 | 269 | 447 => '#892EE4', |
| 270 | 270 | 460 => '#99FF66', |
| 271 | - 461 => '#99CC66', # green |
|
| 272 | - 470 => '#CCCC33', # ocker |
|
| 271 | + 461 => '#99CC66', # green |
|
| 272 | + 470 => '#CCCC33', # ocker |
|
| 273 | 273 | 471 => '#CCFF33', |
| 274 | 274 | 480 => '#6699FF', |
| 275 | 275 | 481 => '#66FFFF', |
@@ -284,18 +284,18 @@ discard block |
||
| 284 | 284 | 1198 => '#FF34B3', |
| 285 | 285 | 1199 => '#8B1C62', |
| 286 | 286 | |
| 287 | - '#61a9f3',# blue |
|
| 288 | - '#f381b9',# pink |
|
| 287 | + '#61a9f3', # blue |
|
| 288 | + '#f381b9', # pink |
|
| 289 | 289 | '#61E3A9', |
| 290 | 290 | '#D56DE2', |
| 291 | 291 | '#85eD82', |
| 292 | 292 | '#F7b7b7', |
| 293 | 293 | '#CFDF49', |
| 294 | 294 | '#88d8f2', |
| 295 | - '#07AF7B',# green |
|
| 295 | + '#07AF7B', # green |
|
| 296 | 296 | '#B9E3F9', |
| 297 | 297 | '#FFF3AD', |
| 298 | - '#EF606A',# red |
|
| 298 | + '#EF606A', # red |
|
| 299 | 299 | '#EC8833', |
| 300 | 300 | '#FFF100', |
| 301 | 301 | '#87C9A5', |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | public function getFilters() |
| 423 | 423 | { |
| 424 | 424 | return [ |
| 425 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
| 425 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
| 426 | 426 | ]; |
| 427 | 427 | } |
| 428 | 428 | |
@@ -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", [ "noresult", $username ]); |
|
| 178 | - return $this->redirectToRoute("AdminScore", [ "project"=>$project ]); |
|
| 177 | + $this->addFlash("notice", ["noresult", $username]); |
|
| 178 | + return $this->redirectToRoute("AdminScore", ["project"=>$project]); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | return $this->render('adminscore/result.html.twig', [ |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | $article = $request->query->get('article'); |
| 56 | 56 | |
| 57 | 57 | if ($projectQuery != '' && $article != '') { |
| 58 | - return $this->redirectToRoute('ArticleInfoResult', [ 'project'=>$projectQuery, 'article' => $article ]); |
|
| 58 | + return $this->redirectToRoute('ArticleInfoResult', ['project'=>$projectQuery, 'article' => $article]); |
|
| 59 | 59 | } elseif ($article != '') { |
| 60 | - return $this->redirectToRoute('ArticleInfoProject', [ 'project'=>$projectQuery ]); |
|
| 60 | + return $this->redirectToRoute('ArticleInfoProject', ['project'=>$projectQuery]); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | return $this->render('articleInfo/index.html.twig', [ |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | 'url' => $basicInfo['fullurl'] |
| 103 | 103 | ]; |
| 104 | 104 | |
| 105 | - $this->pageInfo['watchers'] = ( isset($basicInfo['watchers']) ) ? $basicInfo['watchers'] : "< 30"; |
|
| 105 | + $this->pageInfo['watchers'] = (isset($basicInfo['watchers'])) ? $basicInfo['watchers'] : "< 30"; |
|
| 106 | 106 | |
| 107 | 107 | $pageProps = isset($basicInfo['pageprops']) ? $basicInfo['pageprops'] : []; |
| 108 | 108 | |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | private function getRevCount() |
| 166 | 166 | { |
| 167 | - $query = "SELECT COUNT(*) AS count FROM " . $this->revisionTable |
|
| 168 | - . " WHERE rev_page = '" . $this->pageInfo['id'] . "'"; |
|
| 167 | + $query = "SELECT COUNT(*) AS count FROM ".$this->revisionTable |
|
| 168 | + . " WHERE rev_page = '".$this->pageInfo['id']."'"; |
|
| 169 | 169 | $res = $this->conn->query($query)->fetchAll(); |
| 170 | 170 | return $res[0]['count']; |
| 171 | 171 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | FROM $this->revisionTable |
| 198 | 198 | LEFT JOIN $userGroupsTable ON rev_user = ug_user |
| 199 | 199 | LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user |
| 200 | - WHERE rev_page = " . $this->pageInfo['id'] . " AND (ug_group = 'bot' OR ufg_group = 'bot') |
|
| 200 | + WHERE rev_page = ".$this->pageInfo['id']." AND (ug_group = 'bot' OR ufg_group = 'bot') |
|
| 201 | 201 | GROUP BY rev_user_text"; |
| 202 | 202 | $res = $this->conn->query($query)->fetchAll(); |
| 203 | 203 | |
@@ -206,14 +206,14 @@ discard block |
||
| 206 | 206 | $sum = 0; |
| 207 | 207 | foreach ($res as $bot) { |
| 208 | 208 | $bots[$bot['username']] = [ |
| 209 | - 'count' => (int) $bot['count'], |
|
| 209 | + 'count' => (int)$bot['count'], |
|
| 210 | 210 | 'current' => $bot['current'] === 'bot' |
| 211 | 211 | ]; |
| 212 | 212 | $sum += $bot['count']; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - uasort($bots, function ($a, $b) { |
|
| 216 | - return $b['count'] - $a['count']; |
|
| 215 | + uasort($bots, function($a, $b) { |
|
| 216 | + return $b['count']-$a['count']; |
|
| 217 | 217 | }); |
| 218 | 218 | |
| 219 | 219 | $this->pageInfo['general']['bot_revision_count'] = $sum; |
@@ -249,10 +249,10 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | if ($info['all'] > 1) { |
| 251 | 251 | // Number of seconds between first and last edit |
| 252 | - $secs = intval(strtotime($info['last']) - strtotime($info['first']) / $info['all']); |
|
| 252 | + $secs = intval(strtotime($info['last'])-strtotime($info['first']) / $info['all']); |
|
| 253 | 253 | |
| 254 | 254 | // Average time between edits (in days) |
| 255 | - $this->pageInfo['editors'][$editor]['atbe'] = $secs / ( 60 * 60 * 24 ); |
|
| 255 | + $this->pageInfo['editors'][$editor]['atbe'] = $secs / (60 * 60 * 24); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | if (count($info['sizes'])) { |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | // Transform to associative array by 'type' |
| 300 | 300 | foreach ($res as $row) { |
| 301 | - $data[$row['type'] . '_count'] = $row['value']; |
|
| 301 | + $data[$row['type'].'_count'] = $row['value']; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | return $data; |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | $title = str_replace(' ', '_', $this->pageInfo['title']); |
| 315 | 315 | $query = "SELECT log_action, log_type, log_timestamp AS timestamp |
| 316 | 316 | FROM $loggingTable |
| 317 | - WHERE log_namespace = '" . $this->pageInfo['namespace'] . "' |
|
| 317 | + WHERE log_namespace = '".$this->pageInfo['namespace']."' |
|
| 318 | 318 | AND log_title = '$title' AND log_timestamp > 1 |
| 319 | 319 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
| 320 | 320 | $events = $this->conn->query($query)->fetchAll(); |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | $conn = $this->container->get('doctrine')->getManager('replicas')->getConnection(); |
| 400 | 400 | $res = $conn->query($query)->fetchAll(); |
| 401 | 401 | |
| 402 | - $terms = array_map(function ($entry) { |
|
| 402 | + $terms = array_map(function($entry) { |
|
| 403 | 403 | return $entry['term']; |
| 404 | 404 | }, $res); |
| 405 | 405 | |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | 'prio' => 2, |
| 411 | 411 | 'name' => 'Wikidata', |
| 412 | 412 | 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n |
| 413 | - 'explanation' => "See: <a target='_blank' " . |
|
| 413 | + 'explanation' => "See: <a target='_blank' ". |
|
| 414 | 414 | "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>", |
| 415 | 415 | ]; |
| 416 | 416 | } |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | 'prio' => 3, |
| 420 | 420 | 'name' => 'Wikidata', |
| 421 | 421 | 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n |
| 422 | - 'explanation' => "See: <a target='_blank' " . |
|
| 422 | + 'explanation' => "See: <a target='_blank' ". |
|
| 423 | 423 | "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>", |
| 424 | 424 | ]; |
| 425 | 425 | } |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | $query = "SELECT rev_id, rev_parent_id, rev_user_text, rev_user, rev_timestamp, |
| 437 | 437 | rev_minor_edit, rev_len, rev_comment |
| 438 | 438 | FROM $this->revisionTable |
| 439 | - WHERE rev_page = '" . $this->pageInfo['id'] . "' AND rev_timestamp > 1 |
|
| 439 | + WHERE rev_page = '".$this->pageInfo['id']."' AND rev_timestamp > 1 |
|
| 440 | 440 | ORDER BY rev_timestamp"; |
| 441 | 441 | |
| 442 | 442 | $res = $this->conn->query($query)->fetchAll(); |
@@ -456,14 +456,14 @@ discard block |
||
| 456 | 456 | return $rev['rev_len']; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - $lastRev = $this->pageHistory[$revIndex - 1]; |
|
| 459 | + $lastRev = $this->pageHistory[$revIndex-1]; |
|
| 460 | 460 | |
| 461 | 461 | // TODO: Remove once T101631 is resolved |
| 462 | 462 | // Treat as zero change in size if rev_len of previous edit is missing |
| 463 | 463 | if ($lastRev['rev_len'] === null) { |
| 464 | 464 | return 0; |
| 465 | 465 | } else { |
| 466 | - return $rev['rev_len'] - $lastRev['rev_len']; |
|
| 466 | + return $rev['rev_len']-$lastRev['rev_len']; |
|
| 467 | 467 | } |
| 468 | 468 | } |
| 469 | 469 | |
@@ -484,12 +484,12 @@ discard block |
||
| 484 | 484 | // The month of the first edit. Used as a comparison when building the per-month data |
| 485 | 485 | $firstEditMonth = strtotime(date('Y-m-01, 00:00', strtotime($firstEdit['rev_timestamp']))); |
| 486 | 486 | |
| 487 | - $lastEdit = $this->pageHistory[ $revisionCount - 1 ]; |
|
| 488 | - $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[ $revisionCount - 2 ]; |
|
| 487 | + $lastEdit = $this->pageHistory[$revisionCount-1]; |
|
| 488 | + $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[$revisionCount-2]; |
|
| 489 | 489 | |
| 490 | 490 | // Now we can start our master array. This one will be HUGE! |
| 491 | 491 | $lastEditSize = ($revisionCount > 1) |
| 492 | - ? $lastEdit['rev_len'] - $secondLastEdit['rev_len'] |
|
| 492 | + ? $lastEdit['rev_len']-$secondLastEdit['rev_len'] |
|
| 493 | 493 | : $lastEdit['rev_len']; |
| 494 | 494 | $data = [ |
| 495 | 495 | 'general' => [ |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | // Increment year and month counts for all edits |
| 587 | 587 | $data['year_count'][$timestamp['year']]['all']++; |
| 588 | 588 | $data['year_count'][$timestamp['year']]['months'][$timestamp['month']]['all']++; |
| 589 | - $data['year_count'][$timestamp['year']]['size'] = (int) $rev['rev_len']; |
|
| 589 | + $data['year_count'][$timestamp['year']]['size'] = (int)$rev['rev_len']; |
|
| 590 | 590 | |
| 591 | 591 | $editsThisMonth = $data['year_count'][$timestamp['year']]['months'][$timestamp['month']]['all']; |
| 592 | 592 | if ($editsThisMonth > $data['max_edits_per_month']) { |
@@ -630,9 +630,9 @@ discard block |
||
| 630 | 630 | } |
| 631 | 631 | |
| 632 | 632 | // determine if the next revision was a revert |
| 633 | - $nextRevision = isset($this->pageHistory[$i + 1]) ? $this->pageHistory[$i + 1] : null; |
|
| 633 | + $nextRevision = isset($this->pageHistory[$i+1]) ? $this->pageHistory[$i+1] : null; |
|
| 634 | 634 | $nextRevisionIsRevert = $nextRevision && |
| 635 | - $this->getDiffSize($i + 1) === -$diffSize && |
|
| 635 | + $this->getDiffSize($i+1) === -$diffSize && |
|
| 636 | 636 | $this->aeh->isRevert($nextRevision['rev_comment']); |
| 637 | 637 | |
| 638 | 638 | // don't count this edit as content removal if the next edit reverted it |