@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | final public const CITATION_LIMIT = 150; |
48 | 48 | final public const DELAY_BOTFLAG_SECONDS = 120; |
49 | 49 | final public const DELAY_NO_BOTFLAG_SECONDS = 120; |
50 | - final public const ERROR_MSG_TEMPLATE = __DIR__ . '/templates/message_errors.wiki'; |
|
50 | + final public const ERROR_MSG_TEMPLATE = __DIR__.'/templates/message_errors.wiki'; |
|
51 | 51 | protected const ALWAYS_NO_BOTFLAG_ON_BA = true; |
52 | 52 | protected const ALWAYS_NO_BOTFLAG_ON_ADQ = true; |
53 | 53 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | { |
95 | 95 | while (true) { |
96 | 96 | echo "\n-------------------------------------\n\n"; |
97 | - echo date("Y-m-d H:i:s") . " "; |
|
97 | + echo date("Y-m-d H:i:s")." "; |
|
98 | 98 | $this->log->info($this->memory->getMemory(true)); |
99 | 99 | $this->pageProcess(); |
100 | 100 | sleep(2); // précaution boucle infinie |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | try { |
127 | 127 | $this->wikiPageAction = ServiceFactory::wikiPageAction($this->pageWorkStatus->getTitle()); // , true ? |
128 | 128 | } catch (Exception) { |
129 | - $this->log->warning("*** WikiPageAction error : " . $this->pageWorkStatus->getTitle() . " \n"); |
|
129 | + $this->log->warning("*** WikiPageAction error : ".$this->pageWorkStatus->getTitle()." \n"); |
|
130 | 130 | sleep(20); |
131 | 131 | |
132 | 132 | return false; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | protected function printTitle(string $title): void |
164 | 164 | { |
165 | - echo Color::BG_CYAN . $title . Color::NORMAL . " \n"; |
|
165 | + echo Color::BG_CYAN.$title.Color::NORMAL." \n"; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | protected function checkArticleLabels($title): void |
@@ -240,10 +240,10 @@ discard block |
||
240 | 240 | |
241 | 241 | protected function printDebug(array $data) |
242 | 242 | { |
243 | - $this->log->debug('origin: ' . $data['raw']); |
|
244 | - $this->log->debug('completed: ' . $data['opti']); |
|
245 | - $this->log->debug('modifs: ' . $data['modifs']); |
|
246 | - $this->log->debug('version: ' . $data['version']); |
|
243 | + $this->log->debug('origin: '.$data['raw']); |
|
244 | + $this->log->debug('completed: '.$data['opti']); |
|
245 | + $this->log->debug('modifs: '.$data['modifs']); |
|
246 | + $this->log->debug('version: '.$data['version']); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | protected function editPage(): bool |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $this->log->alert("*** Invalid CSRF token \n"); |
264 | 264 | throw new Exception('Invalid CSRF token', $e->getCode(), $e); |
265 | 265 | } else { |
266 | - $this->log->warning('Exception in editPage() ' . $e->getMessage()); |
|
266 | + $this->log->warning('Exception in editPage() '.$e->getMessage()); |
|
267 | 267 | sleep(10); |
268 | 268 | |
269 | 269 | return false; |
@@ -285,16 +285,16 @@ discard block |
||
285 | 285 | $this->sendOuvrageErrorsOnTalkPage($pageOuvrageCollection, $this->log); |
286 | 286 | } |
287 | 287 | } catch (Throwable $e) { |
288 | - $this->log->warning('Exception in editPage() ' . $e->getMessage()); |
|
288 | + $this->log->warning('Exception in editPage() '.$e->getMessage()); |
|
289 | 289 | unset($e); |
290 | 290 | } |
291 | 291 | |
292 | 292 | if (!$this->pageWorkStatus->botFlag) { |
293 | - $this->log->debug("sleep " . self::DELAY_NO_BOTFLAG_SECONDS); |
|
293 | + $this->log->debug("sleep ".self::DELAY_NO_BOTFLAG_SECONDS); |
|
294 | 294 | sleep(self::DELAY_NO_BOTFLAG_SECONDS); |
295 | 295 | } |
296 | 296 | if ($this->pageWorkStatus->botFlag) { |
297 | - $this->log->debug("sleep " . self::DELAY_BOTFLAG_SECONDS); |
|
297 | + $this->log->debug("sleep ".self::DELAY_BOTFLAG_SECONDS); |
|
298 | 298 | sleep(self::DELAY_BOTFLAG_SECONDS); |
299 | 299 | } |
300 | 300 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | use Codedungeon\PHPCliColors\Color; |
20 | 20 | use Mediawiki\DataModel\EditInfo; |
21 | 21 | |
22 | -include __DIR__ . '/../CodexBot2_Bootstrap.php'; |
|
22 | +include __DIR__.'/../CodexBot2_Bootstrap.php'; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Stupid bot for replacement task |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | ] |
46 | 46 | ); |
47 | 47 | $titles = $list->getPageTitles(); |
48 | -echo count($titles) . " articles !\n"; |
|
48 | +echo count($titles)." articles !\n"; |
|
49 | 49 | |
50 | 50 | |
51 | 51 | foreach ($titles as $title) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $bot->checkStopOnTalkpageOrException(); |
54 | 54 | |
55 | 55 | $title = trim($title); |
56 | - echo Color::BG_GREEN . $title . Color::NORMAL . "\n"; |
|
56 | + echo Color::BG_GREEN.$title.Color::NORMAL."\n"; |
|
57 | 57 | |
58 | 58 | $pageAction = new WikiPageAction($wiki, $title); |
59 | 59 | if ($pageAction->getNs() !== 0) { |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | |
87 | 87 | $currentTaskName = $taskName; |
88 | 88 | if ($botflag) { |
89 | - $currentTaskName = 'bot ' . $taskName; |
|
89 | + $currentTaskName = 'bot '.$taskName; |
|
90 | 90 | } |
91 | 91 | $result = $pageAction->editPage($newText, new EditInfo($currentTaskName, true, $botflag)); |
92 | - echo "Edit result : " . ($result ? "OK" : "ERREUR") . "\n"; |
|
92 | + echo "Edit result : ".($result ? "OK" : "ERREUR")."\n"; |
|
93 | 93 | sleep(5); |
94 | 94 | } |
95 | 95 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Codedungeon\PHPCliColors\Color; |
19 | 19 | use Mediawiki\DataModel\EditInfo; |
20 | 20 | |
21 | -include __DIR__ . '/../ZiziBot_Bootstrap.php'; |
|
21 | +include __DIR__.'/../ZiziBot_Bootstrap.php'; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Stupid bot for replacement task (manual or auto) |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | $titles = $list->getPageTitles(); |
52 | 52 | // ------ |
53 | 53 | |
54 | -echo count($titles) . " articles !\n"; |
|
54 | +echo count($titles)." articles !\n"; |
|
55 | 55 | foreach ($titles as $title) { |
56 | 56 | sleep(1); |
57 | 57 | $bot->checkStopOnTalkpageOrException(); |
58 | 58 | |
59 | 59 | $title = trim($title); |
60 | - echo Color::BG_YELLOW . $title . Color::NORMAL . "\n"; |
|
60 | + echo Color::BG_YELLOW.$title.Color::NORMAL."\n"; |
|
61 | 61 | |
62 | 62 | $pageAction = new WikiPageAction($wiki, $title); |
63 | 63 | if ($pageAction->getNs() !== 0) { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | echo $diffAdapter->getDiff( |
96 | 96 | str_replace('. ', ".\n", $text), |
97 | 97 | str_replace('. ', ".\n", $newText), |
98 | - ) . "\n"; |
|
98 | + )."\n"; |
|
99 | 99 | |
100 | 100 | if (!$auto) { |
101 | 101 | $ask = readline("*** ÉDITION ? [y/n/auto]"); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | $currentTaskName = $taskName; |
111 | 111 | if ($botFlag) { |
112 | - $currentTaskName = 'Bot ' . $taskName; |
|
112 | + $currentTaskName = 'Bot '.$taskName; |
|
113 | 113 | } |
114 | 114 | $result = $pageAction->editPage($newText, new EditInfo($currentTaskName, $minor, $botFlag)); |
115 | 115 | dump($result); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * Traitement synchrone des URL brutes http:// transformée en {lien web} ou {article} |
28 | 28 | */ |
29 | 29 | |
30 | -include __DIR__ . '/../myBootstrap.php'; |
|
30 | +include __DIR__.'/../myBootstrap.php'; |
|
31 | 31 | |
32 | 32 | // --page="Skateboard" --stats=redis --stats=sqlite --debug --verbose |
33 | 33 | echo "OPTIONS: --debug --verbose --stats=redis --stats=sqlite --page=\"Skateboard\" --offset=1000 \n"; |
@@ -59,18 +59,18 @@ discard block |
||
59 | 59 | $torClient = ServiceFactory::getHttpClient(true); |
60 | 60 | |
61 | 61 | |
62 | -$list = PageList::FromFile(__DIR__ . '/../../../resources/titles/titles100kan'); |
|
62 | +$list = PageList::FromFile(__DIR__.'/../../../resources/titles/titles100kan'); |
|
63 | 63 | |
64 | 64 | // filter titles already in edited.txt |
65 | 65 | $titles = $list->getPageTitles(); |
66 | -echo '> before filtering: ' . count($titles) . " articles.\n"; |
|
66 | +echo '> before filtering: '.count($titles)." articles.\n"; |
|
67 | 67 | unset($list); |
68 | -$edited = file(__DIR__ . '/../resources/article_externRef_edited.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
68 | +$edited = file(__DIR__.'/../resources/article_externRef_edited.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
69 | 69 | $titles = array_diff($titles, $edited); |
70 | 70 | $list = new PageList($titles); |
71 | 71 | |
72 | 72 | |
73 | -echo ">" . $list->count() . " dans liste\n"; |
|
73 | +echo ">".$list->count()." dans liste\n"; |
|
74 | 74 | if ($list->count() === 0) { |
75 | 75 | echo "END of process: EMPTY ARTICLE LIST\n"; |
76 | 76 | sleep(120); |
@@ -55,7 +55,7 @@ |
||
55 | 55 | // if carriage return </ref>\n<ref… outside that template, the ref-link appears on a new line => \n deleted |
56 | 56 | // regex option /u for unicode char catch "Ă <ref>" |
57 | 57 | $wikiText = preg_replace('#</ref>[\n\r\s]*<ref#u', '</ref>{{,}}<ref', $wikiText); |
58 | - $wikiText = preg_replace('#(<ref name=[^\/\>\r\n]+/>)[\n\r\s]*<ref#u', "$1" . '{{,}}<ref', $wikiText); |
|
58 | + $wikiText = preg_replace('#(<ref name=[^\/\>\r\n]+/>)[\n\r\s]*<ref#u', "$1".'{{,}}<ref', $wikiText); |
|
59 | 59 | |
60 | 60 | // {{Sfn|...}}{{Sfn|...}} |
61 | 61 | $wikiText = preg_replace('#(\{\{sfn[\s\|\n\r][^\{\}]+}})\s*(\{\{sfn[\s\|\n\r])#ui', '$1{{,}}$2', $wikiText); |
@@ -63,7 +63,7 @@ |
||
63 | 63 | if ($webarchiveDTO->getArchiver() === '[[Internet Archive]]') { |
64 | 64 | $this->log->notice(' |
@@ -32,7 +32,7 @@ |
||
32 | 32 | $this->summary->memo['sites'][] = $this->externalPage->getPrettyDomainName(); // ??? |
33 | 33 | } |
34 | 34 | if (isset($mapData['accès url'])) { |
35 | - $this->log->debug('accès |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | $this->url = $url; |
52 | 52 | $this->registrableDomain = null; |
53 | 53 | if (!HttpUtil::isHttpURL($url)) { |
54 | - $this->log->debug('Skip : not Http URL : ' . $url, ['stats' => 'externref.skip.notRawURL']); |
|
54 | + $this->log->debug('Skip : not Http URL : '.$url, ['stats' => 'externref.skip.notRawURL']); |
|
55 | 55 | return false; |
56 | 56 | } |
57 | 57 | |
58 | 58 | if ($this->hasForbiddenFilenameExtension()) { |
59 | - $this->log->debug('Skip : ForbiddenFilenameExtension : ' . $url, ['stats' => 'externref.skip.forbiddenFilenameExtension']); |
|
59 | + $this->log->debug('Skip : ForbiddenFilenameExtension : '.$url, ['stats' => 'externref.skip.forbiddenFilenameExtension']); |
|
60 | 60 | return false; |
61 | 61 | } |
62 | 62 | |
63 | 63 | if (WikiTextUtil::containsWikiTag($url)) { |
64 | - $this->log->debug('Skip : URL contains HTML tag : ' . $url, ['stats' => 'externref.skip.URLcontainsTag']); |
|
64 | + $this->log->debug('Skip : URL contains HTML tag : '.$url, ['stats' => 'externref.skip.URLcontainsTag']); |
|
65 | 65 | return false; |
66 | 66 | } |
67 | 67 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected function hasForbiddenFilenameExtension(): bool |
79 | 79 | { |
80 | - return (bool)preg_match( |
|
80 | + return (bool) preg_match( |
|
81 | 81 | '#\.(pdf|jpg|jpeg|gif|png|webp|xls|xlsx|xlr|xml|xlt|txt|csv|js|docx|exe|gz|zip|ini|movie|mp3|mp4|ogg|raw|rss|tar|tgz|wma)$#i', |
82 | 82 | $this->url |
83 | 83 | ); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | try { |
89 | 89 | $this->registrableDomain = $this->internetDomainParser->getRegistrableDomainFromURL($this->url); |
90 | 90 | } catch (Exception) { |
91 | - $this->log->warning('Skip : registrableDomain not a valid URL : ' . $this->url, |
|
91 | + $this->log->warning('Skip : registrableDomain not a valid URL : '.$this->url, |
|
92 | 92 | ['stats' => 'externref.skip.URLAuthorized.exception2'] |
93 | 93 | ); |
94 | 94 | return null; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | - return (string)$text; |
|
118 | + return (string) $text; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | // fu_bar => [[fu_bar]] / Fu, fu => [[fu]] |
131 | 131 | if (empty($page) || self::str2WikiTitle($label) === self::str2WikiTitle($page)) { |
132 | - return '[[' . $label . ']]'; |
|
132 | + return '[['.$label.']]'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | // fu, bar => [[Bar|fu]] |