@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $this->stopwatch->start($cacheKey, 'XTools'); |
| 126 | 126 | $api = $this->getMediawikiApi($project); |
| 127 | - $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ]; |
|
| 127 | + $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"]; |
|
| 128 | 128 | $query = new SimpleRequest('query', $params); |
| 129 | 129 | $result = []; |
| 130 | 130 | $res = $api->getRequest($query); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | // Create the API query. |
| 161 | 161 | $api = $this->getMediawikiApi($project); |
| 162 | - $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ]; |
|
| 162 | + $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"]; |
|
| 163 | 163 | $query = new SimpleRequest('query', $params); |
| 164 | 164 | |
| 165 | 165 | // Get the result. |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | $username = $user->getUsername(); |
| 205 | 205 | |
| 206 | - $cacheKey = 'pages.' . $project->getDatabaseName() . '.' |
|
| 207 | - . $user->getCacheKey() . '.' . $namespace . '.' . $redirects; |
|
| 206 | + $cacheKey = 'pages.'.$project->getDatabaseName().'.' |
|
| 207 | + . $user->getCacheKey().'.'.$namespace.'.'.$redirects; |
|
| 208 | 208 | if ($this->cache->hasItem($cacheKey)) { |
| 209 | 209 | return $this->cache->getItem($cacheKey)->get(); |
| 210 | 210 | } |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | FROM $pageTable |
| 263 | 263 | JOIN $revisionTable ON page_id = rev_page |
| 264 | 264 | $paJoin |
| 265 | - WHERE $whereRev AND rev_parent_id = '0' $namespaceConditionRev $redirectCondition" . |
|
| 266 | - ($hasPageAssessments ? 'GROUP BY rev_page' : '') . " |
|
| 265 | + WHERE $whereRev AND rev_parent_id = '0' $namespaceConditionRev $redirectCondition". |
|
| 266 | + ($hasPageAssessments ? 'GROUP BY rev_page' : '')." |
|
| 267 | 267 | ) |
| 268 | 268 | |
| 269 | 269 | UNION |
@@ -305,21 +305,21 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | public function countEdits(Project $project, User $user, $namespace = 'all', $start = '', $end = '') |
| 307 | 307 | { |
| 308 | - $cacheKey = 'editcount.' . $project->getDatabaseName() . '.' |
|
| 309 | - . $user->getCacheKey() . '.' . $namespace; |
|
| 308 | + $cacheKey = 'editcount.'.$project->getDatabaseName().'.' |
|
| 309 | + . $user->getCacheKey().'.'.$namespace; |
|
| 310 | 310 | |
| 311 | 311 | $condBegin = ''; |
| 312 | 312 | $condEnd = ''; |
| 313 | 313 | |
| 314 | 314 | if (!empty($start)) { |
| 315 | - $cacheKey .= '.' . $start; |
|
| 315 | + $cacheKey .= '.'.$start; |
|
| 316 | 316 | |
| 317 | 317 | // For the query |
| 318 | 318 | $start = date('Ymd000000', strtotime($start)); |
| 319 | 319 | $condBegin = 'AND rev_timestamp >= :start '; |
| 320 | 320 | } |
| 321 | 321 | if (!empty($end)) { |
| 322 | - $cacheKey .= '.' . $end; |
|
| 322 | + $cacheKey .= '.'.$end; |
|
| 323 | 323 | |
| 324 | 324 | // For the query |
| 325 | 325 | $end = date('Ymd235959', strtotime($end)); |
@@ -379,21 +379,21 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | public function countAutomatedEdits(Project $project, User $user, $namespace = 'all', $start = '', $end = '') |
| 381 | 381 | { |
| 382 | - $cacheKey = 'autoeditcount.' . $project->getDatabaseName() . '.' |
|
| 383 | - . $user->getCacheKey() . '.' . $namespace; |
|
| 382 | + $cacheKey = 'autoeditcount.'.$project->getDatabaseName().'.' |
|
| 383 | + . $user->getCacheKey().'.'.$namespace; |
|
| 384 | 384 | |
| 385 | 385 | $condBegin = ''; |
| 386 | 386 | $condEnd = ''; |
| 387 | 387 | |
| 388 | 388 | if (!empty($start)) { |
| 389 | - $cacheKey .= '.' . $start; |
|
| 389 | + $cacheKey .= '.'.$start; |
|
| 390 | 390 | |
| 391 | 391 | // For the query |
| 392 | 392 | $start = date('Ymd000000', strtotime($start)); |
| 393 | 393 | $condBegin = 'AND rev_timestamp >= :start '; |
| 394 | 394 | } |
| 395 | 395 | if (!empty($end)) { |
| 396 | - $cacheKey .= '.' . $end; |
|
| 396 | + $cacheKey .= '.'.$end; |
|
| 397 | 397 | |
| 398 | 398 | // For the query |
| 399 | 399 | $end = date('Ymd235959', strtotime($end)); |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | $tagJoin = $tags != '' ? "LEFT OUTER JOIN $tagTable ON ct_rev_id = rev_id" : ''; |
| 426 | 426 | $condTools[] = "ct_tag IN ($tags)"; |
| 427 | 427 | } |
| 428 | - $condTool = 'AND (' . implode(' OR ', $condTools) . ')'; |
|
| 428 | + $condTool = 'AND ('.implode(' OR ', $condTools).')'; |
|
| 429 | 429 | |
| 430 | 430 | $sql = "SELECT COUNT(DISTINCT(rev_id)) |
| 431 | 431 | FROM $revisionTable |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $resultQuery->bindParam('namespace', $namespace); |
| 451 | 451 | } |
| 452 | 452 | $resultQuery->execute(); |
| 453 | - $result = (int) $resultQuery->fetchColumn(); |
|
| 453 | + $result = (int)$resultQuery->fetchColumn(); |
|
| 454 | 454 | |
| 455 | 455 | // Cache for 10 minutes, and return. |
| 456 | 456 | $cacheItem = $this->cache->getItem($cacheKey) |
@@ -482,21 +482,21 @@ discard block |
||
| 482 | 482 | $end = '', |
| 483 | 483 | $offset = 0 |
| 484 | 484 | ) { |
| 485 | - $cacheKey = 'nonautoedits.' . $project->getDatabaseName() . '.' |
|
| 486 | - . $user->getCacheKey() . '.' . $namespace . '.' . $offset; |
|
| 485 | + $cacheKey = 'nonautoedits.'.$project->getDatabaseName().'.' |
|
| 486 | + . $user->getCacheKey().'.'.$namespace.'.'.$offset; |
|
| 487 | 487 | |
| 488 | 488 | $condBegin = ''; |
| 489 | 489 | $condEnd = ''; |
| 490 | 490 | |
| 491 | 491 | if (!empty($start)) { |
| 492 | - $cacheKey .= '.' . $start; |
|
| 492 | + $cacheKey .= '.'.$start; |
|
| 493 | 493 | |
| 494 | 494 | // For the query |
| 495 | 495 | $start = date('Ymd000000', strtotime($start)); |
| 496 | 496 | $condBegin = 'AND revs.rev_timestamp >= :start '; |
| 497 | 497 | } |
| 498 | 498 | if (!empty($end)) { |
| 499 | - $cacheKey .= '.' . $end; |
|
| 499 | + $cacheKey .= '.'.$end; |
|
| 500 | 500 | |
| 501 | 501 | // For the query |
| 502 | 502 | $end = date('Ymd235959', strtotime($end)); |
@@ -589,21 +589,21 @@ discard block |
||
| 589 | 589 | $start = '', |
| 590 | 590 | $end = '' |
| 591 | 591 | ) { |
| 592 | - $cacheKey = 'autotoolcounts.' . $project->getDatabaseName() . '.' |
|
| 593 | - . $user->getCacheKey() . '.' . $namespace; |
|
| 592 | + $cacheKey = 'autotoolcounts.'.$project->getDatabaseName().'.' |
|
| 593 | + . $user->getCacheKey().'.'.$namespace; |
|
| 594 | 594 | |
| 595 | 595 | $condBegin = ''; |
| 596 | 596 | $condEnd = ''; |
| 597 | 597 | |
| 598 | 598 | if (!empty($start)) { |
| 599 | - $cacheKey .= '.' . $start; |
|
| 599 | + $cacheKey .= '.'.$start; |
|
| 600 | 600 | |
| 601 | 601 | // For the query |
| 602 | 602 | $start = date('Ymd000000', strtotime($start)); |
| 603 | 603 | $condBegin = 'AND rev_timestamp >= :start '; |
| 604 | 604 | } |
| 605 | 605 | if (!empty($end)) { |
| 606 | - $cacheKey .= '.' . $end; |
|
| 606 | + $cacheKey .= '.'.$end; |
|
| 607 | 607 | |
| 608 | 608 | // For the query |
| 609 | 609 | $end = date('Ymd235959', strtotime($end)); |
@@ -650,13 +650,13 @@ discard block |
||
| 650 | 650 | if ($condTool === '') { |
| 651 | 651 | $condTool = "ct_tag = $tag"; |
| 652 | 652 | } else { |
| 653 | - $condTool = '(' . $condTool . " OR ct_tag = $tag)"; |
|
| 653 | + $condTool = '('.$condTool." OR ct_tag = $tag)"; |
|
| 654 | 654 | } |
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | // Developer error, no regex or tag provided for this tool. |
| 658 | 658 | if ($condTool === '') { |
| 659 | - throw new Exception("No regex or tag found for the tool $toolname. " . |
|
| 659 | + throw new Exception("No regex or tag found for the tool $toolname. ". |
|
| 660 | 660 | "Please verify this entry in semi_automated.yml"); |
| 661 | 661 | } |
| 662 | 662 | |
@@ -708,8 +708,8 @@ discard block |
||
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | // Sort the array by count |
| 711 | - uasort($results, function ($a, $b) { |
|
| 712 | - return $b['count'] - $a['count']; |
|
| 711 | + uasort($results, function($a, $b) { |
|
| 712 | + return $b['count']-$a['count']; |
|
| 713 | 713 | }); |
| 714 | 714 | |
| 715 | 715 | // Cache for 10 minutes, and return. |