Merge branch 'develop' into MySQL5.7
This commit is contained in:
commit
6b250d3ae9
32 changed files with 326 additions and 194 deletions
|
@ -502,7 +502,7 @@ function acl_lookup(App $a, $out_type = 'json') {
|
|||
INNER JOIN `group_member` ON `group_member`.`gid`=`group`.`id` AND `group_member`.`uid` = `group`.`uid`
|
||||
WHERE NOT `group`.`deleted` AND `group`.`uid` = %d
|
||||
$sql_extra
|
||||
GROUP BY `group`.`name`
|
||||
GROUP BY `group`.`name`, `group`.`id`
|
||||
ORDER BY `group`.`name`
|
||||
LIMIT %d,%d",
|
||||
intval(local_user()),
|
||||
|
@ -610,46 +610,50 @@ function acl_lookup(App $a, $out_type = 'json') {
|
|||
$items = array_merge($groups, $contacts);
|
||||
|
||||
if ($conv_id) {
|
||||
/* if $conv_id is set, get unknow contacts in thread */
|
||||
/* but first get know contacts url to filter them out */
|
||||
function _contact_link($i){ return dbesc($i['link']); }
|
||||
$known_contacts = array_map(_contact_link, $contacts);
|
||||
$unknow_contacts=array();
|
||||
$r = q("SELECT `author-avatar`,`author-name`,`author-link`
|
||||
/*
|
||||
* if $conv_id is set, get unknown contacts in thread
|
||||
* but first get known contacts url to filter them out
|
||||
*/
|
||||
$known_contacts = array_map(
|
||||
function ($i) {
|
||||
return dbesc($i['link']);
|
||||
}
|
||||
, $contacts);
|
||||
|
||||
$unknown_contacts = array();
|
||||
$r = q("SELECT `author-link`
|
||||
FROM `item` WHERE `parent` = %d
|
||||
AND (`author-name` LIKE '%%%s%%' OR `author-link` LIKE '%%%s%%')
|
||||
AND `author-link` NOT IN ('%s')
|
||||
GROUP BY `author-link`
|
||||
GROUP BY `author-link`, `author-avatar`, `author-name`
|
||||
ORDER BY `author-name` ASC
|
||||
",
|
||||
intval($conv_id),
|
||||
dbesc($search),
|
||||
dbesc($search),
|
||||
implode("','", $known_contacts)
|
||||
implode("', '", $known_contacts)
|
||||
);
|
||||
if (dbm::is_result($r)){
|
||||
if (dbm::is_result($r)) {
|
||||
foreach ($r as $row) {
|
||||
// nickname..
|
||||
$up = parse_url($row['author-link']);
|
||||
$nick = explode("/",$up['path']);
|
||||
$nick = $nick[count($nick)-1];
|
||||
$nick .= "@".$up['host'];
|
||||
// /nickname
|
||||
$unknow_contacts[] = array(
|
||||
'type' => 'c',
|
||||
'photo' => proxy_url($row['author-avatar'], false, PROXY_SIZE_MICRO),
|
||||
'name' => htmlentities($row['author-name']),
|
||||
'id' => '',
|
||||
'network' => 'unknown',
|
||||
'link' => $row['author-link'],
|
||||
'nick' => htmlentities($nick),
|
||||
'forum' => false
|
||||
);
|
||||
$contact = get_contact_details_by_url($row['author-link']);
|
||||
|
||||
if (count($contact) > 0) {
|
||||
$unknown_contacts[] = array(
|
||||
'type' => 'c',
|
||||
'photo' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO),
|
||||
'name' => htmlentities($contact['name']),
|
||||
'id' => intval($contact['cid']),
|
||||
'network' => $contact['network'],
|
||||
'link' => $contact['url'],
|
||||
'nick' => htmlentities($contact['nick'] ? : $contact['addr']),
|
||||
'forum' => $contact['forum']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$items = array_merge($items, $unknow_contacts);
|
||||
$tot += count($unknow_contacts);
|
||||
$items = array_merge($items, $unknown_contacts);
|
||||
$tot += count($unknown_contacts);
|
||||
}
|
||||
|
||||
$results = array(
|
||||
|
|
|
@ -3064,7 +3064,7 @@ use \Friendica\Core\Config;
|
|||
function api_fr_photos_list($type) {
|
||||
if (api_user()===false) throw new ForbiddenException();
|
||||
$r = q("select `resource-id`, max(scale) as scale, album, filename, type from photo
|
||||
where uid = %d and album != 'Contact Photos' group by `resource-id`",
|
||||
where uid = %d and album != 'Contact Photos' group by `resource-id`, album, filename, type",
|
||||
intval(local_user())
|
||||
);
|
||||
$typetoext = array(
|
||||
|
@ -3099,11 +3099,14 @@ use \Friendica\Core\Config;
|
|||
|
||||
$scale = (x($_REQUEST, 'scale') ? intval($_REQUEST['scale']) : false);
|
||||
$scale_sql = ($scale === false ? "" : sprintf("and scale=%d",intval($scale)));
|
||||
$data_sql = ($scale === false ? "" : "data, ");
|
||||
$data_sql = ($scale === false ? "" : "ANY_VALUE(data) AS data,");
|
||||
|
||||
$r = q("select %s `resource-id`, `created`, `edited`, `title`, `desc`, `album`, `filename`,
|
||||
`type`, `height`, `width`, `datasize`, `profile`, min(`scale`) as minscale, max(`scale`) as maxscale
|
||||
from photo where `uid` = %d and `resource-id` = '%s' %s group by `resource-id`",
|
||||
$r = q("select %s ANY_VALUE(`resource-id`) AS `resource-id`, ANY_VALUE(`created`) AS `created`,
|
||||
ANY_VALUE(`edited`) AS `edited`, ANY_VALUE(`title`) AS `title`, ANY_VALUE(`desc`) AS `desc`,
|
||||
ANY_VALUE(`album`) AS `album`, ANY_VALUE(`filename`) AS `filename`, ANY_VALUE(`type`) AS `type`,
|
||||
ANY_VALUE(`height`) AS `height`, ANY_VALUE(`width`) AS `width`, ANY_VALUE(`datasize`) AS `datasize`,
|
||||
ANY_VALUE(`profile`) AS `profile`, min(`scale`) as minscale, max(`scale`) as maxscale
|
||||
from photo where `uid` = %d and `resource-id` = '%s' %s",
|
||||
$data_sql,
|
||||
intval(local_user()),
|
||||
dbesc($_REQUEST['photo_id']),
|
||||
|
|
|
@ -20,6 +20,7 @@ class dba {
|
|||
private $driver;
|
||||
public $connected = false;
|
||||
public $error = false;
|
||||
private $_server_info = '';
|
||||
|
||||
function __construct($server, $user, $pass, $db, $install = false) {
|
||||
$a = get_app();
|
||||
|
@ -103,18 +104,20 @@ class dba {
|
|||
* @return string
|
||||
*/
|
||||
public function server_info() {
|
||||
switch ($this->driver) {
|
||||
case 'pdo':
|
||||
$version = $this->db->getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||
break;
|
||||
case 'mysqli':
|
||||
$version = $this->db->server_info;
|
||||
break;
|
||||
case 'mysql':
|
||||
$version = mysql_get_server_info($this->db);
|
||||
break;
|
||||
if ($this->_server_info == '') {
|
||||
switch ($this->driver) {
|
||||
case 'pdo':
|
||||
$this->_server_info = $this->db->getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||
break;
|
||||
case 'mysqli':
|
||||
$this->_server_info = $this->db->server_info;
|
||||
break;
|
||||
case 'mysql':
|
||||
$this->_server_info = mysql_get_server_info($this->db);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $version;
|
||||
return $this->_server_info;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -474,6 +477,26 @@ class dba {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Replaces ANY_VALUE() function by MIN() function,
|
||||
* if the database server does not support ANY_VALUE().
|
||||
*
|
||||
* Considerations for Standard SQL, or MySQL with ONLY_FULL_GROUP_BY (default since 5.7.5).
|
||||
* ANY_VALUE() is available from MySQL 5.7.5 https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html
|
||||
* A standard fall-back is to use MIN().
|
||||
*
|
||||
* @param string $sql An SQL string without the values
|
||||
* @return string The input SQL string modified if necessary.
|
||||
*/
|
||||
public function any_value_fallback($sql) {
|
||||
$server_info = $this->server_info();
|
||||
if (version_compare($server_info, '5.7.5', '<') ||
|
||||
(stripos($server_info, 'MariaDB') !== false)) {
|
||||
$sql = str_ireplace('ANY_VALUE(', 'MIN(', $sql);
|
||||
}
|
||||
return $sql;
|
||||
}
|
||||
}
|
||||
|
||||
function printable($s) {
|
||||
|
@ -514,6 +537,7 @@ function q($sql) {
|
|||
unset($args[0]);
|
||||
|
||||
if ($db && $db->connected) {
|
||||
$sql = $db->any_value_fallback($sql);
|
||||
$stmt = @vsprintf($sql,$args); // Disabled warnings
|
||||
//logger("dba: q: $stmt", LOGGER_ALL);
|
||||
if ($stmt === false)
|
||||
|
@ -550,6 +574,7 @@ function qu($sql) {
|
|||
unset($args[0]);
|
||||
|
||||
if ($db && $db->connected) {
|
||||
$sql = $db->any_value_fallback($sql);
|
||||
$stmt = @vsprintf($sql,$args); // Disabled warnings
|
||||
if ($stmt === false)
|
||||
logger('dba: vsprintf error: ' . print_r(debug_backtrace(),true), LOGGER_DEBUG);
|
||||
|
|
|
@ -78,8 +78,18 @@ function update_fail($update_id, $error_message){
|
|||
function table_structure($table) {
|
||||
$structures = q("DESCRIBE `%s`", $table);
|
||||
|
||||
$full_columns = q("SHOW FULL COLUMNS FROM `%s`", $table);
|
||||
|
||||
$indexes = q("SHOW INDEX FROM `%s`", $table);
|
||||
|
||||
$table_status = q("SHOW TABLE STATUS WHERE `name` = '%s'", $table);
|
||||
|
||||
if (dbm::is_result($table_status)) {
|
||||
$table_status = $table_status[0];
|
||||
} else {
|
||||
$table_status = array();
|
||||
}
|
||||
|
||||
$fielddata = array();
|
||||
$indexdata = array();
|
||||
|
||||
|
@ -104,7 +114,6 @@ function table_structure($table) {
|
|||
|
||||
$indexdata[$index["Key_name"]][] = $column;
|
||||
}
|
||||
|
||||
if (dbm::is_result($structures)) {
|
||||
foreach ($structures AS $field) {
|
||||
$fielddata[$field["Field"]]["type"] = $field["Type"];
|
||||
|
@ -125,10 +134,16 @@ function table_structure($table) {
|
|||
}
|
||||
}
|
||||
}
|
||||
return(array("fields"=>$fielddata, "indexes"=>$indexdata));
|
||||
if (dbm::is_result($full_columns)) {
|
||||
foreach ($full_columns AS $column) {
|
||||
$fielddata[$column["Field"]]["Collation"] = $column["Collation"];
|
||||
}
|
||||
}
|
||||
|
||||
return array("fields" => $fielddata, "indexes" => $indexdata, "table_status" => $table_status);
|
||||
}
|
||||
|
||||
function print_structure($database, $charset) {
|
||||
function print_structure($database) {
|
||||
echo "-- ------------------------------------------\n";
|
||||
echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
|
||||
echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
|
||||
|
@ -137,7 +152,7 @@ function print_structure($database, $charset) {
|
|||
echo "--\n";
|
||||
echo "-- TABLE $name\n";
|
||||
echo "--\n";
|
||||
db_create_table($name, $structure['fields'], $charset, true, false, $structure["indexes"]);
|
||||
db_create_table($name, $structure['fields'], true, false, $structure["indexes"]);
|
||||
|
||||
echo "\n";
|
||||
}
|
||||
|
@ -148,13 +163,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
|||
|
||||
if ($action) {
|
||||
Config::set('system', 'maintenance', 1);
|
||||
Config::set('system', 'maintenance_reason', 'Database update');
|
||||
}
|
||||
|
||||
if (isset($a->config["system"]["db_charset"])) {
|
||||
$charset = $a->config["system"]["db_charset"];
|
||||
} else {
|
||||
$charset = "utf8";
|
||||
Config::set('system', 'maintenance_reason', sprintf(t(': Database update'), dbm::date().' '.date('e')));
|
||||
}
|
||||
|
||||
$errors = false;
|
||||
|
@ -168,16 +177,18 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
|||
$tables = q("SHOW TABLES");
|
||||
}
|
||||
|
||||
foreach ($tables AS $table) {
|
||||
$table = current($table);
|
||||
if (dbm::is_result($tables)) {
|
||||
foreach ($tables AS $table) {
|
||||
$table = current($table);
|
||||
|
||||
logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
|
||||
$database[$table] = table_structure($table);
|
||||
logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
|
||||
$database[$table] = table_structure($table);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the definition
|
||||
if (is_null($definition)) {
|
||||
$definition = db_definition($charset);
|
||||
$definition = db_definition();
|
||||
}
|
||||
|
||||
// MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
|
||||
|
@ -194,7 +205,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
|||
$group_by = "";
|
||||
$sql3 = "";
|
||||
if (!isset($database[$name])) {
|
||||
$r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']);
|
||||
$r = db_create_table($name, $structure["fields"], $verbose, $action, $structure['indexes']);
|
||||
if (!dbm::is_result($r)) {
|
||||
$errors .= t('Errors encountered creating database tables.').$name.EOL;
|
||||
}
|
||||
|
@ -252,17 +263,25 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
|||
}
|
||||
} else {
|
||||
// Compare the field definition
|
||||
$current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
|
||||
$new_field_definition = implode(",",$parameters);
|
||||
$field_definition = $database[$name]["fields"][$fieldname];
|
||||
|
||||
// Define the default collation if not given
|
||||
if (!isset($parameters['Collation']) AND !is_null($field_definition['Collation'])) {
|
||||
$parameters['Collation'] = 'utf8mb4_general_ci';
|
||||
} else {
|
||||
$parameters['Collation'] = null;
|
||||
}
|
||||
|
||||
$current_field_definition = implode(",", $field_definition);
|
||||
$new_field_definition = implode(",", $parameters);
|
||||
if ($current_field_definition != $new_field_definition) {
|
||||
$sql2=db_modify_table_field($fieldname, $parameters);
|
||||
$sql2 = db_modify_table_field($fieldname, $parameters);
|
||||
if ($sql3 == "") {
|
||||
$sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
|
||||
} else {
|
||||
$sql3 .= ", ".$sql2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -288,10 +307,23 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
|||
$group_by = db_group_by($indexname, $fieldnames);
|
||||
}
|
||||
if ($sql2 != "") {
|
||||
if ($sql3 == "")
|
||||
if ($sql3 == "") {
|
||||
$sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
|
||||
else
|
||||
} else {
|
||||
$sql3 .= ", ".$sql2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($database[$name]["table_status"]["Collation"])) {
|
||||
if ($database[$name]["table_status"]["Collation"] != 'utf8mb4_general_ci') {
|
||||
$sql2 = "DEFAULT COLLATE utf8mb4_general_ci";
|
||||
|
||||
if ($sql3 == "") {
|
||||
$sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
|
||||
} else {
|
||||
$sql3 .= ", ".$sql2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -323,6 +355,8 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
|||
}
|
||||
|
||||
if ($action) {
|
||||
Config::set('system', 'maintenance_reason', sprintf(t('%s: updating %s table.'), dbm::date().' '.date('e'), $name));
|
||||
|
||||
// Ensure index conversion to unique removes duplicates
|
||||
if ($is_unique) {
|
||||
if ($ignore != "") {
|
||||
|
@ -376,6 +410,10 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
|||
function db_field_command($parameters, $create = true) {
|
||||
$fieldstruct = $parameters["type"];
|
||||
|
||||
if (!is_null($parameters["Collation"])) {
|
||||
$fieldstruct .= " COLLATE ".$parameters["Collation"];
|
||||
}
|
||||
|
||||
if ($parameters["not null"])
|
||||
$fieldstruct .= " NOT NULL";
|
||||
|
||||
|
@ -395,7 +433,7 @@ function db_field_command($parameters, $create = true) {
|
|||
return($fieldstruct);
|
||||
}
|
||||
|
||||
function db_create_table($name, $fields, $charset, $verbose, $action, $indexes=null) {
|
||||
function db_create_table($name, $fields, $verbose, $action, $indexes=null) {
|
||||
global $a, $db;
|
||||
|
||||
$r = true;
|
||||
|
@ -420,7 +458,7 @@ function db_create_table($name, $fields, $charset, $verbose, $action, $indexes=n
|
|||
|
||||
$sql = implode(",\n\t", $sql_rows);
|
||||
|
||||
$sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=".$charset;
|
||||
$sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT COLLATE utf8mb4_general_ci";
|
||||
if ($verbose)
|
||||
echo $sql.";\n";
|
||||
|
||||
|
@ -503,18 +541,7 @@ function db_group_by($indexname, $fieldnames) {
|
|||
return $sql;
|
||||
}
|
||||
|
||||
function db_index_suffix($charset, $reduce = 0) {
|
||||
if ($charset != "utf8mb4") {
|
||||
return "";
|
||||
}
|
||||
|
||||
// On utf8mb4 indexes can only have a length of 191
|
||||
$indexlength = 191 - $reduce;
|
||||
|
||||
return "(".$indexlength.")";
|
||||
}
|
||||
|
||||
function db_definition($charset) {
|
||||
function db_definition() {
|
||||
|
||||
$database = array();
|
||||
|
||||
|
@ -671,7 +698,7 @@ function db_definition($charset) {
|
|||
"writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
|
||||
"contact-type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
|
||||
|
@ -1658,9 +1685,7 @@ function dbstructure_run(&$argv, &$argc) {
|
|||
set_config('system','build',DB_UPDATE_VERSION);
|
||||
return;
|
||||
case "dumpsql":
|
||||
// For the dump that is used to create the database.sql we always assume utfmb4
|
||||
$charset = "utf8mb4";
|
||||
print_structure(db_definition($charset), $charset);
|
||||
print_structure(db_definition());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -516,7 +516,8 @@ function notifier_run(&$argv, &$argc){
|
|||
$r0 = Diaspora::relay_list();
|
||||
}
|
||||
|
||||
$r1 = q("SELECT DISTINCT(`batch`), `id`, `name`,`network` FROM `contact` WHERE `network` = '%s'
|
||||
$r1 = q("SELECT `batch`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`name`) AS `name`, ANY_VALUE(`network`) AS `network`
|
||||
FROM `contact` WHERE `network` = '%s'
|
||||
AND `uid` = %d AND `rel` != %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` GROUP BY `batch` ORDER BY rand()",
|
||||
dbesc(NETWORK_DIASPORA),
|
||||
intval($owner['uid']),
|
||||
|
|
|
@ -720,11 +720,11 @@ class ostatus {
|
|||
$conversations = q("SELECT `term`.`oid`, `term`.`url`, `term`.`uid` FROM `term`
|
||||
STRAIGHT_JOIN `thread` ON `thread`.`iid` = `term`.`oid` AND `thread`.`uid` = `term`.`uid`
|
||||
WHERE `term`.`type` = 7 AND `term`.`term` > '%s' AND `thread`.`mention`
|
||||
GROUP BY `term`.`url`, `term`.`uid` ORDER BY `term`.`term` DESC", dbesc($start));
|
||||
GROUP BY `term`.`url`, `term`.`uid`, `term`.`oid`, `term`.`term` ORDER BY `term`.`term` DESC", dbesc($start));
|
||||
} else {
|
||||
$conversations = q("SELECT `oid`, `url`, `uid` FROM `term`
|
||||
WHERE `type` = 7 AND `term` > '%s'
|
||||
GROUP BY `url`, `uid` ORDER BY `term` DESC", dbesc($start));
|
||||
GROUP BY `url`, `uid`, `oid`, `term` ORDER BY `term` DESC", dbesc($start));
|
||||
}
|
||||
|
||||
foreach ($conversations AS $conversation) {
|
||||
|
|
|
@ -48,7 +48,7 @@ function photo_albums($uid, $update = false) {
|
|||
if (!Config::get('system', 'no_count', false)) {
|
||||
/// @todo This query needs to be renewed. It is really slow
|
||||
// At this time we just store the data in the cache
|
||||
$albums = qu("SELECT COUNT(DISTINCT `resource-id`) AS `total`, `album`
|
||||
$albums = qu("SELECT COUNT(DISTINCT `resource-id`) AS `total`, `album`, ANY_VALUE(`created`) AS `created`
|
||||
FROM `photo`
|
||||
WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra
|
||||
GROUP BY `album` ORDER BY `created` DESC",
|
||||
|
@ -59,9 +59,8 @@ function photo_albums($uid, $update = false) {
|
|||
} else {
|
||||
// This query doesn't do the count and is much faster
|
||||
$albums = qu("SELECT DISTINCT(`album`), '' AS `total`
|
||||
FROM `photo`
|
||||
WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra
|
||||
GROUP BY `album` ORDER BY `created` DESC",
|
||||
FROM `photo` USE INDEX (`uid_album_scale_created`)
|
||||
WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra",
|
||||
intval($uid),
|
||||
dbesc('Contact Photos'),
|
||||
dbesc(t('Contact Photos'))
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* @todo Detect if it is a forum
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
|
||||
require_once('include/datetime.php');
|
||||
require_once("include/Scrape.php");
|
||||
require_once("include/network.php");
|
||||
|
@ -1656,6 +1658,20 @@ function poco_discover_federation() {
|
|||
}
|
||||
}
|
||||
|
||||
// Disvover Mastodon servers
|
||||
if (!Config::get('system','ostatus_disabled')) {
|
||||
$serverdata = fetch_url("https://instances.mastodon.xyz/instances.json");
|
||||
|
||||
if ($serverdata) {
|
||||
$servers = json_decode($serverdata);
|
||||
|
||||
foreach ($servers AS $server) {
|
||||
$url = (is_null($server->https_score) ? 'http' : 'https').'://'.$server->name;
|
||||
proc_run(PRIORITY_LOW, "include/discover_poco.php", "server", base64_encode($url));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Currently disabled, since the service isn't available anymore.
|
||||
// It is not removed since I hope that there will be a successor.
|
||||
// Discover GNU Social Servers.
|
||||
|
@ -2096,7 +2112,7 @@ function update_gcontact($contact) {
|
|||
fix_alternate_contact_address($contact);
|
||||
|
||||
if (!isset($contact["updated"]))
|
||||
$contact["updated"] = datetime_convert();
|
||||
$contact["updated"] = dbm::date();
|
||||
|
||||
if ($contact["server_url"] == "") {
|
||||
$server_url = $contact["url"];
|
||||
|
@ -2151,7 +2167,7 @@ function update_gcontact($contact) {
|
|||
dbesc($contact["gender"]), dbesc($contact["keywords"]), intval($contact["hide"]),
|
||||
intval($contact["nsfw"]), intval($contact["contact-type"]), dbesc($contact["alias"]),
|
||||
dbesc($contact["notify"]), dbesc($contact["url"]), dbesc($contact["location"]),
|
||||
dbesc($contact["about"]), intval($contact["generation"]), dbesc($contact["updated"]),
|
||||
dbesc($contact["about"]), intval($contact["generation"]), dbesc(dbm::date($contact["updated"])),
|
||||
dbesc($contact["server_url"]), dbesc($contact["connect"]),
|
||||
dbesc(normalise_link($contact["url"])), intval($contact["generation"]));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue