Ensure db connection before changing cache state

When trying to upgrade from 7.0.0 to 7.0.2, the manual upgrade path
(e.g. ` sudo -u www-data /usr/bin/php5 ./occ upgrade`) exits with the
following fatal error:

```
/var/www/owncloud# php occ upgrade
PHP Fatal error:  Call to a member function
  disableQueryStatementCaching() on a non-object in
  /var/www/owncloud/lib/private/db.php on line 423
```

This is caused by the self::$connection static variable having not
been initialized at the point of call. Adding a self::connect() fixes
the issue.

See https://forum.owncloud.org/viewtopic.php?f=29&t=23398&p=68556#p68556
This commit is contained in:
Duane Johnson 2014-08-30 15:46:56 -06:00
parent a8dc4368c0
commit ccf440495e

View file

@ -417,6 +417,7 @@ class OC_DB {
* @param bool $enabled
*/
static public function enableCaching($enabled) {
self::connect();
if ($enabled) {
self::$connection->enableQueryStatementCaching();
} else {