Passed
Push — master ( 732591...229bc5 )
by Dispositif
03:49
created
src/Application/AbstractBotTaskWorker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
     public const SLEEP_AFTER_EDITION = 60;
33 33
     public const MINUTES_DELAY_AFTER_LAST_HUMAN_EDIT = 15;
34 34
     public const CHECK_EDIT_CONFLICT = true;
35
-    public const ARTICLE_ANALYZED_FILENAME = __DIR__ . '/resources/article_edited.txt';
35
+    public const ARTICLE_ANALYZED_FILENAME = __DIR__.'/resources/article_edited.txt';
36 36
     public const SKIP_LASTEDIT_BY_BOT = true;
37 37
     public const SKIP_NOT_IN_MAIN_WIKISPACE = true;
38 38
     public const SKIP_ADQ = false;
39 39
     public const THROTTLE_DELAY_AFTER_EACH_TITLE = 1; //secs
40
-    protected const GIT_COMMIT_HASH_PATH = __DIR__ . '/resources/commithash.txt';
40
+    protected const GIT_COMMIT_HASH_PATH = __DIR__.'/resources/commithash.txt';
41 41
 
42 42
     /**
43 43
      * @var PageListInterface
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         $this->initializePastAnalyzedTitles();
94 94
 
95 95
         // @throw exception on "Invalid CSRF token"
96
-        $this->run();//todo delete that and use (Worker)->run($duration) or process management
96
+        $this->run(); //todo delete that and use (Worker)->run($duration) or process management
97 97
     }
98 98
 
99 99
     /**
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
     final public function run(): void
105 105
     {
106 106
         $this->log->notice('*** '.date('Y-m-d H:i')
107
-            .' New BotTaskWorker: ' . $this->defaultTaskname, ['stats' => 'bottaskworker.instance']);
107
+            .' New BotTaskWorker: '.$this->defaultTaskname, ['stats' => 'bottaskworker.instance']);
108 108
         $this->log->notice(sprintf(
109 109
             '*** Bot: %s - commit: %s',
110 110
             $this->bot::getBotName(),
111 111
             $this->bot->getCurrentGitCommitHash() ?? '??'
112 112
         ));
113
-        $this->log->notice('*** Stats: ' . $this->log->stats::class);
113
+        $this->log->notice('*** Stats: '.$this->log->stats::class);
114 114
 
115 115
         foreach ($this->getTitles() as $title) {
116 116
             try {
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         }
226 226
 
227 227
         $this->log->notice($result ? '>> OK' : '>>  NOCHANGE');
228
-        $this->log->debug("Sleep " . static::SLEEP_AFTER_EDITION);
228
+        $this->log->debug("Sleep ".static::SLEEP_AFTER_EDITION);
229 229
         sleep(static::SLEEP_AFTER_EDITION);
230 230
     }
231 231
 
Please login to merge, or discard this patch.
src/Application/CLI/wikiwixListProcess.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  * Traitement synchrone des URL brutes http:// transformée en {lien web} ou {article}
26 26
  */
27 27
 
28
-include __DIR__ . '/../myBootstrap.php';
28
+include __DIR__.'/../myBootstrap.php';
29 29
 
30 30
 echo "WikiwixListProcess\n";
31 31
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 $titles = [];
63 63
 foreach ($rawtitles as $rawtitle) {
64 64
     // $convTitle =  @iconv('UTF-8', 'latin1', $rawtitle);
65
-    $convTitle =  TextUtil::fixWrongUTF8Encoding($rawtitle);
65
+    $convTitle = TextUtil::fixWrongUTF8Encoding($rawtitle);
66 66
     if ($convTitle !== false && trim($convTitle) !== '') {
67 67
         $titles[] = $convTitle;
68 68
     }
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
 echo sprintf("> %d converted titles\n", count($titles));
72 72
 
73 73
 // filtering
74
-echo '> before filtering: ' . count($titles) . " articles.\n";
75
-$edited = file(__DIR__ . '/../resources/article_externRef_edited.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
74
+echo '> before filtering: '.count($titles)." articles.\n";
75
+$edited = file(__DIR__.'/../resources/article_externRef_edited.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
76 76
 $titles = array_diff($titles, $edited);
77 77
 $list = new PageList($titles);
78 78
 // end HACK list manuelle
79 79
 
80 80
 
81
-echo ">" . $list->count() . " dans liste\n";
81
+echo ">".$list->count()." dans liste\n";
82 82
 if ($list->count() === 0) {
83 83
     echo "END of process: EMPTY ARTICLE LIST\n";
84 84
     sleep(120);
Please login to merge, or discard this patch.
src/Application/CLI/externRefProcess.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,13 +63,13 @@
 block discarded – undo
63 63
     $list = new PageList([trim($options['page'])]);
64 64
 
65 65
     // delete Title from edited.txt
66
-    $file = __DIR__ . '/../resources/article_externRef_edited.txt';
66
+    $file = __DIR__.'/../resources/article_externRef_edited.txt';
67 67
     $text = file_get_contents($file);
68
-    $newText = str_replace(trim($argv[1]) . "\n", '', $text);
68
+    $newText = str_replace(trim($argv[1])."\n", '', $text);
69 69
     if (!empty($text) && $text !== $newText) {
70 70
         @file_put_contents($file, $newText);
71 71
     }
72
-    $botConfig->setTaskName('
Please login to merge, or discard this patch.
src/Application/ExternLink/ExternRefWorker.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public const SLEEP_AFTER_EDITION = 5; // 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;
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             $result = $this->transformer->process($refContent, $this->summary);
78 78
         } catch (Throwable $e) {
79 79
             $this->log->critical(
80
-                'Error patate34 ' . $e->getMessage() . " " . $e->getFile() . ":" . $e->getLine(),
80
+                'Error patate34 '.$e->getMessage()." ".$e->getFile().":".$e->getLine(),
81 81
                 ['stats' => 'externref.exception.patate34']
82 82
             );
83 83
             // TODO : parse $e->message -> variable process, taskName, botflag...
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
         $suffix = '';
145 145
         if (isset($this->summary->memo['count article'])) {
146 146
             $this->log->stats->increment('externref.count.article');
147
-            $suffix .= ' ' . $this->summary->memo['count article'] . 'x {article}';
147
+            $suffix .= ' '.$this->summary->memo['count article'].'x {article}';
148 148
         }
149 149
         if (isset($this->summary->memo['count lien web'])) {
150 150
             $this->log->stats->increment('externref.count.lienweb');
151
-            $suffix .= ' ' . $this->summary->memo['count lien web'] . 'x {lien web}';
151
+            $suffix .= ' '.$this->summary->memo['count lien web'].'x {lien web}';
152 152
         }
153 153
         if (isset($this->summary->memo['presse'])) {
154 154
             $this->log->stats->increment('externref.count.presse');
@@ -162,20 +162,20 @@  discard block
 block discarded – undo
162 162
             $this->log->stats->increment('externref.count.lienbrisé');
163 163
             $suffix .= ' ⚠️️️lien brisé'; //⚠️
Please login to merge, or discard this patch.
src/Application/ExternLink/RecentChangeWorker.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 {
32 32
     protected const USER_RC_LIMIT = 100;
33 33
     protected const TASK_NAME = '
Please login to merge, or discard this patch.
src/Application/OuvrageEdit/OuvrageEditWorker.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     final public const DELAY_BOTFLAG_SECONDS = 120;
48 48
     final public const DELAY_NO_BOTFLAG_SECONDS = 120;
49 49
     final public const DELAY_MINUTES_AFTER_HUMAN_EDIT = 10;
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
 
52 52
     /**
53 53
      * @var PageWorkStatus
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     {
93 93
         while (true) {
94 94
             echo "\n-------------------------------------\n\n";
95
-            echo date("Y-m-d H:i:s") . " ";
95
+            echo date("Y-m-d H:i:s")." ";
96 96
             $this->log->info($this->memory->getMemory(true));
97 97
             $this->pageProcess();
98 98
             sleep(2); // précaution boucle infinie
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         try {
125 125
             $this->wikiPageAction = ServiceFactory::wikiPageAction($this->pageWorkStatus->getTitle()); // , true ?
126 126
         } catch (Exception) {
127
-            $this->log->warning("*** WikiPageAction error : " . $this->pageWorkStatus->getTitle() . " \n");
127
+            $this->log->warning("*** WikiPageAction error : ".$this->pageWorkStatus->getTitle()." \n");
128 128
             sleep(20);
129 129
 
130 130
             return false;
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
     protected function printTitle(string $title): void
162 162
     {
163
-        echo Color::BG_CYAN . $title . Color::NORMAL . " \n";
163
+        echo Color::BG_CYAN.$title.Color::NORMAL." \n";
164 164
     }
165 165
 
166 166
     protected function checkArticleLabels($title): void
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
233 233
 
234 234
     protected function printDebug(array $data)
235 235
     {
236
-        $this->log->debug('origin: ' . $data['raw']);
237
-        $this->log->debug('completed: ' . $data['opti']);
238
-        $this->log->debug('modifs: ' . $data['modifs']);
239
-        $this->log->debug('version: ' . $data['version']);
236
+        $this->log->debug('origin: '.$data['raw']);
237
+        $this->log->debug('completed: '.$data['opti']);
238
+        $this->log->debug('modifs: '.$data['modifs']);
239
+        $this->log->debug('version: '.$data['version']);
240 240
     }
241 241
 
242 242
     protected function editPage(): bool
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
                 $this->log->alert("*** Invalid CSRF token \n");
256 256
                 throw new Exception('Invalid CSRF token', $e->getCode(), $e);
257 257
             } else {
258
-                $this->log->warning('Exception in editPage() ' . $e->getMessage());
258
+                $this->log->warning('Exception in editPage() '.$e->getMessage());
259 259
                 sleep(10);
260 260
 
261 261
                 return false;
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
                 $this->sendOuvrageErrorsOnTalkPage($pageOuvrageCollection, $this->log);
278 278
             }
279 279
         } catch (Throwable $e) {
280
-            $this->log->warning('Exception in editPage() ' . $e->getMessage());
280
+            $this->log->warning('Exception in editPage() '.$e->getMessage());
281 281
             unset($e);
282 282
         }
283 283
 
284 284
         if (!$this->pageWorkStatus->botFlag) {
285
-            $this->log->debug("sleep " . self::DELAY_NO_BOTFLAG_SECONDS);
285
+            $this->log->debug("sleep ".self::DELAY_NO_BOTFLAG_SECONDS);
286 286
             sleep(self::DELAY_NO_BOTFLAG_SECONDS);
287 287
         }
288 288
         if ($this->pageWorkStatus->botFlag) {
289
-            $this->log->debug("sleep " . self::DELAY_BOTFLAG_SECONDS);
289
+            $this->log->debug("sleep ".self::DELAY_BOTFLAG_SECONDS);
290 290
             sleep(self::DELAY_BOTFLAG_SECONDS);
291 291
         }
292 292
     }
Please login to merge, or discard this patch.