@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $this->url = $url; |
50 | 50 | $this->registrableDomain = null; |
51 | 51 | if (!ExternHttpClient::isHttpURL($url)) { |
52 | - $this->log->debug('Skip : not a valid URL : ' . $url); |
|
52 | + $this->log->debug('Skip : not a valid URL : '.$url); |
|
53 | 53 | return false; |
54 | 54 | } |
55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | return false; |
58 | 58 | } |
59 | 59 | if (!ExternHttpClient::isHttpURL($url)) { |
60 | - throw new Exception('string is not an URL ' . $url); |
|
60 | + throw new Exception('string is not an URL '.$url); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $this->findRegistrableDomain(); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | try { |
80 | 80 | $this->registrableDomain = $this->internetDomainParser->getRegistrableDomainFromURL($this->url); |
81 | 81 | } catch (Exception $e) { |
82 | - $this->log->warning('Skip : not a valid URL : ' . $this->url); |
|
82 | + $this->log->warning('Skip : not a valid URL : '.$this->url); |
|
83 | 83 | return null; |
84 | 84 | } |
85 | 85 | return $this->registrableDomain; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function hasForbiddenFilenameExtension(): bool |
94 | 94 | { |
95 | - return (bool)preg_match( |
|
95 | + return (bool) preg_match( |
|
96 | 96 | '#\.(pdf|jpg|jpeg|gif|png|xls|xlsx|xlr|xml|xlt|txt|csv|js|docx|exe|gz|zip|ini|movie|mp3|mp4|ogg|raw|rss|tar|tgz|wma)$#i', |
97 | 97 | $this->url |
98 | 98 | ); |
@@ -11,5 +11,5 @@ |
||
11 | 11 | |
12 | 12 | interface ExternHttpClientInterface |
13 | 13 | { |
14 | - public function getHTML(string $url, ?bool $normalized=false): ?string; |
|
14 | + public function getHTML(string $url, ?bool $normalized = false): ?string; |
|
15 | 15 | } |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | if (isset($meta['citation_firstpage'])) { |
29 | 29 | $page = $meta['citation_firstpage']; |
30 | 30 | if (isset($meta['citation_lastpage'])) { |
31 | - $page .= '–' . $meta['citation_lastpage']; |
|
31 | + $page .= '–'.$meta['citation_lastpage']; |
|
32 | 32 | } |
33 | 33 | |
34 | - return (string)$page; |
|
34 | + return (string) $page; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | return null; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } catch (Exception $e) { |
165 | 165 | // 23/11/2015 00:00:00 |
166 | 166 | if (isset($this->log) && method_exists($this->log, 'notice')) { |
167 | - $this->log->notice('tryFormatDateOrComment failed with ' . $str); |
|
167 | + $this->log->notice('tryFormatDateOrComment failed with '.$str); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | return sprintf('<!-- %s -->', $str); |
@@ -41,15 +41,15 @@ |
||
41 | 41 | |
42 | 42 | public function trackUser(string $user): void |
43 | 43 | { |
44 | - echo "**** TRACK " . $user . "*****\n"; |
|
44 | + echo "**** TRACK ".$user."*****\n"; |
|
45 | 45 | |
46 | 46 | $titles = $this->getLastEditsbyUser($user); |
47 | 47 | |
48 | 48 | // filter titles already in edited.txt |
49 | 49 | $edited = file(__DIR__.'/resources/article_externRef_edited.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
50 | 50 | $filtered = array_diff($titles, $edited); |
51 | - $list = new PageList( $filtered ); // TODO PageList factory in App ? |
|
52 | - echo ">" . $list->count() . " dans liste\n"; |
|
51 | + $list = new PageList($filtered); // TODO PageList factory in App ? |
|
52 | + echo ">".$list->count()." dans liste\n"; |
|
53 | 53 | |
54 | 54 | $this->consumeList($list); |
55 | 55 | } |
@@ -333,7 +333,7 @@ |
||
333 | 333 | 'modifs' => mb_substr(implode(',', $this->getSummaryLog()), 0, 250), |
334 | 334 | 'notcosmetic' => ($this->notCosmetic) ? 1 : 0, |
335 | 335 | 'major' => ($this->major) ? 1 : 0, |
336 | - 'isbn' => substr($isbn,0,19), |
|
336 | + 'isbn' => substr($isbn, 0, 19), |
|
337 | 337 | 'version' => WikiBotConfig::VERSION ?? null, |
338 | 338 | ]; |
339 | 339 | $this->logger->info('finalData', $finalData); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | public function hasWarning(): bool |
25 | 25 | { |
26 | - return (bool)$this->warning; |
|
26 | + return (bool) $this->warning; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public const DELAY_BOTFLAG_SECONDS = 60; |
44 | 44 | public const DELAY_NO_BOTFLAG_SECONDS = 60; |
45 | 45 | public const DELAY_MINUTES_AFTER_HUMAN_EDIT = 10; |
46 | - public const ERROR_MSG_TEMPLATE = __DIR__ . '/../templates/message_errors.wiki'; |
|
46 | + public const ERROR_MSG_TEMPLATE = __DIR__.'/../templates/message_errors.wiki'; |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * @var PageWorkStatus |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | while (true) { |
87 | 87 | echo "\n-------------------------------------\n\n"; |
88 | - echo date("Y-m-d H:i:s") . " "; |
|
88 | + echo date("Y-m-d H:i:s")." "; |
|
89 | 89 | $this->log->info($this->memory->getMemory(true)); |
90 | 90 | $this->pageProcess(); |
91 | 91 | sleep(2); // précaution boucle infinie |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | |
115 | 115 | try { |
116 | 116 | $title = $data[0]['page']; |
117 | - echo Color::BG_CYAN . $title . Color::NORMAL . " \n"; |
|
117 | + echo Color::BG_CYAN.$title.Color::NORMAL." \n"; |
|
118 | 118 | $page = ServiceFactory::wikiPageAction($title, false); // , true ? |
119 | 119 | } catch (Exception $e) { |
120 | - $this->log->warning("*** WikiPageAction error : " . $title . " \n"); |
|
120 | + $this->log->warning("*** WikiPageAction error : ".$title." \n"); |
|
121 | 121 | sleep(20); |
122 | 122 | |
123 | 123 | return false; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $this->log->alert("*** Invalid CSRF token \n"); |
238 | 238 | throw new Exception('Invalid CSRF token', $e->getCode(), $e); |
239 | 239 | } else { |
240 | - $this->log->warning('Exception in editPage() ' . $e->getMessage()); |
|
240 | + $this->log->warning('Exception in editPage() '.$e->getMessage()); |
|
241 | 241 | sleep(10); |
242 | 242 | |
243 | 243 | return false; |
@@ -257,16 +257,16 @@ discard block |
||
257 | 257 | $this->sendOuvrageErrorsOnTalkPage($data, $this->log); |
258 | 258 | } |
259 | 259 | } catch (Throwable $e) { |
260 | - $this->log->warning('Exception in editPage() ' . $e->getMessage()); |
|
260 | + $this->log->warning('Exception in editPage() '.$e->getMessage()); |
|
261 | 261 | unset($e); |
262 | 262 | } |
263 | 263 | |
264 | 264 | if (!$this->pageWorkStatus->botFlag) { |
265 | - $this->log->debug("sleep " . self::DELAY_NO_BOTFLAG_SECONDS); |
|
265 | + $this->log->debug("sleep ".self::DELAY_NO_BOTFLAG_SECONDS); |
|
266 | 266 | sleep(self::DELAY_NO_BOTFLAG_SECONDS); |
267 | 267 | } |
268 | 268 | if ($this->pageWorkStatus->botFlag) { |
269 | - $this->log->debug("sleep " . self::DELAY_BOTFLAG_SECONDS); |
|
269 | + $this->log->debug("sleep ".self::DELAY_BOTFLAG_SECONDS); |
|
270 | 270 | sleep(self::DELAY_BOTFLAG_SECONDS); |
271 | 271 | } |
272 | 272 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | if (WikiTextUtil::isCommented($origin) || $this->isTextCreatingError($origin)) { |
290 | 290 | $this->log->notice("SKIP: template avec commentaire HTML ou modèle problématique."); |
291 | - $this->db->skipRow((int)$data['id']); |
|
291 | + $this->db->skipRow((int) $data['id']); |
|
292 | 292 | |
293 | 293 | return false; |
294 | 294 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | $find = mb_strpos($this->pageWorkStatus->wikiText, $origin); |
297 | 297 | if ($find === false) { |
298 | 298 | $this->log->notice("String non trouvée."); |
299 | - $this->db->skipRow((int)$data['id']); |
|
299 | + $this->db->skipRow((int) $data['id']); |
|
300 | 300 | |
301 | 301 | return false; |
302 | 302 | } |
@@ -423,9 +423,9 @@ discard block |
||
423 | 423 | |
424 | 424 | private function printDebug(array $data) |
425 | 425 | { |
426 | - $this->log->debug('origin: ' . $data['raw']); |
|
427 | - $this->log->debug('completed: ' . $data['opti']); |
|
428 | - $this->log->debug('modifs: ' . $data['modifs']); |
|
429 | - $this->log->debug('version: ' . $data['version']); |
|
426 | + $this->log->debug('origin: '.$data['raw']); |
|
427 | + $this->log->debug('completed: '.$data['opti']); |
|
428 | + $this->log->debug('modifs: '.$data['modifs']); |
|
429 | + $this->log->debug('version: '.$data['version']); |
|
430 | 430 | } |
431 | 431 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public const SLEEP_AFTER_EDITION = 15; // sec |
29 | 29 | public const MINUTES_DELAY_AFTER_LAST_HUMAN_EDIT = 10; // minutes |
30 | 30 | public const CHECK_EDIT_CONFLICT = true; |
31 | - public const ARTICLE_ANALYZED_FILENAME = __DIR__ . '/../resources/article_externRef_edited.txt'; |
|
31 | + public const ARTICLE_ANALYZED_FILENAME = __DIR__.'/../resources/article_externRef_edited.txt'; |
|
32 | 32 | public const SKIP_ADQ = false; |
33 | 33 | public const SKIP_LASTEDIT_BY_BOT = false; |
34 | 34 | public const CITATION_NUMBER_ON_FIRE = 15; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $result = $this->transformer->process($refContent, $this->summary); |
62 | 62 | } catch (Throwable $e) { |
63 | 63 | echo "** Problème détecté 234242\n"; |
64 | - $this->log->critical($e->getMessage() . " " . $e->getFile() . ":" . $e->getLine()); |
|
64 | + $this->log->critical($e->getMessage()." ".$e->getFile().":".$e->getLine()); |
|
65 | 65 | // TODO : parse $e->message -> variable process, taskName, botflag... |
66 | 66 | |
67 | 67 | return $refContent; |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | $prefixSummary = ($this->summary->isBotFlag()) ? 'bot ' : ''; |
122 | 122 | $suffix = ''; |
123 | 123 | if (isset($this->summary->memo['count article'])) { |
124 | - $suffix .= ' ' . $this->summary->memo['count article'] . 'x {article}'; |
|
124 | + $suffix .= ' '.$this->summary->memo['count article'].'x {article}'; |
|
125 | 125 | } |
126 | 126 | if (isset($this->summary->memo['count lien web'])) { |
127 | - $suffix .= ' ' . $this->summary->memo['count lien web'] . 'x {lien web}'; |
|
127 | + $suffix .= ' '.$this->summary->memo['count lien web'].'x {lien web}'; |
|
128 | 128 | } |
129 | 129 | if (isset($this->summary->memo['presse'])) { |
130 | 130 | $suffix .= ' |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $this->summary->memo['sites'][] = $this->externalPage->getPrettyDomainName(); // ??? |
34 | 34 | } |
35 | 35 | if (isset($mapData['accès url'])) { |
36 | - $this->log->debug('accès |