@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $isSection = preg_match_all("/^\/\* (.*?) \*\//", $summary, $sectionMatch); |
| 282 | 282 | |
| 283 | 283 | if ($isSection && isset($page)) { |
| 284 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
| 284 | + $pageUrl = $project->getUrl(false).str_replace( |
|
| 285 | 285 | '$1', |
| 286 | 286 | $page->getTitle($useUnnormalizedPageTitle), |
| 287 | 287 | $project->getArticlePath() |
@@ -291,8 +291,8 @@ discard block |
||
| 291 | 291 | // Must have underscores for the link to properly go to the section. |
| 292 | 292 | $sectionTitleLink = htmlspecialchars(str_replace(' ', '_', $sectionTitle)); |
| 293 | 293 | |
| 294 | - $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>" . |
|
| 295 | - "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> "; |
|
| 294 | + $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>". |
|
| 295 | + "<em class='text-muted'>".htmlspecialchars($sectionTitle).":</em> "; |
|
| 296 | 296 | $summary = str_replace($sectionMatch[0][0], $sectionWikitext, $summary); |
| 297 | 297 | } |
| 298 | 298 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | ); |
| 307 | 307 | |
| 308 | 308 | // Use normalized page title (underscored, capitalized). |
| 309 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
| 309 | + $pageUrl = $project->getUrl(false).str_replace( |
|
| 310 | 310 | '$1', |
| 311 | 311 | ucfirst(str_replace(' ', '_', $wikiLinkPath)), |
| 312 | 312 | $project->getArticlePath() |
@@ -344,8 +344,8 @@ discard block |
||
| 344 | 344 | public function getDiffUrl() |
| 345 | 345 | { |
| 346 | 346 | $project = $this->getProject(); |
| 347 | - $path = str_replace('$1', 'Special:Diff/' . $this->id, $project->getArticlePath()); |
|
| 348 | - return rtrim($project->getUrl(), '/') . $path; |
|
| 347 | + $path = str_replace('$1', 'Special:Diff/'.$this->id, $project->getArticlePath()); |
|
| 348 | + return rtrim($project->getUrl(), '/').$path; |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | /** |
@@ -355,8 +355,8 @@ discard block |
||
| 355 | 355 | public function getPermaUrl() |
| 356 | 356 | { |
| 357 | 357 | $project = $this->getProject(); |
| 358 | - $path = str_replace('$1', 'Special:PermaLink/' . $this->id, $project->getArticlePath()); |
|
| 359 | - return rtrim($project->getUrl(), '/') . $path; |
|
| 358 | + $path = str_replace('$1', 'Special:PermaLink/'.$this->id, $project->getArticlePath()); |
|
| 359 | + return rtrim($project->getUrl(), '/').$path; |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /** |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | */ |
| 389 | 389 | public function isAutomated(Container $container) |
| 390 | 390 | { |
| 391 | - return (bool) $this->getTool($container); |
|
| 391 | + return (bool)$this->getTool($container); |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | public function requestTime() |
| 112 | 112 | { |
| 113 | 113 | if (!isset($this->requestTime)) { |
| 114 | - $this->requestTime = microtime(true) - $this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
| 114 | + $this->requestTime = microtime(true)-$this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | return $this->requestTime; |
@@ -674,15 +674,15 @@ discard block |
||
| 674 | 674 | |
| 675 | 675 | if ($seconds >= 86400) { |
| 676 | 676 | // Over a day |
| 677 | - $val = (int) floor($seconds / 86400); |
|
| 677 | + $val = (int)floor($seconds / 86400); |
|
| 678 | 678 | $key = 'days'; |
| 679 | 679 | } elseif ($seconds >= 3600) { |
| 680 | 680 | // Over an hour, less than a day |
| 681 | - $val = (int) floor($seconds / 3600); |
|
| 681 | + $val = (int)floor($seconds / 3600); |
|
| 682 | 682 | $key = 'hours'; |
| 683 | 683 | } elseif ($seconds >= 60) { |
| 684 | 684 | // Over a minute, less than an hour |
| 685 | - $val = (int) floor($seconds / 60); |
|
| 685 | + $val = (int)floor($seconds / 60); |
|
| 686 | 686 | $key = 'minutes'; |
| 687 | 687 | } |
| 688 | 688 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | // supply as the OFFSET. |
| 152 | 152 | $limitClause = ''; |
| 153 | 153 | if (intval($limit) > 0 && isset($numRevisions)) { |
| 154 | - $offset = $numRevisions - $limit; |
|
| 154 | + $offset = $numRevisions-$limit; |
|
| 155 | 155 | $limitClause = "LIMIT $offset, $limit"; |
| 156 | 156 | } |
| 157 | 157 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $time2 = time(); |
| 290 | 290 | |
| 291 | 291 | // If it took over 5 seconds, cache the result for 20 minutes. |
| 292 | - if ($time2 - $time1 > 5) { |
|
| 292 | + if ($time2-$time1 > 5) { |
|
| 293 | 293 | $this->setCache($cacheKey, $result, 'PT20M'); |
| 294 | 294 | } |
| 295 | 295 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | $wikidataId = ltrim($page->getWikidataId(), 'Q'); |
| 410 | 410 | |
| 411 | - $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . " |
|
| 411 | + $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')." |
|
| 412 | 412 | FROM wikidatawiki_p.wb_items_per_site |
| 413 | 413 | WHERE ips_item_id = :wikidataId"; |
| 414 | 414 | |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | 'wikidataId' => $wikidataId, |
| 417 | 417 | ])->fetchAll(); |
| 418 | 418 | |
| 419 | - return $count ? (int) $result[0]['count'] : $result; |
|
| 419 | + return $count ? (int)$result[0]['count'] : $result; |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | /** |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | |
| 455 | 455 | // Transform to associative array by 'type' |
| 456 | 456 | foreach ($res as $row) { |
| 457 | - $data[$row['type'] . '_count'] = $row['value']; |
|
| 457 | + $data[$row['type'].'_count'] = $row['value']; |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | return $data; |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | |
| 497 | 497 | $project = $page->getProject()->getDomain(); |
| 498 | 498 | |
| 499 | - $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' . |
|
| 499 | + $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'. |
|
| 500 | 500 | "$project/all-access/user/$title/daily/$start/$end"; |
| 501 | 501 | |
| 502 | 502 | $res = $client->request('GET', $url); |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | $normalized = []; |
| 569 | 569 | if (isset($result['query']['normalized'])) { |
| 570 | 570 | array_map( |
| 571 | - function ($e) use (&$normalized) { |
|
| 571 | + function($e) use (&$normalized) { |
|
| 572 | 572 | $normalized[$e['to']] = $e['from']; |
| 573 | 573 | }, |
| 574 | 574 | $result['query']['normalized'] |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | $response->setEncodingOptions(JSON_NUMERIC_CHECK); |
| 320 | 320 | |
| 321 | 321 | $res['automated_editcount'] = $this->autoEdits->getAutomatedCount(); |
| 322 | - $res['nonautomated_editcount'] = $res['total_editcount'] - $res['automated_editcount']; |
|
| 322 | + $res['nonautomated_editcount'] = $res['total_editcount']-$res['automated_editcount']; |
|
| 323 | 323 | |
| 324 | 324 | if ($tools != '') { |
| 325 | 325 | $tools = $this->autoEdits->getToolCounts(); |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | |
| 367 | 367 | $namespaces = $this->project->getNamespaces(); |
| 368 | 368 | |
| 369 | - $ret['nonautomated_edits'] = array_map(function ($rev) use ($namespaces) { |
|
| 369 | + $ret['nonautomated_edits'] = array_map(function($rev) use ($namespaces) { |
|
| 370 | 370 | $pageTitle = $rev['page_title']; |
| 371 | 371 | if ((int)$rev['page_namespace'] === 0) { |
| 372 | 372 | $fullPageTitle = $pageTitle; |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | |
| 421 | 421 | $namespaces = $this->project->getNamespaces(); |
| 422 | 422 | |
| 423 | - $ret['nonautomated_edits'] = array_map(function ($rev) use ($namespaces) { |
|
| 423 | + $ret['nonautomated_edits'] = array_map(function($rev) use ($namespaces) { |
|
| 424 | 424 | $pageTitle = $rev['page_title']; |
| 425 | 425 | if ((int)$rev['page_namespace'] === 0) { |
| 426 | 426 | $fullPageTitle = $pageTitle; |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | $promises[] = $promise; |
| 141 | 141 | |
| 142 | 142 | // Handle response of $promise asynchronously. |
| 143 | - $promise->then(function ($response) use ($key, $endpoint) { |
|
| 144 | - $result = (array) json_decode($response->getBody()->getContents()); |
|
| 143 | + $promise->then(function($response) use ($key, $endpoint) { |
|
| 144 | + $result = (array)json_decode($response->getBody()->getContents()); |
|
| 145 | 145 | |
| 146 | 146 | $this->getRepository() |
| 147 | 147 | ->getLog() |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | // We'll log this to see how often it happens. |
| 159 | 159 | $this->getRepository() |
| 160 | 160 | ->getLog() |
| 161 | - ->error("Failed to fetch data for $endpoint via async, " . |
|
| 161 | + ->error("Failed to fetch data for $endpoint via async, ". |
|
| 162 | 162 | "re-attempting synchoronously."); |
| 163 | 163 | } |
| 164 | 164 | }); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | // Filter out unblocks unless requested. |
| 216 | 216 | if ($blocksOnly) { |
| 217 | - $blocks = array_filter($blocks, function ($block) { |
|
| 217 | + $blocks = array_filter($blocks, function($block) { |
|
| 218 | 218 | return $block['log_action'] === 'block'; |
| 219 | 219 | }); |
| 220 | 220 | } |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | */ |
| 387 | 387 | public function countAllRevisions() |
| 388 | 388 | { |
| 389 | - return $this->countLiveRevisions() + $this->countDeletedRevisions(); |
|
| 389 | + return $this->countLiveRevisions()+$this->countDeletedRevisions(); |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | /** |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | public function countRevisionsWithoutComments() |
| 407 | 407 | { |
| 408 | - return $this->countLiveRevisions() - $this->countRevisionsWithComments(); |
|
| 408 | + return $this->countLiveRevisions()-$this->countRevisionsWithComments(); |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /** |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | */ |
| 445 | 445 | public function countAllPagesEdited() |
| 446 | 446 | { |
| 447 | - return $this->countLivePagesEdited() + $this->countDeletedPagesEdited(); |
|
| 447 | + return $this->countLivePagesEdited()+$this->countDeletedPagesEdited(); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /** |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | */ |
| 455 | 455 | public function countPagesCreated() |
| 456 | 456 | { |
| 457 | - return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted(); |
|
| 457 | + return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted(); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | /** |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | } elseif ($block['log_action'] === 'unblock') { |
| 595 | 595 | // The last block was lifted. So the duration will be the time from when the |
| 596 | 596 | // last block was set to the time of the unblock. |
| 597 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
| 597 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
| 598 | 598 | if ($timeSinceLastBlock > $this->longestBlockSeconds) { |
| 599 | 599 | $this->longestBlockSeconds = $timeSinceLastBlock; |
| 600 | 600 | |
@@ -605,8 +605,8 @@ discard block |
||
| 605 | 605 | // The last block was modified. So we will adjust $lastBlock to include |
| 606 | 606 | // the difference of the duration of the new reblock, and time since the last block. |
| 607 | 607 | // $lastBlock is left unchanged if its duration was indefinite. |
| 608 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
| 609 | - $lastBlock[1] = $timeSinceLastBlock + $duration; |
|
| 608 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
| 609 | + $lastBlock[1] = $timeSinceLastBlock+$duration; |
|
| 610 | 610 | } |
| 611 | 611 | } |
| 612 | 612 | |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | // Test if the last block is still active, and if so use the expiry as the duration. |
| 619 | - $lastBlockExpiry = $lastBlock[0] + $lastBlock[1]; |
|
| 619 | + $lastBlockExpiry = $lastBlock[0]+$lastBlock[1]; |
|
| 620 | 620 | if ($lastBlockExpiry > time() && $lastBlockExpiry > $this->longestBlockSeconds) { |
| 621 | 621 | $this->longestBlockSeconds = $lastBlock[1]; |
| 622 | 622 | // Otherwise, test if the duration of the last block is now the longest overall. |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | // If invalid, $duration is left as null. |
| 658 | 658 | if (strtotime($durationStr)) { |
| 659 | 659 | $expiry = strtotime($durationStr, $timestamp); |
| 660 | - $duration = $expiry - $timestamp; |
|
| 660 | + $duration = $expiry-$timestamp; |
|
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | return [$timestamp, $duration]; |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0; |
| 735 | 735 | $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0; |
| 736 | 736 | $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0; |
| 737 | - return $import + $interwiki + $upload; |
|
| 737 | + return $import+$interwiki+$upload; |
|
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | /** |
@@ -861,9 +861,9 @@ discard block |
||
| 861 | 861 | public function approvals() |
| 862 | 862 | { |
| 863 | 863 | $logCounts = $this->getLogCounts(); |
| 864 | - $total = $logCounts['review-approve'] + |
|
| 865 | - (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) + |
|
| 866 | - (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) + |
|
| 864 | + $total = $logCounts['review-approve']+ |
|
| 865 | + (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+ |
|
| 866 | + (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+ |
|
| 867 | 867 | (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0); |
| 868 | 868 | return $total; |
| 869 | 869 | } |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | $logCounts = $this->getLogCounts(); |
| 888 | 888 | $create2 = $logCounts['newusers-create2'] ?: 0; |
| 889 | 889 | $byemail = $logCounts['newusers-byemail'] ?: 0; |
| 890 | - return $create2 + $byemail; |
|
| 890 | + return $create2+$byemail; |
|
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | /** |
@@ -970,7 +970,7 @@ discard block |
||
| 970 | 970 | |
| 971 | 971 | $totals = $this->getRepository()->getMonthCounts($this->project, $this->user); |
| 972 | 972 | $out = [ |
| 973 | - 'yearLabels' => [], // labels for years |
|
| 973 | + 'yearLabels' => [], // labels for years |
|
| 974 | 974 | 'monthLabels' => [], // labels for months |
| 975 | 975 | 'totals' => [], // actual totals, grouped by namespace, year and then month |
| 976 | 976 | ]; |
@@ -1037,7 +1037,7 @@ discard block |
||
| 1037 | 1037 | $out['totals'][$ns][$total['year']] = []; |
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | - $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count']; |
|
| 1040 | + $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count']; |
|
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | 1043 | return [$out, $firstEdit]; |
@@ -1054,9 +1054,9 @@ discard block |
||
| 1054 | 1054 | private function fillInMonthTotalsAndLabels($out, DatePeriod $dateRange) |
| 1055 | 1055 | { |
| 1056 | 1056 | foreach ($dateRange as $monthObj) { |
| 1057 | - $year = (int) $monthObj->format('Y'); |
|
| 1057 | + $year = (int)$monthObj->format('Y'); |
|
| 1058 | 1058 | $yearLabel = $this->i18n->dateFormat($monthObj, 'yyyy'); |
| 1059 | - $month = (int) $monthObj->format('n'); |
|
| 1059 | + $month = (int)$monthObj->format('n'); |
|
| 1060 | 1060 | $monthLabel = $this->i18n->dateFormat($monthObj, 'yyyy-MM'); |
| 1061 | 1061 | |
| 1062 | 1062 | // Fill in labels |
@@ -1205,8 +1205,8 @@ discard block |
||
| 1205 | 1205 | |
| 1206 | 1206 | if ($sorted) { |
| 1207 | 1207 | // Sort. |
| 1208 | - uasort($this->globalEditCounts, function ($a, $b) { |
|
| 1209 | - return $b['total'] - $a['total']; |
|
| 1208 | + uasort($this->globalEditCounts, function($a, $b) { |
|
| 1209 | + return $b['total']-$a['total']; |
|
| 1210 | 1210 | }); |
| 1211 | 1211 | } |
| 1212 | 1212 | |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | $nsName = $project->getNamespaces()[$revision['page_namespace']]; |
| 1251 | 1251 | } |
| 1252 | 1252 | $page = $project->getRepository() |
| 1253 | - ->getPage($project, $nsName . ':' . $revision['page_title']); |
|
| 1253 | + ->getPage($project, $nsName.':'.$revision['page_title']); |
|
| 1254 | 1254 | $edit = new Edit($page, $revision); |
| 1255 | 1255 | $globalEdits[$edit->getTimestamp()->getTimestamp().'-'.$edit->getId()] = $edit; |
| 1256 | 1256 | } |
@@ -1292,7 +1292,7 @@ discard block |
||
| 1292 | 1292 | public function countSmallEdits() |
| 1293 | 1293 | { |
| 1294 | 1294 | $editSizeData = $this->getEditSizeData(); |
| 1295 | - return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0; |
|
| 1295 | + return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0; |
|
| 1296 | 1296 | } |
| 1297 | 1297 | |
| 1298 | 1298 | /** |
@@ -1302,7 +1302,7 @@ discard block |
||
| 1302 | 1302 | public function countLargeEdits() |
| 1303 | 1303 | { |
| 1304 | 1304 | $editSizeData = $this->getEditSizeData(); |
| 1305 | - return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0; |
|
| 1305 | + return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0; |
|
| 1306 | 1306 | } |
| 1307 | 1307 | |
| 1308 | 1308 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Find the path, and complain if English doesn't exist. |
| 75 | - $path = $this->container->getParameter('kernel.root_dir') . '/../i18n'; |
|
| 75 | + $path = $this->container->getParameter('kernel.root_dir').'/../i18n'; |
|
| 76 | 76 | if (!file_exists("$path/en.json")) { |
| 77 | 77 | throw new Exception("Language directory doesn't exist: $path"); |
| 78 | 78 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $messageFiles = glob($this->container->getParameter('kernel.root_dir').'/../i18n/*.json'); |
| 128 | 128 | |
| 129 | 129 | $languages = array_values(array_unique(array_map( |
| 130 | - function ($filename) { |
|
| 130 | + function($filename) { |
|
| 131 | 131 | return basename($filename, '.json'); |
| 132 | 132 | }, |
| 133 | 133 | $messageFiles |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $this->getIntuition()->getLangFallbacks($this->getLang()) |
| 170 | 170 | ); |
| 171 | 171 | |
| 172 | - return array_filter($fallbacks, function ($lang) use ($i18nPath) { |
|
| 172 | + return array_filter($fallbacks, function($lang) use ($i18nPath) { |
|
| 173 | 173 | return is_file($i18nPath.$lang.'.json'); |
| 174 | 174 | }); |
| 175 | 175 | } |
@@ -91,20 +91,20 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | // MULTIPLIERS (to review) |
| 93 | 93 | $multipliers = [ |
| 94 | - 'account-age-mult' => 1.25, # 0 if = 365 jours |
|
| 95 | - 'edit-count-mult' => 1.25, # 0 if = 10 000 |
|
| 96 | - 'user-page-mult' => 0.1, # 0 if = |
|
| 97 | - 'patrols-mult' => 1, # 0 if = |
|
| 98 | - 'blocks-mult' => 1.4, # 0 if = 10 |
|
| 94 | + 'account-age-mult' => 1.25, # 0 if = 365 jours |
|
| 95 | + 'edit-count-mult' => 1.25, # 0 if = 10 000 |
|
| 96 | + 'user-page-mult' => 0.1, # 0 if = |
|
| 97 | + 'patrols-mult' => 1, # 0 if = |
|
| 98 | + 'blocks-mult' => 1.4, # 0 if = 10 |
|
| 99 | 99 | 'afd-mult' => 1.15, |
| 100 | - 'recent-activity-mult' => 0.9, # 0 if = |
|
| 100 | + 'recent-activity-mult' => 0.9, # 0 if = |
|
| 101 | 101 | 'aiv-mult' => 1.15, |
| 102 | - 'edit-summaries-mult' => 0.8, # 0 if = |
|
| 103 | - 'namespaces-mult' => 1.0, # 0 if = |
|
| 104 | - 'pages-created-live-mult' => 1.4, # 0 if = |
|
| 105 | - 'pages-created-deleted-mult' => 1.4, # 0 if = |
|
| 106 | - 'rpp-mult' => 1.15, # 0 if = |
|
| 107 | - 'user-rights-mult' => 0.75, # 0 if = |
|
| 102 | + 'edit-summaries-mult' => 0.8, # 0 if = |
|
| 103 | + 'namespaces-mult' => 1.0, # 0 if = |
|
| 104 | + 'pages-created-live-mult' => 1.4, # 0 if = |
|
| 105 | + 'pages-created-deleted-mult' => 1.4, # 0 if = |
|
| 106 | + 'rpp-mult' => 1.15, # 0 if = |
|
| 107 | + 'user-rights-mult' => 0.75, # 0 if = |
|
| 108 | 108 | ]; |
| 109 | 109 | |
| 110 | 110 | // Grab the connection to the replica database (which is separate from the above) |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $now = new DateTime(); |
| 186 | 186 | $date = new DateTime($value); |
| 187 | 187 | $diff = $date->diff($now); |
| 188 | - $formula = 365 * $diff->format('%y') + 30 * $diff->format('%m') + $diff->format('%d'); |
|
| 188 | + $formula = 365 * $diff->format('%y')+30 * $diff->format('%m')+$diff->format('%d'); |
|
| 189 | 189 | if ($formula < 365) { |
| 190 | 190 | $multipliers["account-age-mult"] = 0; |
| 191 | 191 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - $multiplierKey = $row['source'] . '-mult'; |
|
| 196 | + $multiplierKey = $row['source'].'-mult'; |
|
| 197 | 197 | $multiplier = isset($multipliers[$multiplierKey]) ? $multipliers[$multiplierKey] : 1; |
| 198 | 198 | $score = max(min($value * $multiplier, 100), -100); |
| 199 | 199 | $master[$key]['mult'] = $multiplier; |