mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-25 14:10:28 +01:00
bugfix mustal, upgrade remove stash, do reset instead
This commit is contained in:
commit
8cc64aee19
@ -452,7 +452,7 @@ function mustal_implode_with_quote(string $quote, string $delimiter, array $arra
|
|||||||
// 10 Error on key definition upgrade
|
// 10 Error on key definition upgrade
|
||||||
// 11 Table type upgrade not supported
|
// 11 Table type upgrade not supported
|
||||||
// 12 Upgrade type not supported
|
// 12 Upgrade type not supported
|
||||||
function mustal_calculate_db_upgrade(array $compare_def, array $db_def, array &$upgrade_sql) : int {
|
function mustal_calculate_db_upgrade(array $compare_def, array $db_def, array &$upgrade_sql, array $replacers) : int {
|
||||||
$upgrade_sql = array();
|
$upgrade_sql = array();
|
||||||
|
|
||||||
$compare_differences = mustal_compare_table_array($compare_def,"in JSON",$db_def,"in DB",true);
|
$compare_differences = mustal_compare_table_array($compare_def,"in JSON",$db_def,"in DB",true);
|
||||||
|
@ -74,14 +74,14 @@ $remote_info = json_decode($remote_info_contents, true);
|
|||||||
|
|
||||||
// Get changed files on system -> Should be empty
|
// Get changed files on system -> Should be empty
|
||||||
$output = array();
|
$output = array();
|
||||||
$retval = git("ls-files -m", $output,$verbose);
|
$retval = git("ls-files -m ..", $output,$verbose);
|
||||||
|
|
||||||
if ($retval != 0) {
|
if ($retval != 0) {
|
||||||
abort("Error while executing git!");
|
abort("Error while executing git!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($output)) {
|
if (!empty($output)) {
|
||||||
echo("There are modifed files:");
|
echo("There are modified files:");
|
||||||
echo_output($output);
|
echo_output($output);
|
||||||
if (!$force) {
|
if (!$force) {
|
||||||
abort("Clear modified files or use -f");
|
abort("Clear modified files or use -f");
|
||||||
@ -98,10 +98,10 @@ if (file_exists($lockfile_name)) {
|
|||||||
echo("--------------- Pulling files... ---------------\n");
|
echo("--------------- Pulling files... ---------------\n");
|
||||||
|
|
||||||
if ($force) {
|
if ($force) {
|
||||||
$retval = git("stash",$output,$verbose);
|
$retval = git("reset --hard",$output,$verbose);
|
||||||
if ($retval != 0) {
|
if ($retval != 0) {
|
||||||
echo_output($output);
|
echo_output($output);
|
||||||
abort("Error while stashing files!");
|
abort("Error while resetting modified files!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +111,12 @@ if ($retval != 0) {
|
|||||||
abort("Error while pulling files!");
|
abort("Error while pulling files!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$retval = git("reset --hard",$output,$verbose);
|
||||||
|
if ($retval != 0) {
|
||||||
|
echo_output($output);
|
||||||
|
abort("Error while applying files!");
|
||||||
|
}
|
||||||
|
|
||||||
echo("--------------- Files upgrade completed ---------------\n");
|
echo("--------------- Files upgrade completed ---------------\n");
|
||||||
$retval = git("log -1 ",$output,$verbose);
|
$retval = git("log -1 ",$output,$verbose);
|
||||||
if ($retval != 0) {
|
if ($retval != 0) {
|
||||||
@ -143,7 +149,7 @@ echo("--------------- Calculating database upgrade for '$schema@$host'... ------
|
|||||||
|
|
||||||
$upgrade_sql = array();
|
$upgrade_sql = array();
|
||||||
|
|
||||||
$result = mustal_calculate_db_upgrade($compare_def, $db_def, $upgrade_sql);
|
$result = mustal_calculate_db_upgrade($compare_def, $db_def, $upgrade_sql, $mustal_replacers);
|
||||||
|
|
||||||
if ($result != 0) {
|
if ($result != 0) {
|
||||||
echo("Error: $result\n");
|
echo("Error: $result\n");
|
||||||
@ -173,8 +179,9 @@ if (!$mysqli) {
|
|||||||
|
|
||||||
$query_result = mysqli_query($mysqli, $sql);
|
$query_result = mysqli_query($mysqli, $sql);
|
||||||
if (!$query_result) {
|
if (!$query_result) {
|
||||||
$error = " not ok: ". mysqli_error($mysqli)."\n";
|
$error = " not ok: ". mysqli_error($mysqli);
|
||||||
echo($error);
|
echo($error);
|
||||||
|
echo("\n");
|
||||||
file_put_contents("./errors.txt",date()." ".$error.$sql."\n",FILE_APPEND);
|
file_put_contents("./errors.txt",date()." ".$error.$sql."\n",FILE_APPEND);
|
||||||
$error_counter++;
|
$error_counter++;
|
||||||
} else {
|
} else {
|
||||||
@ -183,6 +190,7 @@ if (!$mysqli) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo("\n");
|
||||||
echo("$error_counter errors.\n");
|
echo("$error_counter errors.\n");
|
||||||
if ($error_counter > 0) {
|
if ($error_counter > 0) {
|
||||||
echo("See 'errors.txt'\n");
|
echo("See 'errors.txt'\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user