]> source.dussan.org Git - nextcloud-server.git/commitdiff
some aditional feedback during database upgrade
authorRobin Appelman <icewind@owncloud.com>
Mon, 16 Jan 2012 00:13:54 +0000 (01:13 +0100)
committerRobin Appelman <icewind@owncloud.com>
Mon, 16 Jan 2012 00:15:43 +0000 (01:15 +0100)
lib/base.php
lib/db.php

index 9531f7ed74f1b3e95faa00191d9baa42156b27ce..ab7cb2990ed5176e4f6ee28fe0449f3a9970c94b 100644 (file)
@@ -156,7 +156,11 @@ class OC{
                        $installedVersion=OC_Config::getValue('version','0.0.0');
                        $currentVersion=implode('.',OC_Util::getVersion());
                        if (version_compare($currentVersion, $installedVersion, '>')) {
-                               OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/db_structure.xml');
+                               $result=OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/db_structure.xml');
+                               if(!$result){
+                                       echo 'Error while upgrading the database';
+                                       die();
+                               }
                                OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
                        }
 
index f6eddf7825cb4d4e7007a8f97e9e71d3fa554d7d..1a5f9874bd5ad282a499df21d3817612d7aa4607 100644 (file)
@@ -361,6 +361,11 @@ class OC_DB {
                $content = file_get_contents( $file );
                
                $previousSchema = self::$schema->getDefinitionFromDatabase();
+               if (PEAR::isError($previousSchema)) {
+                       $error = $previousSchema->getMessage();
+                       OC_Log::write('core','Failed to get existing database structure for upgrading ('.$error.')',OC_Log::FATAL);
+                       return false;
+               }
 
                // Make changes and save them to a temporary file
                $file2 = tempnam( get_temp_dir(), 'oc_db_scheme_' );
@@ -376,9 +381,9 @@ class OC_DB {
                unlink( $file2 );
                
                if (PEAR::isError($op)) {
-                   $error = $op->getMessage();
-                   OC_Log::write('core','Failed to update database structure ('.$error.')',OC_Log::FATAL);
-                   return false;
+                       $error = $op->getMessage();
+                       OC_Log::write('core','Failed to update database structure ('.$error.')',OC_Log::FATAL);
+                       return false;
                }
                return true;
        }