Deactivated the alternative update script by now
This commit is contained in:
parent
d6ca6f24a7
commit
2cdf87c56a
2
boot.php
2
boot.php
|
@ -38,7 +38,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define ( 'FRIENDICA_CODENAME', 'Asparagus');
|
define ( 'FRIENDICA_CODENAME', 'Asparagus');
|
||||||
define ( 'FRIENDICA_VERSION', '3.5.1-dev' );
|
define ( 'FRIENDICA_VERSION', '3.5.1-dev' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1212 );
|
define ( 'DB_UPDATE_VERSION', 1213 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constant with a HTML line break.
|
* @brief Constant with a HTML line break.
|
||||||
|
|
|
@ -208,9 +208,10 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
if ($current_index_definition != $new_index_definition) {
|
if ($current_index_definition != $new_index_definition) {
|
||||||
if ($fieldnames[0] == "UNIQUE") {
|
if ($fieldnames[0] == "UNIQUE") {
|
||||||
$is_unique = true;
|
$is_unique = true;
|
||||||
if ($ignore == "") {
|
// Deactivated. See below for the reason
|
||||||
$temp_name = "temp-".$name;
|
//if ($ignore == "") {
|
||||||
}
|
// $temp_name = "temp-".$name;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,44 +293,44 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
if ($verbose) {
|
if ($verbose) {
|
||||||
// Ensure index conversion to unique removes duplicates
|
// Ensure index conversion to unique removes duplicates
|
||||||
if ($is_unique) {
|
if ($is_unique) {
|
||||||
if ($ignore != "") {
|
// By now the alternative is commented out.
|
||||||
|
// This is a preparation for the time when we found a good SQL routine.
|
||||||
|
//if ($ignore != "") {
|
||||||
echo "SET session old_alter_table=1;\n";
|
echo "SET session old_alter_table=1;\n";
|
||||||
} else {
|
//} else {
|
||||||
echo "DROP TABLE IF EXISTS `".$temp_name."`;\n";
|
// echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
|
||||||
echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
|
//}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $sql3."\n";
|
echo $sql3."\n";
|
||||||
|
|
||||||
if ($is_unique) {
|
if ($is_unique) {
|
||||||
if ($ignore != "") {
|
// By now the alternative is commented out.
|
||||||
|
// This is a preparation for the time when we found a good SQL routine.
|
||||||
|
//if ($ignore != "") {
|
||||||
echo "SET session old_alter_table=0;\n";
|
echo "SET session old_alter_table=0;\n";
|
||||||
} else {
|
//} else {
|
||||||
echo "INSERT IGNORE INTO `".$temp_name."` SELECT * FROM `".$name."`;\n";
|
// echo "INSERT IGNORE INTO `".$temp_name."` SELECT * FROM `".$name."`;\n";
|
||||||
echo "DROP TABLE `".$name."`;\n";
|
// echo "DROP TABLE `".$name."`;\n";
|
||||||
echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
|
// echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action) {
|
if ($action) {
|
||||||
// Ensure index conversion to unique removes duplicates
|
// Ensure index conversion to unique removes duplicates
|
||||||
if ($is_unique) {
|
if ($is_unique) {
|
||||||
if ($ignore != "") {
|
// By now the alternative is commented out.
|
||||||
|
// This is a preparation for the time when we found a good SQL routine.
|
||||||
|
//if ($ignore != "") {
|
||||||
$db->q("SET session old_alter_table=1;");
|
$db->q("SET session old_alter_table=1;");
|
||||||
} else {
|
//} else {
|
||||||
$r = $db->q("DROP TABLE IF EXISTS `".$temp_name."`;");
|
// $r = $db->q("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
|
||||||
if (!dbm::is_result($r)) {
|
// if (!dbm::is_result($r)) {
|
||||||
$errors .= t('Errors encountered performing database changes.').$sql3.EOL;
|
// $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
|
||||||
return $errors;
|
// return $errors;
|
||||||
}
|
// }
|
||||||
$r = $db->q("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
|
//}
|
||||||
if (!dbm::is_result($r)) {
|
|
||||||
$errors .= t('Errors encountered performing database changes.').$sql3.EOL;
|
|
||||||
return $errors;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = @$db->q($sql3);
|
$r = @$db->q($sql3);
|
||||||
|
@ -337,25 +338,28 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
$errors .= t('Errors encountered performing database changes.').$sql3.EOL;
|
$errors .= t('Errors encountered performing database changes.').$sql3.EOL;
|
||||||
|
|
||||||
if ($is_unique) {
|
if ($is_unique) {
|
||||||
if ($ignore != "") {
|
// By now the alternative is commented out.
|
||||||
|
// This is a preparation for the time when we found a good SQL routine.
|
||||||
|
//if ($ignore != "") {
|
||||||
$db->q("SET session old_alter_table=0;");
|
$db->q("SET session old_alter_table=0;");
|
||||||
} else {
|
//} else {
|
||||||
$r = $db->q("INSERT IGNORE INTO `".$temp_name."` SELECT * FROM `".$name."`;");
|
// We have to check if "INSERT IGNORE" will work on newer MySQL versions
|
||||||
if (!dbm::is_result($r)) {
|
// $r = $db->q("INSERT IGNORE INTO `".$temp_name."` SELECT * FROM `".$name."`;");
|
||||||
$errors .= t('Errors encountered performing database changes.').$sql3.EOL;
|
// if (!dbm::is_result($r)) {
|
||||||
return $errors;
|
// $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
|
||||||
}
|
// return $errors;
|
||||||
$r = $db->q("DROP TABLE `".$name."`;");
|
// }
|
||||||
if (!dbm::is_result($r)) {
|
// $r = $db->q("DROP TABLE `".$name."`;");
|
||||||
$errors .= t('Errors encountered performing database changes.').$sql3.EOL;
|
// if (!dbm::is_result($r)) {
|
||||||
return $errors;
|
// $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
|
||||||
}
|
// return $errors;
|
||||||
$r = $db->q("RENAME TABLE `".$temp_name."` TO `".$name."`;");
|
// }
|
||||||
if (!dbm::is_result($r)) {
|
// $r = $db->q("RENAME TABLE `".$temp_name."` TO `".$name."`;");
|
||||||
$errors .= t('Errors encountered performing database changes.').$sql3.EOL;
|
// if (!dbm::is_result($r)) {
|
||||||
return $errors;
|
// $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
|
||||||
}
|
// return $errors;
|
||||||
}
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1260,7 +1264,7 @@ function db_definition($charset) {
|
||||||
),
|
),
|
||||||
"indexes" => array(
|
"indexes" => array(
|
||||||
"PRIMARY" => array("id"),
|
"PRIMARY" => array("id"),
|
||||||
"poll_id" => array("poll_id"),
|
"poll_id" => array("UNIQUE", "poll_id"),
|
||||||
"choice" => array("choice"),
|
"choice" => array("choice"),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('UPDATE_VERSION' , 1212);
|
define('UPDATE_VERSION' , 1213);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue