@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $editInfo = new EditInfo(static::BOT_TALK_SUMMARY); |
| 59 | 59 | $success = $page->addToBottomOfThePage($addText, $editInfo); |
| 60 | 60 | |
| 61 | - return (bool)$success; |
|
| 61 | + return (bool) $success; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | return null; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - return (string)trim($sentences[array_rand($sentences)]); |
|
| 89 | + return (string) trim($sentences[array_rand($sentences)]); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public function __construct(QueueInterface $queueAdapter, ?bool $verbose = false) |
| 61 | 61 | { |
| 62 | 62 | $this->queueAdapter = $queueAdapter; |
| 63 | - $this->verbose = (bool)$verbose; |
|
| 63 | + $this->verbose = (bool) $verbose; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function run(?int $limit = 10000) |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $this->completeOuvrage($googleOuvrage); |
| 229 | 229 | } catch (Throwable $e) { |
| 230 | 230 | echo "*** ERREUR GOOGLE Isbn Search ***".$e->getMessage()."\n"; |
| 231 | - if( strpos($e->getMessage(), 'Could not resolve host: www.googleapis.com') === false) { |
|
| 231 | + if (strpos($e->getMessage(), 'Could not resolve host: www.googleapis.com') === false) { |
|
| 232 | 232 | throw $e; |
| 233 | 233 | } |
| 234 | 234 | unset($e); |
@@ -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;"> |
@@ -32,25 +32,25 @@ discard block |
||
| 32 | 32 | $data = []; |
| 33 | 33 | |
| 34 | 34 | $monitor = $db->fetchRow('select count(id) from page_ouvrages where optidate is null and edited is null'); |
| 35 | -$data['not analyzed citation'] = (int)$monitor['count(id)']; |
|
| 35 | +$data['not analyzed citation'] = (int) $monitor['count(id)']; |
|
| 36 | 36 | |
| 37 | 37 | $monitor = $db->fetchRow('select count(id) from page_ouvrages where optidate is not null'); |
| 38 | -$data['analyzed citation'] = (int)$monitor['count(id)']; |
|
| 38 | +$data['analyzed citation'] = (int) $monitor['count(id)']; |
|
| 39 | 39 | |
| 40 | 40 | $monitor = $db->fetchRow('select count(distinct page) as n from page_ouvrages where skip=1 and edited is null'); |
| 41 | -$data['skip pages'] = (int)$monitor['n']; |
|
| 41 | +$data['skip pages'] = (int) $monitor['n']; |
|
| 42 | 42 | |
| 43 | 43 | $monitor = $db->fetchRow('select count(distinct page) as n from page_ouvrages where edited is true'); |
| 44 | -$data['edited pages'] = (int)$monitor['n']; |
|
| 44 | +$data['edited pages'] = (int) $monitor['n']; |
|
| 45 | 45 | |
| 46 | 46 | $monitor = $db->fetchRow('select count(id) from page_ouvrages where optidate > SUBDATE(NOW(),1)'); |
| 47 | -$data['analyzed citation 24H'] = (int)$monitor['count(id)']; |
|
| 47 | +$data['analyzed citation 24H'] = (int) $monitor['count(id)']; |
|
| 48 | 48 | |
| 49 | 49 | $monitor = $db->fetchRow('select count(id) as n from page_ouvrages where edited > SUBDATE(NOW(),1)'); |
| 50 | -$data['edited citations 24H'] = (int)$monitor['n']; |
|
| 50 | +$data['edited citations 24H'] = (int) $monitor['n']; |
|
| 51 | 51 | |
| 52 | 52 | $monitor = $db->fetchRow('select count(distinct page) as n from page_ouvrages where edited > SUBDATE(NOW(),1)'); |
| 53 | -$data['edited pages 24H'] = (int)$monitor['n']; |
|
| 53 | +$data['edited pages 24H'] = (int) $monitor['n']; |
|
| 54 | 54 | |
| 55 | 55 | $monitor = $db->fetchRow('SELECT count(distinct A.page) FROM page_ouvrages A |
| 56 | 56 | WHERE notcosmetic=1. |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | ) |
| 66 | 66 | AND A.page = B.page |
| 67 | 67 | )'); |
| 68 | -$data['waiting pages'] = (int)$monitor['count(distinct A.page)']; |
|
| 68 | +$data['waiting pages'] = (int) $monitor['count(distinct A.page)']; |
|
| 69 | 69 | |
| 70 | 70 | $data['currentdate'] = DateUtil::dateEnglish2french((new DateTime())->format('j F Y \à H\:i').' (CEST)'); |
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | $monitWiki = ''; |
| 78 | -if(!empty($monitor)) { |
|
| 78 | +if (!empty($monitor)) { |
|
| 79 | 79 | foreach ($monitor as $monit) { |
| 80 | 80 | // % = "%" |
| 81 | 81 | $edited = new DateTime($monit['edited']); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | "<tr><td>%s %</td><td>%s</td><td>[https://fr.wikipedia.org/w/index.php?title=%s&action=history histo]</td><td>[[%s]]</td><td>%s</td></tr>\n", |
| 84 | 84 | $monit['altered'] ?? '?', |
| 85 | 85 | $edited->format('d-m-Y'), |
| 86 | - str_replace(' ','_', $monit['page']), |
|
| 86 | + str_replace(' ', '_', $monit['page']), |
|
| 87 | 87 | $monit['page'] ?? '??', |
| 88 | 88 | $monit['version'] |
| 89 | 89 | ); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | wiki; |
| 120 | 120 | |
| 121 | 121 | $wikiText = str_replace('#monitor#', $monitWiki, $wikiText); |
| 122 | -foreach($data as $key => $dat){ |
|
| 122 | +foreach ($data as $key => $dat) { |
|
| 123 | 123 | $wikiText = str_replace('#'.$key.'#', $dat, $wikiText); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | sleep(60 * 60 * 3); |
| 37 | 37 | echo "Wake up\n"; |
| 38 | 38 | } |
| 39 | - if(strpos($e->getMessage(), 'Quota Google') !== false){ |
|
| 39 | + if (strpos($e->getMessage(), 'Quota Google') !== false) { |
|
| 40 | 40 | echo "Google Quota dépassé : sleep 6h\n"; |
| 41 | 41 | sleep(60 * 60 * 6); |
| 42 | 42 | echo "Wake up\n"; |
@@ -50,5 +50,5 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | unset($process); |
| 52 | 52 | echo "Sleep 10 min\n"; |
| 53 | - sleep(60*10); |
|
| 53 | + sleep(60 * 10); |
|
| 54 | 54 | } |
@@ -152,7 +152,7 @@ |
||
| 152 | 152 | $page .= '–'.$meta['citation_lastpage']; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - return (string)$page; |
|
| 155 | + return (string) $page; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | return null; |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | $mapper = new WebMapper(new Logger()); |
| 32 | 32 | $data = $mapper->process($htmlData); |
| 33 | 33 | if (isset($data['consulté le'])) { |
| 34 | - $data['consulté le'] = '11-04-2020';// unit testing date... |
|
| 34 | + $data['consulté le'] = '11-04-2020'; // unit testing date... |
|
| 35 | 35 | } |
| 36 | 36 | $this::assertSame($expected, $data); |
| 37 | 37 | } |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * @var AbstractWikiTemplate |
| 55 | 55 | */ |
| 56 | - try{ |
|
| 56 | + try { |
|
| 57 | 57 | $tplObject = WikiTemplateFactory::create($tplName); |
| 58 | - }catch (Throwable $e){ |
|
| 58 | + } catch (Throwable $e) { |
|
| 59 | 59 | unset($e); |
| 60 | 60 | continue; |
| 61 | 61 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | ) { |
| 191 | 191 | array_walk( |
| 192 | 192 | $matches, |
| 193 | - function (&$value) { |
|
| 193 | + function(&$value) { |
|
| 194 | 194 | $value = str_replace(['CURLYBRACKETO', 'CURLYBRACKETC'], ['{', '}'], $value); |
| 195 | 195 | } |
| 196 | 196 | ); |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | try{ |
| 57 | 57 | $tplObject = WikiTemplateFactory::create($tplName); |
| 58 | - }catch (Throwable $e){ |
|
| 58 | + } catch (Throwable $e){ |
|
| 59 | 59 | unset($e); |
| 60 | 60 | continue; |
| 61 | 61 | } |
@@ -185,7 +185,7 @@ |
||
| 185 | 185 | new EditInfo($this->taskName, $this->minorFlag, $this->botFlag, $this->maxLag) |
| 186 | 186 | ); |
| 187 | 187 | dump($result); |
| 188 | - echo "Sleep ".(string)static::SLEEP_AFTER_EDITION."\n"; |
|
| 188 | + echo "Sleep ".(string) static::SLEEP_AFTER_EDITION."\n"; |
|
| 189 | 189 | sleep(static::SLEEP_AFTER_EDITION); |
| 190 | 190 | } |
| 191 | 191 | |