@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $url, |
| 52 | 52 | (string) $archiveData['longformurl'], |
| 53 | 53 | $archiveData['timestamp'] |
| 54 | - ? DateTimeImmutable::createFromFormat('U', (string)$archiveData['timestamp']) |
|
| 54 | + ? DateTimeImmutable::createFromFormat('U', (string) $archiveData['timestamp']) |
|
| 55 | 55 | : null |
| 56 | 56 | ); // todo factory ? |
| 57 | 57 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | $response = $this->externHttpClient->getClient()->request( |
| 62 | 62 | 'GET', |
| 63 | - self::API_URL . urlencode($url) |
|
| 63 | + self::API_URL.urlencode($url) |
|
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | if (!$response instanceof ResponseInterface || $response->getStatusCode() !== 200) { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | // check wikiwix archive status |
| 73 | 73 | if (empty($data['status']) || (int) $data['status'] !== 200) { |
| 74 | - $this->log->debug('WikiwixAdapter response: ' . $jsonString); |
|
| 74 | + $this->log->debug('WikiwixAdapter response: '.$jsonString); |
|
| 75 | 75 | |
| 76 | 76 | return []; |
| 77 | 77 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | class ExternHttpErrorLogic |
| 16 | 16 | { |
| 17 | - public const LOG_REQUEST_ERROR = __DIR__ . '/../../Application/resources/external_request_error.log'; |
|
| 17 | + public const LOG_REQUEST_ERROR = __DIR__.'/../../Application/resources/external_request_error.log'; |
|
| 18 | 18 | |
| 19 | 19 | public function __construct( |
| 20 | 20 | protected DeadLinkTransformer $deadLinkTransformer, |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | return $url; |
| 48 | 48 | } elseif (preg_match('#401 Unauthorized#i', $errorMessage)) { |
| 49 | - $this->log->notice('401 Unauthorized : skip ' . $url); |
|
| 49 | + $this->log->notice('401 Unauthorized : skip '.$url); |
|
| 50 | 50 | |
| 51 | 51 | return $url; |
| 52 | 52 | } else { |
| 53 | 53 | // autre : ne pas générer de {lien brisé}, car peut-être 404 temporaire |
| 54 | - $this->log->warning('erreur sur extractWebData ' . $errorMessage); |
|
| 54 | + $this->log->warning('erreur sur extractWebData '.$errorMessage); |
|
| 55 | 55 | |
| 56 | 56 | //file_put_contents(self::LOG_REQUEST_ERROR, $this->domain."\n", FILE_APPEND); |
| 57 | 57 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | protected function log403(string $url): void |
| 63 | 63 | { |
| 64 | - $this->log->warning('403 Forbidden : ' . $url); |
|
| 64 | + $this->log->warning('403 Forbidden : '.$url); |
|
| 65 | 65 | //file_put_contents(self::LOG_REQUEST_ERROR, '403 Forbidden : ' . $url . "\n", FILE_APPEND); |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | \ No newline at end of file |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $this->url = $url; |
| 50 | 50 | $this->registrableDomain = null; |
| 51 | 51 | if (!ExternHttpClient::isHttpURL($url)) { |
| 52 | - $this->log->debug('Skip : not a valid URL : ' . $url); |
|
| 52 | + $this->log->debug('Skip : not a valid URL : '.$url); |
|
| 53 | 53 | return false; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | return false; |
| 58 | 58 | } |
| 59 | 59 | if (!ExternHttpClient::isHttpURL($url)) { |
| 60 | - throw new Exception('string is not an URL ' . $url); |
|
| 60 | + throw new Exception('string is not an URL '.$url); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $this->findRegistrableDomain(); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | try { |
| 80 | 80 | $this->registrableDomain = $this->internetDomainParser->getRegistrableDomainFromURL($this->url); |
| 81 | 81 | } catch (Exception) { |
| 82 | - $this->log->warning('Skip : not a valid URL : ' . $this->url); |
|
| 82 | + $this->log->warning('Skip : not a valid URL : '.$this->url); |
|
| 83 | 83 | return null; |
| 84 | 84 | } |
| 85 | 85 | return $this->registrableDomain; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | protected function hasForbiddenFilenameExtension(): bool |
| 94 | 94 | { |
| 95 | - return (bool)preg_match( |
|
| 95 | + return (bool) preg_match( |
|
| 96 | 96 | '#\.(pdf|jpg|jpeg|gif|png|webp|xls|xlsx|xlr|xml|xlt|txt|csv|js|docx|exe|gz|zip|ini|movie|mp3|mp4|ogg|raw|rss|tar|tgz|wma)$#i', |
| 97 | 97 | $this->url |
| 98 | 98 | ); |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | { |
| 103 | 103 | $text = str_replace(['https://', 'http://', 'www.'], '', $url); |
| 104 | 104 | if (strlen($text) > 30) { |
| 105 | - $text = substr($text, 0, 30) . '…'; |
|
| 105 | + $text = substr($text, 0, 30).'…'; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return $text; |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | use SummaryExternTrait, PublisherLogicTrait; |
| 36 | 36 | |
| 37 | 37 | public const HTTP_REQUEST_LOOP_DELAY = 10; |
| 38 | - public const SKIP_DOMAIN_FILENAME = __DIR__ . '/../resources/config_skip_domain.txt'; |
|
| 38 | + public const SKIP_DOMAIN_FILENAME = __DIR__.'/../resources/config_skip_domain.txt'; |
|
| 39 | 39 | public const REPLACE_404 = true; |
| 40 | 40 | public const REPLACE_410 = true; |
| 41 | - public const CONFIG_PRESSE = __DIR__ . '/../resources/config_presse.yaml'; |
|
| 42 | - public const CONFIG_NEWSPAPER_JSON = __DIR__ . '/../resources/data_newspapers.json'; |
|
| 43 | - public const CONFIG_SCIENTIFIC_JSON = __DIR__ . '/../resources/data_scientific_domain.json'; |
|
| 44 | - public const CONFIG_SCIENTIFIC_WIKI_JSON = __DIR__ . '/../resources/data_scientific_wiki.json'; |
|
| 41 | + public const CONFIG_PRESSE = __DIR__.'/../resources/config_presse.yaml'; |
|
| 42 | + public const CONFIG_NEWSPAPER_JSON = __DIR__.'/../resources/data_newspapers.json'; |
|
| 43 | + public const CONFIG_SCIENTIFIC_JSON = __DIR__.'/../resources/data_scientific_domain.json'; |
|
| 44 | + public const CONFIG_SCIENTIFIC_WIKI_JSON = __DIR__.'/../resources/data_scientific_wiki.json'; |
|
| 45 | 45 | |
| 46 | 46 | public bool $skipSiteBlacklisted = true; |
| 47 | 47 | public bool $skipRobotNoIndex = true; |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | protected function isSiteBlackListed(): bool |
| 147 | 147 | { |
| 148 | 148 | if ($this->skipSiteBlacklisted && in_array($this->registrableDomain, $this->skip_domain)) { |
| 149 | - $this->log->notice("Skip web site " . $this->registrableDomain); |
|
| 149 | + $this->log->notice("Skip web site ".$this->registrableDomain); |
|
| 150 | 150 | return true; |
| 151 | 151 | } |
| 152 | 152 | return false; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $this->config[$domain] = is_array($this->config[$domain]) ? $this->config[$domain] : []; |
| 165 | 165 | |
| 166 | 166 | if ($this->config[$domain] === 'deactivated' || isset($this->config[$domain]['deactivated'])) { |
| 167 | - $this->log->info("Domain " . $domain . " disabled\n"); |
|
| 167 | + $this->log->info("Domain ".$domain." disabled\n"); |
|
| 168 | 168 | |
| 169 | 169 | return false; |
| 170 | 170 | } |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | protected function logDebugConfigWebDomain(string $domain): void |
| 176 | 176 | { |
| 177 | 177 | if (!isset($this->config[$domain])) { |
| 178 | - $this->log->debug("Domain " . $domain . " non configuré"); |
|
| 178 | + $this->log->debug("Domain ".$domain." non configuré"); |
|
| 179 | 179 | } else { |
| 180 | - $this->log->debug("Domain " . $domain . " configuré"); |
|
| 180 | + $this->log->debug("Domain ".$domain." configuré"); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | if ($pageData === [] |
| 203 | 203 | || (empty($pageData['JSON-LD']) && empty($pageData['meta'])) |
| 204 | 204 | ) { |
| 205 | - $this->log->notice('No metadata : ' . $url); |
|
| 205 | + $this->log->notice('No metadata : '.$url); |
|
| 206 | 206 | |
| 207 | 207 | return true; |
| 208 | 208 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | protected function emptyMapData(array $mapData, string $url): bool |
| 218 | 218 | { |
| 219 | 219 | if ($mapData === [] || empty($mapData['url']) || empty($mapData['titre'])) { |
| 220 | - $this->log->info('Mapping incomplet : ' . $url); |
|
| 220 | + $this->log->info('Mapping incomplet : '.$url); |
|
| 221 | 221 | |
| 222 | 222 | return true; |
| 223 | 223 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | $template = WikiTemplateFactory::create($templateName); |
| 272 | 272 | $template->userSeparator = " |"; |
| 273 | - $this->summary->memo['count ' . $templateName] = 1 + ($this->summary->memo['count ' . $templateName] ?? 0); |
|
| 273 | + $this->summary->memo['count '.$templateName] = 1 + ($this->summary->memo['count '.$templateName] ?? 0); |
|
| 274 | 274 | |
| 275 | 275 | return $template; |
| 276 | 276 | } |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | $templateOptimized = $optimizer->getOptiTemplate(); |
| 327 | 327 | |
| 328 | 328 | $serialized = $templateOptimized->serialize(true); |
| 329 | - $this->log->info('Serialized 444: ' . $serialized . "\n"); |
|
| 329 | + $this->log->info('Serialized 444: '.$serialized."\n"); |
|
| 330 | 330 | return $serialized; |
| 331 | 331 | } |
| 332 | 332 | |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | if ( |
| 37 | 37 | !empty($robots) |
| 38 | 38 | && ( |
| 39 | - stripos((string)$robots, 'noindex') !== false |
|
| 40 | - || stripos((string)$robots, 'none') !== false |
|
| 39 | + stripos((string) $robots, 'noindex') !== false |
|
| 40 | + || stripos((string) $robots, 'none') !== false |
|
| 41 | 41 | ) |
| 42 | 42 | ) { |
| 43 | - $this->log->notice('robots NOINDEX : ' . $this->url); |
|
| 43 | + $this->log->notice('robots NOINDEX : '.$this->url); |
|
| 44 | 44 | |
| 45 | 45 | if (empty($this->pageData['meta']['prettyDomainName'])) { |
| 46 | - $this->log->warning('No prettyDomainName for ' . $this->url); |
|
| 46 | + $this->log->warning('No prettyDomainName for '.$this->url); |
|
| 47 | 47 | |
| 48 | 48 | return true; |
| 49 | 49 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | protected function isNoIndexDomainWhitelisted(?string $prettyDomain): bool |
| 58 | 58 | { |
| 59 | 59 | if (in_array($prettyDomain ?? '', $this->noindexWhitelist)) { |
| 60 | - $this->log->notice('ROBOT_NOINDEX_WHITELIST ' . $prettyDomain); |
|
| 60 | + $this->log->notice('ROBOT_NOINDEX_WHITELIST '.$prettyDomain); |
|
| 61 | 61 | |
| 62 | 62 | return true; |
| 63 | 63 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public const SLEEP_AFTER_EDITION = 15; // sec |
| 30 | 30 | public const MINUTES_DELAY_AFTER_LAST_HUMAN_EDIT = 10; // minutes |
| 31 | 31 | public const CHECK_EDIT_CONFLICT = true; |
| 32 | - public const ARTICLE_ANALYZED_FILENAME = __DIR__ . '/../resources/article_externRef_edited.txt'; |
|
| 32 | + public const ARTICLE_ANALYZED_FILENAME = __DIR__.'/../resources/article_externRef_edited.txt'; |
|
| 33 | 33 | public const SKIP_ADQ = false; |
| 34 | 34 | public const SKIP_LASTEDIT_BY_BOT = false; |
| 35 | 35 | public const CITATION_NUMBER_ON_FIRE = 15; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $result = $this->transformer->process($refContent, $this->summary); |
| 63 | 63 | } catch (Throwable $e) { |
| 64 | 64 | echo "** Problème détecté 234242\n"; |
| 65 | - $this->log->critical($e->getMessage() . " " . $e->getFile() . ":" . $e->getLine()); |
|
| 65 | + $this->log->critical($e->getMessage()." ".$e->getFile().":".$e->getLine()); |
|
| 66 | 66 | // TODO : parse $e->message -> variable process, taskName, botflag... |
| 67 | 67 | |
| 68 | 68 | 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 .= ' |