]> git.agnieray.net Git - galette.git/commitdiff
Execute each migration seperately
authorJohan Cwiklinski <johan@x-tnd.be>
Fri, 7 May 2021 04:25:51 +0000 (06:25 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Sat, 8 May 2021 09:28:19 +0000 (11:28 +0200)
galette/lib/Galette/Core/Install.php

index c67f3a6aab95ffd3e2c15bf21c00af4ea08bf18a..22e8778aa302a281f377c13641795056432fff03 100644 (file)
@@ -630,11 +630,11 @@ class Install
         $queries_results = array();
         $fatal_error = false;
         $update_scripts = $this->getScripts();
-        $sql_query = '';
         $this->_report = array();
         $scripts_path = GALETTE_ROOT . '/install/scripts/';
 
         foreach ($update_scripts as $key => $val) {
+            $sql_query = '';
             if (substr($val, -strlen('.sql')) === '.sql') {
                 //just a SQL script, run it
                 $script = fopen($scripts_path . $val, 'r');
@@ -693,12 +693,16 @@ class Install
                     $this->_report[] = $ret;
                 }
             }
-        }
 
-        if ($sql_query !== '') {
-            $sql_res = $this->executeSql($zdb, $sql_query);
-            $fatal_error = !$sql_res;
+            if ($sql_query !== '') {
+                $sql_res = $this->executeSql($zdb, $sql_query);
+                $fatal_error = !$sql_res;
+                if ($fatal_error) {
+                    break;
+                }
+            }
         }
+
         return !$fatal_error;
     }