@@ -32,12 +32,12 @@ discard block |
||
| 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 = 2; //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 |
||
| 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 |
||
| 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 |
||
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $this->log->notice($result ? '>> EDIT 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 | |
@@ -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/titles100kag'); |
|
| 62 | +$list = PageList::FromFile(__DIR__.'/../../../resources/titles/titles100kag'); |
|
| 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); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | use App\Infrastructure\ServiceFactory; |
| 14 | 14 | use Mediawiki\DataModel\EditInfo; |
| 15 | 15 | |
| 16 | -include __DIR__ . '/../myBootstrap.php'; //myBootstrap.php'; |
|
| 16 | +include __DIR__.'/../myBootstrap.php'; //myBootstrap.php'; |
|
| 17 | 17 | |
| 18 | 18 | $title = 'Utilisateur:ZiziBot/task'; |
| 19 | 19 | $summary = 'bot : ⚙ mise à jour'; |
@@ -86,10 +86,10 @@ |
||
| 86 | 86 | // filter titles already in edited.txt |
| 87 | 87 | unset($list); |
| 88 | 88 | //echo count($titles)." titles\n"; |
| 89 | -$edited = file(__DIR__ . '/../resources/article_externRef_edited.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
| 89 | +$edited = file(__DIR__.'/../resources/article_externRef_edited.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
| 90 | 90 | $filtered = array_diff($titles, $edited); |
| 91 | 91 | $list = new PageList($filtered); |
| 92 | -echo ">" . $list->count() . " dans liste\n"; |
|
| 92 | +echo ">".$list->count()." dans liste\n"; |
|
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | $httpClient = ServiceFactory::getHttpClient(); |
@@ -86,7 +86,7 @@ |
||
| 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 | ); |
@@ -63,13 +63,13 @@ |
||
| 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(' |
|