MDL-37645 cache: fixed issue deleting mongo instance

This commit is contained in:
Sam Hemelryk
2013-02-08 08:07:01 +13:00
parent 3c754bb442
commit 007cd537d0
3 changed files with 11 additions and 5 deletions
+2 -2
View File
@@ -339,7 +339,7 @@ class cachestore_memcache extends cache_store implements cache_is_configurable {
$connection->addServer($server[0], $server[1], true, $server[2]);
}
}
$connection->flush();
@$connection->flush();
unset($connection);
unset($this->connection);
}
@@ -376,4 +376,4 @@ class cachestore_memcache extends cache_store implements cache_is_configurable {
public function my_name() {
return $this->name;
}
}
}
+2 -2
View File
@@ -424,7 +424,7 @@ class cachestore_memcached extends cache_store implements cache_is_configurable
$connection->addServers($this->servers);
}
}
$connection->flush();
@$connection->flush();
unset($connection);
unset($this->connection);
}
@@ -477,4 +477,4 @@ class cachestore_memcached extends cache_store implements cache_is_configurable
public function my_name() {
return $this->name;
}
}
}
+7 -1
View File
@@ -463,7 +463,13 @@ class cachestore_mongodb extends cache_store implements cache_is_configurable {
if ($this->connection) {
$connection = $this->connection;
} else {
$connection = new Mongo($this->server, $this->options);
try {
$connection = new Mongo($this->server, $this->options);
} catch (MongoConnectionException $e) {
// We only want to catch MongoConnectionExceptions here.
// If the server cannot be connected to we cannot clean it.
return;
}
}
$database = $connection->selectDB($this->databasename);
$database->drop();