X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FConsole%2FDatabaseStructure.php;h=4d4125e88a7d6cf2f9de7f919221caa7feb64fc0;hb=1087e36a63cdb2e830d3d368f98042ab64e7b4ed;hp=343c90023d8bfad831f6bd3f6cac074c18a3da3e;hpb=1e273968513b7ae89e03732d2d7ea8eabbf84e6a;p=friendica.git diff --git a/src/Console/DatabaseStructure.php b/src/Console/DatabaseStructure.php index 343c90023d..4d4125e88a 100644 --- a/src/Console/DatabaseStructure.php +++ b/src/Console/DatabaseStructure.php @@ -1,6 +1,6 @@ dba = $dba; - $this->configCache = $configCache; + $this->dbaDefinition = $dbaDefinition; + $this->viewDefinition = $viewDefinition; + $this->config = $config; + $this->basePath = $basePath->getPath(); } - protected function doExecute() + protected function doExecute(): int { if ($this->getOption('v')) { $this->out('Class: ' . __CLASS__); @@ -102,11 +117,11 @@ HELP; throw new RuntimeException('Unable to connect to database'); } - $basePath = $this->configCache->get('system', 'basepath'); + $basePath = $this->config->get('system', 'basepath'); switch ($this->getArgument(0)) { case "dryrun": - $output = DBStructure::update($basePath, true, false); + $output = DBStructure::dryRun(); break; case "update": $force = $this->getOption(['f', 'force'], false); @@ -120,9 +135,9 @@ HELP; $output = ob_get_clean(); break; case "dumpsql": - ob_start(); - DBStructure::printStructure($basePath); - $output = ob_get_clean(); + DocWriter::writeDbDefinition($this->dbaDefinition, $this->basePath); + $output = DbaDefinitionSqlWriter::create($this->dbaDefinition); + $output .= ViewDefinitionSqlWriter::create($this->viewDefinition); break; case "toinnodb": ob_start();