@@ -177,7 +177,7 @@ |
||
177 | 177 | * Get a list of namespaces on the given project. |
178 | 178 | * |
179 | 179 | * @param string $project such as en.wikipedia.org |
180 | - * @return string[] Array of namespace IDs (keys) to names (values). |
|
180 | + * @return string Array of namespace IDs (keys) to names (values). |
|
181 | 181 | */ |
182 | 182 | public function namespaces($project) |
183 | 183 | { |
@@ -2,13 +2,11 @@ |
||
2 | 2 | |
3 | 3 | namespace AppBundle\Helper; |
4 | 4 | |
5 | -use DateInterval; |
|
6 | 5 | use Mediawiki\Api\MediawikiApi; |
7 | 6 | use Mediawiki\Api\SimpleRequest; |
8 | 7 | use Mediawiki\Api\FluentRequest; |
9 | 8 | use Psr\Cache\CacheItemPoolInterface; |
10 | 9 | use Symfony\Component\Config\Definition\Exception\Exception; |
11 | -use Symfony\Component\Debug\Exception\FatalErrorException; |
|
12 | 10 | use Symfony\Component\DependencyInjection\ContainerInterface; |
13 | 11 | use Xtools\ProjectRepository; |
14 | 12 |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | throw new Exception("Unable to find project '$projectName'"); |
67 | 67 | } |
68 | 68 | |
69 | - $cacheKey = "siteinfo." . $project->getDatabaseName(); |
|
69 | + $cacheKey = "siteinfo.".$project->getDatabaseName(); |
|
70 | 70 | if ($this->cacheHas($cacheKey)) { |
71 | 71 | return $this->cacheGet($cacheKey); |
72 | 72 | } |
73 | 73 | |
74 | - $params = [ 'meta'=>'siteinfo', 'siprop'=>'general|namespaces' ]; |
|
74 | + $params = ['meta'=>'siteinfo', 'siprop'=>'general|namespaces']; |
|
75 | 75 | $query = new SimpleRequest('query', $params); |
76 | 76 | |
77 | 77 | $result = [ |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | public function groups($project, $username) |
136 | 136 | { |
137 | 137 | $this->setUp($project); |
138 | - $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ]; |
|
138 | + $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"]; |
|
139 | 139 | $query = new SimpleRequest('query', $params); |
140 | 140 | $result = []; |
141 | 141 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | public function globalGroups($project, $username) |
155 | 155 | { |
156 | 156 | $this->setUp($project); |
157 | - $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ]; |
|
157 | + $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"]; |
|
158 | 158 | $query = new SimpleRequest('query', $params); |
159 | 159 | $result = []; |
160 | 160 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $groups[] = "B"; |
203 | 203 | } |
204 | 204 | if (in_array("steward", $admin["groups"])) { |
205 | - $groups[] = "S" ; |
|
205 | + $groups[] = "S"; |
|
206 | 206 | } |
207 | 207 | if (in_array("checkuser", $admin["groups"])) { |
208 | 208 | $groups[] = "CU"; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | if (in_array("bot", $admin["groups"])) { |
214 | 214 | $groups[] = "Bot"; |
215 | 215 | } |
216 | - $result[ $admin["name"] ] = [ |
|
216 | + $result[$admin["name"]] = [ |
|
217 | 217 | "groups" => implode('/', $groups) |
218 | 218 | ]; |
219 | 219 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $normalized = []; |
289 | 289 | if (isset($result['query']['normalized'])) { |
290 | 290 | array_map( |
291 | - function ($e) use (&$normalized) { |
|
291 | + function($e) use (&$normalized) { |
|
292 | 292 | $normalized[$e['to']] = $e['from']; |
293 | 293 | }, |
294 | 294 | $result['query']['normalized'] |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | ]; |
335 | 335 | |
336 | 336 | // get assessments for this page from the API |
337 | - $assessments = $this->massApi($params, $project, function ($data) { |
|
337 | + $assessments = $this->massApi($params, $project, function($data) { |
|
338 | 338 | return isset($data['pages'][0]['pageassessments']) ? $data['pages'][0]['pageassessments'] : []; |
339 | 339 | }, 'pacontinue')['pages']; |
340 | 340 | |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $classAttrs = $config['class']['Unknown']; |
359 | 359 | $assessment['class']['value'] = '???'; |
360 | 360 | $assessment['class']['category'] = $classAttrs['category']; |
361 | - $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". $classAttrs['badge']; |
|
361 | + $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/".$classAttrs['badge']; |
|
362 | 362 | } else { |
363 | 363 | $classAttrs = $config['class'][$classValue]; |
364 | 364 | $assessment['class'] = [ |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | |
370 | 370 | // add full URL to badge icon |
371 | 371 | if ($classAttrs['badge'] !== '') { |
372 | - $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/" . |
|
372 | + $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". |
|
373 | 373 | $classAttrs['badge']; |
374 | 374 | } |
375 | 375 | |
@@ -418,9 +418,9 @@ discard block |
||
418 | 418 | $config = $this->getAssessmentsConfig(); |
419 | 419 | |
420 | 420 | if (isset($config[$project]['class'][$class])) { |
421 | - return "https://upload.wikimedia.org/wikipedia/commons/" . $config[$project]['class'][$class]['badge']; |
|
421 | + return "https://upload.wikimedia.org/wikipedia/commons/".$config[$project]['class'][$class]['badge']; |
|
422 | 422 | } elseif (isset($config[$project]['class']['Unknown'])) { |
423 | - return "https://upload.wikimedia.org/wikipedia/commons/" . $config[$project]['class']['Unknown']['badge']; |
|
423 | + return "https://upload.wikimedia.org/wikipedia/commons/".$config[$project]['class']['Unknown']['badge']; |
|
424 | 424 | } else { |
425 | 425 | return ""; |
426 | 426 | } |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | $query = FluentRequest::factory()->setAction('query')->setParams($requestData); |
514 | 514 | $innerPromise = $this->api->getRequestAsync($query); |
515 | 515 | |
516 | - $innerPromise->then(function ($result) use (&$data) { |
|
516 | + $innerPromise->then(function($result) use (&$data) { |
|
517 | 517 | // some failures come back as 200s, so we still resolve and let the outer function handle it |
518 | 518 | if (isset($result['error']) || !isset($result['query'])) { |
519 | 519 | return $data['promise']->resolve($data); |
@@ -66,7 +66,7 @@ |
||
66 | 66 | public function userRightsUrl(Project $project) |
67 | 67 | { |
68 | 68 | return $project->getUrl() . $project->getScriptPath() . "?title=Special:UserRights&user=" . |
69 | - $this->getUsername(); |
|
69 | + $this->getUsername(); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -65,7 +65,7 @@ |
||
65 | 65 | */ |
66 | 66 | public function userRightsUrl(Project $project) |
67 | 67 | { |
68 | - return $project->getUrl() . $project->getScriptPath() . "?title=Special:UserRights&user=" . |
|
68 | + return $project->getUrl().$project->getScriptPath()."?title=Special:UserRights&user=". |
|
69 | 69 | $this->getUsername(); |
70 | 70 | } |
71 | 71 |
@@ -96,7 +96,7 @@ |
||
96 | 96 | * List top edits by this user for all pages in a particular namespace. |
97 | 97 | * @param User $user The User. |
98 | 98 | * @param Project $project The project. |
99 | - * @param integer|string $namespaceId The namespace ID or 'all' |
|
99 | + * @param integer $namespaceId The namespace ID or 'all' |
|
100 | 100 | * @return \Symfony\Component\HttpFoundation\Response |
101 | 101 | */ |
102 | 102 | protected function namespaceTopEdits(User $user, Project $project, $namespaceId) |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
8 | 8 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
9 | 9 | use Symfony\Component\HttpFoundation\Request; |
10 | -use Symfony\Component\VarDumper\VarDumper; |
|
11 | 10 | use Xtools\Page; |
12 | 11 | use Xtools\PagesRepository; |
13 | 12 | use Xtools\Project; |
@@ -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 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @param Project $project The project to which the page belongs. |
16 | 16 | * @param string $pageTitle Page title. |
17 | 17 | * @param boolean $followRedirects Whether or not to resolve redirects |
18 | - * @return string[] Array with some of the following keys: pageid, title, missing, displaytitle, |
|
18 | + * @return string|null Array with some of the following keys: pageid, title, missing, displaytitle, |
|
19 | 19 | * url. |
20 | 20 | */ |
21 | 21 | public function getPageInfo(Project $project, $pageTitle, $followRedirects = true) |
@@ -63,9 +63,8 @@ discard block |
||
63 | 63 | |
64 | 64 | /** |
65 | 65 | * Get revisions of a single page. |
66 | - * @param Project $project |
|
67 | 66 | * @param Page $page |
68 | - * @param User|null $user |
|
67 | + * @param User $user |
|
69 | 68 | * @return string[] Each member with keys: id, timestamp, length- |
70 | 69 | */ |
71 | 70 | public function getRevisions(Page $page, User $user) |
@@ -3,12 +3,7 @@ |
||
3 | 3 | namespace AppBundle\Helper; |
4 | 4 | |
5 | 5 | use DateTime; |
6 | -use Doctrine\DBAL\Connection; |
|
7 | -use Psr\Cache\CacheItemPoolInterface; |
|
8 | -use Symfony\Component\Config\Definition\Exception\Exception; |
|
9 | -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
|
10 | 6 | use Symfony\Component\DependencyInjection\ContainerInterface; |
11 | -use Symfony\Component\VarDumper\VarDumper; |
|
12 | 7 | use Xtools\ProjectRepository; |
13 | 8 | |
14 | 9 | class AutomatedEditsHelper extends HelperBase |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $revTable = $lh->getTable('revision', $project->getDatabaseName()); |
124 | 124 | $pageTable = $lh->getTable('page', $project->getDatabaseName()); |
125 | 125 | |
126 | - $AEBTypes = array_map(function ($AEBType) { |
|
126 | + $AEBTypes = array_map(function($AEBType) { |
|
127 | 127 | return $AEBType['regex']; |
128 | 128 | }, $this->container->getParameter('automated_tools')); |
129 | 129 | |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | // Get diff sizes, based on length of each parent revision |
151 | - $parentRevIds = array_map(function ($edit) { |
|
151 | + $parentRevIds = array_map(function($edit) { |
|
152 | 152 | return $edit['rev_parent_id']; |
153 | 153 | }, $editData); |
154 | 154 | $query = "SELECT rev_len, rev_id |
155 | 155 | FROM revision |
156 | - WHERE rev_id IN (" . implode(',', $parentRevIds) . ")"; |
|
156 | + WHERE rev_id IN (" . implode(',', $parentRevIds).")"; |
|
157 | 157 | $diffSizeData = $conn->executeQuery($query)->fetchAll(); |
158 | 158 | |
159 | 159 | // reformat with rev_id as the key, rev_len as the value |
@@ -163,24 +163,24 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | // Build our array of nonautomated edits |
166 | - $editData = array_map(function ($edit) use ($namespaces, $diffSizes) { |
|
166 | + $editData = array_map(function($edit) use ($namespaces, $diffSizes) { |
|
167 | 167 | $pageTitle = $edit['page_title']; |
168 | 168 | |
169 | 169 | if ($edit['page_namespace'] !== '0') { |
170 | - $pageTitle = $namespaces[$edit['page_namespace']] . ":$pageTitle"; |
|
170 | + $pageTitle = $namespaces[$edit['page_namespace']].":$pageTitle"; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | $diffSize = $edit['rev_len']; |
174 | 174 | if ($edit['rev_parent_id'] > 0) { |
175 | - $diffSize = $edit['rev_len'] - $diffSizes[$edit['rev_parent_id']]; |
|
175 | + $diffSize = $edit['rev_len']-$diffSizes[$edit['rev_parent_id']]; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | return [ |
179 | 179 | 'page_title' => $pageTitle, |
180 | - 'namespace' => (int) $edit['page_namespace'], |
|
181 | - 'rev_id' => (int) $edit['rev_id'], |
|
180 | + 'namespace' => (int)$edit['page_namespace'], |
|
181 | + 'rev_id' => (int)$edit['rev_id'], |
|
182 | 182 | 'timestamp' => DateTime::createFromFormat('YmdHis', $edit['rev_timestamp']), |
183 | - 'minor_edit' => (bool) $edit['rev_minor_edit'], |
|
183 | + 'minor_edit' => (bool)$edit['rev_minor_edit'], |
|
184 | 184 | 'summary' => $edit['rev_comment'], |
185 | 185 | 'size' => $diffSize |
186 | 186 | ]; |
@@ -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 | } |
@@ -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', [ |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
6 | 6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
7 | 7 | use Symfony\Component\HttpFoundation\Request; |
8 | -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
|
9 | 8 | use DateTime; |
10 | 9 | use Xtools\ProjectRepository; |
11 | 10 |