summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-09-21 15:12:00 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-09-27 18:43:53 +0200
commitda0cea404d3ec2ac1c3f08e3d3791b02b3b958db (patch)
tree97460f0334cd22db70d754777680f35b04821e31 /lib/private
parent6ca8ce62288aa5b181f97c45ad62c35976dbb65f (diff)
downloadnextcloud-server-da0cea404d3ec2ac1c3f08e3d3791b02b3b958db.tar.gz
nextcloud-server-da0cea404d3ec2ac1c3f08e3d3791b02b3b958db.zip
Kill update simulation
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/DB/MDB2SchemaManager.php11
-rw-r--r--lib/private/Updater.php123
-rw-r--r--lib/private/legacy/db.php17
3 files changed, 37 insertions, 114 deletions
diff --git a/lib/private/DB/MDB2SchemaManager.php b/lib/private/DB/MDB2SchemaManager.php
index 494c8fd53f1..f209991eb84 100644
--- a/lib/private/DB/MDB2SchemaManager.php
+++ b/lib/private/DB/MDB2SchemaManager.php
@@ -122,17 +122,6 @@ class MDB2SchemaManager {
}
/**
- * update the database scheme
- * @param string $file file to read structure from
- * @return boolean
- */
- public function simulateUpdateDbFromStructure($file) {
- $toSchema = $this->readSchemaFromFile($file);
- $this->getMigrator()->checkMigrate($toSchema);
- return true;
- }
-
- /**
* @param \Doctrine\DBAL\Schema\Schema $schema
* @return string
*/
diff --git a/lib/private/Updater.php b/lib/private/Updater.php
index 609e965bfad..646fc031a83 100644
--- a/lib/private/Updater.php
+++ b/lib/private/Updater.php
@@ -35,8 +35,8 @@ use OC\Hooks\BasicEmitter;
use OC\IntegrityCheck\Checker;
use OC_App;
use OCP\IConfig;
-use OC\Setup;
use OCP\ILogger;
+use OCP\Util;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
@@ -60,12 +60,6 @@ class Updater extends BasicEmitter {
private $checker;
/** @var bool */
- private $simulateStepEnabled;
-
- /** @var bool */
- private $updateStepEnabled;
-
- /** @var bool */
private $skip3rdPartyAppsDisable;
private $logLevelNames = [
@@ -87,29 +81,6 @@ class Updater extends BasicEmitter {
$this->log = $log;
$this->config = $config;
$this->checker = $checker;
- $this->simulateStepEnabled = true;
- $this->updateStepEnabled = true;
- }
-
- /**
- * Sets whether the database migration simulation must
- * be enabled.
- * This can be set to false to skip this test.
- *
- * @param bool $flag true to enable simulation, false otherwise
- */
- public function setSimulateStepEnabled($flag) {
- $this->simulateStepEnabled = $flag;
- }
-
- /**
- * Sets whether the update must be performed.
- * This can be set to false to skip the actual update.
- *
- * @param bool $flag true to enable update, false otherwise
- */
- public function setUpdateStepEnabled($flag) {
- $this->updateStepEnabled = $flag;
}
/**
@@ -131,9 +102,9 @@ class Updater extends BasicEmitter {
public function upgrade() {
$this->emitRepairEvents();
- $logLevel = $this->config->getSystemValue('loglevel', \OCP\Util::WARN);
+ $logLevel = $this->config->getSystemValue('loglevel', Util::WARN);
$this->emit('\OC\Updater', 'setDebugLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]);
- $this->config->setSystemValue('loglevel', \OCP\Util::DEBUG);
+ $this->config->setSystemValue('loglevel', Util::DEBUG);
$wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false);
@@ -254,68 +225,48 @@ class Updater extends BasicEmitter {
$repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->getEventDispatcher());
$repair->run();
- // simulate DB upgrade
- if ($this->simulateStepEnabled) {
- $this->checkCoreUpgrade();
-
- // simulate apps DB upgrade
- $this->checkAppUpgrade($currentVersion);
+ $this->doCoreUpgrade();
+ try {
+ // TODO: replace with the new repair step mechanism https://github.com/owncloud/core/pull/24378
+ Setup::installBackgroundJobs();
+ } catch (\Exception $e) {
+ throw new \Exception($e->getMessage());
}
- if ($this->updateStepEnabled) {
- $this->doCoreUpgrade();
-
- try {
- // TODO: replace with the new repair step mechanism https://github.com/owncloud/core/pull/24378
- Setup::installBackgroundJobs();
- } catch (\Exception $e) {
- throw new \Exception($e->getMessage());
- }
-
- // update all shipped apps
- $disabledApps = $this->checkAppsRequirements();
- $this->doAppUpgrade();
+ // update all shipped apps
+ $disabledApps = $this->checkAppsRequirements();
+ $this->doAppUpgrade();
- // upgrade appstore apps
- $this->upgradeAppStoreApps($disabledApps);
-
- // install new shipped apps on upgrade
- OC_App::loadApps('authentication');
- $errors = Installer::installShippedApps(true);
- foreach ($errors as $appId => $exception) {
- /** @var \Exception $exception */
- $this->log->logException($exception, ['app' => $appId]);
- $this->emit('\OC\Updater', 'failure', [$appId . ': ' . $exception->getMessage()]);
- }
+ // upgrade appstore apps
+ $this->upgradeAppStoreApps($disabledApps);
- // post-upgrade repairs
- $repair = new Repair(Repair::getRepairSteps(), \OC::$server->getEventDispatcher());
- $repair->run();
+ // install new shipped apps on upgrade
+ OC_App::loadApps('authentication');
+ $errors = Installer::installShippedApps(true);
+ foreach ($errors as $appId => $exception) {
+ /** @var \Exception $exception */
+ $this->log->logException($exception, ['app' => $appId]);
+ $this->emit('\OC\Updater', 'failure', [$appId . ': ' . $exception->getMessage()]);
+ }
- //Invalidate update feed
- $this->config->setAppValue('core', 'lastupdatedat', 0);
+ // post-upgrade repairs
+ $repair = new Repair(Repair::getRepairSteps(), \OC::$server->getEventDispatcher());
+ $repair->run();
- // Check for code integrity if not disabled
- if(\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) {
- $this->emit('\OC\Updater', 'startCheckCodeIntegrity');
- $this->checker->runInstanceVerification();
- $this->emit('\OC\Updater', 'finishedCheckCodeIntegrity');
- }
+ //Invalidate update feed
+ $this->config->setAppValue('core', 'lastupdatedat', 0);
- // only set the final version if everything went well
- $this->config->setSystemValue('version', implode('.', \OCP\Util::getVersion()));
- $this->config->setAppValue('core', 'vendor', $this->getVendor());
+ // Check for code integrity if not disabled
+ if(\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) {
+ $this->emit('\OC\Updater', 'startCheckCodeIntegrity');
+ $this->checker->runInstanceVerification();
+ $this->emit('\OC\Updater', 'finishedCheckCodeIntegrity');
}
- }
- protected function checkCoreUpgrade() {
- $this->emit('\OC\Updater', 'dbSimulateUpgradeBefore');
-
- // simulate core DB upgrade
- \OC_DB::simulateUpdateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
-
- $this->emit('\OC\Updater', 'dbSimulateUpgrade');
+ // only set the final version if everything went well
+ $this->config->setSystemValue('version', implode('.', Util::getVersion()));
+ $this->config->setAppValue('core', 'vendor', $this->getVendor());
}
protected function doCoreUpgrade() {
@@ -424,7 +375,7 @@ class Updater extends BasicEmitter {
private function checkAppsRequirements() {
$isCoreUpgrade = $this->isCodeUpgrade();
$apps = OC_App::getEnabledApps();
- $version = \OCP\Util::getVersion();
+ $version = Util::getVersion();
$disabledApps = [];
foreach ($apps as $app) {
// check if the app is compatible with this version of ownCloud
@@ -461,7 +412,7 @@ class Updater extends BasicEmitter {
*/
private function isCodeUpgrade() {
$installedVersion = $this->config->getSystemValue('version', '0.0.0');
- $currentVersion = implode('.', \OCP\Util::getVersion());
+ $currentVersion = implode('.', Util::getVersion());
if (version_compare($currentVersion, $installedVersion, '>')) {
return true;
}
diff --git a/lib/private/legacy/db.php b/lib/private/legacy/db.php
index 2d48e830ec2..415701d4024 100644
--- a/lib/private/legacy/db.php
+++ b/lib/private/legacy/db.php
@@ -192,23 +192,6 @@ class OC_DB {
}
/**
- * simulate the database schema update
- * @param string $file file to read structure from
- * @throws Exception
- * @return string|boolean
- */
- public static function simulateUpdateDbFromStructure($file) {
- $schemaManager = self::getMDB2SchemaManager();
- try {
- $result = $schemaManager->simulateUpdateDbFromStructure($file);
- } catch (Exception $e) {
- \OCP\Util::writeLog('core', 'Simulated database structure update failed ('.$e.')', \OCP\Util::FATAL);
- throw $e;
- }
- return $result;
- }
-
- /**
* remove all tables defined in a database structure xml file
* @param string $file the xml file describing the tables
*/