Index: branches/RC/core/install.php =================================================================== diff -u -N -r9985 -r9987 --- branches/RC/core/install.php (.../install.php) (revision 9985) +++ branches/RC/core/install.php (.../install.php) (revision 9987) @@ -125,6 +125,13 @@ * @var string */ var $baseURL = ''; + + /** + * Holds number of last executed query in the SQL + * + * @var unknown_type + */ + var $LastQueryNum = 0; function Init() { @@ -434,7 +441,16 @@ if ($modules) { $upgrade_data = $this->GetUpgradableModules(); + $start_from_module = $this->GetVar('continue_from_module'); + $start_from_query = $this->GetVar('continue_from_query'); + if (!$start_from_query) $start_from_query = 0; foreach ($modules as $module_name) { + if ($start_from_module && $module_name != $start_from_module) { + continue; + } + else { + $start_from_module = false; //otherwise it will skip all modules after the one we start with! + } $module_info = $upgrade_data[$module_name]; $upgrades_file = sprintf(UPGRADES_FILE, $module_info['Path'], 'sql'); @@ -447,8 +463,16 @@ preg_match_all('/'.VERSION_MARK.'/s', $sqls, $regs); - $this->RunUpgrades($module_info['Path'], $regs[1], 'before'); - $this->RunSQLText($sqls); + if (!$start_from_module) { + $this->RunUpgrades($module_info['Path'], $regs[1], 'before'); + } + if (!$this->RunSQLText($sqls, null, null, $start_from_query)) { + $this->errorMessage .= ''; + $this->errorMessage .= ''; + $this->errorMessage .= '
Click Continue button below to skip this query and go further
'; + $this->Done(); + } + $start_from_query = 0; // so that next module start from the beggining $this->RunUpgrades($module_info['Path'], $regs[1], 'after'); // after upgrade sqls are executed update version @@ -753,7 +777,7 @@ * @param mixed $replace_from * @param mixed $replace_to */ - function RunSQLText(&$sqls, $replace_from = null, $replace_to = null) + function RunSQLText(&$sqls, $replace_from = null, $replace_to = null, $start_from=0) { $table_prefix = $this->systemConfig['Database']['TablePrefix']; @@ -775,8 +799,8 @@ $sqls = preg_replace("/#([^;]*?)\n/", '', $sqls); // remove all comments $sqls = explode(";\n", $sqls); - foreach ($sqls as $sql) { - $sql = trim($sql); + for ($i=$start_from; $iConn->Query($sql); if ($this->Conn->getErrorCode() != 0) { - $this->errorMessage = 'Error: ('.$this->Conn->getErrorCode().') '.$this->Conn->getErrorMsg().'

Database Query:
'.htmlspecialchars($sql).'
'; - $this->Done(); - break; - } + $this->errorMessage = 'Error: ('.$this->Conn->getErrorCode().') '.$this->Conn->getErrorMsg().'

Database Query:
'.htmlspecialchars($sql).'
'; + $this->LastQueryNum = $i+1; + return false; +// $this->Done(); +// break; + } } + return true; } function ImportLanguage($lang_file)