diff --git a/library/Class/Migration/RecordSelectionWithInternalData.php b/library/Class/Migration/RecordSelectionWithInternalData.php index 3bc57b4fead41283a2bde676800f0df0ac91fd78..7d15c9ebcd9134be299d2801f0ac31aaeae89174 100644 --- a/library/Class/Migration/RecordSelectionWithInternalData.php +++ b/library/Class/Migration/RecordSelectionWithInternalData.php @@ -22,6 +22,10 @@ class Class_Migration_RecordSelectionWithInternalData { + use + Trait_EchoError, + Trait_Translator; + protected Zend_Db_Adapter_Abstract $_sql; protected array $_sources; protected Class_Cosmogramme_Chronometre $_chrono; @@ -57,17 +61,22 @@ class Class_Migration_RecordSelectionWithInternalData { $this->_cache = []; $this->_chrono->start(); + + $this->setEchoFunction(fn($message) => null); + + $this->echoStartTitle($this->_('Mise à jour des sélections de documents')); + foreach ($this->_sql->fetchAll('select id, notices from notices_paniers') as $row) $this->_runOne($row); - printf("UPGRADE on %d selection(s)\n", $this->_selections_count); - printf("Checked %d key(s)\n", $this->_keys_count); - printf("Upgraded %d key(s)\n", $this->_upgraded_count); - printf("Nothing to do on %d key(s)\n", $this->_nothing_todo_count); - printf("Not upgradable %d key(s)\n", $this->_not_upgradable_count); - printf("%d cache hit(s)\n", $this->_cache_hits); + $this->echoError($this->_("UPGRADE on %d selection(s)", $this->_selections_count) . "\n"); + $this->echoError($this->_("Checked %d key(s)", $this->_keys_count) . "\n"); + $this->echoError($this->_("Upgraded %d key(s)", $this->_upgraded_count) . "\n"); + $this->echoError($this->_("Nothing to do on %d key(s)", $this->_nothing_todo_count) . "\n"); + $this->echoError($this->_("Not upgradable %d key(s)", $this->_not_upgradable_count) . "\n"); + $this->echoError($this->_("%d cache hit(s)", $this->_cache_hits) . "\n"); - echo $this->_chrono->end() . "\n\n"; + $this->echoEndTitle($this->_chrono->end()); return $this; } @@ -127,12 +136,12 @@ class Class_Migration_RecordSelectionWithInternalData { foreach ($this->_sql->fetchAll('select id, notices from notices_paniers') as $row) $this->_downOne($row); - printf("DOWNGRADE on %d selection(s)\n", $this->_selections_count); - printf("Checked %d key(s)\n", $this->_keys_count); - printf("Downgraded %d key(s)\n", $this->_upgraded_count); - printf("Nothing to do on %d key(s)\n", $this->_nothing_todo_count); + $this->echoError($this->_("DOWNGRADE on %d selection(s)", $this->_selections_count)); + $this->echoError($this->_("Checked %d key(s)", $this->_keys_count)); + $this->echoError($this->_("Downgraded %d key(s)", $this->_upgraded_count)); + $this->echoError($this->_("Nothing to do on %d key(s)", $this->_nothing_todo_count)); - echo $this->_chrono->end() . "\n\n"; + $this->echoError($this->_chrono->end()); return $this; }