diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-04 16:20:53 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-04 16:20:53 +0200 |
commit | 4b79fb10a28d9edbace8ec44dfb43861c5570a64 (patch) | |
tree | fdd3134fb2fb4d97bab250810969e7082afa0df3 /lib/private | |
parent | 1f7e02e4d4fa918d933b904abf12fca6fda2c526 (diff) | |
download | nextcloud-server-4b79fb10a28d9edbace8ec44dfb43861c5570a64.tar.gz nextcloud-server-4b79fb10a28d9edbace8ec44dfb43861c5570a64.zip |
Fix verbose output of upgrade command - not progressbar in this case and the schema migration test has one progressbar now for all tables - before we had one progressbar for each table
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/db/migrator.php | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/private/db/migrator.php b/lib/private/db/migrator.php index f477da3bad0..8b8a34d9865 100644 --- a/lib/private/db/migrator.php +++ b/lib/private/db/migrator.php @@ -56,6 +56,9 @@ class Migrator { /** @var EventDispatcher */ private $dispatcher; + /** @var bool */ + private $noEmit = false; + /** * @param \Doctrine\DBAL\Connection|Connection $connection * @param ISecureRandom $random @@ -76,6 +79,7 @@ class Migrator { * @param \Doctrine\DBAL\Schema\Schema $targetSchema */ public function migrate(Schema $targetSchema) { + $this->noEmit = true; $this->applySchema($targetSchema); } @@ -100,21 +104,22 @@ class Migrator { * @throws \OC\DB\MigrationException */ public function checkMigrate(Schema $targetSchema) { - /** - * @var \Doctrine\DBAL\Schema\Table[] $tables - */ + $this->noEmit = true; + /**@var \Doctrine\DBAL\Schema\Table[] $tables */ $tables = $targetSchema->getTables(); $filterExpression = $this->getFilterExpression(); $this->connection->getConfiguration()-> setFilterSchemaAssetsExpression($filterExpression); $existingTables = $this->connection->getSchemaManager()->listTableNames(); + $step = 0; foreach ($tables as $table) { if (strpos($table->getName(), '.')) { list(, $tableName) = explode('.', $table->getName()); } else { $tableName = $table->getName(); } + $this->emitCheckStep($tableName, $step++, count($tables)); // don't need to check for new tables if (array_search($tableName, $existingTables) !== false) { $this->checkTableMigrate($table); @@ -269,9 +274,19 @@ class Migrator { } protected function emit($sql, $step, $max) { + if ($this->noEmit) { + return; + } if(is_null($this->dispatcher)) { return; } $this->dispatcher->dispatch('\OC\DB\Migrator::executeSql', new GenericEvent($sql, [$step+1, $max])); } + + private function emitCheckStep($tableName, $step, $max) { + if(is_null($this->dispatcher)) { + return; + } + $this->dispatcher->dispatch('\OC\DB\Migrator::checkTable', new GenericEvent($tableName, [$step+1, $max])); + } } |