[Pkg-owncloud-commits] [owncloud] 14/46: Add a try catch block
David Prévot
taffit at moszumanska.debian.org
Fri Oct 24 15:11:41 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit f2dadc71041e1306fc6f7d7aaf0828099f2133ca
Author: Lukas Reschke <lukas at owncloud.com>
Date: Thu Oct 16 21:45:09 2014 +0200
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.
---
lib/private/app.php | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/lib/private/app.php b/lib/private/app.php
index a619504..d58c851 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -1109,13 +1109,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;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list