@@ -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', [ |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | 'url' => $basicInfo['fullurl'] |
| 102 | 102 | ]; |
| 103 | 103 | |
| 104 | - $this->pageInfo['watchers'] = ( isset($basicInfo['watchers']) ) ? $basicInfo['watchers'] : "< 30"; |
|
| 104 | + $this->pageInfo['watchers'] = (isset($basicInfo['watchers'])) ? $basicInfo['watchers'] : "< 30"; |
|
| 105 | 105 | |
| 106 | 106 | $pageProps = isset($basicInfo['pageprops']) ? $basicInfo['pageprops'] : []; |
| 107 | 107 | |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | private function getRevCount() |
| 165 | 165 | { |
| 166 | - $query = "SELECT COUNT(*) AS count FROM " . $this->revisionTable |
|
| 167 | - . " WHERE rev_page = '" . $this->pageInfo['id'] . "'"; |
|
| 166 | + $query = "SELECT COUNT(*) AS count FROM ".$this->revisionTable |
|
| 167 | + . " WHERE rev_page = '".$this->pageInfo['id']."'"; |
|
| 168 | 168 | $res = $this->conn->query($query)->fetchAll(); |
| 169 | 169 | return $res[0]['count']; |
| 170 | 170 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | FROM $this->revisionTable |
| 197 | 197 | LEFT JOIN $userGroupsTable ON rev_user = ug_user |
| 198 | 198 | LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user |
| 199 | - WHERE rev_page = " . $this->pageInfo['id'] . " AND (ug_group = 'bot' OR ufg_group = 'bot') |
|
| 199 | + WHERE rev_page = ".$this->pageInfo['id']." AND (ug_group = 'bot' OR ufg_group = 'bot') |
|
| 200 | 200 | GROUP BY rev_user_text"; |
| 201 | 201 | $res = $this->conn->query($query)->fetchAll(); |
| 202 | 202 | |
@@ -205,14 +205,14 @@ discard block |
||
| 205 | 205 | $sum = 0; |
| 206 | 206 | foreach ($res as $bot) { |
| 207 | 207 | $bots[$bot['username']] = [ |
| 208 | - 'count' => (int) $bot['count'], |
|
| 208 | + 'count' => (int)$bot['count'], |
|
| 209 | 209 | 'current' => $bot['current'] === 'bot' |
| 210 | 210 | ]; |
| 211 | 211 | $sum += $bot['count']; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - uasort($bots, function ($a, $b) { |
|
| 215 | - return $b['count'] - $a['count']; |
|
| 214 | + uasort($bots, function($a, $b) { |
|
| 215 | + return $b['count']-$a['count']; |
|
| 216 | 216 | }); |
| 217 | 217 | |
| 218 | 218 | $this->pageInfo['general']['bot_revision_count'] = $sum; |
@@ -248,10 +248,10 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | if ($info['all'] > 1) { |
| 250 | 250 | // Number of seconds between first and last edit |
| 251 | - $secs = intval(strtotime($info['last']) - strtotime($info['first']) / $info['all']); |
|
| 251 | + $secs = intval(strtotime($info['last'])-strtotime($info['first']) / $info['all']); |
|
| 252 | 252 | |
| 253 | 253 | // Average time between edits (in days) |
| 254 | - $this->pageInfo['editors'][$editor]['atbe'] = $secs / ( 60 * 60 * 24 ); |
|
| 254 | + $this->pageInfo['editors'][$editor]['atbe'] = $secs / (60 * 60 * 24); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | if (count($info['sizes'])) { |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | // Transform to associative array by 'type' |
| 299 | 299 | foreach ($res as $row) { |
| 300 | - $data[$row['type'] . '_count'] = $row['value']; |
|
| 300 | + $data[$row['type'].'_count'] = $row['value']; |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | return $data; |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | $title = str_replace(' ', '_', $this->pageInfo['title']); |
| 314 | 314 | $query = "SELECT log_action, log_type, log_timestamp AS timestamp |
| 315 | 315 | FROM $loggingTable |
| 316 | - WHERE log_namespace = '" . $this->pageInfo['namespace'] . "' |
|
| 316 | + WHERE log_namespace = '".$this->pageInfo['namespace']."' |
|
| 317 | 317 | AND log_title = '$title' AND log_timestamp > 1 |
| 318 | 318 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
| 319 | 319 | $events = $this->conn->query($query)->fetchAll(); |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $query = "SELECT rev_id, rev_parent_id, rev_user_text, rev_user, rev_timestamp, |
| 372 | 372 | rev_minor_edit, rev_len, rev_comment |
| 373 | 373 | FROM $this->revisionTable |
| 374 | - WHERE rev_page = '" . $this->pageInfo['id'] . "' AND rev_timestamp > 1 |
|
| 374 | + WHERE rev_page = '".$this->pageInfo['id']."' AND rev_timestamp > 1 |
|
| 375 | 375 | ORDER BY rev_timestamp"; |
| 376 | 376 | |
| 377 | 377 | $res = $this->conn->query($query)->fetchAll(); |
@@ -391,9 +391,9 @@ discard block |
||
| 391 | 391 | return $rev['rev_len']; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - $lastRev = $this->pageHistory[$revIndex - 1]; |
|
| 394 | + $lastRev = $this->pageHistory[$revIndex-1]; |
|
| 395 | 395 | |
| 396 | - return $rev['rev_len'] - $lastRev['rev_len']; |
|
| 396 | + return $rev['rev_len']-$lastRev['rev_len']; |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /** |
@@ -413,12 +413,12 @@ discard block |
||
| 413 | 413 | // The month of the first edit. Used as a comparison when building the per-month data |
| 414 | 414 | $firstEditMonth = strtotime(date('Y-m-01, 00:00', strtotime($firstEdit['rev_timestamp']))); |
| 415 | 415 | |
| 416 | - $lastEdit = $this->pageHistory[ $revisionCount - 1 ]; |
|
| 417 | - $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[ $revisionCount - 2 ]; |
|
| 416 | + $lastEdit = $this->pageHistory[$revisionCount-1]; |
|
| 417 | + $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[$revisionCount-2]; |
|
| 418 | 418 | |
| 419 | 419 | // Now we can start our master array. This one will be HUGE! |
| 420 | 420 | $lastEditSize = ($revisionCount > 1) |
| 421 | - ? $lastEdit['rev_len'] - $secondLastEdit['rev_len'] |
|
| 421 | + ? $lastEdit['rev_len']-$secondLastEdit['rev_len'] |
|
| 422 | 422 | : $lastEdit['rev_len']; |
| 423 | 423 | $data = [ |
| 424 | 424 | 'general' => [ |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | // Increment year and month counts for all edits |
| 516 | 516 | $data['year_count'][$timestamp['year']]['all']++; |
| 517 | 517 | $data['year_count'][$timestamp['year']]['months'][$timestamp['month']]['all']++; |
| 518 | - $data['year_count'][$timestamp['year']]['size'] = (int) $rev['rev_len']; |
|
| 518 | + $data['year_count'][$timestamp['year']]['size'] = (int)$rev['rev_len']; |
|
| 519 | 519 | |
| 520 | 520 | $editsThisMonth = $data['year_count'][$timestamp['year']]['months'][$timestamp['month']]['all']; |
| 521 | 521 | if ($editsThisMonth > $data['max_edits_per_month']) { |
@@ -559,9 +559,9 @@ discard block |
||
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | // determine if the next revision was a revert |
| 562 | - $nextRevision = isset($this->pageHistory[$i + 1]) ? $this->pageHistory[$i + 1] : null; |
|
| 562 | + $nextRevision = isset($this->pageHistory[$i+1]) ? $this->pageHistory[$i+1] : null; |
|
| 563 | 563 | $nextRevisionIsRevert = $nextRevision && |
| 564 | - $this->getDiffSize($i + 1) === -$diffSize && |
|
| 564 | + $this->getDiffSize($i+1) === -$diffSize && |
|
| 565 | 565 | $this->aeh->isRevert($nextRevision['rev_comment']); |
| 566 | 566 | |
| 567 | 567 | // don't count this edit as content removal if the next edit reverted it |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | |
| 43 | 43 | $this->setUp($project); |
| 44 | - $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ]; |
|
| 44 | + $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"]; |
|
| 45 | 45 | $query = new SimpleRequest('query', $params); |
| 46 | 46 | $result = []; |
| 47 | 47 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | |
| 63 | 63 | $this->setUp($project); |
| 64 | - $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ]; |
|
| 64 | + $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"]; |
|
| 65 | 65 | $query = new SimpleRequest('query', $params); |
| 66 | 66 | $result = []; |
| 67 | 67 | |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | public function namespaces($project) |
| 87 | 87 | { |
| 88 | 88 | // Use cache if possible. |
| 89 | - $cacheItem = $this->cache->getItem('api.namespaces.' . $project); |
|
| 89 | + $cacheItem = $this->cache->getItem('api.namespaces.'.$project); |
|
| 90 | 90 | if ($cacheItem->isHit()) { |
| 91 | 91 | return $cacheItem->get(); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $this->setUp($project); |
| 95 | - $query = new SimpleRequest('query', [ "meta"=>"siteinfo", "siprop"=>"namespaces" ]); |
|
| 95 | + $query = new SimpleRequest('query', ["meta"=>"siteinfo", "siprop"=>"namespaces"]); |
|
| 96 | 96 | $result = []; |
| 97 | 97 | |
| 98 | 98 | try { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $normalized = []; |
| 198 | 198 | if (isset($result['query']['normalized'])) { |
| 199 | 199 | array_map( |
| 200 | - function ($e) use (&$normalized) { |
|
| 200 | + function($e) use (&$normalized) { |
|
| 201 | 201 | $normalized[$e['to']] = $e['from']; |
| 202 | 202 | }, |
| 203 | 203 | $result['query']['normalized'] |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | ]; |
| 241 | 241 | |
| 242 | 242 | // get assessments for this page from the API |
| 243 | - $assessments = $this->massApi($params, $project, function ($data) { |
|
| 243 | + $assessments = $this->massApi($params, $project, function($data) { |
|
| 244 | 244 | return isset($data['pages'][0]['pageassessments']) ? $data['pages'][0]['pageassessments'] : []; |
| 245 | 245 | }, 'pacontinue')['pages']; |
| 246 | 246 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $classAttrs = $config['class']['Unknown']; |
| 268 | 268 | $assessment['class']['value'] = '???'; |
| 269 | 269 | $assessment['class']['category'] = $classAttrs['category']; |
| 270 | - $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". $classAttrs['badge']; |
|
| 270 | + $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/".$classAttrs['badge']; |
|
| 271 | 271 | } else { |
| 272 | 272 | $classAttrs = $config['class'][$classValue]; |
| 273 | 273 | $assessment['class'] = [ |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | // add full URL to badge icon |
| 280 | 280 | if ($classAttrs['badge'] !== '') { |
| 281 | - $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/" . |
|
| 281 | + $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". |
|
| 282 | 282 | $classAttrs['badge']; |
| 283 | 283 | } |
| 284 | 284 | |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $query = FluentRequest::factory()->setAction('query')->setParams($requestData); |
| 403 | 403 | $innerPromise = $this->api->getRequestAsync($query); |
| 404 | 404 | |
| 405 | - $innerPromise->then(function ($result) use (&$data) { |
|
| 405 | + $innerPromise->then(function($result) use (&$data) { |
|
| 406 | 406 | // some failures come back as 200s, so we still resolve and let the outer function handle it |
| 407 | 407 | if (isset($result['error']) || !isset($result['query'])) { |
| 408 | 408 | return $data['promise']->resolve($data); |