@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | curl_setopt($this->curlHandle, CURLOPT_SSL_VERIFYPEER, false); |
34 | 34 | } |
35 | 35 | |
36 | - if($cookieJar !== null) { |
|
36 | + if ($cookieJar !== null) { |
|
37 | 37 | curl_setopt($this->curlHandle, CURLOPT_COOKIEFILE, $cookieJar); |
38 | 38 | curl_setopt($this->curlHandle, CURLOPT_COOKIEJAR, $cookieJar); |
39 | 39 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function get($url, $parameters = null, $headers = array()) |
60 | 60 | { |
61 | 61 | if ($parameters !== null && is_array($parameters)) { |
62 | - $getString = '?' . http_build_query($parameters); |
|
62 | + $getString = '?'.http_build_query($parameters); |
|
63 | 63 | $url .= $getString; |
64 | 64 | } |
65 | 65 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | if ($result === false) { |
76 | 76 | $error = curl_error($this->curlHandle); |
77 | - throw new CurlException('Remote request failed with error ' . $error); |
|
77 | + throw new CurlException('Remote request failed with error '.$error); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | return $result; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | if ($result === false) { |
106 | 106 | $error = curl_error($this->curlHandle); |
107 | - throw new CurlException('Remote request failed with error ' . $error); |
|
107 | + throw new CurlException('Remote request failed with error '.$error); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | return $result; |
@@ -241,7 +241,8 @@ |
||
241 | 241 | * @param string $username |
242 | 242 | * @return bool |
243 | 243 | */ |
244 | - public function checkAccountExists($username) { |
|
244 | + public function checkAccountExists($username) |
|
245 | + { |
|
245 | 246 | $parameters = array( |
246 | 247 | 'action' => 'query', |
247 | 248 | 'list' => 'users', |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | $response = $this->mediaWikiClient->doApiCall($tokenParams, 'POST'); |
59 | 59 | |
60 | 60 | if (isset($response->error)) { |
61 | - throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info); |
|
61 | + throw new MediaWikiApiException($response->error->code.': '.$response->error->info); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $token = $response->query->tokens->createaccounttoken; |
65 | 65 | |
66 | - $callback = $this->siteConfiguration->getBaseUrl() . '/internal.php/oauth/createCallback'; |
|
66 | + $callback = $this->siteConfiguration->getBaseUrl().'/internal.php/oauth/createCallback'; |
|
67 | 67 | |
68 | 68 | $checkboxFields = array(); |
69 | 69 | $requiredFields = array(); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $createResponse = $this->mediaWikiClient->doApiCall($createParams, 'POST'); |
87 | 87 | |
88 | 88 | if (isset($createResponse->error)) { |
89 | - throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info); |
|
89 | + throw new MediaWikiApiException($response->error->code.': '.$response->error->info); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | if (!isset($createResponse->createaccount) || !isset($createResponse->createaccount->status)) { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | return; |
103 | 103 | } |
104 | 104 | |
105 | - throw new Exception('API result reported status of ' . $createResponse->createaccount->status); |
|
105 | + throw new Exception('API result reported status of '.$createResponse->createaccount->status); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $response = $this->mediaWikiClient->doApiCall($tokenParams, 'POST'); |
127 | 127 | |
128 | 128 | if (isset($response->error)) { |
129 | - throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info); |
|
129 | + throw new MediaWikiApiException($response->error->code.': '.$response->error->info); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | $token = $response->query->tokens->csrftoken; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | $editParameters = array( |
139 | 139 | 'action' => 'edit', |
140 | - 'title' => 'User talk:' . $username, |
|
140 | + 'title' => 'User talk:'.$username, |
|
141 | 141 | 'section' => 'new', |
142 | 142 | 'sectiontitle' => $title, |
143 | 143 | 'summary' => $summary, |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | if (!isset($response->edit)) { |
155 | 155 | if (isset($response->error)) { |
156 | - throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info); |
|
156 | + throw new MediaWikiApiException($response->error->code.': '.$response->error->info); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | throw new MediaWikiApiException('Unknown error encountered during editing.'); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | return; |
165 | 165 | } |
166 | 166 | |
167 | - throw new MediaWikiApiException('Edit status unsuccessful: ' . $editResponse->result); |
|
167 | + throw new MediaWikiApiException('Edit status unsuccessful: '.$editResponse->result); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | public function getCreationFieldData(&$requiredFields, &$checkboxFields) |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $response = $this->mediaWikiClient->doApiCall($params, 'GET'); |
180 | 180 | |
181 | 181 | if (isset($response->error)) { |
182 | - throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info); |
|
182 | + throw new MediaWikiApiException($response->error->code.': '.$response->error->info); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | $requests = $response->query->authmanagerinfo->requests; |
@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return JobQueueSearchHelper |
25 | 25 | */ |
26 | - public static function get(PdoDatabase $database) { |
|
26 | + public static function get(PdoDatabase $database) |
|
27 | + { |
|
27 | 28 | $helper = new JobQueueSearchHelper($database); |
28 | 29 | return $helper; |
29 | 30 | } |
@@ -33,7 +34,8 @@ discard block |
||
33 | 34 | * |
34 | 35 | * @return $this |
35 | 36 | */ |
36 | - public function statusIn($statuses) { |
|
37 | + public function statusIn($statuses) |
|
38 | + { |
|
37 | 39 | $this->inClause('status', $statuses); |
38 | 40 | |
39 | 41 | return $this; |
@@ -42,27 +44,31 @@ discard block |
||
42 | 44 | /** |
43 | 45 | * @return $this |
44 | 46 | */ |
45 | - public function notAcknowledged() { |
|
47 | + public function notAcknowledged() |
|
48 | + { |
|
46 | 49 | $this->whereClause .= ' AND (acknowledged IS NULL OR acknowledged = 0)'; |
47 | 50 | |
48 | 51 | return $this; |
49 | 52 | } |
50 | 53 | |
51 | - public function byTask($task) { |
|
54 | + public function byTask($task) |
|
55 | + { |
|
52 | 56 | $this->whereClause .= ' AND task = ?'; |
53 | 57 | $this->parameterList[] = $task; |
54 | 58 | |
55 | 59 | return $this; |
56 | 60 | } |
57 | 61 | |
58 | - public function byUser($userId) { |
|
62 | + public function byUser($userId) |
|
63 | + { |
|
59 | 64 | $this->whereClause .= ' AND user = ?'; |
60 | 65 | $this->parameterList[] = $userId; |
61 | 66 | |
62 | 67 | return $this; |
63 | 68 | } |
64 | 69 | |
65 | - public function byStatus($status) { |
|
70 | + public function byStatus($status) |
|
71 | + { |
|
66 | 72 | $this->whereClause .= ' AND status = ?'; |
67 | 73 | $this->parameterList[] = $status; |
68 | 74 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $this->whereClause .= ' AND (ip LIKE ? OR forwardedip LIKE ?)'; |
52 | 52 | $this->parameterList[] = $ipAddress; |
53 | - $this->parameterList[] = '%' . trim($ipAddress, '%') . '%'; |
|
53 | + $this->parameterList[] = '%'.trim($ipAddress, '%').'%'; |
|
54 | 54 | |
55 | 55 | return $this; |
56 | 56 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | public function isHospitalised() |
168 | 168 | { |
169 | 169 | $this->whereClause .= ' AND status = ?'; |
170 | - $this->parameterList[] = RequestStatus::HOSPITAL; |
|
170 | + $this->parameterList[] = RequestStatus::HOSPITAL; |
|
171 | 171 | |
172 | 172 | return $this; |
173 | 173 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | public function notHospitalised() |
181 | 181 | { |
182 | 182 | $this->whereClause .= ' AND status <> ?'; |
183 | - $this->parameterList[] = RequestStatus::HOSPITAL; |
|
183 | + $this->parameterList[] = RequestStatus::HOSPITAL; |
|
184 | 184 | |
185 | 185 | return $this; |
186 | 186 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $template = EmailTemplate::getById((int)$id, $entry->getDatabase()); |
130 | 130 | |
131 | 131 | if ($template != false) { |
132 | - return "closed (" . $template->getName() . ")"; |
|
132 | + return "closed (".$template->getName().")"; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
@@ -275,10 +275,10 @@ discard block |
||
275 | 275 | $ban = Ban::getById($objectId, $database); |
276 | 276 | |
277 | 277 | if ($ban === false) { |
278 | - return 'Ban #' . $objectId . "</a>"; |
|
278 | + return 'Ban #'.$objectId."</a>"; |
|
279 | 279 | } |
280 | 280 | |
281 | - return 'Ban #' . $objectId . " (" . htmlentities($ban->getTarget()) . ")</a>"; |
|
281 | + return 'Ban #'.$objectId." (".htmlentities($ban->getTarget()).")</a>"; |
|
282 | 282 | case 'EmailTemplate': |
283 | 283 | /** @var EmailTemplate $emailTemplate */ |
284 | 284 | $emailTemplate = EmailTemplate::getById($objectId, $database); |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $taskDescriptions = JobQueue::getTaskDescriptions(); |
324 | 324 | |
325 | 325 | $task = $job->getTask(); |
326 | - if(isset($taskDescriptions[$task])){ |
|
326 | + if (isset($taskDescriptions[$task])) { |
|
327 | 327 | $description = $taskDescriptions[$task]; |
328 | 328 | } else { |
329 | 329 | $description = 'Unknown task'; |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | |
332 | 332 | return "<a href=\"{$baseurl}/internal.php/jobQueue/view?id={$objectId}\">Job #{$job->getId()} ({$description})</a>"; |
333 | 333 | default: |
334 | - return '[' . $objectType . " " . $objectId . ']'; |
|
334 | + return '['.$objectType." ".$objectId.']'; |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $renameData = unserialize($logEntry->getComment()); |
380 | 380 | $oldName = htmlentities($renameData['old'], ENT_COMPAT, 'UTF-8'); |
381 | 381 | $newName = htmlentities($renameData['new'], ENT_COMPAT, 'UTF-8'); |
382 | - $comment = 'Renamed \'' . $oldName . '\' to \'' . $newName . '\'.'; |
|
382 | + $comment = 'Renamed \''.$oldName.'\' to \''.$newName.'\'.'; |
|
383 | 383 | break; |
384 | 384 | case 'RoleChange': |
385 | 385 | $roleChangeData = unserialize($logEntry->getComment()); |
@@ -396,15 +396,15 @@ discard block |
||
396 | 396 | |
397 | 397 | $reason = htmlentities($roleChangeData['reason'], ENT_COMPAT, 'UTF-8'); |
398 | 398 | |
399 | - $roleDelta = 'Removed [' . implode(', ', $removed) . '], Added [' . implode(', ', $added) . ']'; |
|
400 | - $comment = $roleDelta . ' with comment: ' . $reason; |
|
399 | + $roleDelta = 'Removed ['.implode(', ', $removed).'], Added ['.implode(', ', $added).']'; |
|
400 | + $comment = $roleDelta.' with comment: '.$reason; |
|
401 | 401 | break; |
402 | 402 | case 'JobIssue': |
403 | 403 | $jobIssueData = unserialize($logEntry->getComment()); |
404 | 404 | $errorMessage = $jobIssueData['error']; |
405 | 405 | $status = $jobIssueData['status']; |
406 | 406 | |
407 | - $comment = 'Job ' . htmlentities($status, ENT_COMPAT, 'UTF-8') . ': '; |
|
407 | + $comment = 'Job '.htmlentities($status, ENT_COMPAT, 'UTF-8').': '; |
|
408 | 408 | $comment .= htmlentities($errorMessage, ENT_COMPAT, 'UTF-8'); |
409 | 409 | break; |
410 | 410 | case 'JobIssueRequest': |
@@ -323,9 +323,10 @@ |
||
323 | 323 | $taskDescriptions = JobQueue::getTaskDescriptions(); |
324 | 324 | |
325 | 325 | $task = $job->getTask(); |
326 | - if(isset($taskDescriptions[$task])){ |
|
326 | + if(isset($taskDescriptions[$task])) { |
|
327 | 327 | $description = $taskDescriptions[$task]; |
328 | - } else { |
|
328 | + } |
|
329 | + else { |
|
329 | 330 | $description = 'Unknown task'; |
330 | 331 | } |
331 | 332 |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | { |
348 | 348 | $userIds = array(); |
349 | 349 | |
350 | - foreach ($logs as $logEntry) { |
|
350 | + foreach ($logs as $logEntry) { |
|
351 | 351 | if (!$logEntry instanceof Log) { |
352 | 352 | // if this happens, we've done something wrong with passing back the log data. |
353 | 353 | throw new Exception('Log entry is not an instance of a Log, this should never happen.'); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | $logData = array(); |
370 | 370 | |
371 | - foreach ($logs as $logEntry) { |
|
371 | + foreach ($logs as $logEntry) { |
|
372 | 372 | $objectDescription = self::getObjectDescription($logEntry->getObjectId(), $logEntry->getObjectType(), |
373 | 373 | $database, $configuration); |
374 | 374 |
@@ -239,11 +239,11 @@ |
||
239 | 239 | |
240 | 240 | $emailSig = $currentUser->getEmailSig(); |
241 | 241 | if ($emailSig !== '' || $emailSig !== null) { |
242 | - $emailSig = "\n\n" . $emailSig; |
|
242 | + $emailSig = "\n\n".$emailSig; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | $subject = "RE: [ACC #{$request->getId()}] English Wikipedia Account Request"; |
246 | - $content = $mailText . $emailSig; |
|
246 | + $content = $mailText.$emailSig; |
|
247 | 247 | |
248 | 248 | $helper->sendMail($request->getEmail(), $subject, $content, $headers); |
249 | 249 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getRequestToken() |
79 | 79 | { |
80 | - $endpoint = $this->oauthEndpoint . '/initiate&format=json&oauth_callback=oob'; |
|
80 | + $endpoint = $this->oauthEndpoint.'/initiate&format=json&oauth_callback=oob'; |
|
81 | 81 | |
82 | 82 | $parsedUrl = parse_url($endpoint); |
83 | 83 | $urlParameters = array(); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $data = $this->httpHelper->get($targetUrl, null); |
93 | 93 | |
94 | 94 | if ($data === false) { |
95 | - throw new CurlException('Curl error: ' . $this->httpHelper->getError()); |
|
95 | + throw new CurlException('Curl error: '.$this->httpHelper->getError()); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | $token = json_decode($data); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | if (isset($token->error)) { |
105 | - throw new OAuthException('Error encountered while getting request token: ' . $token->error); |
|
105 | + throw new OAuthException('Error encountered while getting request token: '.$token->error); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | return $token; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function callbackCompleted($oauthRequestToken, $oauthRequestSecret, $oauthVerifier) |
131 | 131 | { |
132 | - $endpoint = $this->oauthEndpoint . '/token&format=json'; |
|
132 | + $endpoint = $this->oauthEndpoint.'/token&format=json'; |
|
133 | 133 | |
134 | 134 | $requestConsumer = new OAuthConsumer($oauthRequestToken, $oauthRequestSecret); |
135 | 135 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $data = $this->httpHelper->get($targetUrl, null); |
148 | 148 | |
149 | 149 | if ($data === false) { |
150 | - throw new CurlException('Curl error: ' . $this->httpHelper->getError()); |
|
150 | + throw new CurlException('Curl error: '.$this->httpHelper->getError()); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | $token = json_decode($data); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | if (isset($token->error)) { |
160 | - throw new OAuthException('Error encountered while getting access token: ' . $token->error); |
|
160 | + throw new OAuthException('Error encountered while getting access token: '.$token->error); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | return $token; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function getIdentityTicket($oauthAccessToken, $oauthAccessSecret) |
175 | 175 | { |
176 | - $endpoint = $this->oauthEndpoint . '/identify&format=json'; |
|
176 | + $endpoint = $this->oauthEndpoint.'/identify&format=json'; |
|
177 | 177 | |
178 | 178 | $oauthToken = new OAuthToken($oauthAccessToken, $oauthAccessSecret); |
179 | 179 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $data = $this->httpHelper->get($targetUrl, null); |
191 | 191 | |
192 | 192 | if ($data === false) { |
193 | - throw new CurlException('Curl error: ' . $this->httpHelper->getError()); |
|
193 | + throw new CurlException('Curl error: '.$this->httpHelper->getError()); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | $decodedData = json_decode($data); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | } |
247 | 247 | |
248 | 248 | if ($data === false) { |
249 | - throw new CurlException('Curl error: ' . $this->httpHelper->getError()); |
|
249 | + throw new CurlException('Curl error: '.$this->httpHelper->getError()); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | return json_decode($data); |
@@ -26,6 +26,6 @@ |
||
26 | 26 | |
27 | 27 | protected function getCreationReason(Request $request, User $user) |
28 | 28 | { |
29 | - return parent::getCreationReason($request, $user) . ', on behalf of [[User:' . $user->getOnWikiName() . ']]'; |
|
29 | + return parent::getCreationReason($request, $user).', on behalf of [[User:'.$user->getOnWikiName().']]'; |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -61,7 +61,7 @@ |
||
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
64 | - if (!$mediaWikiHelper->checkAccountExists($request->getName())){ |
|
64 | + if (!$mediaWikiHelper->checkAccountExists($request->getName())) { |
|
65 | 65 | $this->markFailed('Account does not exist!'); |
66 | 66 | |
67 | 67 | return; |
@@ -61,7 +61,7 @@ |
||
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
64 | - if (!$mediaWikiHelper->checkAccountExists($request->getName())){ |
|
64 | + if (!$mediaWikiHelper->checkAccountExists($request->getName())) { |
|
65 | 65 | $this->markFailed('Account does not exist!'); |
66 | 66 | |
67 | 67 | return; |