Merge pull request #2853 from annando/1610-bugfix-config
The creation of unique keys failed for MariaDB
This commit is contained in:
commit
a53d48f41f
5 changed files with 10 additions and 9 deletions
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', 1205 );
|
define ( 'DB_UPDATE_VERSION', 1206 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constant with a HTML line break.
|
* @brief Constant with a HTML line break.
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Config {
|
||||||
public static function load($family) {
|
public static function load($family) {
|
||||||
global $a;
|
global $a;
|
||||||
|
|
||||||
$r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s'", dbesc($family));
|
$r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s' ORDER BY `cat`, `k`, `id`", dbesc($family));
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
$k = $rr['k'];
|
$k = $rr['k'];
|
||||||
|
@ -90,7 +90,7 @@ class Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
|
$ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' ORDER BY `id` DESC LIMIT 1",
|
||||||
dbesc($family),
|
dbesc($family),
|
||||||
dbesc($key)
|
dbesc($key)
|
||||||
);
|
);
|
||||||
|
|
|
@ -29,7 +29,7 @@ class PConfig {
|
||||||
*/
|
*/
|
||||||
public static function load($uid,$family) {
|
public static function load($uid,$family) {
|
||||||
global $a;
|
global $a;
|
||||||
$r = q("SELECT `v`,`k` FROM `pconfig` WHERE `cat` = '%s' AND `uid` = %d",
|
$r = q("SELECT `v`,`k` FROM `pconfig` WHERE `cat` = '%s' AND `uid` = %d ORDER BY `cat`, `k`, `id`",
|
||||||
dbesc($family),
|
dbesc($family),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
@ -83,7 +83,7 @@ class PConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1",
|
$ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' ORDER BY `id` DESC LIMIT 1",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc($family),
|
dbesc($family),
|
||||||
dbesc($key)
|
dbesc($key)
|
||||||
|
|
|
@ -166,7 +166,8 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
@$db->q($sql_config);
|
@$db->q($sql_config);
|
||||||
|
|
||||||
// MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
|
// MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
|
||||||
if (version_compare($db->server_info(), '5.7.4') >= 0) {
|
if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
|
||||||
|
!(strpos($db->server_info(), 'MariaDB') !== false)) {
|
||||||
$ignore = '';
|
$ignore = '';
|
||||||
}else {
|
}else {
|
||||||
$ignore = ' IGNORE';
|
$ignore = ' IGNORE';
|
||||||
|
@ -196,7 +197,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
|
if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
|
||||||
$sql2=db_drop_index($indexname);
|
$sql2=db_drop_index($indexname);
|
||||||
if ($sql3 == "")
|
if ($sql3 == "")
|
||||||
$sql3 = "ALTER TABLE `".$name."` ".$sql2;
|
$sql3 = "ALTER".$ignore." TABLE `".$name."` ".$sql2;
|
||||||
else
|
else
|
||||||
$sql3 .= ", ".$sql2;
|
$sql3 .= ", ".$sql2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('UPDATE_VERSION' , 1205);
|
define('UPDATE_VERSION' , 1206);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue