mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-16 20:05:14 +02:00
Rename Friendica\Database\dba to Friendica\Database\DBA
This commit is contained in:
parent
b6a1df0598
commit
af6dbc654f
127 changed files with 1169 additions and 1169 deletions
12
src/App.php
12
src/App.php
|
@ -10,7 +10,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'boot.php';
|
||||
|
@ -490,13 +490,13 @@ class App
|
|||
|
||||
$this->mode |= App::MODE_LOCALCONFIGPRESENT;
|
||||
|
||||
if (!dba::connected()) {
|
||||
if (!DBA::connected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->mode |= App::MODE_DBAVAILABLE;
|
||||
|
||||
if (dba::fetch_first("SHOW TABLES LIKE 'config'") === false) {
|
||||
if (DBA::fetch_first("SHOW TABLES LIKE 'config'") === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,7 @@ class App
|
|||
|
||||
public function loadDatabase()
|
||||
{
|
||||
if (dba::connected()) {
|
||||
if (DBA::connected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -542,7 +542,7 @@ class App
|
|||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
dba::connect($db_host, $db_user, $db_pass, $db_data, $charset);
|
||||
DBA::connect($db_host, $db_user, $db_pass, $db_data, $charset);
|
||||
unset($db_host, $db_user, $db_pass, $db_data, $charset);
|
||||
|
||||
$this->save_timestamp($stamp1, 'network');
|
||||
|
@ -1383,7 +1383,7 @@ class App
|
|||
if ($this->profile_uid && ($this->profile_uid != local_user())) {
|
||||
// Allow folks to override user themes and always use their own on their own site.
|
||||
// This works only if the user is on the same server
|
||||
$user = dba::selectFirst('user', ['theme'], ['uid' => $this->profile_uid]);
|
||||
$user = DBA::selectFirst('user', ['theme'], ['uid' => $this->profile_uid]);
|
||||
if (DBM::is_result($user) && !PConfig::get(local_user(), 'system', 'always_my_theme')) {
|
||||
$page_theme = $user['theme'];
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Friendica\Content;
|
|||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
/**
|
||||
|
@ -26,8 +26,8 @@ class ContactSelector
|
|||
|
||||
$o .= "<select id=\"contact-profile-selector\" class=\"form-control\" $disabled name=\"profile-assign\" >\r\n";
|
||||
|
||||
$s = dba::select('profile', ['id', 'profile-name', 'is-default'], ['uid' => $_SESSION['uid']]);
|
||||
$r = dba::inArray($s);
|
||||
$s = DBA::select('profile', ['id', 'profile-name', 'is-default'], ['uid' => $_SESSION['uid']]);
|
||||
$r = DBA::inArray($s);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
foreach ($r as $rr) {
|
||||
|
@ -102,7 +102,7 @@ class ContactSelector
|
|||
$networkname = str_replace($search, $replace, $s);
|
||||
|
||||
if ((in_array($s, [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) && ($profile != "")) {
|
||||
$r = dba::fetch_first("SELECT `gserver`.`platform` FROM `gcontact`
|
||||
$r = DBA::fetch_first("SELECT `gserver`.`platform` FROM `gcontact`
|
||||
INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url`
|
||||
WHERE `gcontact`.`nurl` = ? AND `platform` != ''", normalise_link($profile));
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Friendica\Content;
|
|||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
|
||||
|
@ -45,7 +45,7 @@ class ForumManager
|
|||
$select = '(`forum` OR `prv`)';
|
||||
}
|
||||
|
||||
$contacts = dba::p(
|
||||
$contacts = DBA::p(
|
||||
"SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro`, `contact`.`thumb`
|
||||
FROM `contact`
|
||||
WHERE `network`= 'dfrn' AND $select AND `uid` = ?
|
||||
|
@ -59,7 +59,7 @@ class ForumManager
|
|||
return($forumlist);
|
||||
}
|
||||
|
||||
while ($contact = dba::fetch($contacts)) {
|
||||
while ($contact = DBA::fetch($contacts)) {
|
||||
$forumlist[] = [
|
||||
'url' => $contact['url'],
|
||||
'name' => $contact['name'],
|
||||
|
@ -68,7 +68,7 @@ class ForumManager
|
|||
'thumb' => $contact['thumb'],
|
||||
];
|
||||
}
|
||||
dba::close($contacts);
|
||||
DBA::close($contacts);
|
||||
|
||||
return($forumlist);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Profile;
|
||||
|
||||
|
@ -105,7 +105,7 @@ class Nav
|
|||
$nav['usermenu'][] = ['notes/', L10n::t('Personal notes'), '', L10n::t('Your personal notes')];
|
||||
|
||||
// user info
|
||||
$contact = dba::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
|
||||
$contact = DBA::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
|
||||
$userinfo = [
|
||||
'icon' => (DBM::is_result($contact) ? $a->remove_baseurl($contact['micro']) : 'images/person-48.jpg'),
|
||||
'name' => $a->user['username'],
|
||||
|
|
|
@ -15,7 +15,7 @@ use Friendica\Core\Cache;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -63,7 +63,7 @@ class OEmbed
|
|||
$a = get_app();
|
||||
|
||||
$condition = ['url' => normalise_link($embedurl), 'maxwidth' => $a->videowidth];
|
||||
$oembed = dba::selectFirst('oembed', ['content'], $condition);
|
||||
$oembed = DBA::selectFirst('oembed', ['content'], $condition);
|
||||
if (DBM::is_result($oembed)) {
|
||||
$txt = $oembed["content"];
|
||||
} else {
|
||||
|
@ -110,7 +110,7 @@ class OEmbed
|
|||
} else { //save in cache
|
||||
$j = json_decode($txt);
|
||||
if (!empty($j->type) && $j->type != "error") {
|
||||
dba::insert('oembed', [
|
||||
DBA::insert('oembed', [
|
||||
'url' => normalise_link($embedurl),
|
||||
'maxwidth' => $a->videowidth,
|
||||
'content' => $txt,
|
||||
|
|
|
@ -11,7 +11,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
|
@ -143,18 +143,18 @@ class Widget
|
|||
|
||||
$extra_sql = self::unavailableNetworks();
|
||||
|
||||
$r = dba::p("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = ? AND `network` != '' $extra_sql ORDER BY `network`",
|
||||
$r = DBA::p("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = ? AND `network` != '' $extra_sql ORDER BY `network`",
|
||||
local_user()
|
||||
);
|
||||
|
||||
$nets = array();
|
||||
while ($rr = dba::fetch($r)) {
|
||||
while ($rr = DBA::fetch($r)) {
|
||||
/// @TODO If 'network' is not there, this triggers an E_NOTICE
|
||||
if ($rr['network']) {
|
||||
$nets[] = array('ref' => $rr['network'], 'name' => ContactSelector::networkToName($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' ));
|
||||
}
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
|
||||
if (count($nets) < 2) {
|
||||
return '';
|
||||
|
@ -275,12 +275,12 @@ class Widget
|
|||
|
||||
if (!$cid) {
|
||||
if (Profile::getMyURL()) {
|
||||
$contact = dba::selectFirst('contact', ['id'],
|
||||
$contact = DBA::selectFirst('contact', ['id'],
|
||||
['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $profile_uid]);
|
||||
if (DBM::is_result($contact)) {
|
||||
$cid = $contact['id'];
|
||||
} else {
|
||||
$gcontact = dba::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
|
||||
$gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
|
||||
if (DBM::is_result($gcontact)) {
|
||||
$zcid = $gcontact['id'];
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Friendica\Content\Widget;
|
|||
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -38,7 +38,7 @@ class TagCloud
|
|||
$o = '';
|
||||
$r = self::tagadelic($uid, $count, $owner_id, $flags, $type);
|
||||
if (count($r)) {
|
||||
$contact = dba::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||
$contact = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||
$url = System::removedBaseUrl($contact['url']);
|
||||
|
||||
foreach ($r as $rr) {
|
||||
|
@ -88,7 +88,7 @@ class TagCloud
|
|||
}
|
||||
|
||||
// Fetch tags
|
||||
$r = dba::p("SELECT `term`, COUNT(`term`) AS `total` FROM `term`
|
||||
$r = DBA::p("SELECT `term`, COUNT(`term`) AS `total` FROM `term`
|
||||
LEFT JOIN `item` ON `term`.`oid` = `item`.`id`
|
||||
WHERE `term`.`uid` = ? AND `term`.`type` = ?
|
||||
AND `term`.`otype` = ?
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Friendica\Core;
|
|||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
|
@ -100,13 +100,13 @@ class ACL extends BaseObject
|
|||
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" $tabindex >\r\n";
|
||||
}
|
||||
|
||||
$stmt = dba::p("SELECT `id`, `name`, `url`, `network` FROM `contact`
|
||||
$stmt = DBA::p("SELECT `id`, `name`, `url`, `network` FROM `contact`
|
||||
WHERE `uid` = ? AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
|
||||
$sql_extra
|
||||
ORDER BY `name` ASC ", intval(local_user())
|
||||
);
|
||||
|
||||
$contacts = dba::inArray($stmt);
|
||||
$contacts = DBA::inArray($stmt);
|
||||
|
||||
$arr = ['contact' => $contacts, 'entry' => $o];
|
||||
|
||||
|
@ -165,13 +165,13 @@ class ACL extends BaseObject
|
|||
|
||||
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\"$tabindex_attr$hidepreselected>\r\n";
|
||||
|
||||
$stmt = dba::p("SELECT `id`, `name`, `url`, `network` FROM `contact`
|
||||
$stmt = DBA::p("SELECT `id`, `name`, `url`, `network` FROM `contact`
|
||||
WHERE `uid` = ? AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
|
||||
$sql_extra
|
||||
ORDER BY `name` ASC ", intval(local_user())
|
||||
);
|
||||
|
||||
$contacts = dba::inArray($stmt);
|
||||
$contacts = DBA::inArray($stmt);
|
||||
|
||||
$arr = ['contact' => $contacts, 'entry' => $o];
|
||||
|
||||
|
@ -268,7 +268,7 @@ class ACL extends BaseObject
|
|||
$pubmail_enabled = false;
|
||||
|
||||
if (!$imap_disabled) {
|
||||
$mailacct = dba::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', local_user()]);
|
||||
$mailacct = DBA::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', local_user()]);
|
||||
if (DBM::is_result($mailacct)) {
|
||||
$mail_enabled = true;
|
||||
$pubmail_enabled = !empty($mailacct['pubmail']);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -24,7 +24,7 @@ class Addon
|
|||
public static function uninstall($addon)
|
||||
{
|
||||
logger("Addons: uninstalling " . $addon);
|
||||
dba::delete('addon', ['name' => $addon]);
|
||||
DBA::delete('addon', ['name' => $addon]);
|
||||
|
||||
@include_once('addon/' . $addon . '/' . $addon . '.php');
|
||||
if (function_exists($addon . '_uninstall')) {
|
||||
|
@ -55,7 +55,7 @@ class Addon
|
|||
|
||||
$addon_admin = (function_exists($addon."_addon_admin") ? 1 : 0);
|
||||
|
||||
dba::insert('addon', ['name' => $addon, 'installed' => true,
|
||||
DBA::insert('addon', ['name' => $addon, 'installed' => true,
|
||||
'timestamp' => $t, 'plugin_admin' => $addon_admin]);
|
||||
|
||||
// we can add the following with the previous SQL
|
||||
|
@ -63,7 +63,7 @@ class Addon
|
|||
// This way the system won't fall over dead during the update.
|
||||
|
||||
if (file_exists('addon/' . $addon . '/.hidden')) {
|
||||
dba::update('addon', ['hidden' => true], ['name' => $addon]);
|
||||
DBA::update('addon', ['hidden' => true], ['name' => $addon]);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
|
@ -79,9 +79,9 @@ class Addon
|
|||
{
|
||||
$addons = Config::get('system', 'addon');
|
||||
if (strlen($addons)) {
|
||||
$r = dba::select('addon', [], ['installed' => 1]);
|
||||
$r = DBA::select('addon', [], ['installed' => 1]);
|
||||
if (DBM::is_result($r)) {
|
||||
$installed = dba::inArray($r);
|
||||
$installed = DBA::inArray($r);
|
||||
} else {
|
||||
$installed = [];
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ class Addon
|
|||
$func = $addon . '_install';
|
||||
$func();
|
||||
}
|
||||
dba::update('addon', ['timestamp' => $t], ['id' => $i['id']]);
|
||||
DBA::update('addon', ['timestamp' => $t], ['id' => $i['id']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class Addon
|
|||
*/
|
||||
public static function isEnabled($addon)
|
||||
{
|
||||
return dba::exists('addon', ['installed' => true, 'name' => $addon]);
|
||||
return DBA::exists('addon', ['installed' => true, 'name' => $addon]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -141,12 +141,12 @@ class Addon
|
|||
public static function registerHook($hook, $file, $function, $priority = 0)
|
||||
{
|
||||
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
|
||||
$exists = dba::exists('hook', $condition);
|
||||
$exists = DBA::exists('hook', $condition);
|
||||
if ($exists) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$r = dba::insert('hook', ['hook' => $hook, 'file' => $file, 'function' => $function, 'priority' => $priority]);
|
||||
$r = DBA::insert('hook', ['hook' => $hook, 'file' => $file, 'function' => $function, 'priority' => $priority]);
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ class Addon
|
|||
public static function unregisterHook($hook, $file, $function)
|
||||
{
|
||||
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
|
||||
$r = dba::delete('hook', $condition);
|
||||
$r = DBA::delete('hook', $condition);
|
||||
return $r;
|
||||
}
|
||||
|
||||
|
@ -173,15 +173,15 @@ class Addon
|
|||
{
|
||||
$a = get_app();
|
||||
$a->hooks = [];
|
||||
$r = dba::select('hook', ['hook', 'file', 'function'], [], ['order' => ['priority' => 'desc', 'file']]);
|
||||
$r = DBA::select('hook', ['hook', 'file', 'function'], [], ['order' => ['priority' => 'desc', 'file']]);
|
||||
|
||||
while ($rr = dba::fetch($r)) {
|
||||
while ($rr = DBA::fetch($r)) {
|
||||
if (! array_key_exists($rr['hook'], $a->hooks)) {
|
||||
$a->hooks[$rr['hook']] = [];
|
||||
}
|
||||
$a->hooks[$rr['hook']][] = [$rr['file'],$rr['function']];
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -245,7 +245,7 @@ class Addon
|
|||
} else {
|
||||
// remove orphan hooks
|
||||
$condition = ['hook' => $name, 'file' => $hook[0], 'function' => $hook[1]];
|
||||
dba::delete('hook', $condition, ['cascade' => false]);
|
||||
DBA::delete('hook', $condition, ['cascade' => false]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Core\Cache;
|
||||
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
|
@ -16,7 +16,7 @@ class DatabaseCacheDriver extends AbstractCacheDriver implements ICacheDriver
|
|||
{
|
||||
public function get($key)
|
||||
{
|
||||
$cache = dba::selectFirst('cache', ['v'], ['`k` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
|
||||
$cache = DBA::selectFirst('cache', ['v'], ['`k` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
|
||||
|
||||
if (DBM::is_result($cache)) {
|
||||
$cached = $cache['v'];
|
||||
|
@ -41,20 +41,20 @@ class DatabaseCacheDriver extends AbstractCacheDriver implements ICacheDriver
|
|||
'updated' => DateTimeFormat::utcNow()
|
||||
];
|
||||
|
||||
return dba::update('cache', $fields, ['k' => $key], true);
|
||||
return DBA::update('cache', $fields, ['k' => $key], true);
|
||||
}
|
||||
|
||||
public function delete($key)
|
||||
{
|
||||
return dba::delete('cache', ['k' => $key]);
|
||||
return DBA::delete('cache', ['k' => $key]);
|
||||
}
|
||||
|
||||
public function clear($outdated = true)
|
||||
{
|
||||
if ($outdated) {
|
||||
return dba::delete('cache', ['`expires` < NOW()']);
|
||||
return DBA::delete('cache', ['`expires` < NOW()']);
|
||||
} else {
|
||||
return dba::delete('cache', ['`k` IS NOT NULL ']);
|
||||
return DBA::delete('cache', ['`k` IS NOT NULL ']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace Friendica\Core\Config;
|
||||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -27,8 +27,8 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
|
|||
return;
|
||||
}
|
||||
|
||||
$configs = dba::select('config', ['v', 'k'], ['cat' => $cat]);
|
||||
while ($config = dba::fetch($configs)) {
|
||||
$configs = DBA::select('config', ['v', 'k'], ['cat' => $cat]);
|
||||
while ($config = DBA::fetch($configs)) {
|
||||
$k = $config['k'];
|
||||
|
||||
self::getApp()->setConfigValue($cat, $k, $config['v']);
|
||||
|
@ -38,7 +38,7 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
|
|||
$this->in_db[$cat][$k] = true;
|
||||
}
|
||||
}
|
||||
dba::close($configs);
|
||||
DBA::close($configs);
|
||||
}
|
||||
|
||||
public function get($cat, $k, $default_value = null, $refresh = false)
|
||||
|
@ -56,7 +56,7 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
|
|||
}
|
||||
}
|
||||
|
||||
$config = dba::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]);
|
||||
$config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]);
|
||||
if (DBM::is_result($config)) {
|
||||
// manage array value
|
||||
$value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
|
||||
|
@ -115,7 +115,7 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
|
|||
// manage array value
|
||||
$dbvalue = (is_array($value) ? serialize($value) : $dbvalue);
|
||||
|
||||
$result = dba::update('config', ['v' => $dbvalue], ['cat' => $cat, 'k' => $k], true);
|
||||
$result = DBA::update('config', ['v' => $dbvalue], ['cat' => $cat, 'k' => $k], true);
|
||||
|
||||
if ($result) {
|
||||
$this->in_db[$cat][$k] = true;
|
||||
|
@ -131,7 +131,7 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
|
|||
unset($this->in_db[$cat][$k]);
|
||||
}
|
||||
|
||||
$result = dba::delete('config', ['cat' => $cat, 'k' => $k]);
|
||||
$result = DBA::delete('config', ['cat' => $cat, 'k' => $k]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace Friendica\Core\Config;
|
||||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -22,9 +22,9 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter
|
|||
{
|
||||
$a = self::getApp();
|
||||
|
||||
$pconfigs = dba::select('pconfig', ['v', 'k'], ['cat' => $cat, 'uid' => $uid]);
|
||||
$pconfigs = DBA::select('pconfig', ['v', 'k'], ['cat' => $cat, 'uid' => $uid]);
|
||||
if (DBM::is_result($pconfigs)) {
|
||||
while ($pconfig = dba::fetch($pconfigs)) {
|
||||
while ($pconfig = DBA::fetch($pconfigs)) {
|
||||
$k = $pconfig['k'];
|
||||
|
||||
self::getApp()->setPConfigValue($uid, $cat, $k, $pconfig['v']);
|
||||
|
@ -35,7 +35,7 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter
|
|||
// Negative caching
|
||||
$a->config[$uid][$cat] = "!<unset>!";
|
||||
}
|
||||
dba::close($pconfigs);
|
||||
DBA::close($pconfigs);
|
||||
}
|
||||
|
||||
public function get($uid, $cat, $k, $default_value = null, $refresh = false)
|
||||
|
@ -58,7 +58,7 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter
|
|||
}
|
||||
}
|
||||
|
||||
$pconfig = dba::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
|
||||
$pconfig = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
|
||||
if (DBM::is_result($pconfig)) {
|
||||
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $pconfig['v']) ? unserialize($pconfig['v']) : $pconfig['v']);
|
||||
|
||||
|
@ -94,7 +94,7 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter
|
|||
// manage array value
|
||||
$dbvalue = (is_array($value) ? serialize($value) : $dbvalue);
|
||||
|
||||
$result = dba::update('pconfig', ['v' => $dbvalue], ['uid' => $uid, 'cat' => $cat, 'k' => $k], true);
|
||||
$result = DBA::update('pconfig', ['v' => $dbvalue], ['uid' => $uid, 'cat' => $cat, 'k' => $k], true);
|
||||
|
||||
if ($result) {
|
||||
$this->in_db[$uid][$cat][$k] = true;
|
||||
|
@ -111,7 +111,7 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter
|
|||
unset($this->in_db[$uid][$cat][$k]);
|
||||
}
|
||||
|
||||
$result = dba::delete('pconfig', ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
|
||||
$result = DBA::delete('pconfig', ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Friendica\Core\Config;
|
|||
|
||||
use Exception;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -31,11 +31,11 @@ class PreloadConfigAdapter extends BaseObject implements IConfigAdapter
|
|||
return;
|
||||
}
|
||||
|
||||
$configs = dba::select('config', ['cat', 'v', 'k']);
|
||||
while ($config = dba::fetch($configs)) {
|
||||
$configs = DBA::select('config', ['cat', 'v', 'k']);
|
||||
while ($config = DBA::fetch($configs)) {
|
||||
self::getApp()->setConfigValue($config['cat'], $config['k'], $config['v']);
|
||||
}
|
||||
dba::close($configs);
|
||||
DBA::close($configs);
|
||||
|
||||
$this->config_loaded = true;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class PreloadConfigAdapter extends BaseObject implements IConfigAdapter
|
|||
public function get($cat, $k, $default_value = null, $refresh = false)
|
||||
{
|
||||
if ($refresh) {
|
||||
$config = dba::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]);
|
||||
$config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]);
|
||||
if (DBM::is_result($config)) {
|
||||
self::getApp()->setConfigValue($cat, $k, $config['v']);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ class PreloadConfigAdapter extends BaseObject implements IConfigAdapter
|
|||
// manage array value
|
||||
$dbvalue = is_array($value) ? serialize($value) : $value;
|
||||
|
||||
$result = dba::update('config', ['v' => $dbvalue], ['cat' => $cat, 'k' => $k], true);
|
||||
$result = DBA::update('config', ['v' => $dbvalue], ['cat' => $cat, 'k' => $k], true);
|
||||
if (!$result) {
|
||||
throw new Exception('Unable to store config value in [' . $cat . '][' . $k . ']');
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ class PreloadConfigAdapter extends BaseObject implements IConfigAdapter
|
|||
{
|
||||
self::getApp()->deleteConfigValue($cat, $k);
|
||||
|
||||
$result = dba::delete('config', ['cat' => $cat, 'k' => $k]);
|
||||
$result = DBA::delete('config', ['cat' => $cat, 'k' => $k]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Friendica\Core\Config;
|
|||
|
||||
use Exception;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -35,11 +35,11 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
|
|||
return;
|
||||
}
|
||||
|
||||
$pconfigs = dba::select('pconfig', ['cat', 'v', 'k'], ['uid' => $uid]);
|
||||
while ($pconfig = dba::fetch($pconfigs)) {
|
||||
$pconfigs = DBA::select('pconfig', ['cat', 'v', 'k'], ['uid' => $uid]);
|
||||
while ($pconfig = DBA::fetch($pconfigs)) {
|
||||
self::getApp()->setPConfigValue($uid, $pconfig['cat'], $pconfig['k'], $pconfig['v']);
|
||||
}
|
||||
dba::close($pconfigs);
|
||||
DBA::close($pconfigs);
|
||||
|
||||
$this->config_loaded = true;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
|
|||
}
|
||||
|
||||
if ($refresh) {
|
||||
$config = dba::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
|
||||
$config = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
|
||||
if (DBM::is_result($config)) {
|
||||
self::getApp()->setPConfigValue($uid, $cat, $k, $config['v']);
|
||||
} else {
|
||||
|
@ -83,7 +83,7 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
|
|||
// manage array value
|
||||
$dbvalue = is_array($value) ? serialize($value) : $value;
|
||||
|
||||
$result = dba::update('pconfig', ['v' => $dbvalue], ['uid' => $uid, 'cat' => $cat, 'k' => $k], true);
|
||||
$result = DBA::update('pconfig', ['v' => $dbvalue], ['uid' => $uid, 'cat' => $cat, 'k' => $k], true);
|
||||
if (!$result) {
|
||||
throw new Exception('Unable to store config value in [' . $uid . '][' . $cat . '][' . $k . ']');
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
|
|||
|
||||
self::getApp()->deletePConfigValue($uid, $cat, $k);
|
||||
|
||||
$result = dba::delete('pconfig', ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
|
||||
$result = DBA::delete('pconfig', ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Friendica\Core\Console;
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
|
@ -61,12 +61,12 @@ HELP;
|
|||
}
|
||||
|
||||
$nurl = normalise_link($this->getArgument(0));
|
||||
if (!dba::exists('contact', ['nurl' => $nurl, 'archive' => false])) {
|
||||
if (!DBA::exists('contact', ['nurl' => $nurl, 'archive' => false])) {
|
||||
throw new RuntimeException(L10n::t('Could not find any unarchived contact entry for this URL (%s)', $nurl));
|
||||
}
|
||||
if (dba::update('contact', ['archive' => true], ['nurl' => $nurl])) {
|
||||
if (DBA::update('contact', ['archive' => true], ['nurl' => $nurl])) {
|
||||
$condition = ["`cid` IN (SELECT `id` FROM `contact` WHERE `archive`)"];
|
||||
dba::delete('queue', $condition);
|
||||
DBA::delete('queue', $condition);
|
||||
$this->out(L10n::t('The contact entries have been archived'));
|
||||
} else {
|
||||
throw new RuntimeException('The contact archival failed.');
|
||||
|
|
|
@ -7,7 +7,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Install;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use RuntimeException;
|
||||
|
||||
require_once 'mod/install.php';
|
||||
|
@ -155,7 +155,7 @@ HELP;
|
|||
);
|
||||
|
||||
|
||||
if (!dba::connect($db_host, $db_user, $db_pass, $db_data)) {
|
||||
if (!DBA::connect($db_host, $db_user, $db_pass, $db_data)) {
|
||||
$result['status'] = false;
|
||||
$result['help'] = 'Failed, please check your MySQL settings and credentials.';
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Core\Console;
|
||||
|
||||
use Friendica\Core;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
use RuntimeException;
|
||||
|
||||
|
@ -58,7 +58,7 @@ HELP;
|
|||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||
}
|
||||
|
||||
if (!dba::connected()) {
|
||||
if (!DBA::connected()) {
|
||||
throw new RuntimeException('Unable to connect to database');
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Core\Console;
|
||||
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Network\Probe;
|
||||
use RuntimeException;
|
||||
|
@ -81,9 +81,9 @@ HELP;
|
|||
}
|
||||
|
||||
$nurl = normalise_link($net['url']);
|
||||
$contact = dba::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]);
|
||||
$contact = DBA::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]);
|
||||
if (DBM::is_result($contact)) {
|
||||
dba::update("contact", ["hidden" => true], ["id" => $contact["id"]]);
|
||||
DBA::update("contact", ["hidden" => true], ["id" => $contact["id"]]);
|
||||
$this->out('NOTICE: The account should be silenced from the global community page');
|
||||
} else {
|
||||
throw new RuntimeException('NOTICE: Could not find any entry for this URL (' . $nurl . ')');
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Friendica\Core\Console;
|
|||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\User;
|
||||
use RuntimeException;
|
||||
|
@ -64,7 +64,7 @@ HELP;
|
|||
|
||||
$nick = $this->getArgument(0);
|
||||
|
||||
$user = dba::selectFirst('user', ['uid'], ['nickname' => $nick]);
|
||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nick]);
|
||||
if (!DBM::is_result($user)) {
|
||||
throw new RuntimeException(L10n::t('User not found'));
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
require_once 'boot.php';
|
||||
require_once 'include/dba.php';
|
||||
|
@ -111,8 +111,8 @@ class L10n extends BaseObject
|
|||
|
||||
$a->strings = [];
|
||||
// load enabled addons strings
|
||||
$addons = dba::select('addon', ['name'], ['installed' => true]);
|
||||
while ($p = dba::fetch($addons)) {
|
||||
$addons = DBA::select('addon', ['name'], ['installed' => true]);
|
||||
while ($p = DBA::fetch($addons)) {
|
||||
$name = $p['name'];
|
||||
if (file_exists("addon/$name/lang/$lang/strings.php")) {
|
||||
include "addon/$name/lang/$lang/strings.php";
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Core\Lock;
|
||||
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
|
@ -21,8 +21,8 @@ class DatabaseLockDriver extends AbstractLockDriver
|
|||
$start = time();
|
||||
|
||||
do {
|
||||
dba::lock('locks');
|
||||
$lock = dba::selectFirst('locks', ['locked', 'pid'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
|
||||
DBA::lock('locks');
|
||||
$lock = DBA::selectFirst('locks', ['locked', 'pid'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
|
||||
|
||||
if (DBM::is_result($lock)) {
|
||||
if ($lock['locked']) {
|
||||
|
@ -32,16 +32,16 @@ class DatabaseLockDriver extends AbstractLockDriver
|
|||
}
|
||||
}
|
||||
if (!$lock['locked']) {
|
||||
dba::update('locks', ['locked' => true, 'pid' => getmypid(), 'expires' => DateTimeFormat::utc('now + ' . $ttl . 'seconds')], ['name' => $key]);
|
||||
DBA::update('locks', ['locked' => true, 'pid' => getmypid(), 'expires' => DateTimeFormat::utc('now + ' . $ttl . 'seconds')], ['name' => $key]);
|
||||
$got_lock = true;
|
||||
}
|
||||
} else {
|
||||
dba::insert('locks', ['name' => $key, 'locked' => true, 'pid' => getmypid(), 'expires' => DateTimeFormat::utc('now + ' . $ttl . 'seconds')]);
|
||||
DBA::insert('locks', ['name' => $key, 'locked' => true, 'pid' => getmypid(), 'expires' => DateTimeFormat::utc('now + ' . $ttl . 'seconds')]);
|
||||
$got_lock = true;
|
||||
$this->markAcquire($key);
|
||||
}
|
||||
|
||||
dba::unlock();
|
||||
DBA::unlock();
|
||||
|
||||
if (!$got_lock && ($timeout > 0)) {
|
||||
usleep(rand(100000, 2000000));
|
||||
|
@ -56,7 +56,7 @@ class DatabaseLockDriver extends AbstractLockDriver
|
|||
*/
|
||||
public function releaseLock($key)
|
||||
{
|
||||
dba::delete('locks', ['name' => $key, 'pid' => getmypid()]);
|
||||
DBA::delete('locks', ['name' => $key, 'pid' => getmypid()]);
|
||||
|
||||
$this->markRelease($key);
|
||||
|
||||
|
@ -68,7 +68,7 @@ class DatabaseLockDriver extends AbstractLockDriver
|
|||
*/
|
||||
public function releaseAll()
|
||||
{
|
||||
dba::delete('locks', ['pid' => getmypid()]);
|
||||
DBA::delete('locks', ['pid' => getmypid()]);
|
||||
|
||||
$this->acquiredLocks = [];
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ class DatabaseLockDriver extends AbstractLockDriver
|
|||
*/
|
||||
public function isLocked($key)
|
||||
{
|
||||
$lock = dba::selectFirst('locks', ['locked'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
|
||||
$lock = DBA::selectFirst('locks', ['locked'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
|
||||
|
||||
if (DBM::is_result($lock)) {
|
||||
return $lock['locked'] !== false;
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Friendica\Core\Session;
|
|||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use SessionHandlerInterface;
|
||||
|
||||
|
@ -30,7 +30,7 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa
|
|||
return '';
|
||||
}
|
||||
|
||||
$session = dba::selectFirst('session', ['data'], ['sid' => $session_id]);
|
||||
$session = DBA::selectFirst('session', ['data'], ['sid' => $session_id]);
|
||||
if (DBM::is_result($session)) {
|
||||
Session::$exists = true;
|
||||
return $session['data'];
|
||||
|
@ -67,10 +67,10 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa
|
|||
if (Session::$exists) {
|
||||
$fields = ['data' => $session_data, 'expire' => $expire];
|
||||
$condition = ["`sid` = ? AND (`data` != ? OR `expire` != ?)", $session_id, $session_data, $expire];
|
||||
dba::update('session', $fields, $condition);
|
||||
DBA::update('session', $fields, $condition);
|
||||
} else {
|
||||
$fields = ['sid' => $session_id, 'expire' => $default_expire, 'data' => $session_data];
|
||||
dba::insert('session', $fields);
|
||||
DBA::insert('session', $fields);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -83,13 +83,13 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa
|
|||
|
||||
public function destroy($id)
|
||||
{
|
||||
dba::delete('session', ['sid' => $id]);
|
||||
DBA::delete('session', ['sid' => $id]);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function gc($maxlifetime)
|
||||
{
|
||||
dba::delete('session', ["`expire` < ?", time()]);
|
||||
DBA::delete('session', ["`expire` < ?", time()]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Object\Image;
|
||||
|
||||
|
@ -24,7 +24,7 @@ class UserImport
|
|||
return 1;
|
||||
}
|
||||
|
||||
return dba::lastInsertId();
|
||||
return DBA::lastInsertId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,8 +108,8 @@ class UserImport
|
|||
|
||||
// check for username
|
||||
// check if username matches deleted account
|
||||
if (dba::exists('user', ['nickname' => $account['user']['nickname']])
|
||||
|| dba::exists('userd', ['username' => $account['user']['nickname']])) {
|
||||
if (DBA::exists('user', ['nickname' => $account['user']['nickname']])
|
||||
|| DBA::exists('userd', ['username' => $account['user']['nickname']])) {
|
||||
notice(L10n::t("User '%s' already exists on this server!", $account['user']['nickname']));
|
||||
return;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ class UserImport
|
|||
// import user
|
||||
$r = self::dbImportAssoc('user', $account['user']);
|
||||
if ($r === false) {
|
||||
logger("uimport:insert user : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
|
||||
logger("uimport:insert user : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
|
||||
notice(L10n::t("User creation error"));
|
||||
return;
|
||||
}
|
||||
|
@ -160,9 +160,9 @@ class UserImport
|
|||
$profile['uid'] = $newuid;
|
||||
$r = self::dbImportAssoc('profile', $profile);
|
||||
if ($r === false) {
|
||||
logger("uimport:insert profile " . $profile['profile-name'] . " : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
|
||||
logger("uimport:insert profile " . $profile['profile-name'] . " : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
|
||||
info(L10n::t("User profile creation error"));
|
||||
dba::delete('user', ['uid' => $newuid]);
|
||||
DBA::delete('user', ['uid' => $newuid]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ class UserImport
|
|||
$contact['uid'] = $newuid;
|
||||
$r = self::dbImportAssoc('contact', $contact);
|
||||
if ($r === false) {
|
||||
logger("uimport:insert contact " . $contact['nick'] . "," . $contact['network'] . " : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
|
||||
logger("uimport:insert contact " . $contact['nick'] . "," . $contact['network'] . " : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
|
||||
$errorcount++;
|
||||
} else {
|
||||
$contact['newid'] = self::lastInsertId();
|
||||
|
@ -212,7 +212,7 @@ class UserImport
|
|||
$group['uid'] = $newuid;
|
||||
$r = self::dbImportAssoc('group', $group);
|
||||
if ($r === false) {
|
||||
logger("uimport:insert group " . $group['name'] . " : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
|
||||
logger("uimport:insert group " . $group['name'] . " : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
|
||||
} else {
|
||||
$group['newid'] = self::lastInsertId();
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ class UserImport
|
|||
if ($import == 2) {
|
||||
$r = self::dbImportAssoc('group_member', $group_member);
|
||||
if ($r === false) {
|
||||
logger("uimport:insert group member " . $group_member['id'] . " : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
|
||||
logger("uimport:insert group member " . $group_member['id'] . " : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ class UserImport
|
|||
);
|
||||
|
||||
if ($r === false) {
|
||||
logger("uimport:insert photo " . $photo['resource-id'] . "," . $photo['scale'] . " : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
|
||||
logger("uimport:insert photo " . $photo['resource-id'] . "," . $photo['scale'] . " : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ class UserImport
|
|||
$pconfig['uid'] = $newuid;
|
||||
$r = self::dbImportAssoc('pconfig', $pconfig);
|
||||
if ($r === false) {
|
||||
logger("uimport:insert pconfig " . $pconfig['id'] . " : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
|
||||
logger("uimport:insert pconfig " . $pconfig['id'] . " : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Process;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -151,7 +151,7 @@ class Worker
|
|||
*/
|
||||
private static function totalEntries()
|
||||
{
|
||||
return dba::count('workerqueue', ["`executed` <= ? AND NOT `done`", NULL_DATE]);
|
||||
return DBA::count('workerqueue', ["`executed` <= ? AND NOT `done`", NULL_DATE]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,7 +162,7 @@ class Worker
|
|||
private static function highestPriority()
|
||||
{
|
||||
$condition = ["`executed` <= ? AND NOT `done`", NULL_DATE];
|
||||
$workerqueue = dba::selectFirst('workerqueue', ['priority'], $condition, ['order' => ['priority']]);
|
||||
$workerqueue = DBA::selectFirst('workerqueue', ['priority'], $condition, ['order' => ['priority']]);
|
||||
if (DBM::is_result($workerqueue)) {
|
||||
return $workerqueue["priority"];
|
||||
} else {
|
||||
|
@ -180,7 +180,7 @@ class Worker
|
|||
private static function processWithPriorityActive($priority)
|
||||
{
|
||||
$condition = ["`priority` <= ? AND `executed` > ? AND NOT `done`", $priority, NULL_DATE];
|
||||
return dba::exists('workerqueue', $condition);
|
||||
return DBA::exists('workerqueue', $condition);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -230,7 +230,7 @@ class Worker
|
|||
|
||||
if ($age > 1) {
|
||||
$stamp = (float)microtime(true);
|
||||
dba::update('workerqueue', ['executed' => DateTimeFormat::utcNow()], ['pid' => $mypid, 'done' => false]);
|
||||
DBA::update('workerqueue', ['executed' => DateTimeFormat::utcNow()], ['pid' => $mypid, 'done' => false]);
|
||||
self::$db_duration += (microtime(true) - $stamp);
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ class Worker
|
|||
self::execFunction($queue, $include, $argv, true);
|
||||
|
||||
$stamp = (float)microtime(true);
|
||||
if (dba::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
|
||||
if (DBA::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
|
||||
Config::set('system', 'last_worker_execution', DateTimeFormat::utcNow());
|
||||
}
|
||||
self::$db_duration = (microtime(true) - $stamp);
|
||||
|
@ -254,7 +254,7 @@ class Worker
|
|||
|
||||
if (!validate_include($include)) {
|
||||
logger("Include file ".$argv[0]." is not valid!");
|
||||
dba::delete('workerqueue', ['id' => $queue["id"]]);
|
||||
DBA::delete('workerqueue', ['id' => $queue["id"]]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -273,20 +273,20 @@ class Worker
|
|||
|
||||
if ($age > 1) {
|
||||
$stamp = (float)microtime(true);
|
||||
dba::update('workerqueue', ['executed' => DateTimeFormat::utcNow()], ['pid' => $mypid, 'done' => false]);
|
||||
DBA::update('workerqueue', ['executed' => DateTimeFormat::utcNow()], ['pid' => $mypid, 'done' => false]);
|
||||
self::$db_duration += (microtime(true) - $stamp);
|
||||
}
|
||||
|
||||
self::execFunction($queue, $funcname, $argv, false);
|
||||
|
||||
$stamp = (float)microtime(true);
|
||||
if (dba::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
|
||||
if (DBA::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
|
||||
Config::set('system', 'last_worker_execution', DateTimeFormat::utcNow());
|
||||
}
|
||||
self::$db_duration = (microtime(true) - $stamp);
|
||||
} else {
|
||||
logger("Function ".$funcname." does not exist");
|
||||
dba::delete('workerqueue', ['id' => $queue["id"]]);
|
||||
DBA::delete('workerqueue', ['id' => $queue["id"]]);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -477,13 +477,13 @@ class Worker
|
|||
|
||||
if ($max == 0) {
|
||||
// the maximum number of possible user connections can be a system variable
|
||||
$r = dba::fetch_first("SHOW VARIABLES WHERE `variable_name` = 'max_user_connections'");
|
||||
$r = DBA::fetch_first("SHOW VARIABLES WHERE `variable_name` = 'max_user_connections'");
|
||||
if (DBM::is_result($r)) {
|
||||
$max = $r["Value"];
|
||||
}
|
||||
// Or it can be granted. This overrides the system variable
|
||||
$r = dba::p('SHOW GRANTS');
|
||||
while ($grants = dba::fetch($r)) {
|
||||
$r = DBA::p('SHOW GRANTS');
|
||||
while ($grants = DBA::fetch($r)) {
|
||||
$grant = array_pop($grants);
|
||||
if (stristr($grant, "GRANT USAGE ON")) {
|
||||
if (preg_match("/WITH MAX_USER_CONNECTIONS (\d*)/", $grant, $match)) {
|
||||
|
@ -491,15 +491,15 @@ class Worker
|
|||
}
|
||||
}
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
}
|
||||
|
||||
// If $max is set we will use the processlist to determine the current number of connections
|
||||
// The processlist only shows entries of the current user
|
||||
if ($max != 0) {
|
||||
$r = dba::p('SHOW PROCESSLIST');
|
||||
$used = dba::num_rows($r);
|
||||
dba::close($r);
|
||||
$r = DBA::p('SHOW PROCESSLIST');
|
||||
$used = DBA::num_rows($r);
|
||||
DBA::close($r);
|
||||
|
||||
logger("Connection usage (user values): ".$used."/".$max, LOGGER_DEBUG);
|
||||
|
||||
|
@ -513,7 +513,7 @@ class Worker
|
|||
|
||||
// We will now check for the system values.
|
||||
// This limit could be reached although the user limits are fine.
|
||||
$r = dba::fetch_first("SHOW VARIABLES WHERE `variable_name` = 'max_connections'");
|
||||
$r = DBA::fetch_first("SHOW VARIABLES WHERE `variable_name` = 'max_connections'");
|
||||
if (!DBM::is_result($r)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ class Worker
|
|||
if ($max == 0) {
|
||||
return false;
|
||||
}
|
||||
$r = dba::fetch_first("SHOW STATUS WHERE `variable_name` = 'Threads_connected'");
|
||||
$r = DBA::fetch_first("SHOW STATUS WHERE `variable_name` = 'Threads_connected'");
|
||||
if (!DBM::is_result($r)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -546,16 +546,16 @@ class Worker
|
|||
*/
|
||||
private static function killStaleWorkers()
|
||||
{
|
||||
$entries = dba::select(
|
||||
$entries = DBA::select(
|
||||
'workerqueue',
|
||||
['id', 'pid', 'executed', 'priority', 'parameter'],
|
||||
['`executed` > ? AND NOT `done` AND `pid` != 0', NULL_DATE],
|
||||
['order' => ['priority', 'created']]
|
||||
);
|
||||
|
||||
while ($entry = dba::fetch($entries)) {
|
||||
while ($entry = DBA::fetch($entries)) {
|
||||
if (!posix_kill($entry["pid"], 0)) {
|
||||
dba::update(
|
||||
DBA::update(
|
||||
'workerqueue',
|
||||
['executed' => NULL_DATE, 'pid' => 0],
|
||||
['id' => $entry["id"]]
|
||||
|
@ -591,7 +591,7 @@ class Worker
|
|||
} elseif ($entry["priority"] != PRIORITY_CRITICAL) {
|
||||
$new_priority = PRIORITY_NEGLIGIBLE;
|
||||
}
|
||||
dba::update(
|
||||
DBA::update(
|
||||
'workerqueue',
|
||||
['executed' => NULL_DATE, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0],
|
||||
['id' => $entry["id"]]
|
||||
|
@ -637,37 +637,37 @@ class Worker
|
|||
$listitem = [];
|
||||
|
||||
// Adding all processes with no workerqueue entry
|
||||
$processes = dba::p(
|
||||
$processes = DBA::p(
|
||||
"SELECT COUNT(*) AS `running` FROM `process` WHERE NOT EXISTS
|
||||
(SELECT id FROM `workerqueue`
|
||||
WHERE `workerqueue`.`pid` = `process`.`pid` AND NOT `done` AND `pid` != ?)",
|
||||
getmypid()
|
||||
);
|
||||
|
||||
if ($process = dba::fetch($processes)) {
|
||||
if ($process = DBA::fetch($processes)) {
|
||||
$listitem[0] = "0:".$process["running"];
|
||||
}
|
||||
dba::close($processes);
|
||||
DBA::close($processes);
|
||||
|
||||
// Now adding all processes with workerqueue entries
|
||||
$entries = dba::p("SELECT COUNT(*) AS `entries`, `priority` FROM `workerqueue` WHERE NOT `done` GROUP BY `priority`");
|
||||
while ($entry = dba::fetch($entries)) {
|
||||
$processes = dba::p("SELECT COUNT(*) AS `running` FROM `process` INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` AND NOT `done` WHERE `priority` = ?", $entry["priority"]);
|
||||
if ($process = dba::fetch($processes)) {
|
||||
$entries = DBA::p("SELECT COUNT(*) AS `entries`, `priority` FROM `workerqueue` WHERE NOT `done` GROUP BY `priority`");
|
||||
while ($entry = DBA::fetch($entries)) {
|
||||
$processes = DBA::p("SELECT COUNT(*) AS `running` FROM `process` INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` AND NOT `done` WHERE `priority` = ?", $entry["priority"]);
|
||||
if ($process = DBA::fetch($processes)) {
|
||||
$listitem[$entry["priority"]] = $entry["priority"].":".$process["running"]."/".$entry["entries"];
|
||||
}
|
||||
dba::close($processes);
|
||||
DBA::close($processes);
|
||||
}
|
||||
dba::close($entries);
|
||||
DBA::close($entries);
|
||||
|
||||
$intervals = [1, 10, 60];
|
||||
$jobs_per_minute = [];
|
||||
foreach ($intervals as $interval) {
|
||||
$jobs = dba::p("SELECT COUNT(*) AS `jobs` FROM `workerqueue` WHERE `done` AND `executed` > UTC_TIMESTAMP() - INTERVAL ".intval($interval)." MINUTE");
|
||||
if ($job = dba::fetch($jobs)) {
|
||||
$jobs = DBA::p("SELECT COUNT(*) AS `jobs` FROM `workerqueue` WHERE `done` AND `executed` > UTC_TIMESTAMP() - INTERVAL ".intval($interval)." MINUTE");
|
||||
if ($job = DBA::fetch($jobs)) {
|
||||
$jobs_per_minute[$interval] = number_format($job['jobs'] / $interval, 0);
|
||||
}
|
||||
dba::close($jobs);
|
||||
DBA::close($jobs);
|
||||
}
|
||||
$processlist = ' - jpm: '.implode('/', $jobs_per_minute).' ('.implode(', ', $listitem).')';
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ class Worker
|
|||
*/
|
||||
private static function activeWorkers()
|
||||
{
|
||||
return dba::count('process', ['command' => 'Worker.php']);
|
||||
return DBA::count('process', ['command' => 'Worker.php']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -728,7 +728,7 @@ class Worker
|
|||
{
|
||||
$highest_priority = 0;
|
||||
|
||||
$r = dba::p(
|
||||
$r = DBA::p(
|
||||
"SELECT `priority`
|
||||
FROM `process`
|
||||
INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` AND NOT `done`"
|
||||
|
@ -739,10 +739,10 @@ class Worker
|
|||
return false;
|
||||
}
|
||||
$priorities = [];
|
||||
while ($line = dba::fetch($r)) {
|
||||
while ($line = DBA::fetch($r)) {
|
||||
$priorities[] = $line["priority"];
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
|
||||
// Should not happen
|
||||
if (count($priorities) == 0) {
|
||||
|
@ -801,33 +801,33 @@ class Worker
|
|||
$ids = [];
|
||||
if (self::passingSlow($highest_priority)) {
|
||||
// Are there waiting processes with a higher priority than the currently highest?
|
||||
$result = dba::select(
|
||||
$result = DBA::select(
|
||||
'workerqueue',
|
||||
['id'],
|
||||
["`executed` <= ? AND `priority` < ? AND NOT `done`", NULL_DATE, $highest_priority],
|
||||
['limit' => $limit, 'order' => ['priority', 'created']]
|
||||
);
|
||||
|
||||
while ($id = dba::fetch($result)) {
|
||||
while ($id = DBA::fetch($result)) {
|
||||
$ids[] = $id["id"];
|
||||
}
|
||||
dba::close($result);
|
||||
DBA::close($result);
|
||||
|
||||
$found = (count($ids) > 0);
|
||||
|
||||
if (!$found) {
|
||||
// Give slower processes some processing time
|
||||
$result = dba::select(
|
||||
$result = DBA::select(
|
||||
'workerqueue',
|
||||
['id'],
|
||||
["`executed` <= ? AND `priority` > ? AND NOT `done`", NULL_DATE, $highest_priority],
|
||||
['limit' => $limit, 'order' => ['priority', 'created']]
|
||||
);
|
||||
|
||||
while ($id = dba::fetch($result)) {
|
||||
while ($id = DBA::fetch($result)) {
|
||||
$ids[] = $id["id"];
|
||||
}
|
||||
dba::close($result);
|
||||
DBA::close($result);
|
||||
|
||||
$found = (count($ids) > 0);
|
||||
$passing_slow = $found;
|
||||
|
@ -836,17 +836,17 @@ class Worker
|
|||
|
||||
// If there is no result (or we shouldn't pass lower processes) we check without priority limit
|
||||
if (!$found) {
|
||||
$result = dba::select(
|
||||
$result = DBA::select(
|
||||
'workerqueue',
|
||||
['id'],
|
||||
["`executed` <= ? AND NOT `done`", NULL_DATE],
|
||||
['limit' => $limit, 'order' => ['priority', 'created']]
|
||||
);
|
||||
|
||||
while ($id = dba::fetch($result)) {
|
||||
while ($id = DBA::fetch($result)) {
|
||||
$ids[] = $id["id"];
|
||||
}
|
||||
dba::close($result);
|
||||
DBA::close($result);
|
||||
|
||||
$found = (count($ids) > 0);
|
||||
}
|
||||
|
@ -854,7 +854,7 @@ class Worker
|
|||
if ($found) {
|
||||
$condition = "`id` IN (".substr(str_repeat("?, ", count($ids)), 0, -2).") AND `pid` = 0 AND NOT `done`";
|
||||
array_unshift($ids, $condition);
|
||||
dba::update('workerqueue', ['executed' => DateTimeFormat::utcNow(), 'pid' => $mypid], $ids);
|
||||
DBA::update('workerqueue', ['executed' => DateTimeFormat::utcNow(), 'pid' => $mypid], $ids);
|
||||
}
|
||||
|
||||
return $found;
|
||||
|
@ -871,12 +871,12 @@ class Worker
|
|||
$stamp = (float)microtime(true);
|
||||
|
||||
// There can already be jobs for us in the queue.
|
||||
$r = dba::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]);
|
||||
$r = DBA::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]);
|
||||
if (DBM::is_result($r)) {
|
||||
self::$db_duration += (microtime(true) - $stamp);
|
||||
return dba::inArray($r);
|
||||
return DBA::inArray($r);
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
|
||||
$stamp = (float)microtime(true);
|
||||
if (!Lock::acquire('worker_process')) {
|
||||
|
@ -891,8 +891,8 @@ class Worker
|
|||
Lock::release('worker_process');
|
||||
|
||||
if ($found) {
|
||||
$r = dba::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]);
|
||||
return dba::inArray($r);
|
||||
$r = DBA::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]);
|
||||
return DBA::inArray($r);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -905,7 +905,7 @@ class Worker
|
|||
{
|
||||
$mypid = getmypid();
|
||||
|
||||
dba::update('workerqueue', ['executed' => NULL_DATE, 'pid' => 0], ['pid' => $mypid, 'done' => false]);
|
||||
DBA::update('workerqueue', ['executed' => NULL_DATE, 'pid' => 0], ['pid' => $mypid, 'done' => false]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -983,7 +983,7 @@ class Worker
|
|||
/// @todo We should clean up the corresponding workerqueue entries as well
|
||||
$condition = ["`created` < ? AND `command` = 'worker.php'",
|
||||
DateTimeFormat::utc("now - ".$timeout." minutes")];
|
||||
dba::delete('process', $condition);
|
||||
DBA::delete('process', $condition);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1076,15 +1076,15 @@ class Worker
|
|||
}
|
||||
|
||||
$parameters = json_encode($args);
|
||||
$found = dba::exists('workerqueue', ['parameter' => $parameters, 'done' => false]);
|
||||
$found = DBA::exists('workerqueue', ['parameter' => $parameters, 'done' => false]);
|
||||
|
||||
// Quit if there was a database error - a precaution for the update process to 3.5.3
|
||||
if (dba::errorNo() != 0) {
|
||||
if (DBA::errorNo() != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
dba::insert('workerqueue', ['parameter' => $parameters, 'created' => $created, 'priority' => $priority]);
|
||||
DBA::insert('workerqueue', ['parameter' => $parameters, 'created' => $created, 'priority' => $priority]);
|
||||
}
|
||||
|
||||
// Should we quit and wait for the worker to be called as a cronjob?
|
||||
|
@ -1152,7 +1152,7 @@ class Worker
|
|||
*/
|
||||
public static function IPCSetJobState($jobs)
|
||||
{
|
||||
dba::update('worker-ipc', ['jobs' => $jobs], ['key' => 1], true);
|
||||
DBA::update('worker-ipc', ['jobs' => $jobs], ['key' => 1], true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1163,7 +1163,7 @@ class Worker
|
|||
*/
|
||||
public static function IPCJobsExists()
|
||||
{
|
||||
$row = dba::selectFirst('worker-ipc', ['jobs'], ['key' => 1]);
|
||||
$row = DBA::selectFirst('worker-ipc', ['jobs'], ['key' => 1]);
|
||||
|
||||
// When we don't have a row, no job is running
|
||||
if (!DBM::is_result($row)) {
|
||||
|
|
|
@ -17,7 +17,7 @@ use PDOStatement;
|
|||
*
|
||||
* This class is for the low level database stuff that does driver specific things.
|
||||
*/
|
||||
class dba
|
||||
class DBA
|
||||
{
|
||||
public static $connected = false;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class DBM
|
|||
}
|
||||
|
||||
if (is_object($array)) {
|
||||
return dba::num_rows($array) > 0;
|
||||
return DBA::num_rows($array) > 0;
|
||||
}
|
||||
|
||||
return (is_array($array) && (count($array) > 0));
|
||||
|
|
|
@ -26,7 +26,7 @@ class DBStructure
|
|||
*/
|
||||
public static function convertToInnoDB() {
|
||||
$r = q("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `engine` = 'MyISAM' AND `table_schema` = '%s'",
|
||||
dbesc(dba::database_name()));
|
||||
dbesc(DBA::database_name()));
|
||||
|
||||
if (!DBM::is_result($r)) {
|
||||
echo L10n::t('There are no tables on MyISAM.')."\n";
|
||||
|
@ -37,7 +37,7 @@ class DBStructure
|
|||
$sql = sprintf("ALTER TABLE `%s` engine=InnoDB;", dbesc($table['TABLE_NAME']));
|
||||
echo $sql."\n";
|
||||
|
||||
$result = dba::e($sql);
|
||||
$result = DBA::e($sql);
|
||||
if (!DBM::is_result($result)) {
|
||||
self::printUpdateError($sql);
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ class DBStructure
|
|||
*/
|
||||
private static function printUpdateError($message) {
|
||||
echo L10n::t("\nError %d occurred during database update:\n%s\n",
|
||||
dba::errorNo(), dba::errorMessage());
|
||||
DBA::errorNo(), DBA::errorMessage());
|
||||
|
||||
return L10n::t('Errors encountered performing database changes: ').$message.EOL;
|
||||
}
|
||||
|
@ -236,8 +236,8 @@ class DBStructure
|
|||
}
|
||||
|
||||
// MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
|
||||
if ((version_compare(dba::server_info(), '5.7.4') >= 0) &&
|
||||
!(strpos(dba::server_info(), 'MariaDB') !== false)) {
|
||||
if ((version_compare(DBA::server_info(), '5.7.4') >= 0) &&
|
||||
!(strpos(DBA::server_info(), 'MariaDB') !== false)) {
|
||||
$ignore = '';
|
||||
} else {
|
||||
$ignore = ' IGNORE';
|
||||
|
@ -322,8 +322,8 @@ class DBStructure
|
|||
$parameters['comment'] = "";
|
||||
}
|
||||
|
||||
$current_field_definition = dba::clean_query(implode(",", $field_definition));
|
||||
$new_field_definition = dba::clean_query(implode(",", $parameters));
|
||||
$current_field_definition = DBA::clean_query(implode(",", $field_definition));
|
||||
$new_field_definition = DBA::clean_query(implode(",", $parameters));
|
||||
if ($current_field_definition != $new_field_definition) {
|
||||
$sql2 = self::modifyTableField($fieldname, $parameters);
|
||||
if ($sql3 == "") {
|
||||
|
@ -460,7 +460,7 @@ class DBStructure
|
|||
if ($ignore != "") {
|
||||
echo "SET session old_alter_table=0;\n";
|
||||
} else {
|
||||
echo "INSERT INTO `".$temp_name."` SELECT ".dba::any_value_fallback($field_list)." FROM `".$name."`".$group_by.";\n";
|
||||
echo "INSERT INTO `".$temp_name."` SELECT ".DBA::any_value_fallback($field_list)." FROM `".$name."`".$group_by.";\n";
|
||||
echo "DROP TABLE `".$name."`;\n";
|
||||
echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
|
||||
}
|
||||
|
@ -475,15 +475,15 @@ class DBStructure
|
|||
// Ensure index conversion to unique removes duplicates
|
||||
if ($is_unique && ($temp_name != $name)) {
|
||||
if ($ignore != "") {
|
||||
dba::e("SET session old_alter_table=1;");
|
||||
DBA::e("SET session old_alter_table=1;");
|
||||
} else {
|
||||
$r = dba::e("DROP TABLE IF EXISTS `".$temp_name."`;");
|
||||
$r = DBA::e("DROP TABLE IF EXISTS `".$temp_name."`;");
|
||||
if (!DBM::is_result($r)) {
|
||||
$errors .= self::printUpdateError($sql3);
|
||||
return $errors;
|
||||
}
|
||||
|
||||
$r = dba::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
|
||||
$r = DBA::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
|
||||
if (!DBM::is_result($r)) {
|
||||
$errors .= self::printUpdateError($sql3);
|
||||
return $errors;
|
||||
|
@ -491,25 +491,25 @@ class DBStructure
|
|||
}
|
||||
}
|
||||
|
||||
$r = dba::e($sql3);
|
||||
$r = DBA::e($sql3);
|
||||
if (!DBM::is_result($r)) {
|
||||
$errors .= self::printUpdateError($sql3);
|
||||
}
|
||||
if ($is_unique && ($temp_name != $name)) {
|
||||
if ($ignore != "") {
|
||||
dba::e("SET session old_alter_table=0;");
|
||||
DBA::e("SET session old_alter_table=0;");
|
||||
} else {
|
||||
$r = dba::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
|
||||
$r = DBA::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
|
||||
if (!DBM::is_result($r)) {
|
||||
$errors .= self::printUpdateError($sql3);
|
||||
return $errors;
|
||||
}
|
||||
$r = dba::e("DROP TABLE `".$name."`;");
|
||||
$r = DBA::e("DROP TABLE `".$name."`;");
|
||||
if (!DBM::is_result($r)) {
|
||||
$errors .= self::printUpdateError($sql3);
|
||||
return $errors;
|
||||
}
|
||||
$r = dba::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
|
||||
$r = DBA::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
|
||||
if (!DBM::is_result($r)) {
|
||||
$errors .= self::printUpdateError($sql3);
|
||||
return $errors;
|
||||
|
@ -606,7 +606,7 @@ class DBStructure
|
|||
}
|
||||
|
||||
if ($action) {
|
||||
$r = dba::e($sql);
|
||||
$r = DBA::e($sql);
|
||||
}
|
||||
|
||||
return $r;
|
||||
|
|
|
@ -124,7 +124,7 @@ class PostUpdate
|
|||
|
||||
// Check if the first step is done (Setting "author-id" and "owner-id" in the item table)
|
||||
$fields = ['author-link', 'author-name', 'author-avatar', 'owner-link', 'owner-name', 'owner-avatar', 'network', 'uid'];
|
||||
$r = dba::select('item', $fields, ['author-id' => 0, 'owner-id' => 0], ['limit' => 1000]);
|
||||
$r = DBA::select('item', $fields, ['author-id' => 0, 'owner-id' => 0], ['limit' => 1000]);
|
||||
if (!$r) {
|
||||
// Are there unfinished entries in the thread table?
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `thread`
|
||||
|
@ -180,7 +180,7 @@ class PostUpdate
|
|||
if ($owner_id == 0) {
|
||||
$owner_id = -1;
|
||||
}
|
||||
dba::update('item', ['author-id' => $author_id, 'owner-id' => $owner_id], ['uid' => $item['uid'], 'author-link' => $item['author-link'], 'owner-link' => $item['owner-link'], 'author-id' => 0, 'owner-id' => 0]);
|
||||
DBA::update('item', ['author-id' => $author_id, 'owner-id' => $owner_id], ['uid' => $item['uid'], 'author-link' => $item['author-link'], 'owner-link' => $item['owner-link'], 'author-id' => 0, 'owner-id' => 0]);
|
||||
}
|
||||
|
||||
logger("Updated items", LOGGER_DEBUG);
|
||||
|
@ -212,7 +212,7 @@ class PostUpdate
|
|||
}
|
||||
foreach ($r as $user) {
|
||||
if (!empty($user["lastitem_date"]) && ($user["lastitem_date"] > $user["last-item"])) {
|
||||
dba::update('contact', ['last-item' => $user['lastitem_date']], ['id' => $user['id']]);
|
||||
DBA::update('contact', ['last-item' => $user['lastitem_date']], ['id' => $user['id']]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ class PostUpdate
|
|||
|
||||
++$rows;
|
||||
}
|
||||
dba::close($items);
|
||||
DBA::close($items);
|
||||
|
||||
Config::set("system", "post_update_version_1279_id", $id);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Object\Image;
|
||||
|
@ -41,7 +41,7 @@ class Contact extends BaseObject
|
|||
{
|
||||
$return = [];
|
||||
if (intval($gid)) {
|
||||
$stmt = dba::p('SELECT `group_member`.`contact-id`, `contact`.*
|
||||
$stmt = DBA::p('SELECT `group_member`.`contact-id`, `contact`.*
|
||||
FROM `contact`
|
||||
INNER JOIN `group_member`
|
||||
ON `contact`.`id` = `group_member`.`contact-id`
|
||||
|
@ -55,7 +55,7 @@ class Contact extends BaseObject
|
|||
local_user()
|
||||
);
|
||||
if (DBM::is_result($stmt)) {
|
||||
$return = dba::inArray($stmt);
|
||||
$return = DBA::inArray($stmt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ class Contact extends BaseObject
|
|||
{
|
||||
$return = 0;
|
||||
if (intval($gid)) {
|
||||
$contacts = dba::fetch_first('SELECT COUNT(*) AS `count`
|
||||
$contacts = DBA::fetch_first('SELECT COUNT(*) AS `count`
|
||||
FROM `contact`
|
||||
INNER JOIN `group_member`
|
||||
ON `contact`.`id` = `group_member`.`contact-id`
|
||||
|
@ -99,16 +99,16 @@ class Contact extends BaseObject
|
|||
public static function createSelfFromUserId($uid)
|
||||
{
|
||||
// Only create the entry if it doesn't exist yet
|
||||
if (dba::exists('contact', ['uid' => $uid, 'self' => true])) {
|
||||
if (DBA::exists('contact', ['uid' => $uid, 'self' => true])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$user = dba::selectFirst('user', ['uid', 'username', 'nickname'], ['uid' => $uid]);
|
||||
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname'], ['uid' => $uid]);
|
||||
if (!DBM::is_result($user)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$return = dba::insert('contact', [
|
||||
$return = DBA::insert('contact', [
|
||||
'uid' => $user['uid'],
|
||||
'created' => DateTimeFormat::utcNow(),
|
||||
'self' => 1,
|
||||
|
@ -146,20 +146,20 @@ class Contact extends BaseObject
|
|||
{
|
||||
$fields = ['id', 'name', 'nick', 'location', 'about', 'keywords', 'gender', 'avatar',
|
||||
'xmpp', 'contact-type', 'forum', 'prv', 'avatar-date', 'nurl'];
|
||||
$self = dba::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]);
|
||||
$self = DBA::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]);
|
||||
if (!DBM::is_result($self)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$fields = ['nickname', 'page-flags', 'account-type'];
|
||||
$user = dba::selectFirst('user', $fields, ['uid' => $uid]);
|
||||
$user = DBA::selectFirst('user', $fields, ['uid' => $uid]);
|
||||
if (!DBM::is_result($user)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$fields = ['name', 'photo', 'thumb', 'about', 'address', 'locality', 'region',
|
||||
'country-name', 'gender', 'pub_keywords', 'xmpp'];
|
||||
$profile = dba::selectFirst('profile', $fields, ['uid' => $uid, 'is-default' => true]);
|
||||
$profile = DBA::selectFirst('profile', $fields, ['uid' => $uid, 'is-default' => true]);
|
||||
if (!DBM::is_result($profile)) {
|
||||
return;
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ class Contact extends BaseObject
|
|||
'gender' => $profile['gender'], 'avatar' => $profile['photo'],
|
||||
'contact-type' => $user['account-type'], 'xmpp' => $profile['xmpp']];
|
||||
|
||||
$avatar = dba::selectFirst('photo', ['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
|
||||
$avatar = DBA::selectFirst('photo', ['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
|
||||
if (DBM::is_result($avatar)) {
|
||||
if ($update_avatar) {
|
||||
$fields['avatar-date'] = DateTimeFormat::utcNow();
|
||||
|
@ -223,15 +223,15 @@ class Contact extends BaseObject
|
|||
|
||||
if ($update) {
|
||||
$fields['name-date'] = DateTimeFormat::utcNow();
|
||||
dba::update('contact', $fields, ['id' => $self['id']]);
|
||||
DBA::update('contact', $fields, ['id' => $self['id']]);
|
||||
|
||||
// Update the public contact as well
|
||||
dba::update('contact', $fields, ['uid' => 0, 'nurl' => $self['nurl']]);
|
||||
DBA::update('contact', $fields, ['uid' => 0, 'nurl' => $self['nurl']]);
|
||||
|
||||
// Update the profile
|
||||
$fields = ['photo' => System::baseUrl() . '/photo/profile/' .$uid . '.jpg',
|
||||
'thumb' => System::baseUrl() . '/photo/avatar/' . $uid .'.jpg'];
|
||||
dba::update('profile', $fields, ['uid' => $uid, 'is-default' => true]);
|
||||
DBA::update('profile', $fields, ['uid' => $uid, 'is-default' => true]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,18 +244,18 @@ class Contact extends BaseObject
|
|||
public static function remove($id)
|
||||
{
|
||||
// We want just to make sure that we don't delete our "self" contact
|
||||
$contact = dba::selectFirst('contact', ['uid'], ['id' => $id, 'self' => false]);
|
||||
$contact = DBA::selectFirst('contact', ['uid'], ['id' => $id, 'self' => false]);
|
||||
if (!DBM::is_result($contact) || !intval($contact['uid'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$archive = PConfig::get($contact['uid'], 'system', 'archive_removed_contacts');
|
||||
if ($archive) {
|
||||
dba::update('contact', ['archive' => true, 'network' => 'none', 'writable' => false], ['id' => $id]);
|
||||
DBA::update('contact', ['archive' => true, 'network' => 'none', 'writable' => false], ['id' => $id]);
|
||||
return;
|
||||
}
|
||||
|
||||
dba::delete('contact', ['id' => $id]);
|
||||
DBA::delete('contact', ['id' => $id]);
|
||||
|
||||
// Delete the rest in the background
|
||||
Worker::add(PRIORITY_LOW, 'RemoveContact', $id);
|
||||
|
@ -305,10 +305,10 @@ class Contact extends BaseObject
|
|||
}
|
||||
|
||||
if ($contact['term-date'] <= NULL_DATE) {
|
||||
dba::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
|
||||
if ($contact['url'] != '') {
|
||||
dba::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE]);
|
||||
DBA::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE]);
|
||||
}
|
||||
} else {
|
||||
/* @todo
|
||||
|
@ -326,10 +326,10 @@ class Contact extends BaseObject
|
|||
* delete, though if the owner tries to unarchive them we'll start
|
||||
* the whole process over again.
|
||||
*/
|
||||
dba::update('contact', ['archive' => 1], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['archive' => 1], ['id' => $contact['id']]);
|
||||
|
||||
if ($contact['url'] != '') {
|
||||
dba::update('contact', ['archive' => 1], ['nurl' => normalise_link($contact['url']), 'self' => false]);
|
||||
DBA::update('contact', ['archive' => 1], ['nurl' => normalise_link($contact['url']), 'self' => false]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ class Contact extends BaseObject
|
|||
public static function unmarkForArchival(array $contact)
|
||||
{
|
||||
$condition = ['`id` = ? AND (`term-date` > ? OR `archive`)', $contact['id'], NULL_DATE];
|
||||
$exists = dba::exists('contact', $condition);
|
||||
$exists = DBA::exists('contact', $condition);
|
||||
|
||||
// We don't need to update, we never marked this contact for archival
|
||||
if (!$exists) {
|
||||
|
@ -355,15 +355,15 @@ class Contact extends BaseObject
|
|||
|
||||
// It's a miracle. Our dead contact has inexplicably come back to life.
|
||||
$fields = ['term-date' => NULL_DATE, 'archive' => false];
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
DBA::update('contact', $fields, ['id' => $contact['id']]);
|
||||
|
||||
if (!empty($contact['url'])) {
|
||||
dba::update('contact', $fields, ['nurl' => normalise_link($contact['url'])]);
|
||||
DBA::update('contact', $fields, ['nurl' => normalise_link($contact['url'])]);
|
||||
}
|
||||
|
||||
if (!empty($contact['batch'])) {
|
||||
$condition = ['batch' => $contact['batch'], 'contact-type' => ACCOUNT_TYPE_RELAY];
|
||||
dba::update('contact', $fields, $condition);
|
||||
DBA::update('contact', $fields, $condition);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -398,41 +398,41 @@ class Contact extends BaseObject
|
|||
$ssl_url = str_replace('http://', 'https://', $url);
|
||||
|
||||
// Fetch contact data from the contact table for the given user
|
||||
$s = dba::p("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
|
||||
$s = DBA::p("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
|
||||
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, `self`
|
||||
FROM `contact` WHERE `nurl` = ? AND `uid` = ?", normalise_link($url), $uid);
|
||||
$r = dba::inArray($s);
|
||||
$r = DBA::inArray($s);
|
||||
|
||||
// Fetch contact data from the contact table for the given user, checking with the alias
|
||||
if (!DBM::is_result($r)) {
|
||||
$s = dba::p("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
|
||||
$s = DBA::p("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
|
||||
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, `self`
|
||||
FROM `contact` WHERE `alias` IN (?, ?, ?) AND `uid` = ?", normalise_link($url), $url, $ssl_url, $uid);
|
||||
$r = dba::inArray($s);
|
||||
$r = DBA::inArray($s);
|
||||
}
|
||||
|
||||
// Fetch the data from the contact table with "uid=0" (which is filled automatically)
|
||||
if (!DBM::is_result($r)) {
|
||||
$s = dba::p("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
|
||||
$s = DBA::p("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
|
||||
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self`
|
||||
FROM `contact` WHERE `nurl` = ? AND `uid` = 0", normalise_link($url));
|
||||
$r = dba::inArray($s);
|
||||
$r = DBA::inArray($s);
|
||||
}
|
||||
|
||||
// Fetch the data from the contact table with "uid=0" (which is filled automatically) - checked with the alias
|
||||
if (!DBM::is_result($r)) {
|
||||
$s = dba::p("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
|
||||
$s = DBA::p("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
|
||||
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self`
|
||||
FROM `contact` WHERE `alias` IN (?, ?, ?) AND `uid` = 0", normalise_link($url), $url, $ssl_url);
|
||||
$r = dba::inArray($s);
|
||||
$r = DBA::inArray($s);
|
||||
}
|
||||
|
||||
// Fetch the data from the gcontact table
|
||||
if (!DBM::is_result($r)) {
|
||||
$s = dba::p("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`,
|
||||
$s = DBA::p("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`,
|
||||
`keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, 0 AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self`
|
||||
FROM `gcontact` WHERE `nurl` = ?", normalise_link($url));
|
||||
$r = dba::inArray($s);
|
||||
$r = DBA::inArray($s);
|
||||
}
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
|
@ -602,7 +602,7 @@ class Contact extends BaseObject
|
|||
}
|
||||
|
||||
// Look for our own contact if the uid doesn't match and isn't public
|
||||
$contact_own = dba::selectFirst('contact', [], ['nurl' => $contact['nurl'], 'network' => $contact['network'], 'uid' => $uid]);
|
||||
$contact_own = DBA::selectFirst('contact', [], ['nurl' => $contact['nurl'], 'network' => $contact['network'], 'uid' => $uid]);
|
||||
if (DBM::is_result($contact_own)) {
|
||||
return self::photoMenu($contact_own, $uid);
|
||||
} else {
|
||||
|
@ -746,11 +746,11 @@ class Contact extends BaseObject
|
|||
|
||||
/// @todo Verify if we can't use Contact::getDetailsByUrl instead of the following
|
||||
// We first try the nurl (http://server.tld/nick), most common case
|
||||
$contact = dba::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['nurl' => normalise_link($url), 'uid' => $uid]);
|
||||
$contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['nurl' => normalise_link($url), 'uid' => $uid]);
|
||||
|
||||
// Then the addr (nick@server.tld)
|
||||
if (!DBM::is_result($contact)) {
|
||||
$contact = dba::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['addr' => $url, 'uid' => $uid]);
|
||||
$contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['addr' => $url, 'uid' => $uid]);
|
||||
}
|
||||
|
||||
// Then the alias (which could be anything)
|
||||
|
@ -758,7 +758,7 @@ class Contact extends BaseObject
|
|||
// The link could be provided as http although we stored it as https
|
||||
$ssl_url = str_replace('http://', 'https://', $url);
|
||||
$condition = ['`alias` IN (?, ?, ?) AND `uid` = ?', $url, normalise_link($url), $ssl_url, $uid];
|
||||
$contact = dba::selectFirst('contact', ['id', 'avatar', 'avatar-date'], $condition);
|
||||
$contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], $condition);
|
||||
}
|
||||
|
||||
if (DBM::is_result($contact)) {
|
||||
|
@ -790,30 +790,30 @@ class Contact extends BaseObject
|
|||
|
||||
// Get data from the gcontact table
|
||||
$fields = ['name', 'nick', 'url', 'photo', 'addr', 'alias', 'network'];
|
||||
$contact = dba::selectFirst('gcontact', $fields, ['nurl' => normalise_link($url)]);
|
||||
$contact = DBA::selectFirst('gcontact', $fields, ['nurl' => normalise_link($url)]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
$contact = dba::selectFirst('contact', $fields, ['nurl' => normalise_link($url)]);
|
||||
$contact = DBA::selectFirst('contact', $fields, ['nurl' => normalise_link($url)]);
|
||||
}
|
||||
|
||||
if (!DBM::is_result($contact)) {
|
||||
$fields = ['url', 'addr', 'alias', 'notify', 'poll', 'name', 'nick',
|
||||
'photo', 'keywords', 'location', 'about', 'network',
|
||||
'priority', 'batch', 'request', 'confirm', 'poco'];
|
||||
$contact = dba::selectFirst('contact', $fields, ['addr' => $url]);
|
||||
$contact = DBA::selectFirst('contact', $fields, ['addr' => $url]);
|
||||
}
|
||||
|
||||
if (!DBM::is_result($contact)) {
|
||||
// The link could be provided as http although we stored it as https
|
||||
$ssl_url = str_replace('http://', 'https://', $url);
|
||||
$condition = ['alias' => [$url, normalise_link($url), $ssl_url]];
|
||||
$contact = dba::selectFirst('contact', $fields, $condition);
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
}
|
||||
|
||||
if (!DBM::is_result($contact)) {
|
||||
$fields = ['url', 'addr', 'alias', 'notify', 'poll', 'name', 'nick',
|
||||
'photo', 'network', 'priority', 'batch', 'request', 'confirm'];
|
||||
$condition = ['url' => [$url, normalise_link($url), $ssl_url]];
|
||||
$contact = dba::selectFirst('fcontact', $fields, $condition);
|
||||
$contact = DBA::selectFirst('fcontact', $fields, $condition);
|
||||
}
|
||||
|
||||
if (!empty($default)) {
|
||||
|
@ -833,7 +833,7 @@ class Contact extends BaseObject
|
|||
|
||||
$url = $data["url"];
|
||||
if (!$contact_id) {
|
||||
dba::insert('contact', [
|
||||
DBA::insert('contact', [
|
||||
'uid' => $uid,
|
||||
'created' => DateTimeFormat::utcNow(),
|
||||
'url' => $data["url"],
|
||||
|
@ -865,8 +865,8 @@ class Contact extends BaseObject
|
|||
'pending' => 0]
|
||||
);
|
||||
|
||||
$s = dba::select('contact', ['id'], ['nurl' => normalise_link($data["url"]), 'uid' => $uid], ['order' => ['id'], 'limit' => 2]);
|
||||
$contacts = dba::inArray($s);
|
||||
$s = DBA::select('contact', ['id'], ['nurl' => normalise_link($data["url"]), 'uid' => $uid], ['order' => ['id'], 'limit' => 2]);
|
||||
$contacts = DBA::inArray($s);
|
||||
if (!DBM::is_result($contacts)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -874,7 +874,7 @@ class Contact extends BaseObject
|
|||
$contact_id = $contacts[0]["id"];
|
||||
|
||||
// Update the newly created contact from data in the gcontact table
|
||||
$gcontact = dba::selectFirst('gcontact', ['location', 'about', 'keywords', 'gender'], ['nurl' => normalise_link($data["url"])]);
|
||||
$gcontact = DBA::selectFirst('gcontact', ['location', 'about', 'keywords', 'gender'], ['nurl' => normalise_link($data["url"])]);
|
||||
if (DBM::is_result($gcontact)) {
|
||||
// Only use the information when the probing hadn't fetched these values
|
||||
if ($data['keywords'] != '') {
|
||||
|
@ -886,11 +886,11 @@ class Contact extends BaseObject
|
|||
if ($data['about'] != '') {
|
||||
unset($gcontact['about']);
|
||||
}
|
||||
dba::update('contact', $gcontact, ['id' => $contact_id]);
|
||||
DBA::update('contact', $gcontact, ['id' => $contact_id]);
|
||||
}
|
||||
|
||||
if (count($contacts) > 1 && $uid == 0 && $contact_id != 0 && $data["url"] != "") {
|
||||
dba::delete('contact', ["`nurl` = ? AND `uid` = 0 AND `id` != ? AND NOT `self`",
|
||||
DBA::delete('contact', ["`nurl` = ? AND `uid` = 0 AND `id` != ? AND NOT `self`",
|
||||
normalise_link($data["url"]), $contact_id]);
|
||||
}
|
||||
}
|
||||
|
@ -898,7 +898,7 @@ class Contact extends BaseObject
|
|||
self::updateAvatar($data["photo"], $uid, $contact_id);
|
||||
|
||||
$fields = ['url', 'nurl', 'addr', 'alias', 'name', 'nick', 'keywords', 'location', 'about', 'avatar-date', 'pubkey'];
|
||||
$contact = dba::selectFirst('contact', $fields, ['id' => $contact_id]);
|
||||
$contact = DBA::selectFirst('contact', $fields, ['id' => $contact_id]);
|
||||
|
||||
// This condition should always be true
|
||||
if (!DBM::is_result($contact)) {
|
||||
|
@ -953,7 +953,7 @@ class Contact extends BaseObject
|
|||
|
||||
$updated['avatar-date'] = DateTimeFormat::utcNow();
|
||||
|
||||
dba::update('contact', $updated, ['id' => $contact_id], $contact);
|
||||
DBA::update('contact', $updated, ['id' => $contact_id], $contact);
|
||||
|
||||
return $contact_id;
|
||||
}
|
||||
|
@ -971,7 +971,7 @@ class Contact extends BaseObject
|
|||
return false;
|
||||
}
|
||||
|
||||
$blocked = dba::selectFirst('contact', ['blocked'], ['id' => $cid]);
|
||||
$blocked = DBA::selectFirst('contact', ['blocked'], ['id' => $cid]);
|
||||
if (!DBM::is_result($blocked)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -991,7 +991,7 @@ class Contact extends BaseObject
|
|||
return false;
|
||||
}
|
||||
|
||||
$hidden = dba::selectFirst('contact', ['hidden'], ['id' => $cid]);
|
||||
$hidden = DBA::selectFirst('contact', ['hidden'], ['id' => $cid]);
|
||||
if (!DBM::is_result($hidden)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1107,7 +1107,7 @@ class Contact extends BaseObject
|
|||
*/
|
||||
public static function block($uid)
|
||||
{
|
||||
$return = dba::update('contact', ['blocked' => true], ['id' => $uid]);
|
||||
$return = DBA::update('contact', ['blocked' => true], ['id' => $uid]);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
@ -1120,7 +1120,7 @@ class Contact extends BaseObject
|
|||
*/
|
||||
public static function unblock($uid)
|
||||
{
|
||||
$return = dba::update('contact', ['blocked' => false], ['id' => $uid]);
|
||||
$return = DBA::update('contact', ['blocked' => false], ['id' => $uid]);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
@ -1137,7 +1137,7 @@ class Contact extends BaseObject
|
|||
*/
|
||||
public static function updateAvatar($avatar, $uid, $cid, $force = false)
|
||||
{
|
||||
$contact = dba::selectFirst('contact', ['avatar', 'photo', 'thumb', 'micro', 'nurl'], ['id' => $cid]);
|
||||
$contact = DBA::selectFirst('contact', ['avatar', 'photo', 'thumb', 'micro', 'nurl'], ['id' => $cid]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -1148,7 +1148,7 @@ class Contact extends BaseObject
|
|||
$photos = Photo::importProfilePhoto($avatar, $uid, $cid, true);
|
||||
|
||||
if ($photos) {
|
||||
dba::update(
|
||||
DBA::update(
|
||||
'contact',
|
||||
['avatar' => $avatar, 'photo' => $photos[0], 'thumb' => $photos[1], 'micro' => $photos[2], 'avatar-date' => DateTimeFormat::utcNow()],
|
||||
['id' => $cid]
|
||||
|
@ -1156,7 +1156,7 @@ class Contact extends BaseObject
|
|||
|
||||
// Update the public contact (contact id = 0)
|
||||
if ($uid != 0) {
|
||||
$pcontact = dba::selectFirst('contact', ['id'], ['nurl' => $contact['nurl'], 'uid' => 0]);
|
||||
$pcontact = DBA::selectFirst('contact', ['id'], ['nurl' => $contact['nurl'], 'uid' => 0]);
|
||||
if (DBM::is_result($pcontact)) {
|
||||
self::updateAvatar($avatar, 0, $pcontact['id'], $force);
|
||||
}
|
||||
|
@ -1181,7 +1181,7 @@ class Contact extends BaseObject
|
|||
*/
|
||||
|
||||
$fields = ['url', 'nurl', 'addr', 'alias', 'batch', 'notify', 'poll', 'poco', 'network'];
|
||||
$contact = dba::selectFirst('contact', $fields, ['id' => $id]);
|
||||
$contact = DBA::selectFirst('contact', $fields, ['id' => $id]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1210,7 +1210,7 @@ class Contact extends BaseObject
|
|||
return true;
|
||||
}
|
||||
|
||||
dba::update(
|
||||
DBA::update(
|
||||
'contact', [
|
||||
'url' => $ret['url'],
|
||||
'nurl' => normalise_link($ret['url']),
|
||||
|
@ -1378,12 +1378,12 @@ class Contact extends BaseObject
|
|||
$new_relation = (($r[0]['rel'] == CONTACT_IS_FOLLOWER) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
|
||||
|
||||
$fields = ['rel' => $new_relation, 'subhub' => $subhub, 'readonly' => false];
|
||||
dba::update('contact', $fields, ['id' => $r[0]['id']]);
|
||||
DBA::update('contact', $fields, ['id' => $r[0]['id']]);
|
||||
} else {
|
||||
$new_relation = ((in_array($ret['network'], [NETWORK_MAIL])) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
|
||||
|
||||
// create contact record
|
||||
dba::insert('contact', [
|
||||
DBA::insert('contact', [
|
||||
'uid' => $uid,
|
||||
'created' => DateTimeFormat::utcNow(),
|
||||
'url' => $ret['url'],
|
||||
|
@ -1409,7 +1409,7 @@ class Contact extends BaseObject
|
|||
]);
|
||||
}
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]);
|
||||
$contact = DBA::selectFirst('contact', [], ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
$result['message'] .= L10n::t('Unable to retrieve contact information.') . EOL;
|
||||
return $result;
|
||||
|
@ -1479,7 +1479,7 @@ class Contact extends BaseObject
|
|||
$fields = ['url' => $contact['url'], 'request' => $contact['request'],
|
||||
'notify' => $contact['notify'], 'poll' => $contact['poll'],
|
||||
'confirm' => $contact['confirm'], 'poco' => $contact['poco']];
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
DBA::update('contact', $fields, ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
return $contact;
|
||||
|
@ -1503,12 +1503,12 @@ class Contact extends BaseObject
|
|||
if (is_array($contact)) {
|
||||
if (($contact['rel'] == CONTACT_IS_SHARING)
|
||||
|| ($sharing && $contact['rel'] == CONTACT_IS_FOLLOWER)) {
|
||||
dba::update('contact', ['rel' => CONTACT_IS_FRIEND, 'writable' => true],
|
||||
DBA::update('contact', ['rel' => CONTACT_IS_FRIEND, 'writable' => true],
|
||||
['id' => $contact['id'], 'uid' => $importer['uid']]);
|
||||
}
|
||||
// send email notification to owner?
|
||||
} else {
|
||||
if (dba::exists('contact', ['nurl' => normalise_link($url), 'uid' => $importer['uid'], 'pending' => true])) {
|
||||
if (DBA::exists('contact', ['nurl' => normalise_link($url), 'uid' => $importer['uid'], 'pending' => true])) {
|
||||
logger('ignoring duplicated connection request from pending contact ' . $url);
|
||||
return;
|
||||
}
|
||||
|
@ -1529,7 +1529,7 @@ class Contact extends BaseObject
|
|||
);
|
||||
|
||||
$contact_record = [
|
||||
'id' => dba::lastInsertId(),
|
||||
'id' => DBA::lastInsertId(),
|
||||
'network' => NETWORK_OSTATUS,
|
||||
'name' => $name,
|
||||
'url' => $url,
|
||||
|
@ -1540,13 +1540,13 @@ class Contact extends BaseObject
|
|||
|
||||
/// @TODO Encapsulate this into a function/method
|
||||
$fields = ['uid', 'username', 'email', 'page-flags', 'notify-flags', 'language'];
|
||||
$user = dba::selectFirst('user', $fields, ['uid' => $importer['uid']]);
|
||||
$user = DBA::selectFirst('user', $fields, ['uid' => $importer['uid']]);
|
||||
if (DBM::is_result($user) && !in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
|
||||
// create notification
|
||||
$hash = random_string();
|
||||
|
||||
if (is_array($contact_record)) {
|
||||
dba::insert('intro', ['uid' => $importer['uid'], 'contact-id' => $contact_record['id'],
|
||||
DBA::insert('intro', ['uid' => $importer['uid'], 'contact-id' => $contact_record['id'],
|
||||
'blocked' => false, 'knowyou' => false,
|
||||
'hash' => $hash, 'datetime' => DateTimeFormat::utcNow()]);
|
||||
}
|
||||
|
@ -1584,7 +1584,7 @@ class Contact extends BaseObject
|
|||
public static function removeFollower($importer, $contact, array $datarray = [], $item = "") {
|
||||
|
||||
if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_SHARING)) {
|
||||
dba::update('contact', ['rel' => CONTACT_IS_SHARING], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['rel' => CONTACT_IS_SHARING], ['id' => $contact['id']]);
|
||||
} else {
|
||||
Contact::remove($contact['id']);
|
||||
}
|
||||
|
@ -1593,7 +1593,7 @@ class Contact extends BaseObject
|
|||
public static function removeSharer($importer, $contact, array $datarray = [], $item = "") {
|
||||
|
||||
if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_FOLLOWER)) {
|
||||
dba::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
|
||||
} else {
|
||||
Contact::remove($contact['id']);
|
||||
}
|
||||
|
@ -1664,14 +1664,14 @@ class Contact extends BaseObject
|
|||
|
||||
$str = dbesc(implode(',', $contact_ids));
|
||||
|
||||
$stmt = dba::p("SELECT `id` FROM `contact` WHERE `id` IN ( " . $str . ") AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0");
|
||||
$stmt = DBA::p("SELECT `id` FROM `contact` WHERE `id` IN ( " . $str . ") AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0");
|
||||
|
||||
$return = [];
|
||||
while($contact = dba::fetch($stmt)) {
|
||||
while($contact = DBA::fetch($stmt)) {
|
||||
$return[] = $contact['id'];
|
||||
}
|
||||
|
||||
dba::close($stmt);
|
||||
DBA::close($stmt);
|
||||
|
||||
$contact_ids = $return;
|
||||
}
|
||||
|
@ -1704,7 +1704,7 @@ class Contact extends BaseObject
|
|||
*/
|
||||
public static function magicLinkbyId($cid, $url = '')
|
||||
{
|
||||
$contact = dba::selectFirst('contact', ['id', 'network', 'url', 'uid'], ['id' => $cid]);
|
||||
$contact = DBA::selectFirst('contact', ['id', 'network', 'url', 'uid'], ['id' => $cid]);
|
||||
|
||||
return self::magicLinkbyContact($contact, $url);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once "include/dba.php";
|
||||
|
@ -53,7 +53,7 @@ class Conversation
|
|||
}
|
||||
|
||||
$fields = ['item-uri', 'reply-to-uri', 'conversation-uri', 'conversation-href', 'protocol', 'source'];
|
||||
$old_conv = dba::selectFirst('conversation', $fields, ['item-uri' => $conversation['item-uri']]);
|
||||
$old_conv = DBA::selectFirst('conversation', $fields, ['item-uri' => $conversation['item-uri']]);
|
||||
if (DBM::is_result($old_conv)) {
|
||||
// Don't update when only the source has changed.
|
||||
// Only do this when there had been no source before.
|
||||
|
@ -65,11 +65,11 @@ class Conversation
|
|||
unset($conversation['protocol']);
|
||||
unset($conversation['source']);
|
||||
}
|
||||
if (!dba::update('conversation', $conversation, ['item-uri' => $conversation['item-uri']], $old_conv)) {
|
||||
if (!DBA::update('conversation', $conversation, ['item-uri' => $conversation['item-uri']], $old_conv)) {
|
||||
logger('Conversation: update for '.$conversation['item-uri'].' from '.$old_conv['protocol'].' to '.$conversation['protocol'].' failed', LOGGER_DEBUG);
|
||||
}
|
||||
} else {
|
||||
if (!dba::insert('conversation', $conversation, true)) {
|
||||
if (!DBA::insert('conversation', $conversation, true)) {
|
||||
logger('Conversation: insert for '.$conversation['item-uri'].' (protocol '.$conversation['protocol'].') failed', LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Map;
|
||||
|
@ -213,7 +213,7 @@ class Event extends BaseObject
|
|||
return;
|
||||
}
|
||||
|
||||
dba::delete('event', ['id' => $event_id]);
|
||||
DBA::delete('event', ['id' => $event_id]);
|
||||
logger("Deleted event ".$event_id, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
|
@ -261,12 +261,12 @@ class Event extends BaseObject
|
|||
$conditions['self'] = true;
|
||||
}
|
||||
|
||||
$contact = dba::selectFirst('contact', [], $conditions);
|
||||
$contact = DBA::selectFirst('contact', [], $conditions);
|
||||
|
||||
// Existing event being modified.
|
||||
if ($event['id']) {
|
||||
// has the event actually changed?
|
||||
$existing_event = dba::selectFirst('event', ['edited'], ['id' => $event['id'], 'uid' => $event['uid']]);
|
||||
$existing_event = DBA::selectFirst('event', ['edited'], ['id' => $event['id'], 'uid' => $event['uid']]);
|
||||
if (!DBM::is_result($existing_event) || ($existing_event['edited'] === $event['edited'])) {
|
||||
|
||||
$item = Item::selectFirst(['id'], ['event-id' => $event['id'], 'uid' => $event['uid']]);
|
||||
|
@ -286,7 +286,7 @@ class Event extends BaseObject
|
|||
'nofinish' => $event['nofinish'],
|
||||
];
|
||||
|
||||
dba::update('event', $updated_fields, ['id' => $event['id'], 'uid' => $event['uid']]);
|
||||
DBA::update('event', $updated_fields, ['id' => $event['id'], 'uid' => $event['uid']]);
|
||||
|
||||
$item = Item::selectFirst(['id'], ['event-id' => $event['id'], 'uid' => $event['uid']]);
|
||||
if (DBM::is_result($item)) {
|
||||
|
@ -307,9 +307,9 @@ class Event extends BaseObject
|
|||
$event['guid'] = System::createGUID(32);
|
||||
|
||||
// New event. Store it.
|
||||
dba::insert('event', $event);
|
||||
DBA::insert('event', $event);
|
||||
|
||||
$event['id'] = dba::lastInsertId();
|
||||
$event['id'] = DBA::lastInsertId();
|
||||
|
||||
$item_arr = [];
|
||||
|
||||
|
@ -737,9 +737,9 @@ class Event extends BaseObject
|
|||
$conditions += ['allow_cid' => '', 'allow_gid' => ''];
|
||||
}
|
||||
|
||||
$events = dba::select('event', $fields, $conditions);
|
||||
$events = DBA::select('event', $fields, $conditions);
|
||||
if (DBM::is_result($events)) {
|
||||
$return = dba::inArray($events);
|
||||
$return = DBA::inArray($events);
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
@ -761,7 +761,7 @@ class Event extends BaseObject
|
|||
{
|
||||
$process = false;
|
||||
|
||||
$user = dba::selectFirst('user', ['timezone'], ['uid' => $uid]);
|
||||
$user = DBA::selectFirst('user', ['timezone'], ['uid' => $uid]);
|
||||
if (DBM::is_result($user)) {
|
||||
$timezone = $user['timezone'];
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ use Exception;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
|
@ -60,7 +60,7 @@ class GContact
|
|||
|
||||
$search .= "%";
|
||||
|
||||
$results = dba::p("SELECT `nurl` FROM `gcontact`
|
||||
$results = DBA::p("SELECT `nurl` FROM `gcontact`
|
||||
WHERE NOT `hide` AND `network` IN (?, ?, ?) AND
|
||||
((`last_contact` >= `last_failure`) OR (`updated` >= `last_failure`)) AND
|
||||
(`addr` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?) $extra_sql
|
||||
|
@ -69,7 +69,7 @@ class GContact
|
|||
);
|
||||
|
||||
$gcontacts = [];
|
||||
while ($result = dba::fetch($results)) {
|
||||
while ($result = DBA::fetch($results)) {
|
||||
$urlparts = parse_url($result["nurl"]);
|
||||
|
||||
// Ignore results that look strange.
|
||||
|
@ -237,8 +237,8 @@ class GContact
|
|||
|
||||
if ($alternate && ($gcontact['network'] == NETWORK_OSTATUS)) {
|
||||
// Delete the old entry - if it exists
|
||||
if (dba::exists('gcontact', ['nurl' => normalise_link($orig_profile)])) {
|
||||
dba::delete('gcontact', ['nurl' => normalise_link($orig_profile)]);
|
||||
if (DBA::exists('gcontact', ['nurl' => normalise_link($orig_profile)])) {
|
||||
DBA::delete('gcontact', ['nurl' => normalise_link($orig_profile)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ class GContact
|
|||
$contact["url"] = self::cleanContactUrl($contact["url"]);
|
||||
}
|
||||
|
||||
dba::lock('gcontact');
|
||||
DBA::lock('gcontact');
|
||||
$r = q(
|
||||
"SELECT `id`, `last_contact`, `last_failure`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($contact["url"]))
|
||||
|
@ -735,7 +735,7 @@ class GContact
|
|||
$doprobing = in_array($r[0]["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""]);
|
||||
}
|
||||
}
|
||||
dba::unlock();
|
||||
DBA::unlock();
|
||||
|
||||
if ($doprobing) {
|
||||
logger("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], LOGGER_DEBUG);
|
||||
|
@ -871,13 +871,13 @@ class GContact
|
|||
'generation' => $contact['generation'], 'updated' => $contact['updated'],
|
||||
'server_url' => $contact['server_url'], 'connect' => $contact['connect']];
|
||||
|
||||
dba::update('gcontact', $updated, $condition, $fields);
|
||||
DBA::update('gcontact', $updated, $condition, $fields);
|
||||
|
||||
// Now update the contact entry with the user id "0" as well.
|
||||
// This is used for the shadow copies of public items.
|
||||
/// @todo Check if we really should do this.
|
||||
// The quality of the gcontact table is mostly lower than the public contact
|
||||
$public_contact = dba::selectFirst('contact', ['id'], ['nurl' => normalise_link($contact["url"]), 'uid' => 0]);
|
||||
$public_contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link($contact["url"]), 'uid' => 0]);
|
||||
if (DBM::is_result($public_contact)) {
|
||||
logger("Update public contact ".$public_contact["id"], LOGGER_DEBUG);
|
||||
|
||||
|
@ -887,7 +887,7 @@ class GContact
|
|||
'network', 'bd', 'gender',
|
||||
'keywords', 'alias', 'contact-type',
|
||||
'url', 'location', 'about'];
|
||||
$old_contact = dba::selectFirst('contact', $fields, ['id' => $public_contact["id"]]);
|
||||
$old_contact = DBA::selectFirst('contact', $fields, ['id' => $public_contact["id"]]);
|
||||
|
||||
// Update it with the current values
|
||||
$fields = ['name' => $contact['name'], 'nick' => $contact['nick'],
|
||||
|
@ -903,7 +903,7 @@ class GContact
|
|||
}
|
||||
|
||||
|
||||
dba::update('contact', $fields, ['id' => $public_contact["id"]], $old_contact);
|
||||
DBA::update('contact', $fields, ['id' => $public_contact["id"]], $old_contact);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Friendica\Model;
|
|||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'boot.php';
|
||||
|
@ -38,17 +38,17 @@ class Group extends BaseObject
|
|||
// all the old members are gone, but the group remains so we don't break any security
|
||||
// access lists. What we're doing here is reviving the dead group, but old content which
|
||||
// was restricted to this group may now be seen by the new group members.
|
||||
$group = dba::selectFirst('group', ['deleted'], ['id' => $gid]);
|
||||
$group = DBA::selectFirst('group', ['deleted'], ['id' => $gid]);
|
||||
if (DBM::is_result($group) && $group['deleted']) {
|
||||
dba::update('group', ['deleted' => 0], ['id' => $gid]);
|
||||
DBA::update('group', ['deleted' => 0], ['id' => $gid]);
|
||||
notice(L10n::t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$return = dba::insert('group', ['uid' => $uid, 'name' => $name]);
|
||||
$return = DBA::insert('group', ['uid' => $uid, 'name' => $name]);
|
||||
if ($return) {
|
||||
$return = dba::lastInsertId();
|
||||
$return = DBA::lastInsertId();
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
|
@ -64,7 +64,7 @@ class Group extends BaseObject
|
|||
*/
|
||||
public static function update($id, $name)
|
||||
{
|
||||
return dba::update('group', ['name' => $name], ['id' => $id]);
|
||||
return DBA::update('group', ['name' => $name], ['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,11 +76,11 @@ class Group extends BaseObject
|
|||
public static function getIdsByContactId($cid)
|
||||
{
|
||||
$condition = ['contact-id' => $cid];
|
||||
$stmt = dba::select('group_member', ['gid'], $condition);
|
||||
$stmt = DBA::select('group_member', ['gid'], $condition);
|
||||
|
||||
$return = [];
|
||||
|
||||
while ($group = dba::fetch($stmt)) {
|
||||
while ($group = DBA::fetch($stmt)) {
|
||||
$return[] = $group['gid'];
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ class Group extends BaseObject
|
|||
*/
|
||||
public static function countUnseen()
|
||||
{
|
||||
$stmt = dba::p("SELECT `group`.`id`, `group`.`name`,
|
||||
$stmt = DBA::p("SELECT `group`.`id`, `group`.`name`,
|
||||
(SELECT COUNT(*) FROM `item` FORCE INDEX (`uid_unseen_contactid`)
|
||||
WHERE `uid` = ?
|
||||
AND `unseen`
|
||||
|
@ -114,7 +114,7 @@ class Group extends BaseObject
|
|||
local_user()
|
||||
);
|
||||
|
||||
return dba::inArray($stmt);
|
||||
return DBA::inArray($stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,7 +132,7 @@ class Group extends BaseObject
|
|||
return false;
|
||||
}
|
||||
|
||||
$group = dba::selectFirst('group', ['id'], ['uid' => $uid, 'name' => $name]);
|
||||
$group = DBA::selectFirst('group', ['id'], ['uid' => $uid, 'name' => $name]);
|
||||
if (DBM::is_result($group)) {
|
||||
return $group['id'];
|
||||
}
|
||||
|
@ -151,13 +151,13 @@ class Group extends BaseObject
|
|||
return false;
|
||||
}
|
||||
|
||||
$group = dba::selectFirst('group', ['uid'], ['id' => $gid]);
|
||||
$group = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
|
||||
if (!DBM::is_result($group)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// remove group from default posting lists
|
||||
$user = dba::selectFirst('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $group['uid']]);
|
||||
$user = DBA::selectFirst('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $group['uid']]);
|
||||
if (DBM::is_result($user)) {
|
||||
$change = false;
|
||||
|
||||
|
@ -175,15 +175,15 @@ class Group extends BaseObject
|
|||
}
|
||||
|
||||
if ($change) {
|
||||
dba::update('user', $user, ['uid' => $group['uid']]);
|
||||
DBA::update('user', $user, ['uid' => $group['uid']]);
|
||||
}
|
||||
}
|
||||
|
||||
// remove all members
|
||||
dba::delete('group_member', ['gid' => $gid]);
|
||||
DBA::delete('group_member', ['gid' => $gid]);
|
||||
|
||||
// remove group
|
||||
$return = dba::update('group', ['deleted' => 1], ['id' => $gid]);
|
||||
$return = DBA::update('group', ['deleted' => 1], ['id' => $gid]);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
@ -221,12 +221,12 @@ class Group extends BaseObject
|
|||
return false;
|
||||
}
|
||||
|
||||
$row_exists = dba::exists('group_member', ['gid' => $gid, 'contact-id' => $cid]);
|
||||
$row_exists = DBA::exists('group_member', ['gid' => $gid, 'contact-id' => $cid]);
|
||||
if ($row_exists) {
|
||||
// Row already existing, nothing to do
|
||||
$return = true;
|
||||
} else {
|
||||
$return = dba::insert('group_member', ['gid' => $gid, 'contact-id' => $cid]);
|
||||
$return = DBA::insert('group_member', ['gid' => $gid, 'contact-id' => $cid]);
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
@ -245,7 +245,7 @@ class Group extends BaseObject
|
|||
return false;
|
||||
}
|
||||
|
||||
$return = dba::delete('group_member', ['gid' => $gid, 'contact-id' => $cid]);
|
||||
$return = DBA::delete('group_member', ['gid' => $gid, 'contact-id' => $cid]);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
@ -293,11 +293,11 @@ class Group extends BaseObject
|
|||
$stmt = call_user_func_array('dba::p', $param_arr);
|
||||
} else {
|
||||
$condition_array = array_merge([$condition], $group_ids);
|
||||
$stmt = dba::select('group_member', ['contact-id'], $condition_array);
|
||||
$stmt = DBA::select('group_member', ['contact-id'], $condition_array);
|
||||
}
|
||||
|
||||
$return = [];
|
||||
while($group_member = dba::fetch($stmt)) {
|
||||
while($group_member = DBA::fetch($stmt)) {
|
||||
$return[] = $group_member['contact-id'];
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ class Group extends BaseObject
|
|||
{
|
||||
$o = '';
|
||||
|
||||
$stmt = dba::select('group', [], ['deleted' => 0, 'uid' => $uid], ['order' => ['name']]);
|
||||
$stmt = DBA::select('group', [], ['deleted' => 0, 'uid' => $uid], ['order' => ['name']]);
|
||||
|
||||
$display_groups = [
|
||||
[
|
||||
|
@ -328,7 +328,7 @@ class Group extends BaseObject
|
|||
'selected' => ''
|
||||
]
|
||||
];
|
||||
while ($group = dba::fetch($stmt)) {
|
||||
while ($group = DBA::fetch($stmt)) {
|
||||
$display_groups[] = [
|
||||
'name' => $group['name'],
|
||||
'id' => $group['id'],
|
||||
|
@ -378,14 +378,14 @@ class Group extends BaseObject
|
|||
]
|
||||
];
|
||||
|
||||
$stmt = dba::select('group', [], ['deleted' => 0, 'uid' => local_user()], ['order' => ['name']]);
|
||||
$stmt = DBA::select('group', [], ['deleted' => 0, 'uid' => local_user()], ['order' => ['name']]);
|
||||
|
||||
$member_of = [];
|
||||
if ($cid) {
|
||||
$member_of = self::getIdsByContactId($cid);
|
||||
}
|
||||
|
||||
while ($group = dba::fetch($stmt)) {
|
||||
while ($group = DBA::fetch($stmt)) {
|
||||
$selected = (($group_id == $group['id']) ? ' group-selected' : '');
|
||||
|
||||
if ($editmode == 'full') {
|
||||
|
|
|
@ -14,7 +14,7 @@ use Friendica\Core\Lock;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
|
@ -142,7 +142,7 @@ class Item extends BaseObject
|
|||
*/
|
||||
public static function fetch($stmt)
|
||||
{
|
||||
$row = dba::fetch($stmt);
|
||||
$row = DBA::fetch($stmt);
|
||||
|
||||
if (is_bool($row)) {
|
||||
return $row;
|
||||
|
@ -254,7 +254,7 @@ class Item extends BaseObject
|
|||
$data[] = $row;
|
||||
}
|
||||
if ($do_close) {
|
||||
dba::close($stmt);
|
||||
DBA::close($stmt);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
@ -272,10 +272,10 @@ class Item extends BaseObject
|
|||
if (is_bool($stmt)) {
|
||||
$retval = $stmt;
|
||||
} else {
|
||||
$retval = (dba::num_rows($stmt) > 0);
|
||||
$retval = (DBA::num_rows($stmt) > 0);
|
||||
}
|
||||
|
||||
dba::close($stmt);
|
||||
DBA::close($stmt);
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ class Item extends BaseObject
|
|||
* @param array $condition
|
||||
* @param array $params
|
||||
* @return bool|array
|
||||
* @see dba::select
|
||||
* @see DBA::select
|
||||
*/
|
||||
public static function selectFirstForUser($uid, array $selected = [], array $condition = [], $params = [])
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ class Item extends BaseObject
|
|||
* @param array $condition
|
||||
* @param array $params
|
||||
* @return bool|array
|
||||
* @see dba::select
|
||||
* @see DBA::select
|
||||
*/
|
||||
public static function selectFirst(array $fields = [], array $condition = [], $params = [])
|
||||
{
|
||||
|
@ -343,7 +343,7 @@ class Item extends BaseObject
|
|||
return $result;
|
||||
} else {
|
||||
$row = self::fetch($result);
|
||||
dba::close($result);
|
||||
DBA::close($result);
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ class Item extends BaseObject
|
|||
|
||||
$select_fields = self::constructSelectFields($fields, $selected);
|
||||
|
||||
$condition_string = dba::buildCondition($condition);
|
||||
$condition_string = DBA::buildCondition($condition);
|
||||
|
||||
$condition_string = self::addTablesToFields($condition_string, $fields);
|
||||
|
||||
|
@ -379,13 +379,13 @@ class Item extends BaseObject
|
|||
$condition_string = $condition_string . ' AND ' . self::condition(false);
|
||||
}
|
||||
|
||||
$param_string = self::addTablesToFields(dba::buildParameter($params), $fields);
|
||||
$param_string = self::addTablesToFields(DBA::buildParameter($params), $fields);
|
||||
|
||||
$table = "`item` " . self::constructJoins($uid, $select_fields . $condition_string . $param_string, false, $usermode);
|
||||
|
||||
$sql = "SELECT " . $select_fields . " FROM " . $table . $condition_string . $param_string;
|
||||
|
||||
return dba::p($sql, $condition);
|
||||
return DBA::p($sql, $condition);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -418,7 +418,7 @@ class Item extends BaseObject
|
|||
* @param array $condition
|
||||
* @param array $params
|
||||
* @return bool|array
|
||||
* @see dba::select
|
||||
* @see DBA::select
|
||||
*/
|
||||
public static function selectFirstThreadForUser($uid, array $selected = [], array $condition = [], $params = [])
|
||||
{
|
||||
|
@ -439,7 +439,7 @@ class Item extends BaseObject
|
|||
* @param array $condition
|
||||
* @param array $params
|
||||
* @return bool|array
|
||||
* @see dba::select
|
||||
* @see DBA::select
|
||||
*/
|
||||
public static function selectFirstThread(array $fields = [], array $condition = [], $params = [])
|
||||
{
|
||||
|
@ -450,7 +450,7 @@ class Item extends BaseObject
|
|||
return $result;
|
||||
} else {
|
||||
$row = self::fetch($result);
|
||||
dba::close($result);
|
||||
DBA::close($result);
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ class Item extends BaseObject
|
|||
|
||||
$select_fields = self::constructSelectFields($fields, $selected);
|
||||
|
||||
$condition_string = dba::buildCondition($condition);
|
||||
$condition_string = DBA::buildCondition($condition);
|
||||
|
||||
$condition_string = self::addTablesToFields($condition_string, $threadfields);
|
||||
$condition_string = self::addTablesToFields($condition_string, $fields);
|
||||
|
@ -492,7 +492,7 @@ class Item extends BaseObject
|
|||
$condition_string = $condition_string . ' AND ' . self::condition(true);
|
||||
}
|
||||
|
||||
$param_string = dba::buildParameter($params);
|
||||
$param_string = DBA::buildParameter($params);
|
||||
$param_string = self::addTablesToFields($param_string, $threadfields);
|
||||
$param_string = self::addTablesToFields($param_string, $fields);
|
||||
|
||||
|
@ -500,7 +500,7 @@ class Item extends BaseObject
|
|||
|
||||
$sql = "SELECT " . $select_fields . " FROM " . $table . $condition_string . $param_string;
|
||||
|
||||
return dba::p($sql, $condition);
|
||||
return DBA::p($sql, $condition);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -752,12 +752,12 @@ class Item extends BaseObject
|
|||
}
|
||||
|
||||
// To ensure the data integrity we do it in an transaction
|
||||
dba::transaction();
|
||||
DBA::transaction();
|
||||
|
||||
// We cannot simply expand the condition to check for origin entries
|
||||
// The condition needn't to be a simple array but could be a complex condition.
|
||||
// And we have to execute this query before the update to ensure to fetch the same data.
|
||||
$items = dba::select('item', ['id', 'origin', 'uri', 'created', 'uri-hash', 'iaid', 'icid', 'tag', 'file'], $condition);
|
||||
$items = DBA::select('item', ['id', 'origin', 'uri', 'created', 'uri-hash', 'iaid', 'icid', 'tag', 'file'], $condition);
|
||||
|
||||
$content_fields = [];
|
||||
foreach (array_merge(self::CONTENT_FIELDLIST, self::MIXED_CONTENT_FIELDLIST) as $field) {
|
||||
|
@ -799,35 +799,35 @@ class Item extends BaseObject
|
|||
$fields['inform'] = null;
|
||||
|
||||
if (!empty($fields)) {
|
||||
$success = dba::update('item', $fields, $condition);
|
||||
$success = DBA::update('item', $fields, $condition);
|
||||
|
||||
if (!$success) {
|
||||
dba::close($items);
|
||||
dba::rollback();
|
||||
DBA::close($items);
|
||||
DBA::rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// When there is no content for the "old" item table, this will count the fetched items
|
||||
$rows = dba::affected_rows();
|
||||
$rows = DBA::affected_rows();
|
||||
|
||||
while ($item = dba::fetch($items)) {
|
||||
while ($item = DBA::fetch($items)) {
|
||||
|
||||
// This part here can safely be removed when the legacy fields in the item had been removed
|
||||
if (empty($item['uri-hash']) && !empty($item['uri']) && !empty($item['created'])) {
|
||||
|
||||
// Fetch the uri-hash from an existing item entry if there is one
|
||||
$item_condition = ["`uri` = ? AND `uri-hash` != ''", $item['uri']];
|
||||
$existing = dba::selectfirst('item', ['uri-hash'], $item_condition);
|
||||
$existing = DBA::selectfirst('item', ['uri-hash'], $item_condition);
|
||||
if (DBM::is_result($existing)) {
|
||||
$item['uri-hash'] = $existing['uri-hash'];
|
||||
} else {
|
||||
$item['uri-hash'] = self::itemHash($item['uri'], $item['created']);
|
||||
}
|
||||
|
||||
dba::update('item', ['uri-hash' => $item['uri-hash']], ['id' => $item['id']]);
|
||||
dba::update('item-activity', ['uri-hash' => $item['uri-hash']], ["`uri` = ? AND `uri-hash` = ''", $item['uri']]);
|
||||
dba::update('item-content', ['uri-plink-hash' => $item['uri-hash']], ["`uri` = ? AND `uri-plink-hash` = ''", $item['uri']]);
|
||||
DBA::update('item', ['uri-hash' => $item['uri-hash']], ['id' => $item['id']]);
|
||||
DBA::update('item-activity', ['uri-hash' => $item['uri-hash']], ["`uri` = ? AND `uri-hash` = ''", $item['uri']]);
|
||||
DBA::update('item-content', ['uri-plink-hash' => $item['uri-hash']], ["`uri` = ? AND `uri-plink-hash` = ''", $item['uri']]);
|
||||
}
|
||||
|
||||
if (!empty($item['iaid']) || (!empty($content_fields['verb']) && (self::activityToIndex($content_fields['verb']) >= 0))) {
|
||||
|
@ -839,7 +839,7 @@ class Item extends BaseObject
|
|||
self::updateActivity($content_fields, $update_condition);
|
||||
|
||||
if (empty($item['iaid'])) {
|
||||
$item_activity = dba::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]);
|
||||
$item_activity = DBA::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]);
|
||||
if (DBM::is_result($item_activity)) {
|
||||
$item_fields = ['iaid' => $item_activity['id'], 'icid' => null];
|
||||
foreach (self::MIXED_CONTENT_FIELDLIST as $field) {
|
||||
|
@ -849,17 +849,17 @@ class Item extends BaseObject
|
|||
unset($item_fields[$field]);
|
||||
}
|
||||
}
|
||||
dba::update('item', $item_fields, ['id' => $item['id']]);
|
||||
DBA::update('item', $item_fields, ['id' => $item['id']]);
|
||||
|
||||
if (!empty($item['icid']) && !dba::exists('item', ['icid' => $item['icid']])) {
|
||||
dba::delete('item-content', ['id' => $item['icid']]);
|
||||
if (!empty($item['icid']) && !DBA::exists('item', ['icid' => $item['icid']])) {
|
||||
DBA::delete('item-content', ['id' => $item['icid']]);
|
||||
}
|
||||
}
|
||||
} elseif (!empty($item['icid'])) {
|
||||
dba::update('item', ['icid' => null], ['id' => $item['id']]);
|
||||
DBA::update('item', ['icid' => null], ['id' => $item['id']]);
|
||||
|
||||
if (!dba::exists('item', ['icid' => $item['icid']])) {
|
||||
dba::delete('item-content', ['id' => $item['icid']]);
|
||||
if (!DBA::exists('item', ['icid' => $item['icid']])) {
|
||||
DBA::delete('item-content', ['id' => $item['icid']]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -871,7 +871,7 @@ class Item extends BaseObject
|
|||
self::updateContent($content_fields, $update_condition);
|
||||
|
||||
if (empty($item['icid'])) {
|
||||
$item_content = dba::selectFirst('item-content', [], ['uri-plink-hash' => $item['uri-hash']]);
|
||||
$item_content = DBA::selectFirst('item-content', [], ['uri-plink-hash' => $item['uri-hash']]);
|
||||
if (DBM::is_result($item_content)) {
|
||||
$item_fields = ['icid' => $item_content['id']];
|
||||
// Clear all fields in the item table that have a content in the item-content table
|
||||
|
@ -884,7 +884,7 @@ class Item extends BaseObject
|
|||
}
|
||||
}
|
||||
}
|
||||
dba::update('item', $item_fields, ['id' => $item['id']]);
|
||||
DBA::update('item', $item_fields, ['id' => $item['id']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -892,14 +892,14 @@ class Item extends BaseObject
|
|||
if (!empty($tags)) {
|
||||
Term::insertFromTagFieldByItemId($item['id'], $tags);
|
||||
if (!empty($item['tag'])) {
|
||||
dba::update('item', ['tag' => ''], ['id' => $item['id']]);
|
||||
DBA::update('item', ['tag' => ''], ['id' => $item['id']]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($files)) {
|
||||
Term::insertFromFileFieldByItemId($item['id'], $files);
|
||||
if (!empty($item['file'])) {
|
||||
dba::update('item', ['file' => ''], ['id' => $item['id']]);
|
||||
DBA::update('item', ['file' => ''], ['id' => $item['id']]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -914,8 +914,8 @@ class Item extends BaseObject
|
|||
}
|
||||
}
|
||||
|
||||
dba::close($items);
|
||||
dba::commit();
|
||||
DBA::close($items);
|
||||
DBA::commit();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
@ -927,11 +927,11 @@ class Item extends BaseObject
|
|||
*/
|
||||
public static function delete($condition, $priority = PRIORITY_HIGH)
|
||||
{
|
||||
$items = dba::select('item', ['id'], $condition);
|
||||
while ($item = dba::fetch($items)) {
|
||||
$items = DBA::select('item', ['id'], $condition);
|
||||
while ($item = DBA::fetch($items)) {
|
||||
self::deleteById($item['id'], $priority);
|
||||
}
|
||||
dba::close($items);
|
||||
DBA::close($items);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -946,18 +946,18 @@ class Item extends BaseObject
|
|||
return;
|
||||
}
|
||||
|
||||
$items = dba::select('item', ['id', 'uid'], $condition);
|
||||
while ($item = dba::fetch($items)) {
|
||||
$items = DBA::select('item', ['id', 'uid'], $condition);
|
||||
while ($item = DBA::fetch($items)) {
|
||||
// "Deleting" global items just means hiding them
|
||||
if ($item['uid'] == 0) {
|
||||
dba::update('user-item', ['hidden' => true], ['iid' => $item['id'], 'uid' => $uid], true);
|
||||
DBA::update('user-item', ['hidden' => true], ['iid' => $item['id'], 'uid' => $uid], true);
|
||||
} elseif ($item['uid'] == $uid) {
|
||||
self::deleteById($item['id'], PRIORITY_HIGH);
|
||||
} else {
|
||||
logger('Wrong ownership. Not deleting item ' . $item['id']);
|
||||
}
|
||||
}
|
||||
dba::close($items);
|
||||
DBA::close($items);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1016,7 +1016,7 @@ class Item extends BaseObject
|
|||
* generate a resource-id and therefore aren't intimately linked to the item.
|
||||
*/
|
||||
if (strlen($item['resource-id'])) {
|
||||
dba::delete('photo', ['resource-id' => $item['resource-id'], 'uid' => $item['uid']]);
|
||||
DBA::delete('photo', ['resource-id' => $item['resource-id'], 'uid' => $item['uid']]);
|
||||
}
|
||||
|
||||
// If item is a link to an event, delete the event.
|
||||
|
@ -1028,7 +1028,7 @@ class Item extends BaseObject
|
|||
foreach (explode(", ", $item['attach']) as $attach) {
|
||||
preg_match("|attach/(\d+)|", $attach, $matches);
|
||||
if (is_array($matches) && count($matches) > 1) {
|
||||
dba::delete('attach', ['id' => $matches[1], 'uid' => $item['uid']]);
|
||||
DBA::delete('attach', ['id' => $matches[1], 'uid' => $item['uid']]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1041,7 +1041,7 @@ class Item extends BaseObject
|
|||
$item_fields = ['deleted' => true, 'edited' => DateTimeFormat::utcNow(), 'changed' => DateTimeFormat::utcNow(),
|
||||
'body' => '', 'title' => '', 'content-warning' => '', 'rendered-hash' => '', 'rendered-html' => '',
|
||||
'object' => '', 'target' => '', 'tag' => '', 'postopts' => '', 'attach' => '', 'file' => ''];
|
||||
dba::update('item', $item_fields, ['id' => $item['id']]);
|
||||
DBA::update('item', $item_fields, ['id' => $item['id']]);
|
||||
|
||||
Term::insertFromTagFieldByItemId($item['id'], '');
|
||||
Term::insertFromFileFieldByItemId($item['id'], '');
|
||||
|
@ -1051,7 +1051,7 @@ class Item extends BaseObject
|
|||
self::delete(['uri' => $item['uri'], 'uid' => 0, 'deleted' => false], $priority);
|
||||
}
|
||||
|
||||
dba::delete('item-delivery-data', ['iid' => $item['id']]);
|
||||
DBA::delete('item-delivery-data', ['iid' => $item['id']]);
|
||||
|
||||
// If it's the parent of a comment thread, kill all the kids
|
||||
if ($item['id'] == $item['parent']) {
|
||||
|
@ -1071,7 +1071,7 @@ class Item extends BaseObject
|
|||
// When we delete just our local user copy of an item, we have to set a marker to hide it
|
||||
$global_item = self::selectFirst(['id'], ['uri' => $item['uri'], 'uid' => 0, 'deleted' => false]);
|
||||
if (DBM::is_result($global_item)) {
|
||||
dba::update('user-item', ['hidden' => true], ['iid' => $global_item['id'], 'uid' => $item['uid']], true);
|
||||
DBA::update('user-item', ['hidden' => true], ['iid' => $global_item['id'], 'uid' => $item['uid']], true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1194,7 +1194,7 @@ class Item extends BaseObject
|
|||
|
||||
// Still missing? Then use the "self" contact of the current user
|
||||
if ($contact_id == 0) {
|
||||
$self = dba::selectFirst('contact', ['id'], ['self' => true, 'uid' => $item['uid']]);
|
||||
$self = DBA::selectFirst('contact', ['id'], ['self' => true, 'uid' => $item['uid']]);
|
||||
if (DBM::is_result($self)) {
|
||||
$contact_id = $self["id"];
|
||||
}
|
||||
|
@ -1279,7 +1279,7 @@ class Item extends BaseObject
|
|||
// check for create date and expire time
|
||||
$expire_interval = Config::get('system', 'dbclean-expire-days', 0);
|
||||
|
||||
$user = dba::selectFirst('user', ['expire'], ['uid' => $uid]);
|
||||
$user = DBA::selectFirst('user', ['expire'], ['uid' => $uid]);
|
||||
if (DBM::is_result($user) && ($user['expire'] > 0) && (($user['expire'] < $expire_interval) || ($expire_interval == 0))) {
|
||||
$expire_interval = $user['expire'];
|
||||
}
|
||||
|
@ -1314,7 +1314,7 @@ class Item extends BaseObject
|
|||
}
|
||||
|
||||
// Ensure to always have the same creation date.
|
||||
$existing = dba::selectfirst('item', ['created', 'uri-hash'], ['uri' => $item['uri']]);
|
||||
$existing = DBA::selectfirst('item', ['created', 'uri-hash'], ['uri' => $item['uri']]);
|
||||
if (DBM::is_result($existing)) {
|
||||
$item['created'] = $existing['created'];
|
||||
$item['uri-hash'] = $existing['uri-hash'];
|
||||
|
@ -1510,13 +1510,13 @@ class Item extends BaseObject
|
|||
|
||||
// If its a post from myself then tag the thread as "mention"
|
||||
logger("Checking if parent ".$parent_id." has to be tagged as mention for user ".$item['uid'], LOGGER_DEBUG);
|
||||
$user = dba::selectFirst('user', ['nickname'], ['uid' => $item['uid']]);
|
||||
$user = DBA::selectFirst('user', ['nickname'], ['uid' => $item['uid']]);
|
||||
if (DBM::is_result($user)) {
|
||||
$self = normalise_link(System::baseUrl() . '/profile/' . $user['nickname']);
|
||||
$self_id = Contact::getIdForURL($self, 0, true);
|
||||
logger("'myself' is ".$self_id." for parent ".$parent_id." checking against ".$item['author-id']." and ".$item['owner-id'], LOGGER_DEBUG);
|
||||
if (($item['author-id'] == $self_id) || ($item['owner-id'] == $self_id)) {
|
||||
dba::update('thread', ['mention' => true], ['iid' => $parent_id]);
|
||||
DBA::update('thread', ['mention' => true], ['iid' => $parent_id]);
|
||||
logger("tagged thread ".$parent_id." as mention for user ".$self, LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
|
@ -1568,7 +1568,7 @@ class Item extends BaseObject
|
|||
$item["global"] = true;
|
||||
|
||||
// Set the global flag on all items if this was a global item entry
|
||||
dba::update('item', ['global' => true], ['uri' => $item["uri"]]);
|
||||
DBA::update('item', ['global' => true], ['uri' => $item["uri"]]);
|
||||
} else {
|
||||
$item["global"] = self::exists(['uid' => 0, 'uri' => $item["uri"]]);
|
||||
}
|
||||
|
@ -1652,15 +1652,15 @@ class Item extends BaseObject
|
|||
unset($item['postopts']);
|
||||
unset($item['inform']);
|
||||
|
||||
dba::transaction();
|
||||
$ret = dba::insert('item', $item);
|
||||
DBA::transaction();
|
||||
$ret = DBA::insert('item', $item);
|
||||
|
||||
// When the item was successfully stored we fetch the ID of the item.
|
||||
if (DBM::is_result($ret)) {
|
||||
$current_post = dba::lastInsertId();
|
||||
$current_post = DBA::lastInsertId();
|
||||
} else {
|
||||
// This can happen - for example - if there are locking timeouts.
|
||||
dba::rollback();
|
||||
DBA::rollback();
|
||||
|
||||
// Store the data into a spool file so that we can try again later.
|
||||
|
||||
|
@ -1689,26 +1689,26 @@ class Item extends BaseObject
|
|||
if ($current_post == 0) {
|
||||
// This is one of these error messages that never should occur.
|
||||
logger("couldn't find created item - we better quit now.");
|
||||
dba::rollback();
|
||||
DBA::rollback();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// How much entries have we created?
|
||||
// We wouldn't need this query when we could use an unique index - but MySQL has length problems with them.
|
||||
$entries = dba::count('item', ['uri' => $item['uri'], 'uid' => $item['uid'], 'network' => $item['network']]);
|
||||
$entries = DBA::count('item', ['uri' => $item['uri'], 'uid' => $item['uid'], 'network' => $item['network']]);
|
||||
|
||||
if ($entries > 1) {
|
||||
// There are duplicates. We delete our just created entry.
|
||||
logger('Duplicated post occurred. uri = ' . $item['uri'] . ' uid = ' . $item['uid']);
|
||||
|
||||
// Yes, we could do a rollback here - but we are having many users with MyISAM.
|
||||
dba::delete('item', ['id' => $current_post]);
|
||||
dba::commit();
|
||||
DBA::delete('item', ['id' => $current_post]);
|
||||
DBA::commit();
|
||||
return 0;
|
||||
} elseif ($entries == 0) {
|
||||
// This really should never happen since we quit earlier if there were problems.
|
||||
logger("Something is terribly wrong. We haven't found our created entry.");
|
||||
dba::rollback();
|
||||
DBA::rollback();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1720,7 +1720,7 @@ class Item extends BaseObject
|
|||
}
|
||||
|
||||
// Set parent id
|
||||
dba::update('item', ['parent' => $parent_id], ['id' => $current_post]);
|
||||
DBA::update('item', ['parent' => $parent_id], ['id' => $current_post]);
|
||||
|
||||
$item['id'] = $current_post;
|
||||
$item['parent'] = $parent_id;
|
||||
|
@ -1728,9 +1728,9 @@ class Item extends BaseObject
|
|||
// update the commented timestamp on the parent
|
||||
// Only update "commented" if it is really a comment
|
||||
if (($item['gravity'] != GRAVITY_ACTIVITY) || !Config::get("system", "like_no_comment")) {
|
||||
dba::update('item', ['commented' => DateTimeFormat::utcNow(), 'changed' => DateTimeFormat::utcNow()], ['id' => $parent_id]);
|
||||
DBA::update('item', ['commented' => DateTimeFormat::utcNow(), 'changed' => DateTimeFormat::utcNow()], ['id' => $parent_id]);
|
||||
} else {
|
||||
dba::update('item', ['changed' => DateTimeFormat::utcNow()], ['id' => $parent_id]);
|
||||
DBA::update('item', ['changed' => DateTimeFormat::utcNow()], ['id' => $parent_id]);
|
||||
}
|
||||
|
||||
if ($dsprsig) {
|
||||
|
@ -1743,14 +1743,14 @@ class Item extends BaseObject
|
|||
logger("Repaired double encoded signature from handle ".$dsprsig->signer, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
dba::insert('sign', ['iid' => $current_post, 'signed_text' => $dsprsig->signed_text,
|
||||
DBA::insert('sign', ['iid' => $current_post, 'signed_text' => $dsprsig->signed_text,
|
||||
'signature' => $dsprsig->signature, 'signer' => $dsprsig->signer]);
|
||||
}
|
||||
|
||||
if (!empty($diaspora_signed_text)) {
|
||||
// Formerly we stored the signed text, the signature and the author in different fields.
|
||||
// We now store the raw data so that we are more flexible.
|
||||
dba::insert('sign', ['iid' => $current_post, 'signed_text' => $diaspora_signed_text]);
|
||||
DBA::insert('sign', ['iid' => $current_post, 'signed_text' => $diaspora_signed_text]);
|
||||
}
|
||||
|
||||
$deleted = self::tagDeliver($item['uid'], $current_post);
|
||||
|
@ -1782,7 +1782,7 @@ class Item extends BaseObject
|
|||
|
||||
self::insertDeliveryData($delivery_data);
|
||||
|
||||
dba::commit();
|
||||
DBA::commit();
|
||||
|
||||
/*
|
||||
* Due to deadlock issues with the "term" table we are doing these steps after the commit.
|
||||
|
@ -1824,7 +1824,7 @@ class Item extends BaseObject
|
|||
return;
|
||||
}
|
||||
|
||||
dba::insert('item-delivery-data', $delivery_data);
|
||||
DBA::insert('item-delivery-data', $delivery_data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1839,7 +1839,7 @@ class Item extends BaseObject
|
|||
return;
|
||||
}
|
||||
|
||||
dba::update('item-delivery-data', $delivery_data, ['iid' => $id], true);
|
||||
DBA::update('item-delivery-data', $delivery_data, ['iid' => $id], true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1870,12 +1870,12 @@ class Item extends BaseObject
|
|||
}
|
||||
|
||||
// Do we already have this content?
|
||||
$item_activity = dba::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]);
|
||||
$item_activity = DBA::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]);
|
||||
if (DBM::is_result($item_activity)) {
|
||||
$item['iaid'] = $item_activity['id'];
|
||||
logger('Fetched activity for URI ' . $item['uri'] . ' (' . $item['iaid'] . ')');
|
||||
} elseif (dba::insert('item-activity', $fields)) {
|
||||
$item['iaid'] = dba::lastInsertId();
|
||||
} elseif (DBA::insert('item-activity', $fields)) {
|
||||
$item['iaid'] = DBA::lastInsertId();
|
||||
logger('Inserted activity for URI ' . $item['uri'] . ' (' . $item['iaid'] . ')');
|
||||
} else {
|
||||
// This shouldn't happen.
|
||||
|
@ -1911,12 +1911,12 @@ class Item extends BaseObject
|
|||
}
|
||||
|
||||
// Do we already have this content?
|
||||
$item_content = dba::selectFirst('item-content', ['id'], ['uri-plink-hash' => $item['uri-hash']]);
|
||||
$item_content = DBA::selectFirst('item-content', ['id'], ['uri-plink-hash' => $item['uri-hash']]);
|
||||
if (DBM::is_result($item_content)) {
|
||||
$item['icid'] = $item_content['id'];
|
||||
logger('Fetched content for URI ' . $item['uri'] . ' (' . $item['icid'] . ')');
|
||||
} elseif (dba::insert('item-content', $fields)) {
|
||||
$item['icid'] = dba::lastInsertId();
|
||||
} elseif (DBA::insert('item-content', $fields)) {
|
||||
$item['icid'] = DBA::lastInsertId();
|
||||
logger('Inserted content for URI ' . $item['uri'] . ' (' . $item['icid'] . ')');
|
||||
} else {
|
||||
// This shouldn't happen.
|
||||
|
@ -1948,7 +1948,7 @@ class Item extends BaseObject
|
|||
|
||||
logger('Update activity for ' . json_encode($condition));
|
||||
|
||||
dba::update('item-activity', $fields, $condition, true);
|
||||
DBA::update('item-activity', $fields, $condition, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1977,7 +1977,7 @@ class Item extends BaseObject
|
|||
|
||||
logger('Update content for ' . json_encode($condition));
|
||||
|
||||
dba::update('item-content', $fields, $condition, true);
|
||||
DBA::update('item-content', $fields, $condition, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2016,8 +2016,8 @@ class Item extends BaseObject
|
|||
|
||||
$condition = ["`nurl` IN (SELECT `nurl` FROM `contact` WHERE `id` = ?) AND `uid` != 0 AND NOT `blocked` AND `rel` IN (?, ?)",
|
||||
$parent['owner-id'], CONTACT_IS_SHARING, CONTACT_IS_FRIEND];
|
||||
$contacts = dba::select('contact', ['uid'], $condition);
|
||||
while ($contact = dba::fetch($contacts)) {
|
||||
$contacts = DBA::select('contact', ['uid'], $condition);
|
||||
while ($contact = DBA::fetch($contacts)) {
|
||||
$users[$contact['uid']] = $contact['uid'];
|
||||
}
|
||||
|
||||
|
@ -2025,7 +2025,7 @@ class Item extends BaseObject
|
|||
|
||||
if ($item['uri'] != $item['parent-uri']) {
|
||||
$parents = self::select(['uid', 'origin'], ["`uri` = ? AND `uid` != 0", $item['parent-uri']]);
|
||||
while ($parent = dba::fetch($parents)) {
|
||||
while ($parent = DBA::fetch($parents)) {
|
||||
$users[$parent['uid']] = $parent['uid'];
|
||||
if ($parent['origin'] && !$origin) {
|
||||
$origin_uid = $parent['uid'];
|
||||
|
@ -2060,7 +2060,7 @@ class Item extends BaseObject
|
|||
}
|
||||
|
||||
if (empty($item['contact-id'])) {
|
||||
$self = dba::selectFirst('contact', ['id'], ['self' => true, 'uid' => $uid]);
|
||||
$self = DBA::selectFirst('contact', ['id'], ['self' => true, 'uid' => $uid]);
|
||||
if (!DBM::is_result($self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -2071,7 +2071,7 @@ class Item extends BaseObject
|
|||
|
||||
$notify = false;
|
||||
if ($item['uri'] == $item['parent-uri']) {
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $item['contact-id'], 'self' => false]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $item['contact-id'], 'self' => false]);
|
||||
if (DBM::is_result($contact)) {
|
||||
$notify = self::isRemoteSelf($contact, $item);
|
||||
}
|
||||
|
@ -2272,7 +2272,7 @@ class Item extends BaseObject
|
|||
|
||||
$hostname = self::getApp()->get_hostname();
|
||||
|
||||
$user = dba::selectFirst('user', ['nickname'], ['uid' => $uid]);
|
||||
$user = DBA::selectFirst('user', ['nickname'], ['uid' => $uid]);
|
||||
|
||||
$uri = "urn:X-dfrn:" . $hostname . ':' . $user['nickname'] . ':' . $guid;
|
||||
|
||||
|
@ -2291,13 +2291,13 @@ class Item extends BaseObject
|
|||
private static function updateContact($arr)
|
||||
{
|
||||
// Unarchive the author
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $arr["author-id"]]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $arr["author-id"]]);
|
||||
if (DBM::is_result($contact)) {
|
||||
Contact::unmarkForArchival($contact);
|
||||
}
|
||||
|
||||
// Unarchive the contact if it's not our own contact
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $arr["contact-id"], 'self' => false]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $arr["contact-id"], 'self' => false]);
|
||||
if (DBM::is_result($contact)) {
|
||||
Contact::unmarkForArchival($contact);
|
||||
}
|
||||
|
@ -2306,22 +2306,22 @@ class Item extends BaseObject
|
|||
|
||||
// Is it a forum? Then we don't care about the rules from above
|
||||
if (!$update && ($arr["network"] == NETWORK_DFRN) && ($arr["parent-uri"] === $arr["uri"])) {
|
||||
if (dba::exists('contact', ['id' => $arr['contact-id'], 'forum' => true])) {
|
||||
if (DBA::exists('contact', ['id' => $arr['contact-id'], 'forum' => true])) {
|
||||
$update = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($update) {
|
||||
dba::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
|
||||
DBA::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
|
||||
['id' => $arr['contact-id']]);
|
||||
}
|
||||
// Now do the same for the system wide contacts with uid=0
|
||||
if (!$arr['private']) {
|
||||
dba::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
|
||||
DBA::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
|
||||
['id' => $arr['owner-id']]);
|
||||
|
||||
if ($arr['owner-id'] != $arr['author-id']) {
|
||||
dba::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
|
||||
DBA::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
|
||||
['id' => $arr['author-id']]);
|
||||
}
|
||||
}
|
||||
|
@ -2416,7 +2416,7 @@ class Item extends BaseObject
|
|||
|
||||
// Does the given user have this item?
|
||||
if ($uid) {
|
||||
$item = dba::fetch_first("SELECT `item`.`id`, `user`.`nickname` FROM `item`
|
||||
$item = DBA::fetch_first("SELECT `item`.`id`, `user`.`nickname` FROM `item`
|
||||
INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `item`.`guid` = ? AND `item`.`uid` = ?", $guid, $uid);
|
||||
|
@ -2428,7 +2428,7 @@ class Item extends BaseObject
|
|||
|
||||
// Or is it anywhere on the server?
|
||||
if ($nick == "") {
|
||||
$item = dba::fetch_first("SELECT `item`.`id`, `user`.`nickname` FROM `item`
|
||||
$item = DBA::fetch_first("SELECT `item`.`id`, `user`.`nickname` FROM `item`
|
||||
INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND NOT `item`.`private` AND `item`.`wall`
|
||||
|
@ -2451,7 +2451,7 @@ class Item extends BaseObject
|
|||
{
|
||||
$mention = false;
|
||||
|
||||
$user = dba::selectFirst('user', [], ['uid' => $uid]);
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $uid]);
|
||||
if (!DBM::is_result($user)) {
|
||||
return;
|
||||
}
|
||||
|
@ -2488,7 +2488,7 @@ class Item extends BaseObject
|
|||
// mmh.. no mention.. community page or private group... no wall.. no origin.. top-post (not a comment)
|
||||
// delete it!
|
||||
logger("no-mention top-level post to community or private group. delete.");
|
||||
dba::delete('item', ['id' => $item_id]);
|
||||
DBA::delete('item', ['id' => $item_id]);
|
||||
return true;
|
||||
}
|
||||
return;
|
||||
|
@ -2512,7 +2512,7 @@ class Item extends BaseObject
|
|||
}
|
||||
|
||||
// now change this copy of the post to a forum head message and deliver to all the tgroup members
|
||||
$self = dba::selectFirst('contact', ['id', 'name', 'url', 'thumb'], ['uid' => $uid, 'self' => true]);
|
||||
$self = DBA::selectFirst('contact', ['id', 'name', 'url', 'thumb'], ['uid' => $uid, 'self' => true]);
|
||||
if (!DBM::is_result($self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -2528,7 +2528,7 @@ class Item extends BaseObject
|
|||
$fields = ['wall' => true, 'origin' => true, 'forum_mode' => $forum_mode, 'contact-id' => $self['id'],
|
||||
'owner-id' => $owner_id, 'owner-link' => $self['url'], 'private' => $private, 'allow_cid' => $user['allow_cid'],
|
||||
'allow_gid' => $user['allow_gid'], 'deny_cid' => $user['deny_cid'], 'deny_gid' => $user['deny_gid']];
|
||||
dba::update('item', $fields, ['id' => $item_id]);
|
||||
DBA::update('item', $fields, ['id' => $item_id]);
|
||||
|
||||
self::updateThread($item_id);
|
||||
|
||||
|
@ -2569,7 +2569,7 @@ class Item extends BaseObject
|
|||
$datarray2 = $datarray;
|
||||
logger('remote-self start - Contact '.$contact['url'].' - '.$contact['remote_self'].' Item '.print_r($datarray, true), LOGGER_DEBUG);
|
||||
if ($contact['remote_self'] == 2) {
|
||||
$self = dba::selectFirst('contact', ['id', 'name', 'url', 'thumb'],
|
||||
$self = DBA::selectFirst('contact', ['id', 'name', 'url', 'thumb'],
|
||||
['uid' => $contact['uid'], 'self' => true]);
|
||||
if (DBM::is_result($self)) {
|
||||
$datarray['contact-id'] = $self["id"];
|
||||
|
@ -2664,7 +2664,7 @@ class Item extends BaseObject
|
|||
$res = substr($i, $x + 1);
|
||||
$i = substr($i, 0, $x);
|
||||
$fields = ['data', 'type', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
|
||||
$photo = dba::selectFirst('photo', $fields, ['resource-id' => $i, 'scale' => $res, 'uid' => $uid]);
|
||||
$photo = DBA::selectFirst('photo', $fields, ['resource-id' => $i, 'scale' => $res, 'uid' => $uid]);
|
||||
if (DBM::is_result($photo)) {
|
||||
/*
|
||||
* Check to see if we should replace this photo link with an embedded image
|
||||
|
@ -2870,7 +2870,7 @@ class Item extends BaseObject
|
|||
|
||||
++$expired;
|
||||
}
|
||||
dba::close($items);
|
||||
DBA::close($items);
|
||||
logger('User ' . $uid . ": expired $expired items; expire items: $expire_items, expire notes: $expire_notes, expire starred: $expire_starred, expire photos: $expire_photos");
|
||||
}
|
||||
|
||||
|
@ -2878,7 +2878,7 @@ class Item extends BaseObject
|
|||
{
|
||||
$condition = ['uid' => $uid, 'wall' => $wall, 'deleted' => false, 'visible' => true, 'moderated' => false];
|
||||
$params = ['order' => ['created' => false]];
|
||||
$thread = dba::selectFirst('thread', ['created'], $condition, $params);
|
||||
$thread = DBA::selectFirst('thread', ['created'], $condition, $params);
|
||||
if (DBM::is_result($thread)) {
|
||||
return substr(DateTimeFormat::local($thread['created']), 0, 10);
|
||||
}
|
||||
|
@ -2955,7 +2955,7 @@ class Item extends BaseObject
|
|||
}
|
||||
|
||||
// Retrieves the local post owner
|
||||
$owner_self_contact = dba::selectFirst('contact', [], ['uid' => $uid, 'self' => true]);
|
||||
$owner_self_contact = DBA::selectFirst('contact', [], ['uid' => $uid, 'self' => true]);
|
||||
if (!DBM::is_result($owner_self_contact)) {
|
||||
logger('like: unknown owner ' . $uid);
|
||||
return false;
|
||||
|
@ -2964,7 +2964,7 @@ class Item extends BaseObject
|
|||
// Retrieve the current logged in user's public contact
|
||||
$author_id = public_contact();
|
||||
|
||||
$author_contact = dba::selectFirst('contact', ['url'], ['id' => $author_id]);
|
||||
$author_contact = DBA::selectFirst('contact', ['url'], ['id' => $author_id]);
|
||||
if (!DBM::is_result($author_contact)) {
|
||||
logger('like: unknown author ' . $author_id);
|
||||
return false;
|
||||
|
@ -2976,7 +2976,7 @@ class Item extends BaseObject
|
|||
$item_contact = $owner_self_contact;
|
||||
} else {
|
||||
$item_contact_id = Contact::getIdForURL($author_contact['url'], $uid, true);
|
||||
$item_contact = dba::selectFirst('contact', [], ['id' => $item_contact_id]);
|
||||
$item_contact = DBA::selectFirst('contact', [], ['id' => $item_contact_id]);
|
||||
if (!DBM::is_result($item_contact)) {
|
||||
logger('like: unknown item contact ' . $item_contact_id);
|
||||
return false;
|
||||
|
@ -3008,10 +3008,10 @@ class Item extends BaseObject
|
|||
// Already voted, undo it
|
||||
$fields = ['deleted' => true, 'unseen' => true, 'changed' => DateTimeFormat::utcNow()];
|
||||
/// @todo Consider using self::update - but before doing so, check the side effects
|
||||
dba::update('item', $fields, ['id' => $like_item['id']]);
|
||||
DBA::update('item', $fields, ['id' => $like_item['id']]);
|
||||
|
||||
// Clean up the Diaspora signatures for this like
|
||||
dba::delete('sign', ['iid' => $like_item['id']]);
|
||||
DBA::delete('sign', ['iid' => $like_item['id']]);
|
||||
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "like", $like_item['id']);
|
||||
|
||||
|
@ -3086,7 +3086,7 @@ class Item extends BaseObject
|
|||
$item['iid'] = $itemid;
|
||||
|
||||
if (!$onlyshadow) {
|
||||
$result = dba::insert('thread', $item);
|
||||
$result = DBA::insert('thread', $item);
|
||||
|
||||
logger("Add thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG);
|
||||
}
|
||||
|
@ -3118,28 +3118,28 @@ class Item extends BaseObject
|
|||
}
|
||||
}
|
||||
|
||||
$result = dba::update('thread', $fields, ['iid' => $itemid]);
|
||||
$result = DBA::update('thread', $fields, ['iid' => $itemid]);
|
||||
|
||||
logger("Update thread for item ".$itemid." - guid ".$item["guid"]." - ".(int)$result, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
private static function deleteThread($itemid, $itemuri = "")
|
||||
{
|
||||
$item = dba::selectFirst('thread', ['uid'], ['iid' => $itemid]);
|
||||
$item = DBA::selectFirst('thread', ['uid'], ['iid' => $itemid]);
|
||||
if (!DBM::is_result($item)) {
|
||||
logger('No thread found for id '.$itemid, LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
// Using dba::delete at this time could delete the associated item entries
|
||||
$result = dba::e("DELETE FROM `thread` WHERE `iid` = ?", $itemid);
|
||||
$result = DBA::e("DELETE FROM `thread` WHERE `iid` = ?", $itemid);
|
||||
|
||||
logger("deleteThread: Deleted thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG);
|
||||
|
||||
if ($itemuri != "") {
|
||||
$condition = ["`uri` = ? AND NOT `deleted` AND NOT (`uid` IN (?, 0))", $itemuri, $item["uid"]];
|
||||
if (!self::exists($condition)) {
|
||||
dba::delete('item', ['uri' => $itemuri, 'uid' => 0]);
|
||||
DBA::delete('item', ['uri' => $itemuri, 'uid' => 0]);
|
||||
logger("deleteThread: Deleted shadow for item ".$itemuri, LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Friendica\Model;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -40,8 +40,8 @@ class Mail
|
|||
$subject = L10n::t('[no subject]');
|
||||
}
|
||||
|
||||
$me = dba::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $recipient, 'uid' => local_user()]);
|
||||
$me = DBA::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $recipient, 'uid' => local_user()]);
|
||||
|
||||
if (!(count($me) && (count($contact)))) {
|
||||
return -2;
|
||||
|
@ -84,8 +84,8 @@ class Mail
|
|||
$fields = ['uid' => local_user(), 'guid' => $conv_guid, 'creator' => $sender_handle,
|
||||
'created' => DateTimeFormat::utcNow(), 'updated' => DateTimeFormat::utcNow(),
|
||||
'subject' => $subject, 'recips' => $handles];
|
||||
if (dba::insert('conv', $fields)) {
|
||||
$convid = dba::lastInsertId();
|
||||
if (DBA::insert('conv', $fields)) {
|
||||
$convid = DBA::lastInsertId();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ class Mail
|
|||
}
|
||||
|
||||
$post_id = null;
|
||||
$success = dba::insert(
|
||||
$success = DBA::insert(
|
||||
'mail',
|
||||
[
|
||||
'uid' => local_user(),
|
||||
|
@ -121,7 +121,7 @@ class Mail
|
|||
);
|
||||
|
||||
if ($success) {
|
||||
$post_id = dba::lastInsertId();
|
||||
$post_id = DBA::lastInsertId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -145,7 +145,7 @@ class Mail
|
|||
}
|
||||
$image_uri = substr($image, strrpos($image, '/') + 1);
|
||||
$image_uri = substr($image_uri, 0, strpos($image_uri, '-'));
|
||||
dba::update('photo', ['allow-cid' => '<' . $recipient . '>'], ['resource-id' => $image_uri, 'album' => 'Wall Photos', 'uid' => local_user()]);
|
||||
DBA::update('photo', ['allow-cid' => '<' . $recipient . '>'], ['resource-id' => $image_uri, 'album' => 'Wall Photos', 'uid' => local_user()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -198,8 +198,8 @@ class Mail
|
|||
$fields = ['uid' => $recipient['uid'], 'guid' => $conv_guid, 'creator' => $sender_handle,
|
||||
'created' => DateTimeFormat::utcNow(), 'updated' => DateTimeFormat::utcNow(),
|
||||
'subject' => $subject, 'recips' => $handles];
|
||||
if (dba::insert('conv', $fields)) {
|
||||
$convid = dba::lastInsertId();
|
||||
if (DBA::insert('conv', $fields)) {
|
||||
$convid = DBA::lastInsertId();
|
||||
}
|
||||
|
||||
if (!$convid) {
|
||||
|
@ -207,7 +207,7 @@ class Mail
|
|||
return -4;
|
||||
}
|
||||
|
||||
dba::insert(
|
||||
DBA::insert(
|
||||
'mail',
|
||||
[
|
||||
'uid' => $recipient['uid'],
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
|
@ -33,7 +33,7 @@ class OpenWebAuthToken
|
|||
"meta" => $meta,
|
||||
"created" => DateTimeFormat::utcNow()
|
||||
];
|
||||
return dba::insert("openwebauth-token", $fields);
|
||||
return DBA::insert("openwebauth-token", $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,9 +49,9 @@ class OpenWebAuthToken
|
|||
{
|
||||
$condition = ["type" => $type, "uid" => $uid, "token" => $token];
|
||||
|
||||
$entry = dba::selectFirst("openwebauth-token", ["id", "meta"], $condition);
|
||||
$entry = DBA::selectFirst("openwebauth-token", ["id", "meta"], $condition);
|
||||
if (DBM::is_result($entry)) {
|
||||
dba::delete("openwebauth-token", ["id" => $entry["id"]]);
|
||||
DBA::delete("openwebauth-token", ["id" => $entry["id"]]);
|
||||
|
||||
return $entry["meta"];
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class OpenWebAuthToken
|
|||
public static function purge($type, $interval)
|
||||
{
|
||||
$condition = ["`type` = ? AND `created` < ?", $type, DateTimeFormat::utcNow() . " - INTERVAL " . $interval];
|
||||
dba::delete("openwebauth-token", $condition);
|
||||
DBA::delete("openwebauth-token", $condition);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -29,12 +29,12 @@ class PermissionSet extends BaseObject
|
|||
'deny_cid' => self::sortPermissions(defaults($postarray, 'deny_cid', '')),
|
||||
'deny_gid' => self::sortPermissions(defaults($postarray, 'deny_gid', ''))];
|
||||
|
||||
$set = dba::selectFirst('permissionset', ['id'], $condition);
|
||||
$set = DBA::selectFirst('permissionset', ['id'], $condition);
|
||||
|
||||
if (!DBM::is_result($set)) {
|
||||
dba::insert('permissionset', $condition, true);
|
||||
DBA::insert('permissionset', $condition, true);
|
||||
|
||||
$set = dba::selectFirst('permissionset', ['id'], $condition);
|
||||
$set = DBA::selectFirst('permissionset', ['id'], $condition);
|
||||
}
|
||||
return $set['id'];
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ use Friendica\Core\Cache;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -41,14 +41,14 @@ class Photo
|
|||
*/
|
||||
public static function store(Image $Image, $uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '', $desc = '')
|
||||
{
|
||||
$photo = dba::selectFirst('photo', ['guid'], ["`resource-id` = ? AND `guid` != ?", $rid, '']);
|
||||
$photo = DBA::selectFirst('photo', ['guid'], ["`resource-id` = ? AND `guid` != ?", $rid, '']);
|
||||
if (DBM::is_result($photo)) {
|
||||
$guid = $photo['guid'];
|
||||
} else {
|
||||
$guid = System::createGUID();
|
||||
}
|
||||
|
||||
$existing_photo = dba::selectFirst('photo', ['id'], ['resource-id' => $rid, 'uid' => $uid, 'contact-id' => $cid, 'scale' => $scale]);
|
||||
$existing_photo = DBA::selectFirst('photo', ['id'], ['resource-id' => $rid, 'uid' => $uid, 'contact-id' => $cid, 'scale' => $scale]);
|
||||
|
||||
$fields = [
|
||||
'uid' => $uid,
|
||||
|
@ -74,9 +74,9 @@ class Photo
|
|||
];
|
||||
|
||||
if (DBM::is_result($existing_photo)) {
|
||||
$r = dba::update('photo', $fields, ['id' => $existing_photo['id']]);
|
||||
$r = DBA::update('photo', $fields, ['id' => $existing_photo['id']]);
|
||||
} else {
|
||||
$r = dba::insert('photo', $fields);
|
||||
$r = DBA::insert('photo', $fields);
|
||||
}
|
||||
|
||||
return $r;
|
||||
|
@ -94,7 +94,7 @@ class Photo
|
|||
$thumb = '';
|
||||
$micro = '';
|
||||
|
||||
$photo = dba::selectFirst(
|
||||
$photo = DBA::selectFirst(
|
||||
'photo', ['resource-id'], ['uid' => $uid, 'contact-id' => $cid, 'scale' => 4, 'album' => 'Contact Photos']
|
||||
);
|
||||
if (x($photo['resource-id'])) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -30,13 +30,13 @@ class Process extends BaseObject
|
|||
$pid = getmypid();
|
||||
}
|
||||
|
||||
dba::transaction();
|
||||
DBA::transaction();
|
||||
|
||||
if (!dba::exists('process', ['pid' => $pid])) {
|
||||
$return = dba::insert('process', ['pid' => $pid, 'command' => $command, 'created' => DateTimeFormat::utcNow()]);
|
||||
if (!DBA::exists('process', ['pid' => $pid])) {
|
||||
$return = DBA::insert('process', ['pid' => $pid, 'command' => $command, 'created' => DateTimeFormat::utcNow()]);
|
||||
}
|
||||
|
||||
dba::commit();
|
||||
DBA::commit();
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class Process extends BaseObject
|
|||
$pid = getmypid();
|
||||
}
|
||||
|
||||
return dba::delete('process', ['pid' => $pid]);
|
||||
return DBA::delete('process', ['pid' => $pid]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,15 +61,15 @@ class Process extends BaseObject
|
|||
*/
|
||||
public static function deleteInactive()
|
||||
{
|
||||
dba::transaction();
|
||||
DBA::transaction();
|
||||
|
||||
$processes = dba::select('process', ['pid']);
|
||||
while($process = dba::fetch($processes)) {
|
||||
$processes = DBA::select('process', ['pid']);
|
||||
while($process = DBA::fetch($processes)) {
|
||||
if (!posix_kill($process['pid'], 0)) {
|
||||
self::deleteByPid($process['pid']);
|
||||
}
|
||||
}
|
||||
|
||||
dba::commit();
|
||||
DBA::commit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -89,7 +89,7 @@ class Profile
|
|||
*/
|
||||
public static function load(App $a, $nickname, $profile = 0, array $profiledata = [], $show_connect = true)
|
||||
{
|
||||
$user = dba::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
|
||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
|
||||
|
||||
if (!DBM::is_result($user) && empty($profiledata)) {
|
||||
logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
|
||||
|
@ -198,7 +198,7 @@ class Profile
|
|||
if (remote_user() && count($_SESSION['remote'])) {
|
||||
foreach ($_SESSION['remote'] as $visitor) {
|
||||
if ($visitor['uid'] == $uid) {
|
||||
$contact = dba::selectFirst('contact', ['profile-id'], ['id' => $visitor['cid']]);
|
||||
$contact = DBA::selectFirst('contact', ['profile-id'], ['id' => $visitor['cid']]);
|
||||
if (DBM::is_result($contact)) {
|
||||
$profile_id = $contact['profile-id'];
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ class Profile
|
|||
$profile = null;
|
||||
|
||||
if ($profile_id) {
|
||||
$profile = dba::fetch_first(
|
||||
$profile = DBA::fetch_first(
|
||||
"SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` AS `contact_photo`,
|
||||
`contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
|
||||
`profile`.`uid` AS `profile_uid`, `profile`.*,
|
||||
|
@ -224,7 +224,7 @@ class Profile
|
|||
);
|
||||
}
|
||||
if (!DBM::is_result($profile)) {
|
||||
$profile = dba::fetch_first(
|
||||
$profile = DBA::fetch_first(
|
||||
"SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` as `contact_photo`,
|
||||
`contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
|
||||
`profile`.`uid` AS `profile_uid`, `profile`.*,
|
||||
|
@ -312,7 +312,7 @@ class Profile
|
|||
$profile_url = normalise_link(System::baseUrl() . '/profile/' . $profile['nickname']);
|
||||
}
|
||||
|
||||
if (dba::exists('contact', ['pending' => false, 'uid' => local_user(), 'nurl' => $profile_url])) {
|
||||
if (DBA::exists('contact', ['pending' => false, 'uid' => local_user(), 'nurl' => $profile_url])) {
|
||||
$connect = false;
|
||||
}
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ class Profile
|
|||
$cachekey = 'get_birthdays:' . local_user();
|
||||
$r = Cache::get($cachekey);
|
||||
if (is_null($r)) {
|
||||
$s = dba::p(
|
||||
$s = DBA::p(
|
||||
"SELECT `event`.*, `event`.`id` AS `eid`, `contact`.* FROM `event`
|
||||
INNER JOIN `contact` ON `contact`.`id` = `event`.`cid`
|
||||
WHERE `event`.`uid` = ? AND `type` = 'birthday' AND `start` < ? AND `finish` > ?
|
||||
|
@ -557,7 +557,7 @@ class Profile
|
|||
DateTimeFormat::utcNow()
|
||||
);
|
||||
if (DBM::is_result($s)) {
|
||||
$r = dba::inArray($s);
|
||||
$r = DBA::inArray($s);
|
||||
Cache::set($cachekey, $r, CACHE_HOUR);
|
||||
}
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ class Profile
|
|||
$bd_format = L10n::t('g A l F d'); // 8 AM Friday January 18
|
||||
$classtoday = '';
|
||||
|
||||
$s = dba::p(
|
||||
$s = DBA::p(
|
||||
"SELECT `event`.*
|
||||
FROM `event`
|
||||
INNER JOIN `item`
|
||||
|
@ -661,7 +661,7 @@ class Profile
|
|||
if (DBM::is_result($s)) {
|
||||
$istoday = false;
|
||||
|
||||
while ($rr = dba::fetch($s)) {
|
||||
while ($rr = DBA::fetch($s)) {
|
||||
if (strlen($rr['name'])) {
|
||||
$total ++;
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ class Profile
|
|||
|
||||
$r[] = $rr;
|
||||
}
|
||||
dba::close($s);
|
||||
DBA::close($s);
|
||||
$classtoday = (($istoday) ? 'event-today' : '');
|
||||
}
|
||||
$tpl = get_markup_template('events_reminder.tpl');
|
||||
|
@ -1025,7 +1025,7 @@ class Profile
|
|||
return;
|
||||
}
|
||||
|
||||
$contact = dba::selectFirst('contact',['id', 'url'], ['id' => $cid]);
|
||||
$contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]);
|
||||
|
||||
if (DBM::is_result($contact) && remote_user() && remote_user() == $contact['id']) {
|
||||
// The visitor is already authenticated.
|
||||
|
@ -1081,7 +1081,7 @@ class Profile
|
|||
return;
|
||||
}
|
||||
|
||||
$visitor = dba::selectFirst('contact', [], ['id' => $cid]);
|
||||
$visitor = DBA::selectFirst('contact', [], ['id' => $cid]);
|
||||
|
||||
// Authenticate the visitor.
|
||||
$_SESSION['authenticated'] = 1;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
|
@ -22,7 +22,7 @@ class PushSubscriber
|
|||
public static function publishFeed($uid, $default_priority = PRIORITY_HIGH)
|
||||
{
|
||||
$condition = ['push' => 0, 'uid' => $uid];
|
||||
dba::update('push_subscriber', ['push' => 1, 'next_try' => NULL_DATE], $condition);
|
||||
DBA::update('push_subscriber', ['push' => 1, 'next_try' => NULL_DATE], $condition);
|
||||
|
||||
self::requeue($default_priority);
|
||||
}
|
||||
|
@ -36,9 +36,9 @@ class PushSubscriber
|
|||
{
|
||||
// We'll push to each subscriber that has push > 0,
|
||||
// i.e. there has been an update (set in notifier.php).
|
||||
$subscribers = dba::select('push_subscriber', ['id', 'push', 'callback_url', 'nickname'], ["`push` > 0 AND `next_try` < UTC_TIMESTAMP()"]);
|
||||
$subscribers = DBA::select('push_subscriber', ['id', 'push', 'callback_url', 'nickname'], ["`push` > 0 AND `next_try` < UTC_TIMESTAMP()"]);
|
||||
|
||||
while ($subscriber = dba::fetch($subscribers)) {
|
||||
while ($subscriber = DBA::fetch($subscribers)) {
|
||||
// We always handle retries with low priority
|
||||
if ($subscriber['push'] > 1) {
|
||||
$priority = PRIORITY_LOW;
|
||||
|
@ -50,7 +50,7 @@ class PushSubscriber
|
|||
Worker::add($priority, 'PubSubPublish', (int)$subscriber['id']);
|
||||
}
|
||||
|
||||
dba::close($subscribers);
|
||||
DBA::close($subscribers);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,10 +66,10 @@ class PushSubscriber
|
|||
public static function renew($uid, $nick, $subscribe, $hub_callback, $hub_topic, $hub_secret)
|
||||
{
|
||||
// fetch the old subscription if it exists
|
||||
$subscriber = dba::selectFirst('push_subscriber', ['last_update', 'push'], ['callback_url' => $hub_callback]);
|
||||
$subscriber = DBA::selectFirst('push_subscriber', ['last_update', 'push'], ['callback_url' => $hub_callback]);
|
||||
|
||||
// delete old subscription if it exists
|
||||
dba::delete('push_subscriber', ['callback_url' => $hub_callback]);
|
||||
DBA::delete('push_subscriber', ['callback_url' => $hub_callback]);
|
||||
|
||||
if ($subscribe) {
|
||||
// if we are just updating an old subscription, keep the
|
||||
|
@ -87,7 +87,7 @@ class PushSubscriber
|
|||
'topic' => $hub_topic, 'nickname' => $nick, 'push' => $push_flag,
|
||||
'last_update' => $last_update, 'renewed' => DateTimeFormat::utcNow(),
|
||||
'secret' => $hub_secret];
|
||||
dba::insert('push_subscriber', $fields);
|
||||
DBA::insert('push_subscriber', $fields);
|
||||
|
||||
logger("Successfully subscribed [$hub_callback] for $nick");
|
||||
} else {
|
||||
|
@ -103,7 +103,7 @@ class PushSubscriber
|
|||
*/
|
||||
public static function delay($id)
|
||||
{
|
||||
$subscriber = dba::selectFirst('push_subscriber', ['push', 'callback_url', 'renewed', 'nickname'], ['id' => $id]);
|
||||
$subscriber = DBA::selectFirst('push_subscriber', ['push', 'callback_url', 'renewed', 'nickname'], ['id' => $id]);
|
||||
if (!DBM::is_result($subscriber)) {
|
||||
return;
|
||||
}
|
||||
|
@ -115,10 +115,10 @@ class PushSubscriber
|
|||
$days = round((time() - strtotime($subscriber['renewed'])) / (60 * 60 * 24));
|
||||
|
||||
if ($days > 60) {
|
||||
dba::update('push_subscriber', ['push' => -1, 'next_try' => NULL_DATE], ['id' => $id]);
|
||||
DBA::update('push_subscriber', ['push' => -1, 'next_try' => NULL_DATE], ['id' => $id]);
|
||||
logger('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.', LOGGER_DEBUG);
|
||||
} else {
|
||||
dba::update('push_subscriber', ['push' => 0, 'next_try' => NULL_DATE], ['id' => $id]);
|
||||
DBA::update('push_subscriber', ['push' => 0, 'next_try' => NULL_DATE], ['id' => $id]);
|
||||
logger('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.', LOGGER_DEBUG);
|
||||
}
|
||||
} else {
|
||||
|
@ -128,7 +128,7 @@ class PushSubscriber
|
|||
|
||||
$retrial = $retrial + 1;
|
||||
|
||||
dba::update('push_subscriber', ['push' => $retrial, 'next_try' => $next], ['id' => $id]);
|
||||
DBA::update('push_subscriber', ['push' => $retrial, 'next_try' => $next], ['id' => $id]);
|
||||
logger('Delivery error: Next try (' . $retrial . ') ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' at ' . $next, LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
|
@ -141,14 +141,14 @@ class PushSubscriber
|
|||
*/
|
||||
public static function reset($id, $last_update)
|
||||
{
|
||||
$subscriber = dba::selectFirst('push_subscriber', ['callback_url', 'nickname'], ['id' => $id]);
|
||||
$subscriber = DBA::selectFirst('push_subscriber', ['callback_url', 'nickname'], ['id' => $id]);
|
||||
if (!DBM::is_result($subscriber)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// set last_update to the 'created' date of the last item, and reset push=0
|
||||
$fields = ['push' => 0, 'next_try' => NULL_DATE, 'last_update' => $last_update];
|
||||
dba::update('push_subscriber', $fields, ['id' => $id]);
|
||||
DBA::update('push_subscriber', $fields, ['id' => $id]);
|
||||
logger('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital', LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
|
@ -19,7 +19,7 @@ class Queue
|
|||
public static function updateTime($id)
|
||||
{
|
||||
logger('queue: requeue item ' . $id);
|
||||
$queue = dba::selectFirst('queue', ['retrial'], ['id' => $id]);
|
||||
$queue = DBA::selectFirst('queue', ['retrial'], ['id' => $id]);
|
||||
if (!DBM::is_result($queue)) {
|
||||
return;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class Queue
|
|||
$delay = (($retrial + 3) ** 4) + (rand(1, 30) * ($retrial + 1));
|
||||
$next = DateTimeFormat::utc('now + ' . $delay . ' seconds');
|
||||
|
||||
dba::update('queue', ['last' => DateTimeFormat::utcNow(), 'retrial' => $retrial + 1, 'next' => $next], ['id' => $id]);
|
||||
DBA::update('queue', ['last' => DateTimeFormat::utcNow(), 'retrial' => $retrial + 1, 'next' => $next], ['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,7 +43,7 @@ class Queue
|
|||
public static function removeItem($id)
|
||||
{
|
||||
logger('queue: remove queue item ' . $id);
|
||||
dba::delete('queue', ['id' => $id]);
|
||||
DBA::delete('queue', ['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,7 +109,7 @@ class Queue
|
|||
}
|
||||
}
|
||||
|
||||
dba::insert('queue', [
|
||||
DBA::insert('queue', [
|
||||
'cid' => $cid,
|
||||
'network' => $network,
|
||||
'guid' => $guid,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'boot.php';
|
||||
|
@ -18,8 +18,8 @@ class Term
|
|||
{
|
||||
$tag_text = '';
|
||||
$condition = ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_HASHTAG, TERM_MENTION]];
|
||||
$tags = dba::select('term', [], $condition);
|
||||
while ($tag = dba::fetch($tags)) {
|
||||
$tags = DBA::select('term', [], $condition);
|
||||
while ($tag = DBA::fetch($tags)) {
|
||||
if ($tag_text != '') {
|
||||
$tag_text .= ',';
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ class Term
|
|||
{
|
||||
$file_text = '';
|
||||
$condition = ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_FILE, TERM_CATEGORY]];
|
||||
$tags = dba::select('term', [], $condition);
|
||||
while ($tag = dba::fetch($tags)) {
|
||||
$tags = DBA::select('term', [], $condition);
|
||||
while ($tag = DBA::fetch($tags)) {
|
||||
if ($tag['type'] == TERM_CATEGORY) {
|
||||
$file_text .= '<' . $tag['term'] . '>';
|
||||
} else {
|
||||
|
@ -66,7 +66,7 @@ class Term
|
|||
$message['tag'] = $tags;
|
||||
|
||||
// Clean up all tags
|
||||
dba::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_HASHTAG, TERM_MENTION]]);
|
||||
DBA::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_HASHTAG, TERM_MENTION]]);
|
||||
|
||||
if ($message['deleted']) {
|
||||
return;
|
||||
|
@ -128,12 +128,12 @@ class Term
|
|||
|
||||
if ($message['uid'] == 0) {
|
||||
$global = true;
|
||||
dba::update('term', ['global' => true], ['otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
|
||||
DBA::update('term', ['global' => true], ['otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
|
||||
} else {
|
||||
$global = dba::exists('term', ['uid' => 0, 'otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
|
||||
$global = DBA::exists('term', ['uid' => 0, 'otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
|
||||
}
|
||||
|
||||
dba::insert('term', [
|
||||
DBA::insert('term', [
|
||||
'uid' => $message['uid'],
|
||||
'oid' => $itemid,
|
||||
'otype' => TERM_OBJ_POST,
|
||||
|
@ -152,8 +152,8 @@ class Term
|
|||
foreach ($users AS $user) {
|
||||
if ($user['uid'] == $message['uid']) {
|
||||
/// @todo This function is called frim Item::update - so we mustn't call that function here
|
||||
dba::update('item', ['mention' => true], ['id' => $itemid]);
|
||||
dba::update('thread', ['mention' => true], ['iid' => $message['parent']]);
|
||||
DBA::update('item', ['mention' => true], ['id' => $itemid]);
|
||||
DBA::update('thread', ['mention' => true], ['iid' => $message['parent']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ class Term
|
|||
}
|
||||
|
||||
// Clean up all tags
|
||||
dba::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_FILE, TERM_CATEGORY]]);
|
||||
DBA::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_FILE, TERM_CATEGORY]]);
|
||||
|
||||
if ($message["deleted"]) {
|
||||
return;
|
||||
|
@ -182,7 +182,7 @@ class Term
|
|||
|
||||
if (preg_match_all("/\[(.*?)\]/ism", $message["file"], $files)) {
|
||||
foreach ($files[1] as $file) {
|
||||
dba::insert('term', [
|
||||
DBA::insert('term', [
|
||||
'uid' => $message["uid"],
|
||||
'oid' => $itemid,
|
||||
'otype' => TERM_OBJ_POST,
|
||||
|
@ -194,7 +194,7 @@ class Term
|
|||
|
||||
if (preg_match_all("/\<(.*?)\>/ism", $message["file"], $files)) {
|
||||
foreach ($files[1] as $file) {
|
||||
dba::insert('term', [
|
||||
DBA::insert('term', [
|
||||
'uid' => $message["uid"],
|
||||
'oid' => $itemid,
|
||||
'otype' => TERM_OBJ_POST,
|
||||
|
@ -222,14 +222,14 @@ class Term
|
|||
|
||||
$searchpath = System::baseUrl() . "/search?tag=";
|
||||
|
||||
$taglist = dba::select(
|
||||
$taglist = DBA::select(
|
||||
'term',
|
||||
['type', 'term', 'url'],
|
||||
["`otype` = ? AND `oid` = ? AND `type` IN (?, ?)", TERM_OBJ_POST, $item['id'], TERM_HASHTAG, TERM_MENTION],
|
||||
['order' => ['tid']]
|
||||
);
|
||||
|
||||
while ($tag = dba::fetch($taglist)) {
|
||||
while ($tag = DBA::fetch($taglist)) {
|
||||
if ($tag["url"] == "") {
|
||||
$tag["url"] = $searchpath . $tag["term"];
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ class Term
|
|||
|
||||
$return['tags'][] = $prefix . "<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
|
||||
}
|
||||
dba::close($taglist);
|
||||
DBA::close($taglist);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Crypto;
|
||||
|
@ -38,7 +38,7 @@ class User
|
|||
* @return boolean|array
|
||||
*/
|
||||
public static function getOwnerDataById($uid) {
|
||||
$r = dba::fetch_first("SELECT
|
||||
$r = DBA::fetch_first("SELECT
|
||||
`contact`.*,
|
||||
`user`.`prvkey` AS `uprvkey`,
|
||||
`user`.`timezone`,
|
||||
|
@ -70,7 +70,7 @@ class User
|
|||
*/
|
||||
public static function getOwnerDataByNick($nick)
|
||||
{
|
||||
$user = dba::selectFirst('user', ['uid'], ['nickname' => $nick]);
|
||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nick]);
|
||||
if (!DBM::is_result($user)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ class User
|
|||
return $default_group;
|
||||
}
|
||||
|
||||
$user = dba::selectFirst('user', ['def_gid'], ['uid' => $uid]);
|
||||
$user = DBA::selectFirst('user', ['def_gid'], ['uid' => $uid]);
|
||||
|
||||
if (DBM::is_result($user)) {
|
||||
$default_group = $user["def_gid"];
|
||||
|
@ -198,7 +198,7 @@ class User
|
|||
}
|
||||
} elseif (is_int($user_info) || is_string($user_info)) {
|
||||
if (is_int($user_info)) {
|
||||
$user = dba::selectFirst('user', ['uid', 'password', 'legacy_password'],
|
||||
$user = DBA::selectFirst('user', ['uid', 'password', 'legacy_password'],
|
||||
[
|
||||
'uid' => $user_info,
|
||||
'blocked' => 0,
|
||||
|
@ -212,7 +212,7 @@ class User
|
|||
$condition = ["(`email` = ? OR `username` = ? OR `nickname` = ?)
|
||||
AND NOT `blocked` AND NOT `account_expired` AND NOT `account_removed` AND `verified`",
|
||||
$user_info, $user_info, $user_info];
|
||||
$user = dba::selectFirst('user', $fields, $condition);
|
||||
$user = DBA::selectFirst('user', $fields, $condition);
|
||||
}
|
||||
|
||||
if (!DBM::is_result($user)) {
|
||||
|
@ -298,7 +298,7 @@ class User
|
|||
'pwdreset_time' => null,
|
||||
'legacy_password' => false
|
||||
];
|
||||
return dba::update('user', $fields, ['uid' => $uid]);
|
||||
return DBA::update('user', $fields, ['uid' => $uid]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -379,7 +379,7 @@ class User
|
|||
throw new Exception(L10n::t('An invitation is required.'));
|
||||
}
|
||||
|
||||
if (!dba::exists('register', ['hash' => $invite_id])) {
|
||||
if (!DBA::exists('register', ['hash' => $invite_id])) {
|
||||
throw new Exception(L10n::t('Invitation could not be verified.'));
|
||||
}
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ class User
|
|||
throw new Exception(L10n::t('The nickname was blocked from registration by the nodes admin.'));
|
||||
}
|
||||
|
||||
if (Config::get('system', 'block_extended_register', false) && dba::exists('user', ['email' => $email])) {
|
||||
if (Config::get('system', 'block_extended_register', false) && DBA::exists('user', ['email' => $email])) {
|
||||
throw new Exception(L10n::t('Cannot use that email.'));
|
||||
}
|
||||
|
||||
|
@ -465,8 +465,8 @@ class User
|
|||
}
|
||||
|
||||
// Check existing and deleted accounts for this nickname.
|
||||
if (dba::exists('user', ['nickname' => $nickname])
|
||||
|| dba::exists('userd', ['username' => $nickname])
|
||||
if (DBA::exists('user', ['nickname' => $nickname])
|
||||
|| DBA::exists('userd', ['username' => $nickname])
|
||||
) {
|
||||
throw new Exception(L10n::t('Nickname is already registered. Please choose another.'));
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ class User
|
|||
$sprvkey = $sres['prvkey'];
|
||||
$spubkey = $sres['pubkey'];
|
||||
|
||||
$insert_result = dba::insert('user', [
|
||||
$insert_result = DBA::insert('user', [
|
||||
'guid' => generate_user_guid(),
|
||||
'username' => $username,
|
||||
'password' => $new_password_encoded,
|
||||
|
@ -509,8 +509,8 @@ class User
|
|||
]);
|
||||
|
||||
if ($insert_result) {
|
||||
$uid = dba::lastInsertId();
|
||||
$user = dba::selectFirst('user', [], ['uid' => $uid]);
|
||||
$uid = DBA::lastInsertId();
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $uid]);
|
||||
} else {
|
||||
throw new Exception(L10n::t('An error occurred during registration. Please try again.'));
|
||||
}
|
||||
|
@ -521,14 +521,14 @@ class User
|
|||
|
||||
// if somebody clicked submit twice very quickly, they could end up with two accounts
|
||||
// due to race condition. Remove this one.
|
||||
$user_count = dba::count('user', ['nickname' => $nickname]);
|
||||
$user_count = DBA::count('user', ['nickname' => $nickname]);
|
||||
if ($user_count > 1) {
|
||||
dba::delete('user', ['uid' => $uid]);
|
||||
DBA::delete('user', ['uid' => $uid]);
|
||||
|
||||
throw new Exception(L10n::t('Nickname is already registered. Please choose another.'));
|
||||
}
|
||||
|
||||
$insert_result = dba::insert('profile', [
|
||||
$insert_result = DBA::insert('profile', [
|
||||
'uid' => $uid,
|
||||
'name' => $username,
|
||||
'photo' => System::baseUrl() . "/photo/profile/{$uid}.jpg",
|
||||
|
@ -539,14 +539,14 @@ class User
|
|||
'profile-name' => L10n::t('default')
|
||||
]);
|
||||
if (!$insert_result) {
|
||||
dba::delete('user', ['uid' => $uid]);
|
||||
DBA::delete('user', ['uid' => $uid]);
|
||||
|
||||
throw new Exception(L10n::t('An error occurred creating your default profile. Please try again.'));
|
||||
}
|
||||
|
||||
// Create the self contact
|
||||
if (!Contact::createSelfFromUserId($uid)) {
|
||||
dba::delete('user', ['uid' => $uid]);
|
||||
DBA::delete('user', ['uid' => $uid]);
|
||||
|
||||
throw new Exception(L10n::t('An error occurred creating your self contact. Please try again.'));
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ class User
|
|||
// right away as a default group for new contacts.
|
||||
$def_gid = Group::create($uid, L10n::t('Friends'));
|
||||
if (!$def_gid) {
|
||||
dba::delete('user', ['uid' => $uid]);
|
||||
DBA::delete('user', ['uid' => $uid]);
|
||||
|
||||
throw new Exception(L10n::t('An error occurred creating your default contact group. Please try again.'));
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ class User
|
|||
$fields['allow_gid'] = '<' . $def_gid . '>';
|
||||
}
|
||||
|
||||
dba::update('user', $fields, ['uid' => $uid]);
|
||||
DBA::update('user', $fields, ['uid' => $uid]);
|
||||
|
||||
// if we have no OpenID photo try to look up an avatar
|
||||
if (!strlen($photo)) {
|
||||
|
@ -610,7 +610,7 @@ class User
|
|||
}
|
||||
|
||||
if (!$photo_failure) {
|
||||
dba::update('photo', ['profile' => 1], ['resource-id' => $hash]);
|
||||
DBA::update('photo', ['profile' => 1], ['resource-id' => $hash]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -714,16 +714,16 @@ class User
|
|||
|
||||
logger('Removing user: ' . $uid);
|
||||
|
||||
$user = dba::selectFirst('user', [], ['uid' => $uid]);
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $uid]);
|
||||
|
||||
Addon::callHooks('remove_user', $user);
|
||||
|
||||
// save username (actually the nickname as it is guaranteed
|
||||
// unique), so it cannot be re-registered in the future.
|
||||
dba::insert('userd', ['username' => $user['nickname']]);
|
||||
DBA::insert('userd', ['username' => $user['nickname']]);
|
||||
|
||||
// The user and related data will be deleted in "cron_expire_and_remove_users" (cronjobs.php)
|
||||
dba::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utcNow()], ['uid' => $uid]);
|
||||
DBA::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utcNow()], ['uid' => $uid]);
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "removeme", $uid);
|
||||
|
||||
// Send an update to the directory
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Friendica\Module;
|
|||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
require_once 'include/text.php';
|
||||
|
@ -26,14 +26,14 @@ class Hashtag extends BaseModule
|
|||
System::jsonExit($result);
|
||||
}
|
||||
|
||||
$taglist = dba::p("SELECT DISTINCT(`term`) FROM `term` WHERE `term` LIKE ? AND `type` = ? ORDER BY `term`",
|
||||
$taglist = DBA::p("SELECT DISTINCT(`term`) FROM `term` WHERE `term` LIKE ? AND `type` = ? ORDER BY `term`",
|
||||
$t . '%',
|
||||
intval(TERM_HASHTAG)
|
||||
);
|
||||
while ($tag = dba::fetch($taglist)) {
|
||||
while ($tag = DBA::fetch($taglist)) {
|
||||
$result[] = ['text' => $tag['term']];
|
||||
}
|
||||
dba::close($taglist);
|
||||
DBA::close($taglist);
|
||||
|
||||
System::jsonExit($result);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -135,7 +135,7 @@ class Login extends BaseModule
|
|||
throw new Exception(L10n::t('Login failed.'));
|
||||
}
|
||||
} else {
|
||||
$record = dba::selectFirst('user', [],
|
||||
$record = DBA::selectFirst('user', [],
|
||||
['uid' => User::getIdFromPasswordAuthentication($username, $password)]
|
||||
);
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ class Login extends BaseModule
|
|||
$data = json_decode($_COOKIE["Friendica"]);
|
||||
if (isset($data->uid)) {
|
||||
|
||||
$user = dba::selectFirst('user', [],
|
||||
$user = DBA::selectFirst('user', [],
|
||||
[
|
||||
'uid' => $data->uid,
|
||||
'blocked' => false,
|
||||
|
@ -231,7 +231,7 @@ class Login extends BaseModule
|
|||
goaway(self::getApp()->get_baseurl());
|
||||
}
|
||||
|
||||
$user = dba::selectFirst('user', [],
|
||||
$user = DBA::selectFirst('user', [],
|
||||
[
|
||||
'uid' => $_SESSION['uid'],
|
||||
'blocked' => false,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -44,7 +44,7 @@ class Magic extends BaseModule
|
|||
goaway($dest);
|
||||
}
|
||||
|
||||
$contact = dba::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]);
|
||||
$contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]);
|
||||
|
||||
// Redirect if the contact is already authenticated on this site.
|
||||
if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], normalise_link(self::getApp()->get_baseurl())) !== false) {
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Friendica\Module;
|
|||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\OpenWebAuthToken;
|
||||
|
@ -50,7 +50,7 @@ class Owa extends BaseModule
|
|||
$fields = ['id', 'url', 'addr', 'pubkey'];
|
||||
$condition = ['id' => $cid];
|
||||
|
||||
$contact = dba::selectFirst('contact', $fields, $condition);
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
|
||||
if (DBM::is_result($contact)) {
|
||||
// Try to verify the signed header with the public key of the contact record
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Friendica\Network;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use OAuthServer;
|
||||
|
@ -37,7 +37,7 @@ class FKOAuth1 extends OAuthServer
|
|||
{
|
||||
logger("FKOAuth1::loginUser $uid");
|
||||
$a = get_app();
|
||||
$record = dba::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]);
|
||||
$record = DBA::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]);
|
||||
|
||||
if (!DBM::is_result($record)) {
|
||||
logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
|
||||
|
@ -60,14 +60,14 @@ class FKOAuth1 extends OAuthServer
|
|||
$a->timezone = $a->user['timezone'];
|
||||
}
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => 1]);
|
||||
$contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => 1]);
|
||||
if (DBM::is_result($contact)) {
|
||||
$a->contact = $contact;
|
||||
$a->cid = $contact['id'];
|
||||
$_SESSION['cid'] = $a->cid;
|
||||
}
|
||||
|
||||
dba::update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $_SESSION['uid']]);
|
||||
DBA::update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $_SESSION['uid']]);
|
||||
|
||||
Addon::callHooks('logged_in', $a->user);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
namespace Friendica\Network;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use OAuthConsumer;
|
||||
use OAuthDataStore;
|
||||
|
@ -42,8 +42,8 @@ class FKOAuthDataStore extends OAuthDataStore
|
|||
{
|
||||
logger(__function__ . ":" . $consumer_key);
|
||||
|
||||
$s = dba::select('clients', ['client_id', 'pw', 'redirect_uri'], ['client_id' => $consumer_key]);
|
||||
$r = dba::inArray($s);
|
||||
$s = DBA::select('clients', ['client_id', 'pw', 'redirect_uri'], ['client_id' => $consumer_key]);
|
||||
$r = DBA::inArray($s);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
return new OAuthConsumer($r[0]['client_id'], $r[0]['pw'], $r[0]['redirect_uri']);
|
||||
|
@ -62,8 +62,8 @@ class FKOAuthDataStore extends OAuthDataStore
|
|||
{
|
||||
logger(__function__ . ":" . $consumer . ", " . $token_type . ", " . $token);
|
||||
|
||||
$s = dba::select('tokens', ['id', 'secret', 'scope', 'expires', 'uid'], ['client_id' => $consumer->key, 'scope' => $token_type, 'id' => $token]);
|
||||
$r = dba::inArray($s);
|
||||
$s = DBA::select('tokens', ['id', 'secret', 'scope', 'expires', 'uid'], ['client_id' => $consumer->key, 'scope' => $token_type, 'id' => $token]);
|
||||
$r = DBA::inArray($s);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
$ot = new OAuthToken($r[0]['id'], $r[0]['secret']);
|
||||
|
@ -85,7 +85,7 @@ class FKOAuthDataStore extends OAuthDataStore
|
|||
*/
|
||||
public function lookup_nonce($consumer, $token, $nonce, $timestamp)
|
||||
{
|
||||
$token = dba::selectFirst('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp]);
|
||||
$token = DBA::selectFirst('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp]);
|
||||
if (DBM::is_result($token)) {
|
||||
return new OAuthToken($token['id'], $token['secret']);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ class FKOAuthDataStore extends OAuthDataStore
|
|||
$k = $consumer;
|
||||
}
|
||||
|
||||
$r = dba::insert(
|
||||
$r = DBA::insert(
|
||||
'tokens',
|
||||
[
|
||||
'id' => $key,
|
||||
|
@ -151,7 +151,7 @@ class FKOAuthDataStore extends OAuthDataStore
|
|||
if (is_null($verifier) || ($uverifier !== false)) {
|
||||
$key = self::genToken();
|
||||
$sec = self::genToken();
|
||||
$r = dba::insert(
|
||||
$r = DBA::insert(
|
||||
'tokens',
|
||||
[
|
||||
'id' => $key,
|
||||
|
@ -167,7 +167,7 @@ class FKOAuthDataStore extends OAuthDataStore
|
|||
}
|
||||
}
|
||||
|
||||
dba::delete('tokens', ['id' => $token->key]);
|
||||
DBA::delete('tokens', ['id' => $token->key]);
|
||||
|
||||
if (!is_null($ret) && !is_null($uverifier)) {
|
||||
Config::delete("oauth", $verifier);
|
||||
|
|
|
@ -13,7 +13,7 @@ use DOMDocument;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Protocol\Email;
|
||||
|
@ -415,7 +415,7 @@ class Probe
|
|||
|
||||
$condition = ['nurl' => normalise_link($data["url"])];
|
||||
|
||||
$old_fields = dba::selectFirst('gcontact', $fieldnames, $condition);
|
||||
$old_fields = DBA::selectFirst('gcontact', $fieldnames, $condition);
|
||||
|
||||
// When the gcontact doesn't exist, the value "true" will trigger an insert.
|
||||
// In difference to the public contacts we want to have every contact
|
||||
|
@ -428,7 +428,7 @@ class Probe
|
|||
$fields['created'] = DateTimeFormat::utcNow();
|
||||
}
|
||||
|
||||
dba::update('gcontact', $fields, $condition, $old_fields);
|
||||
DBA::update('gcontact', $fields, $condition, $old_fields);
|
||||
|
||||
$fields = ['name' => $data['name'],
|
||||
'nick' => $data['nick'],
|
||||
|
@ -466,13 +466,13 @@ class Probe
|
|||
// This won't trigger an insert. This is intended, since we only need
|
||||
// public contacts for everyone we store items from.
|
||||
// We don't need to store every contact on the planet.
|
||||
$old_fields = dba::selectFirst('contact', $fieldnames, $condition);
|
||||
$old_fields = DBA::selectFirst('contact', $fieldnames, $condition);
|
||||
|
||||
$fields['name-date'] = DateTimeFormat::utcNow();
|
||||
$fields['uri-date'] = DateTimeFormat::utcNow();
|
||||
$fields['success_update'] = DateTimeFormat::utcNow();
|
||||
|
||||
dba::update('contact', $fields, $condition, $old_fields);
|
||||
DBA::update('contact', $fields, $condition, $old_fields);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -264,7 +264,7 @@ class Post extends BaseObject
|
|||
'starred' => L10n::t('starred'),
|
||||
];
|
||||
|
||||
$thread = dba::selectFirst('thread', ['ignored'], ['uid' => $item['uid'], 'iid' => $item['id']]);
|
||||
$thread = DBA::selectFirst('thread', ['ignored'], ['uid' => $item['uid'], 'iid' => $item['id']]);
|
||||
if (DBM::is_result($thread)) {
|
||||
$ignore = [
|
||||
'do' => L10n::t("ignore thread"),
|
||||
|
|
|
@ -18,7 +18,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Event;
|
||||
|
@ -952,7 +952,7 @@ class DFRN
|
|||
$conversation_uri = $conversation_href;
|
||||
|
||||
if (isset($parent_item)) {
|
||||
$conversation = dba::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $item['parent-uri']]);
|
||||
$conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $item['parent-uri']]);
|
||||
if (DBM::is_result($conversation)) {
|
||||
if ($conversation['conversation-uri'] != '') {
|
||||
$conversation_uri = $conversation['conversation-uri'];
|
||||
|
@ -1401,7 +1401,7 @@ class DFRN
|
|||
if (empty($contact['addr'])) {
|
||||
logger('Empty contact handle for ' . $contact['id'] . ' - ' . $contact['url'] . ' - trying to update it.');
|
||||
if (Contact::updateFromProbe($contact['id'])) {
|
||||
$new_contact = dba::selectFirst('contact', ['addr'], ['id' => $contact['id']]);
|
||||
$new_contact = DBA::selectFirst('contact', ['addr'], ['id' => $contact['id']]);
|
||||
$contact['addr'] = $new_contact['addr'];
|
||||
}
|
||||
|
||||
|
@ -1543,7 +1543,7 @@ class DFRN
|
|||
'name', 'nick', 'about', 'location', 'keywords', 'xmpp', 'bdyear', 'bd', 'hidden', 'contact-type'];
|
||||
$condition = ["`uid` = ? AND `nurl` = ? AND `network` != ?",
|
||||
$importer["importer_uid"], normalise_link($author["link"]), NETWORK_STATUSNET];
|
||||
$contact_old = dba::selectFirst('contact', $fields, $condition);
|
||||
$contact_old = DBA::selectFirst('contact', $fields, $condition);
|
||||
|
||||
if (DBM::is_result($contact_old)) {
|
||||
$author["contact-id"] = $contact_old["id"];
|
||||
|
@ -1855,7 +1855,7 @@ class DFRN
|
|||
$msg["seen"] = 0;
|
||||
$msg["replied"] = 0;
|
||||
|
||||
dba::insert('mail', $msg);
|
||||
DBA::insert('mail', $msg);
|
||||
|
||||
// send notifications.
|
||||
/// @TODO Arange this mess
|
||||
|
@ -2074,7 +2074,7 @@ class DFRN
|
|||
'url' => $relocate["url"], 'nurl' => normalise_link($relocate["url"]),
|
||||
'addr' => $relocate["addr"], 'connect' => $relocate["addr"],
|
||||
'notify' => $relocate["notify"], 'server_url' => $relocate["server_url"]];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($old["url"])]);
|
||||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($old["url"])]);
|
||||
|
||||
// Update the contact table. We try to find every entry.
|
||||
$fields = ['name' => $relocate["name"], 'avatar' => $relocate["avatar"],
|
||||
|
@ -2084,7 +2084,7 @@ class DFRN
|
|||
'poll' => $relocate["poll"], 'site-pubkey' => $relocate["sitepubkey"]];
|
||||
$condition = ["(`id` = ?) OR (`nurl` = ?)", $importer["id"], normalise_link($old["url"])];
|
||||
|
||||
dba::update('contact', $fields, $condition);
|
||||
DBA::update('contact', $fields, $condition);
|
||||
|
||||
Contact::updateAvatar($relocate["avatar"], $importer["importer_uid"], $importer["id"], true);
|
||||
|
||||
|
@ -2228,7 +2228,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if ($Blink && link_compare($Blink, System::baseUrl() . "/profile/" . $importer["nickname"])) {
|
||||
$author = dba::selectFirst('contact', ['name', 'thumb', 'url'], ['id' => $item['author-id']]);
|
||||
$author = DBA::selectFirst('contact', ['name', 'thumb', 'url'], ['id' => $item['author-id']]);
|
||||
|
||||
// send a notification
|
||||
notification(
|
||||
|
@ -2851,16 +2851,16 @@ class DFRN
|
|||
$accounttype = intval(XML::getFirstNodeValue($xpath, "/atom:feed/dfrn:account_type/text()"));
|
||||
|
||||
if ($accounttype != $importer["contact-type"]) {
|
||||
dba::update('contact', ['contact-type' => $accounttype], ['id' => $importer["id"]]);
|
||||
DBA::update('contact', ['contact-type' => $accounttype], ['id' => $importer["id"]]);
|
||||
}
|
||||
// A forum contact can either have set "forum" or "prv" - but not both
|
||||
if (($accounttype == ACCOUNT_TYPE_COMMUNITY) && (($forum != $importer["forum"]) || ($forum == $importer["prv"]))) {
|
||||
$condition = ['(`forum` != ? OR `prv` != ?) AND `id` = ?', $forum, !$forum, $importer["id"]];
|
||||
dba::update('contact', ['forum' => $forum, 'prv' => !$forum], $condition);
|
||||
DBA::update('contact', ['forum' => $forum, 'prv' => !$forum], $condition);
|
||||
}
|
||||
} elseif ($forum != $importer["forum"]) { // Deprecated since 3.5.1
|
||||
$condition = ['`forum` != ? AND `id` = ?', $forum, $importer["id"]];
|
||||
dba::update('contact', ['forum' => $forum], $condition);
|
||||
DBA::update('contact', ['forum' => $forum], $condition);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2988,7 +2988,7 @@ class DFRN
|
|||
|
||||
$sec = random_string();
|
||||
|
||||
dba::insert('profile_check', ['uid' => local_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id, 'sec' => $sec, 'expire' => time() + 45]);
|
||||
DBA::insert('profile_check', ['uid' => local_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id, 'sec' => $sec, 'expire' => time() + 45]);
|
||||
|
||||
$url = curPageURL();
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
|
@ -76,32 +76,32 @@ class Diaspora
|
|||
}
|
||||
|
||||
// Servers that want to get all content
|
||||
$servers = dba::select('gserver', ['url'], ['relay-subscribe' => true, 'relay-scope' => 'all']);
|
||||
while ($server = dba::fetch($servers)) {
|
||||
$servers = DBA::select('gserver', ['url'], ['relay-subscribe' => true, 'relay-scope' => 'all']);
|
||||
while ($server = DBA::fetch($servers)) {
|
||||
$serverlist[$server['url']] = $server['url'];
|
||||
}
|
||||
|
||||
// All tags of the current post
|
||||
$condition = ['otype' => TERM_OBJ_POST, 'type' => TERM_HASHTAG, 'oid' => $parent['parent']];
|
||||
$tags = dba::select('term', ['term'], $condition);
|
||||
$tags = DBA::select('term', ['term'], $condition);
|
||||
$taglist = [];
|
||||
while ($tag = dba::fetch($tags)) {
|
||||
while ($tag = DBA::fetch($tags)) {
|
||||
$taglist[] = $tag['term'];
|
||||
}
|
||||
|
||||
// All servers who wants content with this tag
|
||||
$tagserverlist = [];
|
||||
if (!empty($taglist)) {
|
||||
$tagserver = dba::select('gserver-tag', ['gserver-id'], ['tag' => $taglist]);
|
||||
while ($server = dba::fetch($tagserver)) {
|
||||
$tagserver = DBA::select('gserver-tag', ['gserver-id'], ['tag' => $taglist]);
|
||||
while ($server = DBA::fetch($tagserver)) {
|
||||
$tagserverlist[] = $server['gserver-id'];
|
||||
}
|
||||
}
|
||||
|
||||
// All adresses with the given id
|
||||
if (!empty($tagserverlist)) {
|
||||
$servers = dba::select('gserver', ['url'], ['relay-subscribe' => true, 'relay-scope' => 'tags', 'id' => $tagserverlist]);
|
||||
while ($server = dba::fetch($servers)) {
|
||||
$servers = DBA::select('gserver', ['url'], ['relay-subscribe' => true, 'relay-scope' => 'tags', 'id' => $tagserverlist]);
|
||||
while ($server = DBA::fetch($servers)) {
|
||||
$serverlist[$server['url']] = $server['url'];
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ class Diaspora
|
|||
// Fetch the relay contact
|
||||
$condition = ['uid' => 0, 'nurl' => normalise_link($server_url),
|
||||
'contact-type' => ACCOUNT_TYPE_RELAY];
|
||||
$contact = dba::selectFirst('contact', $fields, $condition);
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
|
||||
if (DBM::is_result($contact)) {
|
||||
if ($contact['archive'] || $contact['blocked']) {
|
||||
|
@ -156,7 +156,7 @@ class Diaspora
|
|||
} else {
|
||||
self::setRelayContact($server_url);
|
||||
|
||||
$contact = dba::selectFirst('contact', $fields, $condition);
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
if (DBM::is_result($contact)) {
|
||||
return $contact;
|
||||
}
|
||||
|
@ -186,11 +186,11 @@ class Diaspora
|
|||
$condition = ['uid' => 0, 'nurl' => normalise_link($server_url),
|
||||
'contact-type' => ACCOUNT_TYPE_RELAY];
|
||||
|
||||
if (dba::exists('contact', $condition)) {
|
||||
if (DBA::exists('contact', $condition)) {
|
||||
unset($fields['created']);
|
||||
}
|
||||
|
||||
dba::update('contact', $fields, $condition, true);
|
||||
DBA::update('contact', $fields, $condition, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -207,13 +207,13 @@ class Diaspora
|
|||
*/
|
||||
public static function participantsForThread($thread, array $contacts)
|
||||
{
|
||||
$r = dba::p("SELECT `contact`.`batch`, `contact`.`id`, `contact`.`name`, `contact`.`network`,
|
||||
$r = DBA::p("SELECT `contact`.`batch`, `contact`.`id`, `contact`.`name`, `contact`.`network`,
|
||||
`fcontact`.`batch` AS `fbatch`, `fcontact`.`network` AS `fnetwork` FROM `participation`
|
||||
INNER JOIN `contact` ON `contact`.`id` = `participation`.`cid`
|
||||
INNER JOIN `fcontact` ON `fcontact`.`id` = `participation`.`fid`
|
||||
WHERE `participation`.`iid` = ?", $thread);
|
||||
|
||||
while ($contact = dba::fetch($r)) {
|
||||
while ($contact = DBA::fetch($r)) {
|
||||
if (!empty($contact['fnetwork'])) {
|
||||
$contact['network'] = $contact['fnetwork'];
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ class Diaspora
|
|||
$contacts[] = $contact;
|
||||
}
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
|
||||
return $contacts;
|
||||
}
|
||||
|
@ -899,7 +899,7 @@ class Diaspora
|
|||
{
|
||||
$update = false;
|
||||
|
||||
$person = dba::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
|
||||
$person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
|
||||
if (DBM::is_result($person)) {
|
||||
logger("In cache " . print_r($person, true), LOGGER_DEBUG);
|
||||
|
||||
|
@ -924,7 +924,7 @@ class Diaspora
|
|||
self::updateFContact($r);
|
||||
|
||||
// Fetch the updated or added contact
|
||||
$person = dba::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
|
||||
$person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
|
||||
if (!DBM::is_result($person)) {
|
||||
$person = $r;
|
||||
}
|
||||
|
@ -951,7 +951,7 @@ class Diaspora
|
|||
|
||||
$condition = ['url' => $arr["url"], 'network' => $arr["network"]];
|
||||
|
||||
dba::update('fcontact', $fields, $condition, true);
|
||||
DBA::update('fcontact', $fields, $condition, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1425,7 +1425,7 @@ class Diaspora
|
|||
private static function authorContactByUrl($def_contact, $person, $uid)
|
||||
{
|
||||
$condition = ['nurl' => normalise_link($person["url"]), 'uid' => $uid];
|
||||
$contact = dba::selectFirst('contact', ['id', 'network'], $condition);
|
||||
$contact = DBA::selectFirst('contact', ['id', 'network'], $condition);
|
||||
if (DBM::is_result($contact)) {
|
||||
$cid = $contact["id"];
|
||||
$network = $contact["network"];
|
||||
|
@ -1532,7 +1532,7 @@ class Diaspora
|
|||
'notify' => $data['notify'], 'poll' => $data['poll'],
|
||||
'network' => $data['network']];
|
||||
|
||||
dba::update('contact', $fields, ['addr' => $old_handle]);
|
||||
DBA::update('contact', $fields, ['addr' => $old_handle]);
|
||||
|
||||
$fields = ['url' => $data['url'], 'nurl' => normalise_link($data['url']),
|
||||
'name' => $data['name'], 'nick' => $data['nick'],
|
||||
|
@ -1540,7 +1540,7 @@ class Diaspora
|
|||
'notify' => $data['notify'], 'photo' => $data['photo'],
|
||||
'server_url' => $data['baseurl'], 'network' => $data['network']];
|
||||
|
||||
dba::update('gcontact', $fields, ['addr' => $old_handle]);
|
||||
DBA::update('gcontact', $fields, ['addr' => $old_handle]);
|
||||
|
||||
logger('Contacts are updated.');
|
||||
|
||||
|
@ -1558,12 +1558,12 @@ class Diaspora
|
|||
{
|
||||
$author = notags(unxmlify($data->author));
|
||||
|
||||
$contacts = dba::select('contact', ['id'], ['addr' => $author]);
|
||||
while ($contact = dba::fetch($contacts)) {
|
||||
$contacts = DBA::select('contact', ['id'], ['addr' => $author]);
|
||||
while ($contact = DBA::fetch($contacts)) {
|
||||
Contact::remove($contact["id"]);
|
||||
}
|
||||
|
||||
dba::delete('gcontact', ['addr' => $author]);
|
||||
DBA::delete('gcontact', ['addr' => $author]);
|
||||
|
||||
logger('Removed contacts for ' . $author);
|
||||
|
||||
|
@ -1631,7 +1631,7 @@ class Diaspora
|
|||
$item = Item::selectFirst(['uid'], ['origin' => true, 'guid' => $guid]);
|
||||
if (DBM::is_result($item)) {
|
||||
logger("Found user ".$item['uid']." as owner of item ".$guid, LOGGER_DEBUG);
|
||||
$contact = dba::selectFirst('contact', [], ['self' => true, 'uid' => $item['uid']]);
|
||||
$contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $item['uid']]);
|
||||
if (DBM::is_result($contact)) {
|
||||
return $contact;
|
||||
}
|
||||
|
@ -1797,7 +1797,7 @@ class Diaspora
|
|||
|
||||
$person = self::personByHandle($msg_author);
|
||||
|
||||
dba::lock('mail');
|
||||
DBA::lock('mail');
|
||||
|
||||
$r = q(
|
||||
"SELECT `id` FROM `mail` WHERE `guid` = '%s' AND `uid` = %d LIMIT 1",
|
||||
|
@ -1828,9 +1828,9 @@ class Diaspora
|
|||
dbesc($msg_created_at)
|
||||
);
|
||||
|
||||
dba::unlock();
|
||||
DBA::unlock();
|
||||
|
||||
dba::update('conv', ['updated' => DateTimeFormat::utcNow()], ['id' => $conversation["id"]]);
|
||||
DBA::update('conv', ['updated' => DateTimeFormat::utcNow()], ['id' => $conversation["id"]]);
|
||||
|
||||
notification(
|
||||
[
|
||||
|
@ -2084,7 +2084,7 @@ class Diaspora
|
|||
|
||||
$body = self::replacePeopleGuid($body, $person["url"]);
|
||||
|
||||
dba::lock('mail');
|
||||
DBA::lock('mail');
|
||||
|
||||
$r = q(
|
||||
"SELECT `id` FROM `mail` WHERE `guid` = '%s' AND `uid` = %d LIMIT 1",
|
||||
|
@ -2115,9 +2115,9 @@ class Diaspora
|
|||
dbesc($created_at)
|
||||
);
|
||||
|
||||
dba::unlock();
|
||||
DBA::unlock();
|
||||
|
||||
dba::update('conv', ['updated' => DateTimeFormat::utcNow()], ['id' => $conversation["id"]]);
|
||||
DBA::update('conv', ['updated' => DateTimeFormat::utcNow()], ['id' => $conversation["id"]]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2162,8 +2162,8 @@ class Diaspora
|
|||
|
||||
logger('Received participation for ID: '.$item['id'].' - Contact: '.$contact_id.' - Server: '.$server, LOGGER_DEBUG);
|
||||
|
||||
if (!dba::exists('participation', ['iid' => $item['id'], 'server' => $server])) {
|
||||
dba::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]);
|
||||
if (!DBA::exists('participation', ['iid' => $item['id'], 'server' => $server])) {
|
||||
DBA::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]);
|
||||
}
|
||||
|
||||
// Send all existing comments and likes to the requesting server
|
||||
|
@ -2180,7 +2180,7 @@ class Diaspora
|
|||
logger("Send ".$cmd." for item ".$comment['id']." to contact ".$contact_id, LOGGER_DEBUG);
|
||||
Worker::add(PRIORITY_HIGH, 'Delivery', $cmd, $comment['id'], $contact_id);
|
||||
}
|
||||
dba::close($comments);
|
||||
DBA::close($comments);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2291,7 +2291,7 @@ class Diaspora
|
|||
$fields['bd'] = $birthday;
|
||||
}
|
||||
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
DBA::update('contact', $fields, ['id' => $contact['id']]);
|
||||
|
||||
$gcontact = ["url" => $contact["url"], "network" => NETWORK_DIASPORA, "generation" => 2,
|
||||
"photo" => $image_url, "name" => $name, "location" => $location,
|
||||
|
@ -2320,7 +2320,7 @@ class Diaspora
|
|||
$a = get_app();
|
||||
|
||||
if ($contact["rel"] == CONTACT_IS_SHARING) {
|
||||
dba::update(
|
||||
DBA::update(
|
||||
'contact',
|
||||
['rel' => CONTACT_IS_FRIEND, 'writable' => true],
|
||||
['id' => $contact["id"], 'uid' => $importer["uid"]]
|
||||
|
@ -3213,7 +3213,7 @@ class Diaspora
|
|||
// If the item belongs to a user, we take this user id.
|
||||
if ($item['uid'] == 0) {
|
||||
$condition = ['verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false];
|
||||
$first_user = dba::selectFirst('user', ['uid'], $condition);
|
||||
$first_user = DBA::selectFirst('user', ['uid'], $condition);
|
||||
$owner = User::getOwnerDataById($first_user['uid']);
|
||||
} else {
|
||||
$owner = User::getOwnerDataById($item['uid']);
|
||||
|
@ -4200,7 +4200,7 @@ class Diaspora
|
|||
* Now store the signature more flexible to dynamically support new fields.
|
||||
* This will break Diaspora compatibility with Friendica versions prior to 3.5.
|
||||
*/
|
||||
dba::insert('sign', ['iid' => $post_id, 'signed_text' => json_encode($message)]);
|
||||
DBA::insert('sign', ['iid' => $post_id, 'signed_text' => json_encode($message)]);
|
||||
|
||||
logger('Stored diaspora like signature');
|
||||
return true;
|
||||
|
@ -4236,7 +4236,7 @@ class Diaspora
|
|||
* Now store the signature more flexible to dynamically support new fields.
|
||||
* This will break Diaspora compatibility with Friendica versions prior to 3.5.
|
||||
*/
|
||||
dba::insert('sign', ['iid' => $message_id, 'signed_text' => json_encode($message)]);
|
||||
DBA::insert('sign', ['iid' => $message_id, 'signed_text' => json_encode($message)]);
|
||||
|
||||
logger('Stored diaspora comment signature');
|
||||
return true;
|
||||
|
|
|
@ -13,7 +13,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Lock;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Conversation;
|
||||
|
@ -78,7 +78,7 @@ class OStatus
|
|||
$condition = ["`uid` = ? AND `alias` = ? AND `network` != ? AND `rel` IN (?, ?)",
|
||||
$importer["uid"], $aliaslink, NETWORK_STATUSNET,
|
||||
CONTACT_IS_SHARING, CONTACT_IS_FRIEND];
|
||||
$contact = dba::selectFirst('contact', [], $condition);
|
||||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
}
|
||||
|
||||
if (!DBM::is_result($contact) && $author["author-link"] != '') {
|
||||
|
@ -89,14 +89,14 @@ class OStatus
|
|||
$condition = ["`uid` = ? AND `nurl` IN (?, ?) AND `network` != ? AND `rel` IN (?, ?)",
|
||||
$importer["uid"], normalise_link($author["author-link"]), normalise_link($aliaslink),
|
||||
NETWORK_STATUSNET, CONTACT_IS_SHARING, CONTACT_IS_FRIEND];
|
||||
$contact = dba::selectFirst('contact', [], $condition);
|
||||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
}
|
||||
|
||||
if (!DBM::is_result($contact) && ($addr != '')) {
|
||||
$condition = ["`uid` = ? AND `addr` = ? AND `network` != ? AND `rel` IN (?, ?)",
|
||||
$importer["uid"], $addr, NETWORK_STATUSNET,
|
||||
CONTACT_IS_SHARING, CONTACT_IS_FRIEND];
|
||||
$contact = dba::selectFirst('contact', [], $condition);
|
||||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
}
|
||||
|
||||
if (DBM::is_result($contact)) {
|
||||
|
@ -182,7 +182,7 @@ class OStatus
|
|||
|
||||
$contact['name-date'] = DateTimeFormat::utcNow();
|
||||
|
||||
dba::update('contact', $contact, ['id' => $contact["id"]], $current);
|
||||
DBA::update('contact', $contact, ['id' => $contact["id"]], $current);
|
||||
|
||||
if (!empty($author["author-avatar"]) && ($author["author-avatar"] != $current['avatar'])) {
|
||||
logger("Update profile picture for contact ".$contact["id"], LOGGER_DEBUG);
|
||||
|
@ -194,7 +194,7 @@ class OStatus
|
|||
|
||||
if ($cid) {
|
||||
$fields = ['url', 'nurl', 'name', 'nick', 'alias', 'about', 'location'];
|
||||
$old_contact = dba::selectFirst('contact', $fields, ['id' => $cid]);
|
||||
$old_contact = DBA::selectFirst('contact', $fields, ['id' => $cid]);
|
||||
|
||||
// Update it with the current values
|
||||
$fields = ['url' => $author["author-link"], 'name' => $contact["name"],
|
||||
|
@ -203,7 +203,7 @@ class OStatus
|
|||
'about' => $contact["about"], 'location' => $contact["location"],
|
||||
'success_update' => DateTimeFormat::utcNow(), 'last-update' => DateTimeFormat::utcNow()];
|
||||
|
||||
dba::update('contact', $fields, ['id' => $cid], $old_contact);
|
||||
DBA::update('contact', $fields, ['id' => $cid], $old_contact);
|
||||
|
||||
// Update the avatar
|
||||
if (!empty($author["author-avatar"])) {
|
||||
|
@ -834,9 +834,9 @@ class OStatus
|
|||
$conv_data['source'] = $doc2->saveXML();
|
||||
|
||||
$condition = ['item-uri' => $conv_data['uri'],'protocol' => PROTOCOL_OSTATUS_FEED];
|
||||
if (dba::exists('conversation', $condition)) {
|
||||
if (DBA::exists('conversation', $condition)) {
|
||||
logger('Delete deprecated entry for URI '.$conv_data['uri'], LOGGER_DEBUG);
|
||||
dba::delete('conversation', ['item-uri' => $conv_data['uri']]);
|
||||
DBA::delete('conversation', ['item-uri' => $conv_data['uri']]);
|
||||
}
|
||||
|
||||
logger('Store conversation data for uri '.$conv_data['uri'], LOGGER_DEBUG);
|
||||
|
@ -858,7 +858,7 @@ class OStatus
|
|||
private static function fetchSelf($self, &$item)
|
||||
{
|
||||
$condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $self, PROTOCOL_DFRN, PROTOCOL_OSTATUS_SALMON];
|
||||
if (dba::exists('conversation', $condition)) {
|
||||
if (DBA::exists('conversation', $condition)) {
|
||||
logger('Conversation '.$item['uri'].' is already stored.', LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
@ -893,7 +893,7 @@ class OStatus
|
|||
private static function fetchRelated($related, $related_uri, $importer)
|
||||
{
|
||||
$condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $related_uri, PROTOCOL_DFRN, PROTOCOL_OSTATUS_SALMON];
|
||||
$conversation = dba::selectFirst('conversation', ['source', 'protocol'], $condition);
|
||||
$conversation = DBA::selectFirst('conversation', ['source', 'protocol'], $condition);
|
||||
if (DBM::is_result($conversation)) {
|
||||
$stored = true;
|
||||
$xml = $conversation['source'];
|
||||
|
@ -903,7 +903,7 @@ class OStatus
|
|||
}
|
||||
if ($conversation['protocol'] == PROTOCOL_OSTATUS_SALMON) {
|
||||
logger('Delete invalid cached XML for URI '.$related_uri, LOGGER_DEBUG);
|
||||
dba::delete('conversation', ['item-uri' => $related_uri]);
|
||||
DBA::delete('conversation', ['item-uri' => $related_uri]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -973,7 +973,7 @@ class OStatus
|
|||
// Finally we take the data that we fetched from "ostatus:conversation"
|
||||
if ($xml == '') {
|
||||
$condition = ['item-uri' => $related_uri, 'protocol' => PROTOCOL_SPLITTED_CONV];
|
||||
$conversation = dba::selectFirst('conversation', ['source'], $condition);
|
||||
$conversation = DBA::selectFirst('conversation', ['source'], $condition);
|
||||
if (DBM::is_result($conversation)) {
|
||||
$stored = true;
|
||||
logger('Got cached XML from conversation for URI '.$related_uri, LOGGER_DEBUG);
|
||||
|
@ -1300,7 +1300,7 @@ class OStatus
|
|||
if ($owner['account-type'] == ACCOUNT_TYPE_COMMUNITY) {
|
||||
$condition = ['uid' => $owner['uid'], 'self' => false, 'pending' => false,
|
||||
'archive' => false, 'hidden' => false, 'blocked' => false];
|
||||
$members = dba::count('contact', $condition);
|
||||
$members = DBA::count('contact', $condition);
|
||||
XML::addElement($doc, $root, "statusnet:group_info", "", ["member_count" => $members]);
|
||||
}
|
||||
|
||||
|
@ -1401,7 +1401,7 @@ class OStatus
|
|||
*/
|
||||
private static function addAuthor($doc, $owner, $show_profile = true)
|
||||
{
|
||||
$profile = dba::selectFirst('profile', ['homepage', 'publish'], ['uid' => $owner['uid'], 'is-default' => true]);
|
||||
$profile = DBA::selectFirst('profile', ['homepage', 'publish'], ['uid' => $owner['uid'], 'is-default' => true]);
|
||||
$author = $doc->createElement("author");
|
||||
XML::addElement($doc, $author, "id", $owner["url"]);
|
||||
if ($owner['account-type'] == ACCOUNT_TYPE_COMMUNITY) {
|
||||
|
@ -1981,7 +1981,7 @@ class OStatus
|
|||
$conversation_uri = $conversation_href;
|
||||
|
||||
if (isset($parent_item)) {
|
||||
$conversation = dba::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $parent_item]);
|
||||
$conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $parent_item]);
|
||||
if (DBM::is_result($conversation)) {
|
||||
if ($conversation['conversation-uri'] != '') {
|
||||
$conversation_uri = $conversation['conversation-uri'];
|
||||
|
@ -2022,7 +2022,7 @@ class OStatus
|
|||
|
||||
foreach ($mentioned as $mention) {
|
||||
$condition = ['uid' => $owner['uid'], 'nurl' => normalise_link($mention)];
|
||||
$contact = dba::selectFirst('contact', ['forum', 'prv', 'self', 'contact-type'], $condition);
|
||||
$contact = DBA::selectFirst('contact', ['forum', 'prv', 'self', 'contact-type'], $condition);
|
||||
if ($contact["forum"] || $contact["prv"] || ($owner['contact-type'] == ACCOUNT_TYPE_COMMUNITY) ||
|
||||
($contact['self'] && ($owner['account-type'] == ACCOUNT_TYPE_COMMUNITY))) {
|
||||
XML::addElement($doc, $entry, "link", "",
|
||||
|
|
|
@ -15,7 +15,7 @@ use Exception;
|
|||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Profile;
|
||||
|
@ -67,7 +67,7 @@ class PortableContact
|
|||
|
||||
if ($cid) {
|
||||
if (!$url || !$uid) {
|
||||
$contact = dba::selectFirst('contact', ['poco', 'uid'], ['id' => $cid]);
|
||||
$contact = DBA::selectFirst('contact', ['poco', 'uid'], ['id' => $cid]);
|
||||
if (DBM::is_result($contact)) {
|
||||
$url = $contact['poco'];
|
||||
$uid = $contact['uid'];
|
||||
|
@ -204,7 +204,7 @@ class PortableContact
|
|||
logger("load: loaded $total entries", LOGGER_DEBUG);
|
||||
|
||||
$condition = ["`cid` = ? AND `uid` = ? AND `zcid` = ? AND `updated` < UTC_TIMESTAMP - INTERVAL 2 DAY", $cid, $uid, $zcid];
|
||||
dba::delete('glink', $condition);
|
||||
DBA::delete('glink', $condition);
|
||||
}
|
||||
|
||||
public static function reachable($profile, $server = "", $network = "", $force = false)
|
||||
|
@ -342,7 +342,7 @@ class PortableContact
|
|||
if (!self::checkServer($server_url, $gcontacts[0]["network"], $force)) {
|
||||
if ($force) {
|
||||
$fields = ['last_failure' => DateTimeFormat::utcNow()];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
}
|
||||
|
||||
logger("Profile ".$profile.": Server ".$server_url." wasn't reachable.", LOGGER_DEBUG);
|
||||
|
@ -423,7 +423,7 @@ class PortableContact
|
|||
|
||||
if (!empty($noscrape["updated"])) {
|
||||
$fields = ['last_contact' => DateTimeFormat::utcNow()];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
logger("Profile ".$profile." was last updated at ".$noscrape["updated"]." (noscrape)", LOGGER_DEBUG);
|
||||
|
||||
|
@ -451,7 +451,7 @@ class PortableContact
|
|||
&& (normalise_link($profile) != normalise_link($data["url"]))
|
||||
) {
|
||||
// Delete the old entry
|
||||
dba::delete('gcontact', ['nurl' => normalise_link($profile)]);
|
||||
DBA::delete('gcontact', ['nurl' => normalise_link($profile)]);
|
||||
|
||||
$gcontact = array_merge($gcontacts[0], $data);
|
||||
|
||||
|
@ -472,7 +472,7 @@ class PortableContact
|
|||
|
||||
if (($data["poll"] == "") || (in_array($data["network"], [NETWORK_FEED, NETWORK_PHANTOM]))) {
|
||||
$fields = ['last_failure' => DateTimeFormat::utcNow()];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
logger("Profile ".$profile." wasn't reachable (profile)", LOGGER_DEBUG);
|
||||
return false;
|
||||
|
@ -488,7 +488,7 @@ class PortableContact
|
|||
|
||||
if (!$feedret["success"]) {
|
||||
$fields = ['last_failure' => DateTimeFormat::utcNow()];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
logger("Profile ".$profile." wasn't reachable (no feed)", LOGGER_DEBUG);
|
||||
return false;
|
||||
|
@ -530,11 +530,11 @@ class PortableContact
|
|||
$fields['updated'] = $last_updated;
|
||||
}
|
||||
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
if (($gcontacts[0]["generation"] == 0)) {
|
||||
$fields = ['generation' => 9];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
}
|
||||
|
||||
logger("Profile ".$profile." was last updated at ".$last_updated, LOGGER_DEBUG);
|
||||
|
@ -930,12 +930,12 @@ class PortableContact
|
|||
return false;
|
||||
}
|
||||
|
||||
$gserver = dba::selectFirst('gserver', [], ['nurl' => normalise_link($server_url)]);
|
||||
$gserver = DBA::selectFirst('gserver', [], ['nurl' => normalise_link($server_url)]);
|
||||
if (DBM::is_result($gserver)) {
|
||||
if ($gserver["created"] <= NULL_DATE) {
|
||||
$fields = ['created' => DateTimeFormat::utcNow()];
|
||||
$condition = ['nurl' => normalise_link($server_url)];
|
||||
dba::update('gserver', $fields, $condition);
|
||||
DBA::update('gserver', $fields, $condition);
|
||||
}
|
||||
$poco = $gserver["poco"];
|
||||
$noscrape = $gserver["noscrape"];
|
||||
|
@ -989,7 +989,7 @@ class PortableContact
|
|||
// Mastodon uses the "@" for user profiles.
|
||||
// But this can be misunderstood.
|
||||
if (parse_url($server_url, PHP_URL_USER) != '') {
|
||||
dba::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
|
||||
DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1005,7 +1005,7 @@ class PortableContact
|
|||
if (DBM::is_result($gserver) && ($orig_server_url == $server_url) &&
|
||||
(!$serverret["success"] && ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT))) {
|
||||
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
|
||||
dba::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
|
||||
DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1020,7 +1020,7 @@ class PortableContact
|
|||
// Quit if there is a timeout
|
||||
if (!$serverret["success"] && ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
|
||||
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
|
||||
dba::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
|
||||
DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1046,7 +1046,7 @@ class PortableContact
|
|||
|
||||
if (!$failure) {
|
||||
// This will be too low, but better than no value at all.
|
||||
$registered_users = dba::count('gcontact', ['server_url' => normalise_link($server_url)]);
|
||||
$registered_users = DBA::count('gcontact', ['server_url' => normalise_link($server_url)]);
|
||||
}
|
||||
|
||||
// Look for poco
|
||||
|
@ -1365,7 +1365,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
// Check again if the server exists
|
||||
$found = dba::exists('gserver', ['nurl' => normalise_link($server_url)]);
|
||||
$found = DBA::exists('gserver', ['nurl' => normalise_link($server_url)]);
|
||||
|
||||
$version = strip_tags($version);
|
||||
$site_name = strip_tags($site_name);
|
||||
|
@ -1379,11 +1379,11 @@ class PortableContact
|
|||
'last_contact' => $last_contact, 'last_failure' => $last_failure];
|
||||
|
||||
if ($found) {
|
||||
dba::update('gserver', $fields, ['nurl' => normalise_link($server_url)]);
|
||||
DBA::update('gserver', $fields, ['nurl' => normalise_link($server_url)]);
|
||||
} elseif (!$failure) {
|
||||
$fields['nurl'] = normalise_link($server_url);
|
||||
$fields['created'] = DateTimeFormat::utcNow();
|
||||
dba::insert('gserver', $fields);
|
||||
DBA::insert('gserver', $fields);
|
||||
}
|
||||
|
||||
if (!$failure && in_array($fields['network'], [NETWORK_DFRN, NETWORK_DIASPORA])) {
|
||||
|
@ -1414,17 +1414,17 @@ class PortableContact
|
|||
return;
|
||||
}
|
||||
|
||||
$gserver = dba::selectFirst('gserver', ['id', 'relay-subscribe', 'relay-scope'], ['nurl' => normalise_link($server_url)]);
|
||||
$gserver = DBA::selectFirst('gserver', ['id', 'relay-subscribe', 'relay-scope'], ['nurl' => normalise_link($server_url)]);
|
||||
if (!DBM::is_result($gserver)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (($gserver['relay-subscribe'] != $data->subscribe) || ($gserver['relay-scope'] != $data->scope)) {
|
||||
$fields = ['relay-subscribe' => $data->subscribe, 'relay-scope' => $data->scope];
|
||||
dba::update('gserver', $fields, ['id' => $gserver['id']]);
|
||||
DBA::update('gserver', $fields, ['id' => $gserver['id']]);
|
||||
}
|
||||
|
||||
dba::delete('gserver-tag', ['gserver-id' => $gserver['id']]);
|
||||
DBA::delete('gserver-tag', ['gserver-id' => $gserver['id']]);
|
||||
if ($data->scope == 'tags') {
|
||||
// Avoid duplicates
|
||||
$tags = [];
|
||||
|
@ -1434,7 +1434,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
dba::insert('gserver-tag', ['gserver-id' => $gserver['id'], 'tag' => $tag], true);
|
||||
DBA::insert('gserver-tag', ['gserver-id' => $gserver['id'], 'tag' => $tag], true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1620,7 +1620,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
$fields = ['last_poco_query' => DateTimeFormat::utcNow()];
|
||||
dba::update('gserver', $fields, ['nurl' => $server["nurl"]]);
|
||||
DBA::update('gserver', $fields, ['nurl' => $server["nurl"]]);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
@ -1629,7 +1629,7 @@ class PortableContact
|
|||
|
||||
// If we couldn't reach the server, we will try it some time later
|
||||
$fields = ['last_poco_query' => DateTimeFormat::utcNow()];
|
||||
dba::update('gserver', $fields, ['nurl' => $server["nurl"]]);
|
||||
DBA::update('gserver', $fields, ['nurl' => $server["nurl"]]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1655,7 +1655,7 @@ class PortableContact
|
|||
if (!self::checkServer($server["url"], $server["network"])) {
|
||||
// The server is not reachable? Okay, then we will try it later
|
||||
$fields = ['last_poco_query' => DateTimeFormat::utcNow()];
|
||||
dba::update('gserver', $fields, ['nurl' => $server["nurl"]]);
|
||||
DBA::update('gserver', $fields, ['nurl' => $server["nurl"]]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Friendica\Util;
|
|||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\User;
|
||||
|
||||
|
@ -71,7 +71,7 @@ class ExAuth
|
|||
{
|
||||
while (!feof(STDIN)) {
|
||||
// Quit if the database connection went down
|
||||
if (!dba::connected()) {
|
||||
if (!DBA::connected()) {
|
||||
$this->writeLog(LOG_ERR, 'the database connection went down');
|
||||
return;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ class ExAuth
|
|||
// Does the hostname match? So we try directly
|
||||
if ($a->get_hostname() == $aCommand[2]) {
|
||||
$this->writeLog(LOG_INFO, 'internal user check for ' . $sUser . '@' . $aCommand[2]);
|
||||
$found = dba::exists('user', ['nickname' => $sUser]);
|
||||
$found = DBA::exists('user', ['nickname' => $sUser]);
|
||||
} else {
|
||||
$found = false;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ class ExAuth
|
|||
if ($a->get_hostname() == $aCommand[2]) {
|
||||
$this->writeLog(LOG_INFO, 'internal auth for ' . $sUser . '@' . $aCommand[2]);
|
||||
|
||||
$aUser = dba::selectFirst('user', ['uid', 'password', 'legacy_password'], ['nickname' => $sUser]);
|
||||
$aUser = DBA::selectFirst('user', ['uid', 'password', 'legacy_password'], ['nickname' => $sUser]);
|
||||
if (DBM::is_result($aUser)) {
|
||||
$uid = $aUser['uid'];
|
||||
$success = User::authenticate($aUser, $aCommand[3]);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace Friendica\Util;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
/**
|
||||
|
@ -179,9 +179,9 @@ class HTTPSignature
|
|||
private static function getActivitypubKey($id)
|
||||
{
|
||||
if (strpos($id, 'acct:') === 0) {
|
||||
$contact = dba::selectFirst('contact', ['pubkey'], ['uid' => 0, 'addr' => str_replace('acct:', '', $id)]);
|
||||
$contact = DBA::selectFirst('contact', ['pubkey'], ['uid' => 0, 'addr' => str_replace('acct:', '', $id)]);
|
||||
} else {
|
||||
$contact = dba::selectFirst('contact', ['pubkey'], ['id' => $id, 'network' => 'activitypub']);
|
||||
$contact = DBA::selectFirst('contact', ['pubkey'], ['id' => $id, 'network' => 'activitypub']);
|
||||
}
|
||||
|
||||
if (DBM::is_result($contact)) {
|
||||
|
|
|
@ -9,7 +9,7 @@ use DOMDocument;
|
|||
use DOMXPath;
|
||||
use Friendica\Content\OEmbed;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Object\Image;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -47,7 +47,7 @@ class ParseUrl
|
|||
return false;
|
||||
}
|
||||
|
||||
$parsed_url = dba::selectFirst('parsed_url', ['content'],
|
||||
$parsed_url = DBA::selectFirst('parsed_url', ['content'],
|
||||
['url' => normalise_link($url), 'guessing' => !$no_guessing, 'oembed' => $do_oembed]
|
||||
);
|
||||
if (!empty($parsed_url['content'])) {
|
||||
|
@ -57,7 +57,7 @@ class ParseUrl
|
|||
|
||||
$data = self::getSiteinfo($url, $no_guessing, $do_oembed);
|
||||
|
||||
dba::insert(
|
||||
DBA::insert(
|
||||
'parsed_url',
|
||||
[
|
||||
'url' => normalise_link($url), 'guessing' => !$no_guessing,
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\BaseObject;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
|
@ -102,11 +102,11 @@ class Cron
|
|||
if (Config::get('system', 'last_cron_hourly', 0) + 3600 < time()) {
|
||||
|
||||
// Delete all done workerqueue entries
|
||||
dba::delete('workerqueue', ['`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 1 HOUR']);
|
||||
DBA::delete('workerqueue', ['`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 1 HOUR']);
|
||||
|
||||
// Optimizing this table only last seconds
|
||||
if (Config::get('system', 'optimize_workerqueue', false)) {
|
||||
dba::e("OPTIMIZE TABLE `workerqueue`");
|
||||
DBA::e("OPTIMIZE TABLE `workerqueue`");
|
||||
}
|
||||
|
||||
Config::set('system', 'last_cron_hourly', time());
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\App;
|
|||
use Friendica\BaseObject;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Database\PostUpdate;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -109,18 +109,18 @@ class CronJobs
|
|||
{
|
||||
// expire any expired regular accounts. Don't expire forums.
|
||||
$condition = ["NOT `account_expired` AND `account_expires_on` > ? AND `account_expires_on` < UTC_TIMESTAMP() AND `page-flags` = 0", NULL_DATE];
|
||||
dba::update('user', ['account_expired' => true], $condition);
|
||||
DBA::update('user', ['account_expired' => true], $condition);
|
||||
|
||||
// Remove any freshly expired account
|
||||
$users = dba::select('user', ['uid'], ['account_expired' => true, 'account_removed' => false]);
|
||||
while ($user = dba::fetch($users)) {
|
||||
$users = DBA::select('user', ['uid'], ['account_expired' => true, 'account_removed' => false]);
|
||||
while ($user = DBA::fetch($users)) {
|
||||
User::remove($user['uid']);
|
||||
}
|
||||
|
||||
// delete user records for recently removed accounts
|
||||
$users = dba::select('user', ['uid'], ["`account_removed` AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY"]);
|
||||
while ($user = dba::fetch($users)) {
|
||||
dba::delete('user', ['uid' => $user['uid']]);
|
||||
$users = DBA::select('user', ['uid'], ["`account_removed` AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY"]);
|
||||
while ($user = DBA::fetch($users)) {
|
||||
DBA::delete('user', ['uid' => $user['uid']]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,14 +165,14 @@ class CronJobs
|
|||
$cachetime = PROXY_DEFAULT_TIME;
|
||||
}
|
||||
$condition = ['`uid` = 0 AND `resource-id` LIKE "pic:%" AND `created` < NOW() - INTERVAL ? SECOND', $cachetime];
|
||||
dba::delete('photo', $condition);
|
||||
DBA::delete('photo', $condition);
|
||||
}
|
||||
|
||||
// Delete the cached OEmbed entries that are older than three month
|
||||
dba::delete('oembed', ["`created` < NOW() - INTERVAL 3 MONTH"]);
|
||||
DBA::delete('oembed', ["`created` < NOW() - INTERVAL 3 MONTH"]);
|
||||
|
||||
// Delete the cached "parse_url" entries that are older than three month
|
||||
dba::delete('parsed_url', ["`created` < NOW() - INTERVAL 3 MONTH"]);
|
||||
DBA::delete('parsed_url', ["`created` < NOW() - INTERVAL 3 MONTH"]);
|
||||
|
||||
// Maximum table size in megabyte
|
||||
$max_tablesize = intval(Config::get('system', 'optimize_max_tablesize')) * 1000000;
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Friendica\Worker;
|
|||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
|
@ -81,22 +81,22 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-1', 0);
|
||||
|
||||
logger("Deleting old global item entries from item table without user copy. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||
$r = DBA::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
||||
`received` < UTC_TIMESTAMP() - INTERVAL ? DAY AND `id` >= ?
|
||||
ORDER BY `id` LIMIT ".intval($limit), $days_unclaimed, $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found global item orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('item', ['id' => $orphan["id"]]);
|
||||
DBA::delete('item', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 1, $last_id);
|
||||
} else {
|
||||
logger("No global item orphans found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." old global item entries from item table without user copy. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-1', $last_id);
|
||||
|
@ -104,21 +104,21 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-2', 0);
|
||||
|
||||
logger("Deleting items without parents. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `id` FROM `item`
|
||||
$r = DBA::p("SELECT `id` FROM `item`
|
||||
WHERE NOT EXISTS (SELECT `id` FROM `item` AS `i` WHERE `item`.`parent` = `i`.`id`)
|
||||
AND `id` >= ? ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found item orphans without parents: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('item', ['id' => $orphan["id"]]);
|
||||
DBA::delete('item', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 2, $last_id);
|
||||
} else {
|
||||
logger("No item orphans without parents found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." items without parents. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-2', $last_id);
|
||||
|
@ -130,21 +130,21 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-3', 0);
|
||||
|
||||
logger("Deleting orphaned data from thread table. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `iid` FROM `thread`
|
||||
$r = DBA::p("SELECT `iid` FROM `thread`
|
||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `thread`.`iid`) AND `iid` >= ?
|
||||
ORDER BY `iid` LIMIT ".intval($limit), $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found thread orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["iid"];
|
||||
dba::delete('thread', ['iid' => $orphan["iid"]]);
|
||||
DBA::delete('thread', ['iid' => $orphan["iid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 3, $last_id);
|
||||
} else {
|
||||
logger("No thread orphans found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." orphaned data from thread table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-3', $last_id);
|
||||
|
@ -156,21 +156,21 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-4', 0);
|
||||
|
||||
logger("Deleting orphaned data from notify table. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `iid`, `id` FROM `notify`
|
||||
$r = DBA::p("SELECT `iid`, `id` FROM `notify`
|
||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `notify`.`iid`) AND `id` >= ?
|
||||
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found notify orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('notify', ['iid' => $orphan["iid"]]);
|
||||
DBA::delete('notify', ['iid' => $orphan["iid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 4, $last_id);
|
||||
} else {
|
||||
logger("No notify orphans found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." orphaned data from notify table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-4', $last_id);
|
||||
|
@ -182,21 +182,21 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-5', 0);
|
||||
|
||||
logger("Deleting orphaned data from notify-threads table. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `id` FROM `notify-threads`
|
||||
$r = DBA::p("SELECT `id` FROM `notify-threads`
|
||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `notify-threads`.`master-parent-item`) AND `id` >= ?
|
||||
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found notify-threads orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('notify-threads', ['id' => $orphan["id"]]);
|
||||
DBA::delete('notify-threads', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 5, $last_id);
|
||||
} else {
|
||||
logger("No notify-threads orphans found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." orphaned data from notify-threads table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-5', $last_id);
|
||||
|
@ -208,21 +208,21 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-6', 0);
|
||||
|
||||
logger("Deleting orphaned data from sign table. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `iid`, `id` FROM `sign`
|
||||
$r = DBA::p("SELECT `iid`, `id` FROM `sign`
|
||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `sign`.`iid`) AND `id` >= ?
|
||||
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found sign orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('sign', ['iid' => $orphan["iid"]]);
|
||||
DBA::delete('sign', ['iid' => $orphan["iid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 6, $last_id);
|
||||
} else {
|
||||
logger("No sign orphans found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." orphaned data from sign table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-6', $last_id);
|
||||
|
@ -234,21 +234,21 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-7', 0);
|
||||
|
||||
logger("Deleting orphaned data from term table. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `oid`, `tid` FROM `term`
|
||||
$r = DBA::p("SELECT `oid`, `tid` FROM `term`
|
||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `term`.`oid`) AND `tid` >= ?
|
||||
ORDER BY `tid` LIMIT ".intval($limit), $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found term orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["tid"];
|
||||
dba::delete('term', ['oid' => $orphan["oid"]]);
|
||||
DBA::delete('term', ['oid' => $orphan["oid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 7, $last_id);
|
||||
} else {
|
||||
logger("No term orphans found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." orphaned data from term table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-7', $last_id);
|
||||
|
@ -264,7 +264,7 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-8', 0);
|
||||
|
||||
logger("Deleting expired threads. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `thread`.`iid` FROM `thread`
|
||||
$r = DBA::p("SELECT `thread`.`iid` FROM `thread`
|
||||
INNER JOIN `contact` ON `thread`.`contact-id` = `contact`.`id` AND NOT `notify_new_posts`
|
||||
WHERE `thread`.`received` < UTC_TIMESTAMP() - INTERVAL ? DAY
|
||||
AND NOT `thread`.`mention` AND NOT `thread`.`starred`
|
||||
|
@ -276,18 +276,18 @@ class DBClean {
|
|||
OR (`item`.`attach` != '') OR `item`.`wall` OR `item`.`origin`)
|
||||
AND `item`.`parent` = `thread`.`iid`)
|
||||
ORDER BY `thread`.`iid` LIMIT 1000", $days, $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found expired threads: ".$count);
|
||||
while ($thread = dba::fetch($r)) {
|
||||
while ($thread = DBA::fetch($r)) {
|
||||
$last_id = $thread["iid"];
|
||||
dba::delete('thread', ['iid' => $thread["iid"]]);
|
||||
DBA::delete('thread', ['iid' => $thread["iid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 8, $last_id);
|
||||
} else {
|
||||
logger("No expired threads found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." expired threads. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-8', $last_id);
|
||||
|
@ -300,22 +300,22 @@ class DBClean {
|
|||
$till_id = Config::get('system', 'dbclean-last-id-8', 0);
|
||||
|
||||
logger("Deleting old global item entries from expired threads from ID ".$last_id." to ID ".$till_id);
|
||||
$r = dba::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||
$r = DBA::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
||||
`received` < UTC_TIMESTAMP() - INTERVAL 90 DAY AND `id` >= ? AND `id` <= ?
|
||||
ORDER BY `id` LIMIT ".intval($limit), $last_id, $till_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found global item entries from expired threads: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('item', ['id' => $orphan["id"]]);
|
||||
DBA::delete('item', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 9, $last_id);
|
||||
} else {
|
||||
logger("No global item entries from expired threads");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." old global item entries from expired threads. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-9', $last_id);
|
||||
|
@ -324,21 +324,21 @@ class DBClean {
|
|||
$days = intval(Config::get('system', 'dbclean_expire_conversation', 90));
|
||||
|
||||
logger("Deleting old conversations. Last created: ".$last_id);
|
||||
$r = dba::p("SELECT `received`, `item-uri` FROM `conversation`
|
||||
$r = DBA::p("SELECT `received`, `item-uri` FROM `conversation`
|
||||
WHERE `received` < UTC_TIMESTAMP() - INTERVAL ? DAY
|
||||
ORDER BY `received` LIMIT ".intval($limit), $days);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found old conversations: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["received"];
|
||||
dba::delete('conversation', ['item-uri' => $orphan["item-uri"]]);
|
||||
DBA::delete('conversation', ['item-uri' => $orphan["item-uri"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 10, $last_id);
|
||||
} else {
|
||||
logger("No old conversations found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." conversations. Last created: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-10', $last_id);
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\BaseObject;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -39,14 +39,14 @@ class Delivery extends BaseObject
|
|||
$public_message = false;
|
||||
|
||||
if ($cmd == self::MAIL) {
|
||||
$target_item = dba::selectFirst('mail', [], ['id' => $item_id]);
|
||||
$target_item = DBA::selectFirst('mail', [], ['id' => $item_id]);
|
||||
if (!DBM::is_result($target_item)) {
|
||||
return;
|
||||
}
|
||||
$uid = $target_item['uid'];
|
||||
$items = [];
|
||||
} elseif ($cmd == self::SUGGESTION) {
|
||||
$target_item = dba::selectFirst('fsuggest', [], ['id' => $item_id]);
|
||||
$target_item = DBA::selectFirst('fsuggest', [], ['id' => $item_id]);
|
||||
if (!DBM::is_result($target_item)) {
|
||||
return;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ class Delivery extends BaseObject
|
|||
}
|
||||
$items[] = $item;
|
||||
}
|
||||
dba::close($itemdata);
|
||||
DBA::close($itemdata);
|
||||
|
||||
$uid = $target_item['contact-uid'];
|
||||
|
||||
|
@ -138,7 +138,7 @@ class Delivery extends BaseObject
|
|||
}
|
||||
|
||||
// We don't deliver our items to blocked or pending contacts, and not to ourselves either
|
||||
$contact = dba::selectFirst('contact', [],
|
||||
$contact = DBA::selectFirst('contact', [],
|
||||
['id' => $contact_id, 'blocked' => false, 'pending' => false, 'self' => false]
|
||||
);
|
||||
if (!DBM::is_result($contact)) {
|
||||
|
@ -210,7 +210,7 @@ class Delivery extends BaseObject
|
|||
} elseif ($cmd == self::SUGGESTION) {
|
||||
$item = $target_item;
|
||||
$atom = DFRN::fsuggest($item, $owner);
|
||||
dba::delete('fsuggest', ['id' => $item['id']]);
|
||||
DBA::delete('fsuggest', ['id' => $item['id']]);
|
||||
} elseif ($cmd == self::RELOCATION) {
|
||||
$atom = DFRN::relocate($owner, $owner['uid']);
|
||||
} elseif ($followup) {
|
||||
|
@ -237,7 +237,7 @@ class Delivery extends BaseObject
|
|||
|
||||
if (link_compare($basepath, System::baseUrl())) {
|
||||
$condition = ['nurl' => normalise_link($contact['url']), 'self' => true];
|
||||
$target_self = dba::selectFirst('contact', ['uid'], $condition);
|
||||
$target_self = DBA::selectFirst('contact', ['uid'], $condition);
|
||||
if (!DBM::is_result($target_self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ class Delivery extends BaseObject
|
|||
}
|
||||
|
||||
// We now have some contact, so we fetch it
|
||||
$target_importer = dba::fetch_first("SELECT *, `name` as `senderName`
|
||||
$target_importer = DBA::fetch_first("SELECT *, `name` as `senderName`
|
||||
FROM `contact`
|
||||
WHERE NOT `blocked` AND `id` = ? LIMIT 1",
|
||||
$cid);
|
||||
|
@ -264,7 +264,7 @@ class Delivery extends BaseObject
|
|||
return;
|
||||
}
|
||||
|
||||
$user = dba::selectFirst('user', [], ['uid' => $target_uid]);
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $target_uid]);
|
||||
|
||||
$target_importer = array_merge($target_importer, $user);
|
||||
|
||||
|
@ -404,7 +404,7 @@ class Delivery extends BaseObject
|
|||
return;
|
||||
}
|
||||
|
||||
$local_user = dba::selectFirst('user', [], ['uid' => $owner['uid']]);
|
||||
$local_user = DBA::selectFirst('user', [], ['uid' => $owner['uid']]);
|
||||
if (!DBM::is_result($local_user)) {
|
||||
return;
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ class Delivery extends BaseObject
|
|||
logger('Deliver ' . $target_item["guid"] . ' via mail to ' . $contact['addr']);
|
||||
|
||||
$reply_to = '';
|
||||
$mailacct = dba::selectFirst('mailacct', ['reply_to'], ['uid' => $owner['uid']]);
|
||||
$mailacct = DBA::selectFirst('mailacct', ['reply_to'], ['uid' => $owner['uid']]);
|
||||
if (DBM::is_result($mailacct) && !empty($mailacct['reply_to'])) {
|
||||
$reply_to = $mailacct['reply_to'];
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Friendica\Worker;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Network\Probe;
|
||||
|
@ -160,7 +160,7 @@ class DiscoverPoCo
|
|||
|
||||
$urlparts = parse_url($user["url"]);
|
||||
if (!isset($urlparts["scheme"])) {
|
||||
dba::update('gcontact', ['network' => NETWORK_PHANTOM],
|
||||
DBA::update('gcontact', ['network' => NETWORK_PHANTOM],
|
||||
['nurl' => normalise_link($user["url"])]);
|
||||
continue;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ class DiscoverPoCo
|
|||
"identi.ca" => NETWORK_PUMPIO,
|
||||
"alpha.app.net" => NETWORK_APPNET];
|
||||
|
||||
dba::update('gcontact', ['network' => $networks[$urlparts["host"]]],
|
||||
DBA::update('gcontact', ['network' => $networks[$urlparts["host"]]],
|
||||
['nurl' => normalise_link($user["url"])]);
|
||||
continue;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ class DiscoverPoCo
|
|||
return;
|
||||
}
|
||||
} else {
|
||||
dba::update('gcontact', ['last_failure' => DateTimeFormat::utcNow()],
|
||||
DBA::update('gcontact', ['last_failure' => DateTimeFormat::utcNow()],
|
||||
['nurl' => normalise_link($user["url"])]);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use Friendica\BaseObject;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Item;
|
||||
|
||||
|
@ -30,44 +30,44 @@ class Expire
|
|||
logger('Delete expired items', LOGGER_DEBUG);
|
||||
// physically remove anything that has been deleted for more than two months
|
||||
$condition = ["`deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY"];
|
||||
$rows = dba::select('item', ['id', 'iaid', 'icid', 'psid'], $condition);
|
||||
while ($row = dba::fetch($rows)) {
|
||||
dba::delete('item', ['id' => $row['id']]);
|
||||
if (!empty($row['iaid']) && !dba::exists('item', ['iaid' => $row['iaid']])) {
|
||||
dba::delete('item-activity', ['id' => $row['iaid']]);
|
||||
$rows = DBA::select('item', ['id', 'iaid', 'icid', 'psid'], $condition);
|
||||
while ($row = DBA::fetch($rows)) {
|
||||
DBA::delete('item', ['id' => $row['id']]);
|
||||
if (!empty($row['iaid']) && !DBA::exists('item', ['iaid' => $row['iaid']])) {
|
||||
DBA::delete('item-activity', ['id' => $row['iaid']]);
|
||||
}
|
||||
if (!empty($row['icid']) && !dba::exists('item', ['icid' => $row['icid']])) {
|
||||
dba::delete('item-content', ['id' => $row['icid']]);
|
||||
if (!empty($row['icid']) && !DBA::exists('item', ['icid' => $row['icid']])) {
|
||||
DBA::delete('item-content', ['id' => $row['icid']]);
|
||||
}
|
||||
// When the permission set will be used in photo and events as well.
|
||||
// this query here needs to be extended.
|
||||
if (!empty($row['psid']) && !dba::exists('item', ['psid' => $row['psid']])) {
|
||||
dba::delete('permissionset', ['id' => $row['psid']]);
|
||||
if (!empty($row['psid']) && !DBA::exists('item', ['psid' => $row['psid']])) {
|
||||
DBA::delete('permissionset', ['id' => $row['psid']]);
|
||||
}
|
||||
}
|
||||
dba::close($rows);
|
||||
DBA::close($rows);
|
||||
|
||||
// Normally we shouldn't have orphaned data at all.
|
||||
// If we do have some, then we have to check why.
|
||||
logger('Deleting orphaned item activities - start', LOGGER_DEBUG);
|
||||
$condition = ["NOT EXISTS (SELECT `iaid` FROM `item` WHERE `item`.`iaid` = `item-activity`.`id`)"];
|
||||
dba::delete('item-activity', $condition);
|
||||
logger('Orphaned item activities deleted: ' . dba::affected_rows(), LOGGER_DEBUG);
|
||||
DBA::delete('item-activity', $condition);
|
||||
logger('Orphaned item activities deleted: ' . DBA::affected_rows(), LOGGER_DEBUG);
|
||||
|
||||
logger('Deleting orphaned item content - start', LOGGER_DEBUG);
|
||||
$condition = ["NOT EXISTS (SELECT `icid` FROM `item` WHERE `item`.`icid` = `item-content`.`id`)"];
|
||||
dba::delete('item-content', $condition);
|
||||
logger('Orphaned item content deleted: ' . dba::affected_rows(), LOGGER_DEBUG);
|
||||
DBA::delete('item-content', $condition);
|
||||
logger('Orphaned item content deleted: ' . DBA::affected_rows(), LOGGER_DEBUG);
|
||||
|
||||
// make this optional as it could have a performance impact on large sites
|
||||
if (intval(Config::get('system', 'optimize_items'))) {
|
||||
dba::e("OPTIMIZE TABLE `item`");
|
||||
DBA::e("OPTIMIZE TABLE `item`");
|
||||
}
|
||||
|
||||
logger('Delete expired items - done', LOGGER_DEBUG);
|
||||
return;
|
||||
} elseif (intval($param) > 0) {
|
||||
$user = dba::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
|
||||
$user = DBA::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
|
||||
if (DBM::is_result($user)) {
|
||||
logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG);
|
||||
Item::expire($user['uid'], $user['expire']);
|
||||
|
@ -89,13 +89,13 @@ class Expire
|
|||
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
|
||||
'Expire', 'delete');
|
||||
|
||||
$r = dba::p("SELECT `uid`, `username` FROM `user` WHERE `expire` != 0");
|
||||
while ($row = dba::fetch($r)) {
|
||||
$r = DBA::p("SELECT `uid`, `username` FROM `user` WHERE `expire` != 0");
|
||||
while ($row = DBA::fetch($r)) {
|
||||
logger('Calling expiry for user '.$row['uid'].' ('.$row['username'].')', LOGGER_DEBUG);
|
||||
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
|
||||
'Expire', (int)$row['uid']);
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
|
||||
logger('expire: calling hooks');
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\BaseObject;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
|
@ -65,7 +65,7 @@ class Notifier
|
|||
|
||||
if ($cmd == Delivery::MAIL) {
|
||||
$normal_mode = false;
|
||||
$message = dba::selectFirst('mail', ['uid', 'contact-id'], ['id' => $item_id]);
|
||||
$message = DBA::selectFirst('mail', ['uid', 'contact-id'], ['id' => $item_id]);
|
||||
if (!DBM::is_result($message)) {
|
||||
return;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class Notifier
|
|||
$recipients[] = $message['contact-id'];
|
||||
} elseif ($cmd == Delivery::SUGGESTION) {
|
||||
$normal_mode = false;
|
||||
$suggest = dba::selectFirst('fsuggest', ['uid', 'cid'], ['id' => $item_id]);
|
||||
$suggest = DBA::selectFirst('fsuggest', ['uid', 'cid'], ['id' => $item_id]);
|
||||
if (!DBM::is_result($suggest)) {
|
||||
return;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ class Notifier
|
|||
|
||||
$fields = ['forum', 'prv'];
|
||||
$condition = ['id' => $target_item['contact-id']];
|
||||
$contact = dba::selectFirst('contact', $fields, $condition);
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
if (!DBM::is_result($contact)) {
|
||||
// Should never happen
|
||||
return false;
|
||||
|
@ -343,14 +343,14 @@ class Notifier
|
|||
logger('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent['author-id']." - Owner: ".$thr_parent['owner-id'], LOGGER_DEBUG);
|
||||
|
||||
// Send a salmon to the parent author
|
||||
$probed_contact = dba::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
|
||||
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
|
||||
if (DBM::is_result($probed_contact) && !empty($probed_contact["notify"])) {
|
||||
logger('Notify parent author '.$probed_contact["url"].': '.$probed_contact["notify"]);
|
||||
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
|
||||
}
|
||||
|
||||
// Send a salmon to the parent owner
|
||||
$probed_contact = dba::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]);
|
||||
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]);
|
||||
if (DBM::is_result($probed_contact) && !empty($probed_contact["notify"])) {
|
||||
logger('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]);
|
||||
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
|
||||
|
@ -407,8 +407,8 @@ class Notifier
|
|||
if (!empty($networks)) {
|
||||
$condition['network'] = $networks;
|
||||
}
|
||||
$contacts = dba::select('contact', ['id', 'url', 'network'], $condition);
|
||||
$r = dba::inArray($contacts);
|
||||
$contacts = DBA::select('contact', ['id', 'url', 'network'], $condition);
|
||||
$r = DBA::inArray($contacts);
|
||||
}
|
||||
|
||||
// delivery loop
|
||||
|
@ -458,7 +458,7 @@ class Notifier
|
|||
|
||||
$condition = ['network' => NETWORK_DFRN, 'uid' => $owner['uid'], 'blocked' => false,
|
||||
'pending' => false, 'archive' => false, 'rel' => [CONTACT_IS_FOLLOWER, CONTACT_IS_FRIEND]];
|
||||
$r2 = dba::inArray(dba::select('contact', ['id', 'name', 'network'], $condition));
|
||||
$r2 = DBA::inArray(DBA::select('contact', ['id', 'name', 'network'], $condition));
|
||||
|
||||
$r = array_merge($r2, $r1);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\BaseObject;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -47,7 +47,7 @@ class OnePoll
|
|||
|
||||
$d = DateTimeFormat::utcNow();
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $contact_id]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
logger('Contact not found or cannot be used.');
|
||||
return;
|
||||
|
@ -118,7 +118,7 @@ class OnePoll
|
|||
logger("Skipping probably dead contact ".$contact['url']);
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ class OnePoll
|
|||
logger('Contact is marked dead');
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
return;
|
||||
} else {
|
||||
Contact::unmarkForArchival($contact);
|
||||
|
@ -138,7 +138,7 @@ class OnePoll
|
|||
logger('Ignore public contacts');
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ class OnePoll
|
|||
logger('No self contact for user '.$importer_uid);
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ class OnePoll
|
|||
|
||||
if (!intval($contact['writable'])) {
|
||||
$fields = ['writable' => true];
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
DBA::update('contact', $fields, ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
$url = $contact['poll'] . '?dfrn_id=' . $idtosend
|
||||
|
@ -187,7 +187,7 @@ class OnePoll
|
|||
|
||||
if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
}
|
||||
|
@ -243,13 +243,13 @@ class OnePoll
|
|||
|
||||
if ((intval($res->status) != 0) || !strlen($res->challenge) || !strlen($res->dfrn_id)) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (((float)$res->dfrn_version > 2.21) && ($contact['poco'] == '')) {
|
||||
$fields = ['poco' => str_replace('/profile/', '/poco/', $contact['url'])];
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
DBA::update('contact', $fields, ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
$postvars = [];
|
||||
|
@ -278,7 +278,7 @@ class OnePoll
|
|||
logger('ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id);
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
}
|
||||
|
@ -306,14 +306,14 @@ class OnePoll
|
|||
|
||||
if ($stat_writeable != $contact['writable']) {
|
||||
$fields = ['writable' => $stat_writeable];
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
DBA::update('contact', $fields, ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
// Are we allowed to import from this person?
|
||||
|
||||
if ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked']) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ class OnePoll
|
|||
|
||||
if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ class OnePoll
|
|||
$mail_disabled = ((function_exists('imap_open') && (! Config::get('system', 'imap_disabled'))) ? 0 : 1);
|
||||
if ($mail_disabled) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
}
|
||||
|
@ -345,10 +345,10 @@ class OnePoll
|
|||
logger("Mail: Enabled", LOGGER_DEBUG);
|
||||
|
||||
$mbox = null;
|
||||
$user = dba::selectFirst('user', ['prvkey'], ['uid' => $importer_uid]);
|
||||
$user = DBA::selectFirst('user', ['prvkey'], ['uid' => $importer_uid]);
|
||||
|
||||
$condition = ["`server` != '' AND `uid` = ?", $importer_uid];
|
||||
$mailconf = dba::selectFirst('mailacct', [], $condition);
|
||||
$mailconf = DBA::selectFirst('mailacct', [], $condition);
|
||||
if (DBM::is_result($user) && DBM::is_result($mailconf)) {
|
||||
$mailbox = Email::constructMailboxName($mailconf);
|
||||
$password = '';
|
||||
|
@ -358,7 +358,7 @@ class OnePoll
|
|||
logger("Mail: Connect to " . $mailconf['user']);
|
||||
if ($mbox) {
|
||||
$fields = ['last_check' => DateTimeFormat::utcNow()];
|
||||
dba::update('mailacct', $fields, ['id' => $mailconf['id']]);
|
||||
DBA::update('mailacct', $fields, ['id' => $mailconf['id']]);
|
||||
logger("Mail: Connected to " . $mailconf['user']);
|
||||
} else {
|
||||
logger("Mail: Connection error ".$mailconf['user']." ".print_r(imap_errors(), true));
|
||||
|
@ -620,17 +620,17 @@ class OnePoll
|
|||
$updated = DateTimeFormat::utcNow();
|
||||
|
||||
self::updateContact($contact, ['last-update' => $updated, 'success_update' => $updated]);
|
||||
dba::update('gcontact', ['last_contact' => $updated], ['nurl' => $contact['nurl']]);
|
||||
DBA::update('gcontact', ['last_contact' => $updated], ['nurl' => $contact['nurl']]);
|
||||
Contact::unmarkForArchival($contact);
|
||||
} elseif (in_array($contact["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_FEED])) {
|
||||
$updated = DateTimeFormat::utcNow();
|
||||
|
||||
self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]);
|
||||
dba::update('gcontact', ['last_failure' => $updated], ['nurl' => $contact['nurl']]);
|
||||
DBA::update('gcontact', ['last_failure' => $updated], ['nurl' => $contact['nurl']]);
|
||||
Contact::markForArchival($contact);
|
||||
} else {
|
||||
$updated = DateTimeFormat::utcNow();
|
||||
dba::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -653,7 +653,7 @@ class OnePoll
|
|||
*/
|
||||
private static function updateContact($contact, $fields)
|
||||
{
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
dba::update('contact', $fields, ['uid' => 0, 'nurl' => $contact['nurl']]);
|
||||
DBA::update('contact', $fields, ['id' => $contact['id']]);
|
||||
DBA::update('contact', $fields, ['uid' => 0, 'nurl' => $contact['nurl']]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Friendica\Worker;
|
|||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\PushSubscriber;
|
||||
use Friendica\Protocol\OStatus;
|
||||
|
@ -30,7 +30,7 @@ class PubSubPublish
|
|||
{
|
||||
$a = BaseObject::getApp();
|
||||
|
||||
$subscriber = dba::selectFirst('push_subscriber', [], ['id' => $id]);
|
||||
$subscriber = DBA::selectFirst('push_subscriber', [], ['id' => $id]);
|
||||
if (!DBM::is_result($subscriber)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\PushSubscriber;
|
||||
use Friendica\Model\Queue as QueueModel;
|
||||
|
@ -36,7 +36,7 @@ class Queue
|
|||
// Handling the pubsubhubbub requests
|
||||
PushSubscriber::requeue();
|
||||
|
||||
$r = dba::inArray(dba::p("SELECT `id` FROM `queue` WHERE `next` < UTC_TIMESTAMP() ORDER BY `batch`, `cid`"));
|
||||
$r = DBA::inArray(DBA::p("SELECT `id` FROM `queue` WHERE `next` < UTC_TIMESTAMP() ORDER BY `batch`, `cid`"));
|
||||
|
||||
Addon::callHooks('queue_predeliver', $r);
|
||||
|
||||
|
@ -52,12 +52,12 @@ class Queue
|
|||
|
||||
|
||||
// delivering
|
||||
$q_item = dba::selectFirst('queue', [], ['id' => $queue_id]);
|
||||
$q_item = DBA::selectFirst('queue', [], ['id' => $queue_id]);
|
||||
if (!DBM::is_result($q_item)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $q_item['cid']]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $q_item['cid']]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
QueueModel::removeItem($q_item['id']);
|
||||
return;
|
||||
|
@ -97,7 +97,7 @@ class Queue
|
|||
}
|
||||
}
|
||||
|
||||
$user = dba::selectFirst('user', [], ['uid' => $contact['uid']]);
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $contact['uid']]);
|
||||
if (!DBM::is_result($user)) {
|
||||
QueueModel::removeItem($q_item['id']);
|
||||
return;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
|
@ -13,12 +13,12 @@ class RemoveContact {
|
|||
public static function execute($id) {
|
||||
|
||||
// Only delete if the contact doesn't exist (anymore)
|
||||
$r = dba::exists('contact', ['id' => $id]);
|
||||
$r = DBA::exists('contact', ['id' => $id]);
|
||||
if ($r) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Now we delete all the depending table entries
|
||||
dba::delete('contact', ['id' => $id]);
|
||||
DBA::delete('contact', ['id' => $id]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,38 +2,38 @@
|
|||
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
class TagUpdate
|
||||
{
|
||||
public static function execute()
|
||||
{
|
||||
$messages = dba::p("SELECT `oid`,`item`.`guid`, `item`.`created`, `item`.`received` FROM `term` INNER JOIN `item` ON `item`.`id`=`term`.`oid` WHERE `term`.`otype` = 1 AND `term`.`guid` = ''");
|
||||
$messages = DBA::p("SELECT `oid`,`item`.`guid`, `item`.`created`, `item`.`received` FROM `term` INNER JOIN `item` ON `item`.`id`=`term`.`oid` WHERE `term`.`otype` = 1 AND `term`.`guid` = ''");
|
||||
|
||||
logger('fetched messages: ' . dba::num_rows($messages));
|
||||
while ($message = dba::fetch($messages)) {
|
||||
logger('fetched messages: ' . DBA::num_rows($messages));
|
||||
while ($message = DBA::fetch($messages)) {
|
||||
if ($message['uid'] == 0) {
|
||||
$global = true;
|
||||
|
||||
dba::update('term', ['global' => true], ['otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
|
||||
DBA::update('term', ['global' => true], ['otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
|
||||
} else {
|
||||
$global = (dba::count('term', ['uid' => 0, 'otype' => TERM_OBJ_POST, 'guid' => $message['guid']]) > 0);
|
||||
$global = (DBA::count('term', ['uid' => 0, 'otype' => TERM_OBJ_POST, 'guid' => $message['guid']]) > 0);
|
||||
}
|
||||
|
||||
$fields = ['guid' => $message['guid'], 'created' => $message['created'],
|
||||
'received' => $message['received'], 'global' => $global];
|
||||
dba::update('term', $fields, ['otype' => TERM_OBJ_POST, 'oid' => $message['oid']]);
|
||||
DBA::update('term', $fields, ['otype' => TERM_OBJ_POST, 'oid' => $message['oid']]);
|
||||
}
|
||||
|
||||
dba::close($messages);
|
||||
DBA::close($messages);
|
||||
|
||||
$messages = dba::select('item', ['guid'], ['uid' => 0]);
|
||||
$messages = DBA::select('item', ['guid'], ['uid' => 0]);
|
||||
|
||||
logger('fetched messages: ' . dba::num_rows($messages));
|
||||
while ($message = dba::fetch(messages)) {
|
||||
dba::update('item', ['global' => true], ['guid' => $message['guid']]);
|
||||
logger('fetched messages: ' . DBA::num_rows($messages));
|
||||
while ($message = DBA::fetch(messages)) {
|
||||
DBA::update('item', ['global' => true], ['guid' => $message['guid']]);
|
||||
}
|
||||
|
||||
dba::close($messages);
|
||||
DBA::close($messages);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue