Passed
Push — master ( e142f8...aea8b9 )
by Dispositif
03:02
created
src/Application/CLI/externRefProcess.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
             'srsort' => CirrusSearch::SRSORT_NONE,
87 87
 //            'sroffset' => $offset, //default: 0
88 88
 //            'srqiprofile' => CirrusSearch::SRQIPROFILE_POPULAR_INCLINKS_PV, // nombre de vues de la page
89
-	      'srqiprofile' => 'popular_inclinks',
89
+            'srqiprofile' => 'popular_inclinks',
90 90
         ],
91 91
         [CirrusSearch::OPTION_CONTINUE => true]
92 92
     );
Please login to merge, or discard this 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/Domain/WikiOptimizer/Handlers/LocationHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
  */
22 22
 class LocationHandler extends AbstractOuvrageHandler
23 23
 {
24
-    final public const TRANSLATE_CITY_FR = __DIR__ . '/../../resources/traduction_ville.csv';
24
+    final public const TRANSLATE_CITY_FR = __DIR__.'/../../resources/traduction_ville.csv';
25 25
 
26 26
     public function __construct(OuvrageTemplate $ouvrage, OptiStatus $optiStatus, protected PageListInterface $pageListManager)
27 27
     {
Please login to merge, or discard this patch.
src/Application/WikiBotConfig.php 1 patch
Spacing   +10 added lines, -11 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 class WikiBotConfig
32 32
 {
33 33
     public const VERSION = '2.2';
34
-    public const WATCHPAGE_FILENAME = __DIR__ . '/resources/watch_pages.json';
34
+    public const WATCHPAGE_FILENAME = __DIR__.'/resources/watch_pages.json';
35 35
     public const EXIT_ON_CHECK_WATCHPAGE = false;
36 36
     // do not stop if they play with {stop} on bot talk page
37 37
     public const BLACKLIST_EDITOR = ['OrlodrimBot'];
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * @var DateTimeImmutable
58 58
      */
59 59
     protected $lastCheckStopDate;
60
-    protected SMSInterface|null $SMSClient;
60
+    protected SMSInterface | null $SMSClient;
61 61
     protected $mediawikiFactory;
62 62
     protected ?string $gitCommitHash = null;
63 63
 
@@ -91,9 +91,8 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $text = WikiTextUtil::removeHTMLcomments($text);
93 93
         $botName = $botName ?: self::getBotName();
94
-        $denyReg = (empty($botName)) ? '' :
95
-            '|\{\{bots ?\| ?(optout|deny)\=[^\}]*' . preg_quote($botName, '#') . '[^\}]*\}\}';
96
-        return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}' . $denyReg . ')#i', $text) > 0;
94
+        $denyReg = (empty($botName)) ? '' : '|\{\{bots ?\| ?(optout|deny)\=[^\}]*'.preg_quote($botName, '#').'[^\}]*\}\}';
95
+        return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}'.$denyReg.')#i', $text) > 0;
97 96
     }
98 97
 
99 98
     /**
@@ -128,12 +127,12 @@  discard block
 block discarded – undo
128 127
         if ($this->gitCommitHash) {
129 128
             return $this->gitCommitHash;
130 129
         }
131
-        $path = __DIR__ . '/../../.git/';
130
+        $path = __DIR__.'/../../.git/';
132 131
         if (!file_exists($path)) {
133 132
             return null;
134 133
         }
135
-        $head = trim(substr(file_get_contents($path . 'HEAD'), 4));
136
-        $hash = trim(file_get_contents(sprintf($path . $head)));
134
+        $head = trim(substr(file_get_contents($path.'HEAD'), 4));
135
+        $hash = trim(file_get_contents(sprintf($path.$head)));
137 136
         $this->gitCommitHash = $hash; // cached
138 137
 
139 138
         return $hash;
@@ -204,7 +203,7 @@  discard block
 block discarded – undo
204 203
 
205 204
     protected function getBotTalkPageTitle(): string
206 205
     {
207
-        return self::TALK_PAGE_PREFIX . $this::getBotName();
206
+        return self::TALK_PAGE_PREFIX.$this::getBotName();
208 207
     }
209 208
 
210 209
     protected function sendSMSandFunnyTalk(string $lastEditor, ?bool $botTalk): void
@@ -304,8 +303,8 @@  discard block
 block discarded – undo
304 303
      */
305 304
     public function minutesSinceLastEdit(string $title): int
306 305
     {
307
-        $time = $this->getTimestamp($title);  // 2011-09-02T16:31:13Z
306
+        $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z
308 307
 
309
-        return (int)round((time() - strtotime($time)) / 60);
308
+        return (int) round((time() - strtotime($time)) / 60);
310 309
     }
311 310
 }
Please login to merge, or discard this patch.
src/Domain/ExternLink/DeadLinkTransformer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
                 if ($webarchiveDTO->getArchiver() === '[[Internet Archive]]') {
64 64
                     $this->log->notice('
Please login to merge, or discard this patch.
src/Domain/ExternLink/SummaryExternTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
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 
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 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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Application/CLI/fixTypo.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
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/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.