/** * Executes all necessary scripts in the engine folder * @param string $engineFolder The folder * @throws \Exception Raises error if any of the scripts fail */ private function ExecuteScripts($engineFolder) { $files = $this->SortFilesByVersion(Folder::GetFiles($engineFolder)); $completeSql = ''; foreach ($files as $file) { $sqlFile = Path::Combine($engineFolder, $file); $completeSql .= "\r\n" . File::GetContents($sqlFile); } try { $this->CleanAllForeignKeys(); //$this->connection->StartTransaction(); $this->connection->ExecuteMultiQuery($completeSql); } catch (\Exception $exc) { //$this->connection->RollBack(); throw $exc; //throw new \Exception("Error executing SQL in folder $engineFolder: " . $completeSql, null, $exc); } //$this->connection->Commit(); }