@@ -51,9 +51,9 @@ |
||
51 | 51 | sleep(60 * 10); |
52 | 52 | exit; |
53 | 53 | } |
54 | - if(preg_match('#Quota exceeded#', $e->getMessage())) { |
|
54 | + if (preg_match('#Quota exceeded#', $e->getMessage())) { |
|
55 | 55 | echo "ouvrageCompleteProcess : Quota exceeded. Sleep 4h and EXIT."; |
56 | - sleep(60*60*4); |
|
56 | + sleep(60 * 60 * 4); |
|
57 | 57 | exit; |
58 | 58 | } |
59 | 59 |
@@ -78,7 +78,7 @@ |
||
78 | 78 | //echo count($titles)." titles\n"; |
79 | 79 | $edited = file(__DIR__.'/../resources/article_externRef_edited.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
80 | 80 | $filtered = array_diff($titles, $edited); |
81 | -$list = new PageList( $filtered ); |
|
81 | +$list = new PageList($filtered); |
|
82 | 82 | echo ">".$list->count()." dans liste\n"; |
83 | 83 | |
84 | 84 | new ExternRefWorker($botConfig, $wiki, $list, null, new InternetDomainParser()); |
@@ -37,25 +37,25 @@ discard block |
||
37 | 37 | $data = []; |
38 | 38 | |
39 | 39 | $monitor = $db->fetchRow('select count(id) from page_ouvrages where optidate is null and edited is null and skip=0'); |
40 | -$data['not analyzed citation'] = (int)$monitor['count(id)']; |
|
40 | +$data['not analyzed citation'] = (int) $monitor['count(id)']; |
|
41 | 41 | |
42 | 42 | $monitor = $db->fetchRow('select count(id) from page_ouvrages where optidate is not null'); |
43 | -$data['analyzed citation'] = (int)$monitor['count(id)']; |
|
43 | +$data['analyzed citation'] = (int) $monitor['count(id)']; |
|
44 | 44 | |
45 | 45 | $monitor = $db->fetchRow('select count(distinct page) as n from page_ouvrages where skip=1 and edited is null'); // ? |
46 | -$data['skip pages'] = (int)$monitor['n']; |
|
46 | +$data['skip pages'] = (int) $monitor['n']; |
|
47 | 47 | |
48 | 48 | $monitor = $db->fetchRow('select count(distinct page) as n from page_ouvrages where edited is true'); |
49 | -$data['edited pages'] = (int)$monitor['n']; |
|
49 | +$data['edited pages'] = (int) $monitor['n']; |
|
50 | 50 | |
51 | 51 | $monitor = $db->fetchRow('select count(id) from page_ouvrages where optidate > SUBDATE(NOW(),1)'); |
52 | -$data['analyzed citation 24H'] = (int)$monitor['count(id)']; |
|
52 | +$data['analyzed citation 24H'] = (int) $monitor['count(id)']; |
|
53 | 53 | |
54 | 54 | $monitor = $db->fetchRow('select count(id) as n from page_ouvrages where edited > SUBDATE(NOW(),1)'); |
55 | -$data['edited citations 24H'] = (int)$monitor['n']; |
|
55 | +$data['edited citations 24H'] = (int) $monitor['n']; |
|
56 | 56 | |
57 | 57 | $monitor = $db->fetchRow('select count(distinct page) as n from page_ouvrages where edited > SUBDATE(NOW(),1)'); |
58 | -$data['edited pages 24H'] = (int)$monitor['n']; |
|
58 | +$data['edited pages 24H'] = (int) $monitor['n']; |
|
59 | 59 | |
60 | 60 | $monitor = $db->fetchRow( |
61 | 61 | 'SELECT count(distinct A.page) FROM page_ouvrages A |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | AND A.page = B.page |
75 | 75 | )' |
76 | 76 | ); |
77 | -$data['waiting pages'] = (int)$monitor['count(distinct A.page)']; |
|
77 | +$data['waiting pages'] = (int) $monitor['count(distinct A.page)']; |
|
78 | 78 | |
79 | 79 | $data['currentdate'] = DateUtil::english2french((new DateTime())->format('j F Y \à H\:i').' (CEST)'); |
80 | 80 |
@@ -40,10 +40,10 @@ |
||
40 | 40 | $db = new Mysql($pdo); |
41 | 41 | |
42 | 42 | $monitor = $db->fetchRow('select count(id) from page_ouvrages where optidate is not null'); |
43 | -$number = (int)$monitor['count(id)']; |
|
43 | +$number = (int) $monitor['count(id)']; |
|
44 | 44 | |
45 | 45 | $monitor = $db->fetchRow('select count(distinct page) as pages from page_ouvrages where optidate is not null and isbn<>""'); |
46 | -$pageNb = (int)$monitor['pages']; |
|
46 | +$pageNb = (int) $monitor['pages']; |
|
47 | 47 | |
48 | 48 | $newText = <<<EOF |
49 | 49 | <div style="background:#EBF6E9;border:2px solid grey;padding:10px;border-radius:10px;"> |
@@ -11,5 +11,5 @@ |
||
11 | 11 | |
12 | 12 | interface ExternHttpClientInterface |
13 | 13 | { |
14 | - public function getHTML(string $url, ?bool $normalized=false): ?string; |
|
14 | + public function getHTML(string $url, ?bool $normalized = false): ?string; |
|
15 | 15 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | public function hasWarning(): bool |
25 | 25 | { |
26 | - return (bool)$this->warning; |
|
26 | + return (bool) $this->warning; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -41,7 +41,7 @@ |
||
41 | 41 | { |
42 | 42 | $sender = getenv('BOT_NAME') ?? ''; |
43 | 43 | $message = sprintf('%s : %s', $sender, $message); |
44 | - $url = getenv('FREE_SMS_URL') . urlencode($message); |
|
44 | + $url = getenv('FREE_SMS_URL').urlencode($message); |
|
45 | 45 | |
46 | 46 | $response = $this->client->get($url, ['timeout' => 120]); |
47 | 47 |
@@ -58,7 +58,7 @@ |
||
58 | 58 | |
59 | 59 | |
60 | 60 | // utilise une liste d'import wstat.fr |
61 | - echo "Liste d'après wstat.fr\n"; |
|
61 | + echo "Liste d'après wstat.fr\n"; |
|
62 | 62 | $list = PageList::FromFile(__DIR__.'/../resources/importISBN_nov.txt'); |
63 | 63 | new ScanWiki2DB($wiki, new DbAdapter(), new WikiBotConfig($wiki), $list, 0); |
64 | 64 |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | // idn_to_ascii('teßt.com',IDNA_NONTRANSITIONAL_TO_ASCII,INTL_IDNA_VARIANT_UTS46) |
59 | 59 | // checkdnsrr($string, "A") // check DNS record |
60 | 60 | if (!self::isHttpURL($url)) { |
61 | - throw new DomainException('URL not compatible : ' . $url); |
|
61 | + throw new DomainException('URL not compatible : '.$url); |
|
62 | 62 | } |
63 | 63 | $response = $this->client->get($url); |
64 | 64 | |
65 | 65 | if (200 !== $response->getStatusCode()) { |
66 | - echo 'HTTP error ' . $response->getStatusCode(); |
|
67 | - $this->log->error('HTTP error ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase()); |
|
66 | + echo 'HTTP error '.$response->getStatusCode(); |
|
67 | + $this->log->error('HTTP error '.$response->getStatusCode().' '.$response->getReasonPhrase()); |
|
68 | 68 | |
69 | 69 | return null; |
70 | 70 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public static function isHttpURL(string $url): bool |
83 | 83 | { |
84 | - return (bool)preg_match('#^https?://[^ ]+$#i', $url); |
|
84 | + return (bool) preg_match('#^https?://[^ ]+$#i', $url); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -103,19 +103,19 @@ discard block |
||
103 | 103 | $charset = $this->extractCharset($html) ?? 'WINDOWS-1252'; |
104 | 104 | |
105 | 105 | if (empty($charset)) { |
106 | - throw new DomainException('normalized html error and no charset found : ' . $url); |
|
106 | + throw new DomainException('normalized html error and no charset found : '.$url); |
|
107 | 107 | } |
108 | 108 | try { |
109 | 109 | $html2 = iconv($charset, 'UTF-8//TRANSLIT', $html); |
110 | 110 | if (false === $html2) { |
111 | - throw new DomainException("error iconv : $charset to UTF-8 on " . $url); |
|
111 | + throw new DomainException("error iconv : $charset to UTF-8 on ".$url); |
|
112 | 112 | } |
113 | 113 | $html2 = Normalizer::normalize($html2); |
114 | 114 | if (!is_string($html2)) { |
115 | - throw new DomainException("error normalizer : $charset to UTF-8 on " . $url); |
|
115 | + throw new DomainException("error normalizer : $charset to UTF-8 on ".$url); |
|
116 | 116 | } |
117 | 117 | } catch (Throwable $e) { |
118 | - throw new DomainException("error converting : $charset to UTF-8 on " . $url, $e->getCode(), $e); |
|
118 | + throw new DomainException("error converting : $charset to UTF-8 on ".$url, $e->getCode(), $e); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | return $html2; |