]> source.dussan.org Git - nextcloud-server.git/commitdiff
Gallery: Fix database creation on update, also only from version less then 0.5
authorBart Visscher <bartv@thisnet.nl>
Thu, 7 Jun 2012 21:38:50 +0000 (23:38 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Mon, 11 Jun 2012 09:20:51 +0000 (11:20 +0200)
apps/gallery/appinfo/update.php

index dd248e21b3e4de22e4861a369c73c32c2d4eb977..a0997ab5e86f88e46ff11a7dabfa24d8599af680 100644 (file)
@@ -1,9 +1,11 @@
 <?php
 
-$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('./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');
+}