@@ -21,7 +21,7 @@ |
||
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 | { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Codedungeon\PHPCliColors\Color; |
19 | 19 | use Mediawiki\DataModel\EditInfo; |
20 | 20 | |
21 | -include __DIR__ . '/../CodexBot2_Bootstrap.php'; |
|
21 | +include __DIR__.'/../CodexBot2_Bootstrap.php'; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Stupid bot for replacement task |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ] |
45 | 45 | ); |
46 | 46 | $titles = $list->getPageTitles(); |
47 | -echo count($titles) . " articles !\n"; |
|
47 | +echo count($titles)." articles !\n"; |
|
48 | 48 | |
49 | 49 | |
50 | 50 | foreach ($titles as $title) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $bot->checkStopOnTalkpageOrException(); |
53 | 53 | |
54 | 54 | $title = trim($title); |
55 | - echo Color::BG_GREEN . $title . Color::NORMAL . "\n"; |
|
55 | + echo Color::BG_GREEN.$title.Color::NORMAL."\n"; |
|
56 | 56 | |
57 | 57 | $pageAction = new WikiPageAction($wiki, $title); |
58 | 58 | if ($pageAction->getNs() !== 0) { |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | |
82 | 82 | $currentTaskName = $taskName; |
83 | 83 | if ($botflag) { |
84 | - $currentTaskName = 'bot ' . $taskName; |
|
84 | + $currentTaskName = 'bot '.$taskName; |
|
85 | 85 | } |
86 | 86 | $result = $pageAction->editPage($newText, new EditInfo($currentTaskName, false, $botflag)); |
87 | - echo "Edit result : " . ($result ? "OK" : "ERREUR") . "\n"; |
|
87 | + echo "Edit result : ".($result ? "OK" : "ERREUR")."\n"; |
|
88 | 88 | sleep(5); |
89 | 89 | } |
90 | 90 |
@@ -31,7 +31,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |