aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-10-16 21:45:09 +0200
committerLukas Reschke <lukas@owncloud.com>2014-10-16 21:45:09 +0200
commit53e0cf2f74af236f6121b5aedfd1e06d93902674 (patch)
tree784169e438d50eab45a56328402bc0a184299eed /lib/private
parent1ebeb6792eca53f34c2ad5a9c5eed7850b40fbb6 (diff)
downloadnextcloud-server-53e0cf2f74af236f6121b5aedfd1e06d93902674.tar.gz
nextcloud-server-53e0cf2f74af236f6121b5aedfd1e06d93902674.zip
Add a try catch block
This function might also be called before ownCloud is setup which results in a PHP fatal error. We therefore should gracefully catch errors in there.
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/app.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/private/app.php b/lib/private/app.php
index 95a8a7302d9..faaadef3857 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -1101,13 +1101,17 @@ class OC_App {
return $versions; // when function is used besides in checkUpgrade
}
$versions = array();
- $query = OC_DB::prepare('SELECT `appid`, `configvalue` FROM `*PREFIX*appconfig`'
- . ' WHERE `configkey` = \'installed_version\'');
- $result = $query->execute();
- while ($row = $result->fetchRow()) {
- $versions[$row['appid']] = $row['configvalue'];
+ try {
+ $query = OC_DB::prepare('SELECT `appid`, `configvalue` FROM `*PREFIX*appconfig`'
+ . ' WHERE `configkey` = \'installed_version\'');
+ $result = $query->execute();
+ while ($row = $result->fetchRow()) {
+ $versions[$row['appid']] = $row['configvalue'];
+ }
+ return $versions;
+ } catch (\Exception $e) {
+ return array();
}
- return $versions;
}