catch error if old filecache table is not present during upgrade

This commit is contained in:
Robin Appelman 2012-12-06 17:49:35 +01:00
parent 98f42d314c
commit 317cd4c70a
1 changed files with 9 additions and 5 deletions

View File

@ -15,13 +15,17 @@ class Upgrade {
$insertQuery = \OC_DB::prepare('INSERT INTO `*PREFIX*filecache`( `fileid`, `storage`, `path`, `path_hash`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted` )
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
$oldEntriesQuery = \OC_DB::prepare('SELECT * FROM `*PREFIX*fscache` ORDER BY `id` ASC'); //sort ascending to ensure the parent gets inserted before a child
try{
$oldEntriesResult = $oldEntriesQuery->execute();
}catch(\Exception $e){
try {
$oldEntriesQuery = \OC_DB::prepare('SELECT * FROM `*PREFIX*fscache` ORDER BY `id` ASC'); //sort ascending to ensure the parent gets inserted before a child
} catch (\Exception $e) {
return;
}
if(!$oldEntriesResult){
try {
$oldEntriesResult = $oldEntriesQuery->execute();
} catch (\Exception $e) {
return;
}
if (!$oldEntriesResult) {
return;
}