@@ -56,7 +56,7 @@ |
||
| 56 | 56 | if ($webarchiveDTO->getArchiver() === '[[Internet Archive]]') { |
| 57 | 57 | $this->log->notice(' |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | return new WebarchiveDTO( |
| 46 | 46 | self::ARCHIVER_NAME, |
| 47 | 47 | $url, |
| 48 | - (string)$archiveData['url'], |
|
| 48 | + (string) $archiveData['url'], |
|
| 49 | 49 | $iaDateOrNull |
| 50 | 50 | ); |
| 51 | 51 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | protected function requestInternetArchiveApi(string $url, ?DateTimeInterface $date = null): array |
| 54 | 54 | { |
| 55 | 55 | $response = $this->client->get( |
| 56 | - 'https://archive.org/wayback/available?timestamp=' . self::SEARCH_CLOSEST_TIMESTAMP . '&url=' . urlencode($url), |
|
| 56 | + 'https://archive.org/wayback/available?timestamp='.self::SEARCH_CLOSEST_TIMESTAMP.'&url='.urlencode($url), |
|
| 57 | 57 | [ |
| 58 | 58 | 'timeout' => 20, |
| 59 | 59 | 'allow_redirects' => true, |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | $iaDateTime = new DateTime(); |
| 105 | 105 | $iaDateTime->setDate( |
| 106 | - (int)substr($iaTimestamp, 0, 4), |
|
| 107 | - (int)substr($iaTimestamp, 4, 2), |
|
| 108 | - (int)substr($iaTimestamp, 6, 2) |
|
| 106 | + (int) substr($iaTimestamp, 0, 4), |
|
| 107 | + (int) substr($iaTimestamp, 4, 2), |
|
| 108 | + (int) substr($iaTimestamp, 6, 2) |
|
| 109 | 109 | ); |
| 110 | 110 | $iaDateTime->setTime( |
| 111 | - (int)substr($iaTimestamp, 8, 2), |
|
| 112 | - (int)substr($iaTimestamp, 10, 2), |
|
| 113 | - (int)substr($iaTimestamp, 12, 2) |
|
| 111 | + (int) substr($iaTimestamp, 8, 2), |
|
| 112 | + (int) substr($iaTimestamp, 10, 2), |
|
| 113 | + (int) substr($iaTimestamp, 12, 2) |
|
| 114 | 114 | ); |
| 115 | 115 | |
| 116 | 116 | return $iaDateTime; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function hasWarning(): bool |
| 26 | 26 | { |
| 27 | - return (bool)$this->warning; |
|
| 27 | + return (bool) $this->warning; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $refs = array_slice($refs, 0, self::MAX_REFS_PROCESSED_IN_ARTICLE, true); |
| 56 | 56 | |
| 57 | 57 | foreach ($refs as $ref) { |
| 58 | - $refContent = WikiTextUtil::stripFinalPoint(trim((string)$ref[1])); |
|
| 58 | + $refContent = WikiTextUtil::stripFinalPoint(trim((string) $ref[1])); |
|
| 59 | 59 | |
| 60 | 60 | $newRefContent = $this->processRefContent($refContent); |
| 61 | 61 | |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | protected function replaceRefInText(array $ref, string $replace, string $text) |
| 71 | 71 | { |
| 72 | 72 | // Pas de changement |
| 73 | - if (WikiTextUtil::stripFinalPoint(trim($replace)) === WikiTextUtil::stripFinalPoint(trim((string)$ref[1]))) { |
|
| 73 | + if (WikiTextUtil::stripFinalPoint(trim($replace)) === WikiTextUtil::stripFinalPoint(trim((string) $ref[1]))) { |
|
| 74 | 74 | return $text; |
| 75 | 75 | } |
| 76 | 76 | $replace = $this->addFinalPeriod($ref[0], $replace); |
| 77 | - $result = str_replace($ref[1], $replace, (string)$ref[0]); |
|
| 77 | + $result = str_replace($ref[1], $replace, (string) $ref[0]); |
|
| 78 | 78 | $this->printDiff($ref[0], $result); |
| 79 | 79 | |
| 80 | 80 | return str_replace($ref[0], $result, $text); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | protected function addFinalPeriod($ref, string $replace): string |
| 87 | 87 | { |
| 88 | - if (preg_match('#</ref>#', (string)$ref)) { |
|
| 88 | + if (preg_match('#</ref>#', (string) $ref)) { |
|
| 89 | 89 | $replace .= '.'; |
| 90 | 90 | } |
| 91 | 91 | return $replace; |
@@ -56,10 +56,10 @@ |
||
| 56 | 56 | $titles = $list->getPageTitles(); |
| 57 | 57 | unset($list); |
| 58 | 58 | //echo count($titles)." titles\n"; |
| 59 | -$edited = file(__DIR__ . '/../resources/article_externRef_edited.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
| 59 | +$edited = file(__DIR__.'/../resources/article_externRef_edited.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
| 60 | 60 | $filtered = array_diff($titles, $edited); |
| 61 | 61 | $list = new PageList($filtered); |
| 62 | -echo ">" . $list->count() . " dans liste\n"; |
|
| 62 | +echo ">".$list->count()." dans liste\n"; |
|
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | $httpClient = ServiceFactory::getHttpClient(); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | // todo command --tor --wikiwix --internetarchive |
| 39 | 39 | $torEnabled = false; |
| 40 | -echo "TOR enabled : ".($torEnabled ? "oui" : "non"). "\n"; |
|
| 40 | +echo "TOR enabled : ".($torEnabled ? "oui" : "non")."\n"; |
|
| 41 | 41 | |
| 42 | 42 | $client = ServiceFactory::getHttpClient(); |
| 43 | 43 | $wikiwix = new WikiwixAdapter($client, $logger); |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | // Attention : pas de post-processing (sanitize title, etc.) |
| 57 | 57 | $result = $trans->process($url, $summary); |
| 58 | 58 | } catch (Exception $e) { |
| 59 | - $result = "EXCEPTION ". $e->getMessage().$e->getFile().$e->getLine(); |
|
| 59 | + $result = "EXCEPTION ".$e->getMessage().$e->getFile().$e->getLine(); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | -echo '>>> '. $result."\n"; |
|
| 62 | +echo '>>> '.$result."\n"; |
|
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | |
@@ -54,23 +54,23 @@ |
||
| 54 | 54 | $list = new PageList([trim($argv[1])]); |
| 55 | 55 | |
| 56 | 56 | // delete Title from edited.txt |
| 57 | - $file = __DIR__ . '/../resources/article_externRef_edited.txt'; |
|
| 57 | + $file = __DIR__.'/../resources/article_externRef_edited.txt'; |
|
| 58 | 58 | $text = file_get_contents($file); |
| 59 | - $newText = str_replace(trim($argv[1]) . "\n", '', $text); |
|
| 59 | + $newText = str_replace(trim($argv[1])."\n", '', $text); |
|
| 60 | 60 | if (!empty($text) && $text !== $newText) { |
| 61 | 61 | @file_put_contents($file, $newText); |
| 62 | 62 | } |
| 63 | - $botConfig->taskName = ' |
|
@@ -28,7 +28,7 @@ discard block |
||
| 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; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | try { |
| 76 | 76 | $result = $this->transformer->process($refContent, $this->summary); |
| 77 | 77 | } catch (Throwable $e) { |
| 78 | - $this->log->critical('Error patate34 ' . $e->getMessage() . " " . $e->getFile() . ":" . $e->getLine()); |
|
| 78 | + $this->log->critical('Error patate34 '.$e->getMessage()." ".$e->getFile().":".$e->getLine()); |
|
| 79 | 79 | // TODO : parse $e->message -> variable process, taskName, botflag... |
| 80 | 80 | |
| 81 | 81 | return $refContent; |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | $prefixSummary = ($this->summary->isBotFlag()) ? 'bot ' : ''; |
| 134 | 134 | $suffix = ''; |
| 135 | 135 | if (isset($this->summary->memo['count article'])) { |
| 136 | - $suffix .= ' ' . $this->summary->memo['count article'] . 'x {article}'; |
|
| 136 | + $suffix .= ' '.$this->summary->memo['count article'].'x {article}'; |
|
| 137 | 137 | } |
| 138 | 138 | if (isset($this->summary->memo['count lien web'])) { |
| 139 | - $suffix .= ' ' . $this->summary->memo['count lien web'] . 'x {lien web}'; |
|
| 139 | + $suffix .= ' '.$this->summary->memo['count lien web'].'x {lien web}'; |
|
| 140 | 140 | } |
| 141 | 141 | if (isset($this->summary->memo['presse'])) { |
| 142 | 142 | $suffix .= ' |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | { |
| 32 | 32 | protected const USER_RC_LIMIT = 100; |
| 33 | 33 | protected const TASK_NAME = ' |