summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/db/mdb2schemamanager.php2
-rw-r--r--lib/private/files/cache/storage.php32
-rw-r--r--lib/private/updater.php1
3 files changed, 24 insertions, 11 deletions
diff --git a/lib/private/db/mdb2schemamanager.php b/lib/private/db/mdb2schemamanager.php
index 734ba18d1ac..ee3d53b576a 100644
--- a/lib/private/db/mdb2schemamanager.php
+++ b/lib/private/db/mdb2schemamanager.php
@@ -109,7 +109,7 @@ class MDB2SchemaManager {
*/
public function simulateUpdateDbFromStructure($file) {
$toSchema = $this->readSchemaFromFile($file);
- $migrator = $this->getMigrator()->checkMigrate($toSchema);
+ $this->getMigrator()->checkMigrate($toSchema);
return true;
}
diff --git a/lib/private/files/cache/storage.php b/lib/private/files/cache/storage.php
index 6b6b0bce9d7..3a267874431 100644
--- a/lib/private/files/cache/storage.php
+++ b/lib/private/files/cache/storage.php
@@ -43,12 +43,15 @@ class Storage {
}
}
+ /**
+ * @return string
+ */
public function getNumericId() {
return $this->numericId;
}
/**
- * @return string
+ * @return string|null
*/
public static function getStorageId($numericId) {
@@ -62,37 +65,46 @@ class Storage {
}
/**
- * @param string $storageId
+ * @return string|null
*/
- public static function exists($storageId) {
+ public static function getNumericStorageId($storageId) {
if (strlen($storageId) > 64) {
$storageId = md5($storageId);
}
+
$sql = 'SELECT `numeric_id` FROM `*PREFIX*storages` WHERE `id` = ?';
$result = \OC_DB::executeAudited($sql, array($storageId));
if ($row = $result->fetchRow()) {
- return true;
+ return $row['numeric_id'];
} else {
- return false;
+ return null;
}
}
/**
+ * @param string $storageId
+ * @return bool
+ */
+ public static function exists($storageId) {
+ return !is_null(self::getNumericStorageId($storageId));
+ }
+
+ /**
* remove the entry for the storage
*
* @param string $storageId
*/
public static function remove($storageId) {
- $storageCache = new Storage($storageId);
- $numericId = $storageCache->getNumericId();
-
if (strlen($storageId) > 64) {
$storageId = md5($storageId);
}
$sql = 'DELETE FROM `*PREFIX*storages` WHERE `id` = ?';
\OC_DB::executeAudited($sql, array($storageId));
- $sql = 'DELETE FROM `*PREFIX*filecache` WHERE `storage` = ?';
- \OC_DB::executeAudited($sql, array($numericId));
+ $numericId = self::exists($storageId);
+ if (!is_null($numericId)) {
+ $sql = 'DELETE FROM `*PREFIX*filecache` WHERE `storage` = ?';
+ \OC_DB::executeAudited($sql, array($numericId));
+ }
}
}
diff --git a/lib/private/updater.php b/lib/private/updater.php
index 58a4086c80f..9cc1b3322eb 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -150,6 +150,7 @@ class Updater extends BasicEmitter {
// This is added to prevent host header poisoning
\OC_Config::setValue('trusted_domains', \OC_Config::getValue('trusted_domains', array(\OC_Request::serverHost())));
}
+
/*
* STOP CONFIG CHANGES FOR OLDER VERSIONS
*/