@@ -59,13 +59,13 @@ |
||
59 | 59 | $list = new PageList([trim($options['page'])]); |
60 | 60 | |
61 | 61 | // delete Title from edited.txt |
62 | - $file = __DIR__ . '/../resources/article_externRef_edited.txt'; |
|
62 | + $file = __DIR__.'/../resources/article_externRef_edited.txt'; |
|
63 | 63 | $text = file_get_contents($file); |
64 | - $newText = str_replace(trim($argv[1]) . "\n", '', $text); |
|
64 | + $newText = str_replace(trim($argv[1])."\n", '', $text); |
|
65 | 65 | if (!empty($text) && $text !== $newText) { |
66 | 66 | @file_put_contents($file, $newText); |
67 | 67 | } |
68 | - $botConfig->setTaskName(' |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | $this->url = $url; |
50 | 50 | $this->registrableDomain = null; |
51 | 51 | if (!HttpUtil::isHttpURL($url)) { |
52 | - $this->log->debug('Skip : not Http URL : ' . $url, ['stats' => 'externref.skip.notRawURL']); |
|
52 | + $this->log->debug('Skip : not Http URL : '.$url, ['stats' => 'externref.skip.notRawURL']); |
|
53 | 53 | return false; |
54 | 54 | } |
55 | 55 | |
56 | 56 | if ($this->hasForbiddenFilenameExtension()) { |
57 | - $this->log->debug('Skip : ForbiddenFilenameExtension : ' . $url, ['stats' => 'externref.skip.forbiddenFilenameExtension']); |
|
57 | + $this->log->debug('Skip : ForbiddenFilenameExtension : '.$url, ['stats' => 'externref.skip.forbiddenFilenameExtension']); |
|
58 | 58 | return false; |
59 | 59 | } |
60 | 60 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | protected function hasForbiddenFilenameExtension(): bool |
72 | 72 | { |
73 | - return (bool)preg_match( |
|
73 | + return (bool) preg_match( |
|
74 | 74 | '#\.(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', |
75 | 75 | $this->url |
76 | 76 | ); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | try { |
82 | 82 | $this->registrableDomain = $this->internetDomainParser->getRegistrableDomainFromURL($this->url); |
83 | 83 | } catch (Exception) { |
84 | - $this->log->warning('Skip : registrableDomain not a valid URL : ' . $this->url, |
|
84 | + $this->log->warning('Skip : registrableDomain not a valid URL : '.$this->url, |
|
85 | 85 | ['stats' => 'externref.skip.URLAuthorized.exception2'] |
86 | 86 | ); |
87 | 87 | return null; |
@@ -63,7 +63,7 @@ |
||
63 | 63 | if ($webarchiveDTO->getArchiver() === '[[Internet Archive]]') { |
64 | 64 | $this->log->notice(' |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | use SummaryExternTrait, PublisherLogicTrait; |
36 | 36 | |
37 | 37 | final public const HTTP_REQUEST_LOOP_DELAY = 10; |
38 | - final public const SKIP_DOMAIN_FILENAME = __DIR__ . '/../resources/config_skip_domain.txt'; |
|
38 | + final public const SKIP_DOMAIN_FILENAME = __DIR__.'/../resources/config_skip_domain.txt'; |
|
39 | 39 | final public const REPLACE_404 = true; |
40 | 40 | final public const REPLACE_410 = true; |
41 | - final public const CONFIG_PRESSE = __DIR__ . '/../resources/config_presse.yaml'; |
|
42 | - final public const CONFIG_NEWSPAPER_JSON = __DIR__ . '/../resources/data_newspapers.json'; |
|
43 | - final public const CONFIG_SCIENTIFIC_JSON = __DIR__ . '/../resources/data_scientific_domain.json'; |
|
44 | - final public const CONFIG_SCIENTIFIC_WIKI_JSON = __DIR__ . '/../resources/data_scientific_wiki.json'; |
|
41 | + final public const CONFIG_PRESSE = __DIR__.'/../resources/config_presse.yaml'; |
|
42 | + final public const CONFIG_NEWSPAPER_JSON = __DIR__.'/../resources/data_newspapers.json'; |
|
43 | + final public const CONFIG_SCIENTIFIC_JSON = __DIR__.'/../resources/data_scientific_domain.json'; |
|
44 | + final 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; |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | } |
97 | 97 | $this->registrableDomain = $this->urlChecker->getRegistrableDomain($url); // hack |
98 | 98 | if ($this->isSiteBlackListed()) { |
99 | - $this->log->debug('Site blacklisted : ' . $this->registrableDomain, ['stats' => 'externref.skip.blacklisted']); |
|
99 | + $this->log->debug('Site blacklisted : '.$this->registrableDomain, ['stats' => 'externref.skip.blacklisted']); |
|
100 | 100 | return $url; |
101 | 101 | } |
102 | 102 | |
103 | 103 | if ($this->registrableDomain && !$this->validateConfigWebDomain($this->registrableDomain)) { |
104 | 104 | $this->log->debug( |
105 | - 'Domain blocked by config : ' . $this->registrableDomain, |
|
105 | + 'Domain blocked by config : '.$this->registrableDomain, |
|
106 | 106 | ['stats' => 'externref.skip.domainDisabledByConfig'] |
107 | 107 | ); |
108 | 108 | return $url; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | protected function isSiteBlackListed(): bool |
160 | 160 | { |
161 | 161 | if ($this->registrableDomain && $this->skipSiteBlacklisted && in_array($this->registrableDomain, $this->skip_domain)) { |
162 | - $this->log->notice("Skip web site " . $this->registrableDomain); |
|
162 | + $this->log->notice("Skip web site ".$this->registrableDomain); |
|
163 | 163 | return true; |
164 | 164 | } |
165 | 165 | return false; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $this->config[$domain] = is_array($this->config[$domain]) ? $this->config[$domain] : []; |
178 | 178 | |
179 | 179 | if ($this->config[$domain] === 'deactivated' || isset($this->config[$domain]['deactivated'])) { |
180 | - $this->log->info("Domain " . $domain . " disabled\n"); |
|
180 | + $this->log->info("Domain ".$domain." disabled\n"); |
|
181 | 181 | |
182 | 182 | return false; |
183 | 183 | } |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | protected function logDebugConfigWebDomain(string $domain): void |
189 | 189 | { |
190 | 190 | if (!isset($this->config[$domain])) { |
191 | - $this->log->debug("Domain " . $domain . " non configuré"); |
|
191 | + $this->log->debug("Domain ".$domain." non configuré"); |
|
192 | 192 | } else { |
193 | - $this->log->debug("Domain " . $domain . " configuré"); |
|
193 | + $this->log->debug("Domain ".$domain." configuré"); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | if ($pageData === [] |
217 | 217 | || (empty($pageData['JSON-LD']) && empty($pageData['meta'])) |
218 | 218 | ) { |
219 | - $this->log->notice('No metadata : ' . $url); |
|
219 | + $this->log->notice('No metadata : '.$url); |
|
220 | 220 | |
221 | 221 | return true; |
222 | 222 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | protected function emptyMapData(array $mapData, string $url): bool |
232 | 232 | { |
233 | 233 | if ($mapData === [] || empty($mapData['url']) || empty($mapData['titre'])) { |
234 | - $this->log->info('Mapping incomplet : ' . $url); |
|
234 | + $this->log->info('Mapping incomplet : '.$url); |
|
235 | 235 | |
236 | 236 | return true; |
237 | 237 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | protected function correctSiteViaWebarchiver(array $mapData): array |
323 | 323 | { |
324 | 324 | if (!empty($this->options['originalRegistrableDomain']) && $mapData['site']) { |
325 | - $mapData['site'] = $this->options['originalRegistrableDomain'] . ' via ' . $mapData['site']; |
|
325 | + $mapData['site'] = $this->options['originalRegistrableDomain'].' via '.$mapData['site']; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | return $mapData; |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | $templateOptimized = $optimizer->getOptiTemplate(); |
347 | 347 | |
348 | 348 | $serialized = $templateOptimized->serialize(true); |
349 | - $this->log->info('Serialized 444: ' . $serialized . "\n"); |
|
349 | + $this->log->info('Serialized 444: '.$serialized."\n"); |
|
350 | 350 | return $serialized; |
351 | 351 | } |
352 | 352 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | { |
355 | 355 | $template = WikiTemplateFactory::create($templateName); |
356 | 356 | $template->userSeparator = " |"; |
357 | - $this->summary->memo['count ' . $templateName] = 1 + ($this->summary->memo['count ' . $templateName] ?? 0); |
|
357 | + $this->summary->memo['count '.$templateName] = 1 + ($this->summary->memo['count '.$templateName] ?? 0); |
|
358 | 358 | |
359 | 359 | return $template; |
360 | 360 | } |
@@ -32,7 +32,7 @@ |
||
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 |