@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
| 6 | 6 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
| 7 | -use Symfony\Component\Debug\Exception\ContextErrorException; |
|
| 8 | 7 | use Symfony\Component\Routing\Exception\InvalidParameterException; |
| 9 | 8 | use Symfony\Component\HttpFoundation\Request; |
| 10 | 9 | |
@@ -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, |
@@ -14,6 +14,9 @@ |
||
| 14 | 14 | /** @var string[] Basic metadata about the project */ |
| 15 | 15 | protected $metadata; |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param string $nameOrUrl |
|
| 19 | + */ |
|
| 17 | 20 | public function __construct($nameOrUrl) |
| 18 | 21 | { |
| 19 | 22 | $this->nameUnnormalized = $nameOrUrl; |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function getUrl() |
| 57 | 57 | { |
| 58 | - return rtrim($this->getMetadata()['url'], '/') . '/'; |
|
| 58 | + return rtrim($this->getMetadata()['url'], '/').'/'; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -155,7 +155,7 @@ |
||
| 155 | 155 | $archiveTable = $lh->getTable("archive", $dbName); |
| 156 | 156 | |
| 157 | 157 | $cond_begin = $start ? " AND rev_timestamp > :start " : null; |
| 158 | - $cond_end = $end ? " AND rev_timestamp < :end ": null; |
|
| 158 | + $cond_end = $end ? " AND rev_timestamp < :end " : null; |
|
| 159 | 159 | |
| 160 | 160 | foreach ($AEBTypes as $toolname => $check) { |
| 161 | 161 | $toolname = $dbh->quote($toolname, \PDO::PARAM_STR); |
@@ -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 Xtools\ProjectRepository; |
| 10 | 9 | |
| 11 | 10 | class AutomatedEditsController extends Controller |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Get this page's database ID. |
| 55 | - * @return int |
|
| 55 | + * @return \string|null |
|
| 56 | 56 | */ |
| 57 | 57 | public function getId() |
| 58 | 58 | { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * @return string |
|
| 78 | + * @return \string|null |
|
| 79 | 79 | */ |
| 80 | 80 | public function getUrl() |
| 81 | 81 | { |
@@ -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) |
@@ -16,39 +16,39 @@ 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('lang', [ $this, 'getLang' ], $options), |
|
| 26 | - new \Twig_SimpleFunction('langName', [ $this, 'getLangName' ], $options), |
|
| 27 | - new \Twig_SimpleFunction('allLangs', [ $this, 'getAllLangs' ]), |
|
| 28 | - new \Twig_SimpleFunction('isRTL', [ $this, 'intuitionIsRTL' ]), |
|
| 29 | - new \Twig_SimpleFunction('isRTLLang', [ $this, 'intuitionIsRTLLang' ]), |
|
| 30 | - new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]), |
|
| 31 | - new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]), |
|
| 32 | - new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]), |
|
| 33 | - new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]), |
|
| 34 | - new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]), |
|
| 35 | - new \Twig_SimpleFunction('chartColor', [ $this, 'chartColor' ]), |
|
| 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 | - new \Twig_SimpleFunction('bugReportURL', [ $this, 'bugReportURL' ]), |
|
| 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('lang', [$this, 'getLang'], $options), |
|
| 26 | + new \Twig_SimpleFunction('langName', [$this, 'getLangName'], $options), |
|
| 27 | + new \Twig_SimpleFunction('allLangs', [$this, 'getAllLangs']), |
|
| 28 | + new \Twig_SimpleFunction('isRTL', [$this, 'intuitionIsRTL']), |
|
| 29 | + new \Twig_SimpleFunction('isRTLLang', [$this, 'intuitionIsRTLLang']), |
|
| 30 | + new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']), |
|
| 31 | + new \Twig_SimpleFunction('hash', [$this, 'gitHash']), |
|
| 32 | + new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']), |
|
| 33 | + new \Twig_SimpleFunction('tools', [$this, 'allTools']), |
|
| 34 | + new \Twig_SimpleFunction('color', [$this, 'getColorList']), |
|
| 35 | + new \Twig_SimpleFunction('chartColor', [$this, 'chartColor']), |
|
| 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 | + new \Twig_SimpleFunction('bugReportURL', [$this, 'bugReportURL']), |
|
| 45 | 45 | ]; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function requestTime($decimals = 3) |
| 49 | 49 | { |
| 50 | 50 | |
| 51 | - return number_format(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
| 51 | + return number_format(microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function requestMemory() |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | // TODO: refactor all intuition stuff so it can be used anywhere |
| 69 | 69 | public function intuitionMessageExists($message = "") |
| 70 | 70 | { |
| 71 | - return $this->getIntuition()->msgExists($message, [ "domain" => "xtools" ]); |
|
| 71 | + return $this->getIntuition()->msgExists($message, ["domain" => "xtools"]); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function intuitionMessagePrintExists($message = "", $vars = []) |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | public function intuitionMessage($message = "", $vars = []) |
| 89 | 89 | { |
| 90 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
| 90 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function getLang() |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function getAllLangs() |
| 110 | 110 | { |
| 111 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
| 111 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
| 112 | 112 | |
| 113 | 113 | $languages = array_values(array_unique(array_map( |
| 114 | - function ($filename) { |
|
| 114 | + function($filename) { |
|
| 115 | 115 | return basename($filename, '.json'); |
| 116 | 116 | }, |
| 117 | 117 | $messageFiles |
@@ -168,41 +168,41 @@ discard block |
||
| 168 | 168 | public static function getColorList($num = false) |
| 169 | 169 | { |
| 170 | 170 | $colors = [ |
| 171 | - 0 => '#Cc0000',# '#FF005A', #red '#FF5555', |
|
| 171 | + 0 => '#Cc0000', # '#FF005A', #red '#FF5555', |
|
| 172 | 172 | 1 => '#F7b7b7', |
| 173 | - 2 => '#5c8d20',# '#008800', #green'#55FF55', |
|
| 173 | + 2 => '#5c8d20', # '#008800', #green'#55FF55', |
|
| 174 | 174 | 3 => '#85eD82', |
| 175 | 175 | 4 => '#2E97E0', # blue |
| 176 | 176 | 5 => '#B9E3F9', |
| 177 | - 6 => '#e1711d', # orange |
|
| 177 | + 6 => '#e1711d', # orange |
|
| 178 | 178 | 7 => '#ffc04c', |
| 179 | 179 | 8 => '#FDFF98', # yellow |
| 180 | 180 | 9 => '#5555FF', |
| 181 | 181 | 10 => '#55FFFF', |
| 182 | - 11 => '#0000C0', # |
|
| 183 | - 12 => '#008800', # green |
|
| 182 | + 11 => '#0000C0', # |
|
| 183 | + 12 => '#008800', # green |
|
| 184 | 184 | 13 => '#00C0C0', |
| 185 | - 14 => '#FFAFAF', # rosé |
|
| 186 | - 15 => '#808080', # gray |
|
| 185 | + 14 => '#FFAFAF', # rosé |
|
| 186 | + 15 => '#808080', # gray |
|
| 187 | 187 | 16 => '#00C000', |
| 188 | 188 | 17 => '#404040', |
| 189 | - 18 => '#C0C000', # green |
|
| 189 | + 18 => '#C0C000', # green |
|
| 190 | 190 | 19 => '#C000C0', |
| 191 | - 100 => '#75A3D1', # blue |
|
| 192 | - 101 => '#A679D2', # purple |
|
| 191 | + 100 => '#75A3D1', # blue |
|
| 192 | + 101 => '#A679D2', # purple |
|
| 193 | 193 | 102 => '#660000', |
| 194 | 194 | 103 => '#000066', |
| 195 | - 104 => '#FAFFAF', # caramel |
|
| 195 | + 104 => '#FAFFAF', # caramel |
|
| 196 | 196 | 105 => '#408345', |
| 197 | 197 | 106 => '#5c8d20', |
| 198 | - 107 => '#e1711d', # red |
|
| 199 | - 108 => '#94ef2b', # light green |
|
| 200 | - 109 => '#756a4a', # brown |
|
| 198 | + 107 => '#e1711d', # red |
|
| 199 | + 108 => '#94ef2b', # light green |
|
| 200 | + 109 => '#756a4a', # brown |
|
| 201 | 201 | 110 => '#6f1dab', |
| 202 | 202 | 111 => '#301e30', |
| 203 | 203 | 112 => '#5c9d96', |
| 204 | - 113 => '#a8cd8c', # earth green |
|
| 205 | - 114 => '#f2b3f1', # light purple |
|
| 204 | + 113 => '#a8cd8c', # earth green |
|
| 205 | + 114 => '#f2b3f1', # light purple |
|
| 206 | 206 | 115 => '#9b5828', |
| 207 | 207 | 118 => '#99FFFF', |
| 208 | 208 | 119 => '#99BBFF', |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | 446 => '#06DCFB', |
| 224 | 224 | 447 => '#892EE4', |
| 225 | 225 | 460 => '#99FF66', |
| 226 | - 461 => '#99CC66', # green |
|
| 227 | - 470 => '#CCCC33', # ocker |
|
| 226 | + 461 => '#99CC66', # green |
|
| 227 | + 470 => '#CCCC33', # ocker |
|
| 228 | 228 | 471 => '#CCFF33', |
| 229 | 229 | 480 => '#6699FF', |
| 230 | 230 | 481 => '#66FFFF', |
@@ -239,18 +239,18 @@ discard block |
||
| 239 | 239 | 1198 => '#FF34B3', |
| 240 | 240 | 1199 => '#8B1C62', |
| 241 | 241 | |
| 242 | - '#61a9f3',# blue |
|
| 243 | - '#f381b9',# pink |
|
| 242 | + '#61a9f3', # blue |
|
| 243 | + '#f381b9', # pink |
|
| 244 | 244 | '#61E3A9', |
| 245 | 245 | '#D56DE2', |
| 246 | 246 | '#85eD82', |
| 247 | 247 | '#F7b7b7', |
| 248 | 248 | '#CFDF49', |
| 249 | 249 | '#88d8f2', |
| 250 | - '#07AF7B',# green |
|
| 250 | + '#07AF7B', # green |
|
| 251 | 251 | '#B9E3F9', |
| 252 | 252 | '#FFF3AD', |
| 253 | - '#EF606A',# red |
|
| 253 | + '#EF606A', # red |
|
| 254 | 254 | '#EC8833', |
| 255 | 255 | '#FFF100', |
| 256 | 256 | '#87C9A5', |
@@ -400,8 +400,8 @@ discard block |
||
| 400 | 400 | public function getFilters() |
| 401 | 401 | { |
| 402 | 402 | return [ |
| 403 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
| 404 | - new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]), |
|
| 403 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
| 404 | + new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']), |
|
| 405 | 405 | ]; |
| 406 | 406 | } |
| 407 | 407 | |
@@ -428,9 +428,9 @@ discard block |
||
| 428 | 428 | if (!$denominator) { |
| 429 | 429 | $quotient = $numerator; |
| 430 | 430 | } else { |
| 431 | - $quotient = ( $numerator / $denominator ) * 100; |
|
| 431 | + $quotient = ($numerator / $denominator) * 100; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - return round($quotient, $precision) . '%'; |
|
| 434 | + return round($quotient, $precision).'%'; |
|
| 435 | 435 | } |
| 436 | 436 | } |
@@ -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 |
@@ -143,12 +143,12 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | // Get diff sizes, based on length of each parent revision |
| 146 | - $parentRevIds = array_map(function ($edit) { |
|
| 146 | + $parentRevIds = array_map(function($edit) { |
|
| 147 | 147 | return $edit['rev_parent_id']; |
| 148 | 148 | }, $editData); |
| 149 | 149 | $query = "SELECT rev_len, rev_id |
| 150 | 150 | FROM revision |
| 151 | - WHERE rev_id IN (" . implode(',', $parentRevIds) . ")"; |
|
| 151 | + WHERE rev_id IN (" . implode(',', $parentRevIds).")"; |
|
| 152 | 152 | $diffSizeData = $conn->executeQuery($query)->fetchAll(); |
| 153 | 153 | |
| 154 | 154 | // reformat with rev_id as the key, rev_len as the value |
@@ -158,24 +158,24 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // Build our array of nonautomated edits |
| 161 | - $editData = array_map(function ($edit) use ($namespaces, $diffSizes) { |
|
| 161 | + $editData = array_map(function($edit) use ($namespaces, $diffSizes) { |
|
| 162 | 162 | $pageTitle = $edit['page_title']; |
| 163 | 163 | |
| 164 | 164 | if ($edit['page_namespace'] !== '0') { |
| 165 | - $pageTitle = $namespaces[$edit['page_namespace']] . ":$pageTitle"; |
|
| 165 | + $pageTitle = $namespaces[$edit['page_namespace']].":$pageTitle"; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $diffSize = $edit['rev_len']; |
| 169 | 169 | if ($edit['rev_parent_id'] > 0) { |
| 170 | - $diffSize = $edit['rev_len'] - $diffSizes[$edit['rev_parent_id']]; |
|
| 170 | + $diffSize = $edit['rev_len']-$diffSizes[$edit['rev_parent_id']]; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | return [ |
| 174 | 174 | 'page_title' => $pageTitle, |
| 175 | - 'namespace' => (int) $edit['page_namespace'], |
|
| 176 | - 'rev_id' => (int) $edit['rev_id'], |
|
| 175 | + 'namespace' => (int)$edit['page_namespace'], |
|
| 176 | + 'rev_id' => (int)$edit['rev_id'], |
|
| 177 | 177 | 'timestamp' => DateTime::createFromFormat('YmdHis', $edit['rev_timestamp']), |
| 178 | - 'minor_edit' => (bool) $edit['rev_minor_edit'], |
|
| 178 | + 'minor_edit' => (bool)$edit['rev_minor_edit'], |
|
| 179 | 179 | 'summary' => $edit['rev_comment'], |
| 180 | 180 | 'size' => $diffSize |
| 181 | 181 | ]; |