From: Bart Visscher Date: Thu, 7 Jun 2012 21:38:50 +0000 (+0200) Subject: Gallery: Fix database creation on update, also only from version less then 0.5 X-Git-Tag: v4.5.0beta1~74^2~423^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4afcae8d56e880288124605a7b2a9890081601d5;p=nextcloud-server.git Gallery: Fix database creation on update, also only from version less then 0.5 --- diff --git a/apps/gallery/appinfo/update.php b/apps/gallery/appinfo/update.php index dd248e21b3e..a0997ab5e86 100644 --- a/apps/gallery/appinfo/update.php +++ b/apps/gallery/appinfo/update.php @@ -1,9 +1,11 @@ execute(); -$stmt = OCP\DB::prepare('DROP TABLE IF EXISTS *PREFIX*gallery_albums'); -$stmt->execute(); - -\OC_DB::createDbFromStructure('./database.xml'); +$currentVersion=OC_Appconfig::getValue('gallery', 'installed_version'); +if (version_compare($currentVersion, '0.5.0', '<')) { + $stmt = OCP\DB::prepare('DROP TABLE IF EXISTS *PREFIX*gallery_photos'); + $stmt->execute(); + $stmt = OCP\DB::prepare('DROP TABLE IF EXISTS *PREFIX*gallery_albums'); + $stmt->execute(); + \OC_DB::createDbFromStructure(OC::$APPSROOT.'/apps/'.$appid.'/appinfo/database.xml'); +}