diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-04-02 08:48:37 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-04-02 08:48:37 +0200 |
commit | 7086c386fdd1cfcec0ddc0db19615bd4586bade3 (patch) | |
tree | 26d7a890bc0350af5260bb7a3736610e533e6d3b /lib/private/updater.php | |
parent | 229e3dcba86db3bd91bbddd78079bf340edff710 (diff) | |
parent | 73dd5ff26c2d7652fd4abacbac53d734f64fde96 (diff) | |
download | nextcloud-server-7086c386fdd1cfcec0ddc0db19615bd4586bade3.tar.gz nextcloud-server-7086c386fdd1cfcec0ddc0db19615bd4586bade3.zip |
Merge branch 'master' into append-error-document
Conflicts:
lib/private/setup.php
lib/private/updater.php
Diffstat (limited to 'lib/private/updater.php')
-rw-r--r-- | lib/private/updater.php | 54 |
1 files changed, 10 insertions, 44 deletions
diff --git a/lib/private/updater.php b/lib/private/updater.php index 67764771fd0..a59e3820deb 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -16,9 +16,6 @@ use OC\Hooks\BasicEmitter; * - maintenanceStart() * - maintenanceEnd() * - dbUpgrade() - * - filecacheStart() - * - filecacheProgress(int $percentage) - * - filecacheDone() * - failure(string $message) */ class Updater extends BasicEmitter { @@ -76,7 +73,9 @@ class Updater extends BasicEmitter { if ($xml == false) { return array(); } + $loadEntities = libxml_disable_entity_loader(true); $data = @simplexml_load_string($xml); + libxml_disable_entity_loader($loadEntities); $tmp = array(); $tmp['version'] = $data->version; @@ -109,10 +108,15 @@ class Updater extends BasicEmitter { \OC_Setup::updateHtaccess(); } + // create empty file in data dir, so we can later find + // out that this is indeed an ownCloud data directory + // (in case it didn't exist before) + file_put_contents(\OC_Config::getValue('datadirectory', \OC::$SERVERROOT.'/data').'/.ocdata', ''); + /* * START CONFIG CHANGES FOR OLDER VERSIONS */ - if (version_compare($currentVersion, '6.90.1', '<')) { + if (!\OC::$CLI && version_compare($installedVersion, '6.90.1', '<')) { // Add the overwriteHost config if it is not existant // This is added to prevent host header poisoning \OC_Config::setValue('trusted_domains', \OC_Config::getValue('trusted_domains', array(\OC_Request::serverHost()))); @@ -126,9 +130,6 @@ class Updater extends BasicEmitter { \OC_DB::updateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml'); $this->emit('\OC\Updater', 'dbUpgrade'); - // do a file cache upgrade for users with files - // this can take loooooooooooooooooooooooong - $this->upgradeFileCache(); } catch (\Exception $exception) { $this->emit('\OC\Updater', 'failure', array($exception->getMessage())); } @@ -140,46 +141,11 @@ class Updater extends BasicEmitter { $repair = new Repair(); $repair->run(); + //Invalidate update feed + \OC_Appconfig::setValue('core', 'lastupdatedat', 0); \OC_Config::setValue('maintenance', false); $this->emit('\OC\Updater', 'maintenanceEnd'); } - private function upgradeFileCache() { - try { - $query = \OC_DB::prepare(' - SELECT DISTINCT `user` - FROM `*PREFIX*fscache` - '); - $result = $query->execute(); - } catch (\Exception $e) { - return; - } - $users = $result->fetchAll(); - if (count($users) == 0) { - return; - } - $step = 100 / count($users); - $percentCompleted = 0; - $lastPercentCompletedOutput = 0; - $startInfoShown = false; - foreach ($users as $userRow) { - $user = $userRow['user']; - \OC\Files\Filesystem::initMountPoints($user); - \OC\Files\Cache\Upgrade::doSilentUpgrade($user); - if (!$startInfoShown) { - //We show it only now, because otherwise Info about upgraded apps - //will appear between this and progress info - $this->emit('\OC\Updater', 'filecacheStart'); - $startInfoShown = true; - } - $percentCompleted += $step; - $out = floor($percentCompleted); - if ($out != $lastPercentCompletedOutput) { - $this->emit('\OC\Updater', 'filecacheProgress', array($out)); - $lastPercentCompletedOutput = $out; - } - } - $this->emit('\OC\Updater', 'filecacheDone'); - } } |