mirror of
https://github.com/friendica/friendica
synced 2024-12-22 17:20:16 +00: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
|
@ -10,7 +10,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
// Ensure that daemon.php is executed from the base path of the installation
|
||||
if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
|
||||
|
@ -114,7 +114,7 @@ if (!$foreground) {
|
|||
// fclose(STDOUT); // file descriptors as we
|
||||
// fclose(STDERR); // are running as a daemon.
|
||||
|
||||
dba::disconnect();
|
||||
DBA::disconnect();
|
||||
|
||||
register_shutdown_function('shutdown');
|
||||
|
||||
|
@ -155,7 +155,7 @@ while (true) {
|
|||
if ($do_cron) {
|
||||
// We force a reconnect of the database connection.
|
||||
// This is done to ensure that the connection don't get lost over time.
|
||||
dba::reconnect();
|
||||
DBA::reconnect();
|
||||
|
||||
$last_cron = time();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\Protocol;
|
||||
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\Group;
|
||||
|
@ -231,7 +231,7 @@ function api_login(App $a)
|
|||
} else {
|
||||
$user_id = User::authenticate(trim($user), trim($password));
|
||||
if ($user_id !== false) {
|
||||
$record = dba::selectFirst('user', [], ['uid' => $user_id]);
|
||||
$record = DBA::selectFirst('user', [], ['uid' => $user_id]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -499,7 +499,7 @@ function api_rss_extra(App $a, $arr, $user_info)
|
|||
*/
|
||||
function api_unique_id_to_nurl($id)
|
||||
{
|
||||
$r = dba::selectFirst('contact', ['nurl'], ['id' => $id]);
|
||||
$r = DBA::selectFirst('contact', ['nurl'], ['id' => $id]);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
return $r["nurl"];
|
||||
|
@ -696,8 +696,8 @@ function api_get_user(App $a, $contact_id = null)
|
|||
$uinfo[0]['network'] = NETWORK_DFRN;
|
||||
}
|
||||
|
||||
$usr = dba::selectFirst('user', ['default-location'], ['uid' => api_user()]);
|
||||
$profile = dba::selectFirst('profile', ['about'], ['uid' => api_user(), 'is-default' => true]);
|
||||
$usr = DBA::selectFirst('user', ['default-location'], ['uid' => api_user()]);
|
||||
$profile = DBA::selectFirst('profile', ['about'], ['uid' => api_user(), 'is-default' => true]);
|
||||
}
|
||||
$countitems = 0;
|
||||
$countfriends = 0;
|
||||
|
@ -770,7 +770,7 @@ function api_get_user(App $a, $contact_id = null)
|
|||
|
||||
// If this is a local user and it uses Frio, we can get its color preferences.
|
||||
if ($ret['self']) {
|
||||
$theme_info = dba::selectFirst('user', ['theme'], ['uid' => $ret['uid']]);
|
||||
$theme_info = DBA::selectFirst('user', ['theme'], ['uid' => $ret['uid']]);
|
||||
if ($theme_info['theme'] === 'frio') {
|
||||
$schema = PConfig::get($ret['uid'], 'frio', 'schema');
|
||||
|
||||
|
@ -1131,7 +1131,7 @@ function api_statuses_update($type)
|
|||
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60);
|
||||
|
||||
$condition = ["`uid` = ? AND `wall` AND `created` > ? AND `id` = `parent`", api_user(), $datefrom];
|
||||
$posts_day = dba::count('item', $condition);
|
||||
$posts_day = DBA::count('item', $condition);
|
||||
|
||||
if ($posts_day > $throttle_day) {
|
||||
logger('Daily posting limit reached for user '.api_user(), LOGGER_DEBUG);
|
||||
|
@ -1145,7 +1145,7 @@ function api_statuses_update($type)
|
|||
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*7);
|
||||
|
||||
$condition = ["`uid` = ? AND `wall` AND `created` > ? AND `id` = `parent`", api_user(), $datefrom];
|
||||
$posts_week = dba::count('item', $condition);
|
||||
$posts_week = DBA::count('item', $condition);
|
||||
|
||||
if ($posts_week > $throttle_week) {
|
||||
logger('Weekly posting limit reached for user '.api_user(), LOGGER_DEBUG);
|
||||
|
@ -1159,7 +1159,7 @@ function api_statuses_update($type)
|
|||
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*30);
|
||||
|
||||
$condition = ["`uid` = ? AND `wall` AND `created` > ? AND `id` = `parent`", api_user(), $datefrom];
|
||||
$posts_month = dba::count('item', $condition);
|
||||
$posts_month = DBA::count('item', $condition);
|
||||
|
||||
if ($posts_month > $throttle_month) {
|
||||
logger('Monthly posting limit reached for user '.api_user(), LOGGER_DEBUG);
|
||||
|
@ -2768,7 +2768,7 @@ function api_format_items_activities(&$item, $type = "json")
|
|||
}
|
||||
}
|
||||
|
||||
dba::close($ret);
|
||||
DBA::close($ret);
|
||||
|
||||
if ($type == "xml") {
|
||||
$xml_activities = [];
|
||||
|
@ -3048,7 +3048,7 @@ function api_lists_ownerships($type)
|
|||
$user_info = api_get_user($a);
|
||||
$uid = $user_info['uid'];
|
||||
|
||||
$groups = dba::select('group', [], ['deleted' => 0, 'uid' => $uid]);
|
||||
$groups = DBA::select('group', [], ['deleted' => 0, 'uid' => $uid]);
|
||||
|
||||
// loop through all groups
|
||||
$lists = [];
|
||||
|
@ -3867,7 +3867,7 @@ function api_fr_photoalbum_delete($type)
|
|||
}
|
||||
|
||||
// now let's delete all photos from the album
|
||||
$result = dba::delete('photo', ['uid' => api_user(), 'album' => $album]);
|
||||
$result = DBA::delete('photo', ['uid' => api_user(), 'album' => $album]);
|
||||
|
||||
// return success of deletion or error message
|
||||
if ($result) {
|
||||
|
@ -3901,11 +3901,11 @@ function api_fr_photoalbum_update($type)
|
|||
throw new BadRequestException("no new albumname specified");
|
||||
}
|
||||
// check if album is existing
|
||||
if (!dba::exists('photo', ['uid' => api_user(), 'album' => $album])) {
|
||||
if (!DBA::exists('photo', ['uid' => api_user(), 'album' => $album])) {
|
||||
throw new BadRequestException("album not available");
|
||||
}
|
||||
// now let's update all photos to the albumname
|
||||
$result = dba::update('photo', ['album' => $album_new], ['uid' => api_user(), 'album' => $album]);
|
||||
$result = DBA::update('photo', ['album' => $album_new], ['uid' => api_user(), 'album' => $album]);
|
||||
|
||||
// return success of updating or error message
|
||||
if ($result) {
|
||||
|
@ -4139,7 +4139,7 @@ function api_fr_photo_delete($type)
|
|||
throw new BadRequestException("photo not available");
|
||||
}
|
||||
// now we can perform on the deletion of the photo
|
||||
$result = dba::delete('photo', ['uid' => api_user(), 'resource-id' => $photo_id]);
|
||||
$result = DBA::delete('photo', ['uid' => api_user(), 'resource-id' => $photo_id]);
|
||||
|
||||
// return success of deletion or error message
|
||||
if ($result) {
|
||||
|
@ -4212,7 +4212,7 @@ function api_account_update_profile_image($type)
|
|||
|
||||
// check if specified profile id is valid
|
||||
if ($profile_id != 0) {
|
||||
$profile = dba::selectFirst('profile', ['is-default'], ['uid' => api_user(), 'id' => $profile_id]);
|
||||
$profile = DBA::selectFirst('profile', ['is-default'], ['uid' => api_user(), 'id' => $profile_id]);
|
||||
// error message if specified profile id is not in database
|
||||
if (!DBM::is_result($profile)) {
|
||||
throw new BadRequestException("profile_id not available");
|
||||
|
@ -4249,11 +4249,11 @@ function api_account_update_profile_image($type)
|
|||
// change specified profile or all profiles to the new resource-id
|
||||
if ($is_default_profile) {
|
||||
$condition = ["`profile` AND `resource-id` != ? AND `uid` = ?", $data['photo']['id'], api_user()];
|
||||
dba::update('photo', ['profile' => false], $condition);
|
||||
DBA::update('photo', ['profile' => false], $condition);
|
||||
} else {
|
||||
$fields = ['photo' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $filetype,
|
||||
'thumb' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $filetype];
|
||||
dba::update('profile', $fields, ['id' => $_REQUEST['profile'], 'uid' => api_user()]);
|
||||
DBA::update('profile', $fields, ['id' => $_REQUEST['profile'], 'uid' => api_user()]);
|
||||
}
|
||||
|
||||
Contact::updateSelfFromUserID(api_user(), true);
|
||||
|
@ -4298,16 +4298,16 @@ function api_account_update_profile($type)
|
|||
$api_user = api_get_user(get_app());
|
||||
|
||||
if (!empty($_POST['name'])) {
|
||||
dba::update('profile', ['name' => $_POST['name']], ['uid' => $local_user]);
|
||||
dba::update('user', ['username' => $_POST['name']], ['uid' => $local_user]);
|
||||
dba::update('contact', ['name' => $_POST['name']], ['uid' => $local_user, 'self' => 1]);
|
||||
dba::update('contact', ['name' => $_POST['name']], ['id' => $api_user['id']]);
|
||||
DBA::update('profile', ['name' => $_POST['name']], ['uid' => $local_user]);
|
||||
DBA::update('user', ['username' => $_POST['name']], ['uid' => $local_user]);
|
||||
DBA::update('contact', ['name' => $_POST['name']], ['uid' => $local_user, 'self' => 1]);
|
||||
DBA::update('contact', ['name' => $_POST['name']], ['id' => $api_user['id']]);
|
||||
}
|
||||
|
||||
if (isset($_POST['description'])) {
|
||||
dba::update('profile', ['about' => $_POST['description']], ['uid' => $local_user]);
|
||||
dba::update('contact', ['about' => $_POST['description']], ['uid' => $local_user, 'self' => 1]);
|
||||
dba::update('contact', ['about' => $_POST['description']], ['id' => $api_user['id']]);
|
||||
DBA::update('profile', ['about' => $_POST['description']], ['uid' => $local_user]);
|
||||
DBA::update('contact', ['about' => $_POST['description']], ['uid' => $local_user, 'self' => 1]);
|
||||
DBA::update('contact', ['about' => $_POST['description']], ['id' => $api_user['id']]);
|
||||
}
|
||||
|
||||
Worker::add(PRIORITY_LOW, 'ProfileUpdate', $local_user);
|
||||
|
@ -4701,7 +4701,7 @@ function api_friendica_remoteauth()
|
|||
|
||||
// traditional DFRN
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['uid' => api_user(), 'nurl' => $c_url]);
|
||||
$contact = DBA::selectFirst('contact', [], ['uid' => api_user(), 'nurl' => $c_url]);
|
||||
|
||||
if (!DBM::is_result($contact) || ($contact['network'] !== NETWORK_DFRN)) {
|
||||
throw new BadRequestException("Unknown contact");
|
||||
|
@ -4724,7 +4724,7 @@ function api_friendica_remoteauth()
|
|||
|
||||
$fields = ['uid' => api_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id,
|
||||
'sec' => $sec, 'expire' => time() + 45];
|
||||
dba::insert('profile_check', $fields);
|
||||
DBA::insert('profile_check', $fields);
|
||||
|
||||
logger($contact['name'] . ' ' . $sec, LOGGER_DEBUG);
|
||||
$dest = ($url ? '&destination_url=' . $url : '');
|
||||
|
@ -5252,7 +5252,7 @@ function api_lists_destroy($type)
|
|||
}
|
||||
|
||||
// get data of the specified group id
|
||||
$group = dba::selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
|
||||
$group = DBA::selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
|
||||
// error message if specified gid is not in database
|
||||
if (!$group) {
|
||||
throw new BadRequestException('gid not available');
|
||||
|
@ -5506,7 +5506,7 @@ function api_lists_update($type)
|
|||
}
|
||||
|
||||
// get data of the specified group id
|
||||
$group = dba::selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
|
||||
$group = DBA::selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
|
||||
// error message if specified gid is not in database
|
||||
if (!$group) {
|
||||
throw new BadRequestException('gid not available');
|
||||
|
@ -5676,13 +5676,13 @@ function api_friendica_direct_messages_setseen($type)
|
|||
}
|
||||
|
||||
// error message if specified id is not in database
|
||||
if (!dba::exists('mail', ['id' => $id, 'uid' => $uid])) {
|
||||
if (!DBA::exists('mail', ['id' => $id, 'uid' => $uid])) {
|
||||
$answer = ['result' => 'error', 'message' => 'message id not in database'];
|
||||
return api_format_data("direct_messages_setseen", $type, ['$result' => $answer]);
|
||||
}
|
||||
|
||||
// update seen indicator
|
||||
$result = dba::update('mail', ['seen' => true], ['id' => $id]);
|
||||
$result = DBA::update('mail', ['seen' => true], ['id' => $id]);
|
||||
|
||||
if ($result) {
|
||||
// return success
|
||||
|
@ -5852,7 +5852,7 @@ api_register_func('api/friendica/profile/show', 'api_friendica_profile_show', tr
|
|||
*/
|
||||
function api_saved_searches_list($type)
|
||||
{
|
||||
$terms = dba::select('search', ['id', 'term'], ['uid' => local_user()]);
|
||||
$terms = DBA::select('search', ['id', 'term'], ['uid' => local_user()]);
|
||||
|
||||
$result = [];
|
||||
while ($term = $terms->fetch()) {
|
||||
|
@ -5866,7 +5866,7 @@ function api_saved_searches_list($type)
|
|||
];
|
||||
}
|
||||
|
||||
dba::close($terms);
|
||||
DBA::close($terms);
|
||||
|
||||
return api_format_data("terms", $type, ['terms' => $result]);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,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\Item;
|
||||
|
@ -829,7 +829,7 @@ function item_photo_menu($item) {
|
|||
$network = '';
|
||||
$rel = 0;
|
||||
$condition = ['uid' => local_user(), 'nurl' => normalise_link($item['author-link'])];
|
||||
$contact = dba::selectFirst('contact', ['id', 'network', 'rel'], $condition);
|
||||
$contact = DBA::selectFirst('contact', ['id', 'network', 'rel'], $condition);
|
||||
if (DBM::is_result($contact)) {
|
||||
$cid = $contact['id'];
|
||||
$network = $contact['network'];
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
function dbesc($str) {
|
||||
if (dba::$connected) {
|
||||
return(dba::escape($str));
|
||||
if (DBA::$connected) {
|
||||
return(DBA::escape($str));
|
||||
} else {
|
||||
return(str_replace("'","\\'",$str));
|
||||
}
|
||||
|
@ -24,24 +24,24 @@ function q($sql) {
|
|||
$args = func_get_args();
|
||||
unset($args[0]);
|
||||
|
||||
if (!dba::$connected) {
|
||||
if (!DBA::$connected) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = dba::clean_query($sql);
|
||||
$sql = dba::any_value_fallback($sql);
|
||||
$sql = DBA::clean_query($sql);
|
||||
$sql = DBA::any_value_fallback($sql);
|
||||
|
||||
$stmt = @vsprintf($sql, $args);
|
||||
|
||||
$ret = dba::p($stmt);
|
||||
$ret = DBA::p($stmt);
|
||||
|
||||
if (is_bool($ret)) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$columns = dba::columnCount($ret);
|
||||
$columns = DBA::columnCount($ret);
|
||||
|
||||
$data = dba::inArray($ret);
|
||||
$data = DBA::inArray($ret);
|
||||
|
||||
if ((count($data) == 0) && ($columns == 0)) {
|
||||
return true;
|
||||
|
|
|
@ -8,7 +8,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\Item;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -50,7 +50,7 @@ function notification($params)
|
|||
$sender_email = $a->getSenderEmailAddress();
|
||||
|
||||
if ($params['type'] != SYSTEM_EMAIL) {
|
||||
$user = dba::selectFirst('user', ['nickname', 'page-flags'],
|
||||
$user = DBA::selectFirst('user', ['nickname', 'page-flags'],
|
||||
['uid' => $params['uid']]);
|
||||
|
||||
// There is no need to create notifications for forum accounts
|
||||
|
@ -107,7 +107,7 @@ function notification($params)
|
|||
}
|
||||
|
||||
if ($params['type'] == NOTIFY_COMMENT) {
|
||||
$thread = dba::selectFirst('thread', ['ignored'], ['iid' => $parent_id]);
|
||||
$thread = DBA::selectFirst('thread', ['ignored'], ['iid' => $parent_id]);
|
||||
if (DBM::is_result($thread) && $thread["ignored"]) {
|
||||
logger("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
|
||||
return;
|
||||
|
@ -506,7 +506,7 @@ function notification($params)
|
|||
);
|
||||
if ($p && (count($p) > 1)) {
|
||||
for ($d = 1; $d < count($p); $d ++) {
|
||||
dba::delete('notify', ['id' => $p[$d]['id']]);
|
||||
DBA::delete('notify', ['id' => $p[$d]['id']]);
|
||||
}
|
||||
|
||||
// only continue on if we stored the first one
|
||||
|
@ -666,13 +666,13 @@ function notification($params)
|
|||
*/
|
||||
function check_user_notification($itemid) {
|
||||
// fetch all users in the thread
|
||||
$users = dba::p("SELECT DISTINCT(`contact`.`uid`) FROM `item`
|
||||
$users = DBA::p("SELECT DISTINCT(`contact`.`uid`) FROM `item`
|
||||
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` != 0
|
||||
WHERE `parent` IN (SELECT `parent` FROM `item` WHERE `id`=?)", $itemid);
|
||||
while ($user = dba::fetch($users)) {
|
||||
while ($user = DBA::fetch($users)) {
|
||||
check_item_notification($itemid, $user['uid']);
|
||||
}
|
||||
dba::close($users);
|
||||
DBA::close($users);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -689,12 +689,12 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
|
|||
$profiles = $notification_data["profiles"];
|
||||
|
||||
$fields = ['notify-flags', 'language', 'username', 'email', 'nickname'];
|
||||
$user = dba::selectFirst('user', $fields, ['uid' => $uid]);
|
||||
$user = DBA::selectFirst('user', $fields, ['uid' => $uid]);
|
||||
if (!DBM::is_result($user)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$owner = dba::selectFirst('contact', ['url'], ['self' => true, 'uid' => $uid]);
|
||||
$owner = DBA::selectFirst('contact', ['url'], ['self' => true, 'uid' => $uid]);
|
||||
if (!DBM::is_result($owner)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -727,17 +727,17 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
|
|||
|
||||
$profiles = $profiles2;
|
||||
|
||||
$ret = dba::select('contact', ['id'], ['uid' => 0, 'nurl' => $profiles]);
|
||||
$ret = DBA::select('contact', ['id'], ['uid' => 0, 'nurl' => $profiles]);
|
||||
|
||||
$contacts = [];
|
||||
|
||||
while ($contact = dba::fetch($ret)) {
|
||||
while ($contact = DBA::fetch($ret)) {
|
||||
$contacts[] = $contact['id'];
|
||||
}
|
||||
|
||||
$contact_list = implode(',', $contacts);
|
||||
|
||||
dba::close($ret);
|
||||
DBA::close($ret);
|
||||
|
||||
// Only act if it is a "real" post
|
||||
// We need the additional check for the "local_profile" because of mixed situations on connector networks
|
||||
|
@ -767,7 +767,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
|
|||
|
||||
if ($item["parent-uri"] === $item["uri"]) {
|
||||
// Send a notification for every new post?
|
||||
$send_notification = dba::exists('contact', ['id' => $item['contact-id'], 'notify_new_posts' => true]);
|
||||
$send_notification = DBA::exists('contact', ['id' => $item['contact-id'], 'notify_new_posts' => true]);
|
||||
|
||||
if (!$send_notification) {
|
||||
$tags = q("SELECT `url` FROM `term` WHERE `otype` = %d AND `oid` = %d AND `type` = %d AND `uid` = %d",
|
||||
|
@ -776,7 +776,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
|
|||
if (DBM::is_result($tags)) {
|
||||
foreach ($tags AS $tag) {
|
||||
$condition = ['nurl' => normalise_link($tag["url"]), 'uid' => $uid, 'notify_new_posts' => true];
|
||||
$r = dba::exists('contact', $condition);
|
||||
$r = DBA::exists('contact', $condition);
|
||||
if ($r) {
|
||||
$send_notification = true;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,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\Item;
|
||||
use Friendica\Protocol\DFRN;
|
||||
|
@ -304,7 +304,7 @@ function subscribe_to_hub($url, $importer, $contact, $hubmode = 'subscribe') {
|
|||
logger('subscribe_to_hub: ' . $hubmode . ' ' . $contact['name'] . ' to hub ' . $url . ' endpoint: ' . $push_url . ' with verifier ' . $verify_token);
|
||||
|
||||
if (!strlen($contact['hub-verify']) || ($contact['hub-verify'] != $verify_token)) {
|
||||
dba::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
Network::post($url, $params);
|
||||
|
|
|
@ -8,7 +8,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\Group;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -100,7 +100,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
|
|||
$master_record = $a->user;
|
||||
|
||||
if ((x($_SESSION, 'submanage')) && intval($_SESSION['submanage'])) {
|
||||
$user = dba::selectFirst('user', [], ['uid' => $_SESSION['submanage']]);
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $_SESSION['submanage']]);
|
||||
if (DBM::is_result($user)) {
|
||||
$master_record = $user;
|
||||
}
|
||||
|
@ -113,38 +113,38 @@ function authenticate_success($user_record, $login_initial = false, $interactive
|
|||
'nickname' => $master_record['nickname']]];
|
||||
|
||||
// Then add all the children
|
||||
$r = dba::select('user', ['uid', 'username', 'nickname'],
|
||||
$r = DBA::select('user', ['uid', 'username', 'nickname'],
|
||||
['parent-uid' => $master_record['uid'], 'account_removed' => false]);
|
||||
if (DBM::is_result($r)) {
|
||||
$a->identities = array_merge($a->identities, dba::inArray($r));
|
||||
$a->identities = array_merge($a->identities, DBA::inArray($r));
|
||||
}
|
||||
} else {
|
||||
// Just ensure that the array is always defined
|
||||
$a->identities = [];
|
||||
|
||||
// First entry is our parent
|
||||
$r = dba::select('user', ['uid', 'username', 'nickname'],
|
||||
$r = DBA::select('user', ['uid', 'username', 'nickname'],
|
||||
['uid' => $master_record['parent-uid'], 'account_removed' => false]);
|
||||
if (DBM::is_result($r)) {
|
||||
$a->identities = dba::inArray($r);
|
||||
$a->identities = DBA::inArray($r);
|
||||
}
|
||||
|
||||
// Then add all siblings
|
||||
$r = dba::select('user', ['uid', 'username', 'nickname'],
|
||||
$r = DBA::select('user', ['uid', 'username', 'nickname'],
|
||||
['parent-uid' => $master_record['parent-uid'], 'account_removed' => false]);
|
||||
if (DBM::is_result($r)) {
|
||||
$a->identities = array_merge($a->identities, dba::inArray($r));
|
||||
$a->identities = array_merge($a->identities, DBA::inArray($r));
|
||||
}
|
||||
}
|
||||
|
||||
$r = dba::p("SELECT `user`.`uid`, `user`.`username`, `user`.`nickname`
|
||||
$r = DBA::p("SELECT `user`.`uid`, `user`.`username`, `user`.`nickname`
|
||||
FROM `manage`
|
||||
INNER JOIN `user` ON `manage`.`mid` = `user`.`uid`
|
||||
WHERE `user`.`account_removed` = 0 AND `manage`.`uid` = ?",
|
||||
$master_record['uid']
|
||||
);
|
||||
if (DBM::is_result($r)) {
|
||||
$a->identities = array_merge($a->identities, dba::inArray($r));
|
||||
$a->identities = array_merge($a->identities, DBA::inArray($r));
|
||||
}
|
||||
|
||||
if ($login_initial) {
|
||||
|
@ -154,7 +154,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
|
|||
logger('auth_identities refresh: ' . print_r($a->identities, true), LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => true]);
|
||||
$contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => true]);
|
||||
if (DBM::is_result($contact)) {
|
||||
$a->contact = $contact;
|
||||
$a->cid = $contact['id'];
|
||||
|
@ -164,10 +164,10 @@ function authenticate_success($user_record, $login_initial = false, $interactive
|
|||
header('X-Account-Management-Status: active; name="' . $a->user['username'] . '"; id="' . $a->user['nickname'] . '"');
|
||||
|
||||
if ($login_initial || $login_refresh) {
|
||||
dba::update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $_SESSION['uid']]);
|
||||
DBA::update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $_SESSION['uid']]);
|
||||
|
||||
// Set the login date for all identities of the user
|
||||
dba::update('user', ['login_date' => DateTimeFormat::utcNow()],
|
||||
DBA::update('user', ['login_date' => DateTimeFormat::utcNow()],
|
||||
['parent-uid' => $master_record['uid'], 'account_removed' => false]);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ use Friendica\Core\Session;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Module\Login;
|
||||
|
@ -94,7 +94,7 @@ if (!$a->is_backend()) {
|
|||
*/
|
||||
if (x($_SESSION, 'authenticated') && !x($_SESSION, 'language')) {
|
||||
// we haven't loaded user data yet, but we need user language
|
||||
$user = dba::selectFirst('user', ['language'], ['uid' => $_SESSION['uid']]);
|
||||
$user = DBA::selectFirst('user', ['language'], ['uid' => $_SESSION['uid']]);
|
||||
$_SESSION['language'] = $lang;
|
||||
if (DBM::is_result($user)) {
|
||||
$_SESSION['language'] = $user['language'];
|
||||
|
|
|
@ -6,7 +6,7 @@ use Friendica\App;
|
|||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -264,7 +264,7 @@ function acl_content(App $a)
|
|||
while ($author = Item::fetch($authors)) {
|
||||
$item_authors[$author['author-link']] = $author['author-link'];
|
||||
}
|
||||
dba::close($authors);
|
||||
DBA::close($authors);
|
||||
|
||||
foreach ($item_authors as $author) {
|
||||
if (in_array($author, $known_contacts)) {
|
||||
|
|
|
@ -14,7 +14,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -472,14 +472,14 @@ function admin_page_contactblock(App $a)
|
|||
{
|
||||
$condition = ['uid' => 0, 'blocked' => true];
|
||||
|
||||
$total = dba::count('contact', $condition);
|
||||
$total = DBA::count('contact', $condition);
|
||||
|
||||
$a->set_pager_total($total);
|
||||
$a->set_pager_itemspage(30);
|
||||
|
||||
$statement = dba::select('contact', [], $condition, ['limit' => [$a->pager['start'], $a->pager['itemspage']]]);
|
||||
$statement = DBA::select('contact', [], $condition, ['limit' => [$a->pager['start'], $a->pager['itemspage']]]);
|
||||
|
||||
$contacts = dba::inArray($statement);
|
||||
$contacts = DBA::inArray($statement);
|
||||
|
||||
$t = get_markup_template('admin/contactblock.tpl');
|
||||
$o = replace_macros($t, [
|
||||
|
@ -781,8 +781,8 @@ function admin_page_queue(App $a)
|
|||
function admin_page_workerqueue(App $a)
|
||||
{
|
||||
// get jobs from the workerqueue table
|
||||
$statement = dba::select('workerqueue', ['id', 'parameter', 'created', 'priority'], ['done' => 0], ['order'=> ['priority']]);
|
||||
$r = dba::inArray($statement);
|
||||
$statement = DBA::select('workerqueue', ['id', 'parameter', 'created', 'priority'], ['done' => 0], ['order'=> ['priority']]);
|
||||
$r = DBA::inArray($statement);
|
||||
|
||||
for($i = 0; $i < count($r); $i++) {
|
||||
$r[$i]['parameter'] = stripslashes(implode(': ', explode('","', $r[$i]['parameter'])));
|
||||
|
@ -817,7 +817,7 @@ function admin_page_workerqueue(App $a)
|
|||
function admin_page_summary(App $a)
|
||||
{
|
||||
// are there MyISAM tables in the DB? If so, trigger a warning message
|
||||
$r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1", dbesc(dba::database_name()));
|
||||
$r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1", dbesc(DBA::database_name()));
|
||||
$showwarning = false;
|
||||
$warningtext = [];
|
||||
if (DBM::is_result($r)) {
|
||||
|
@ -963,7 +963,7 @@ function admin_page_site_post(App $a)
|
|||
$r = q("UPDATE %s SET %s;", $table_name, $upds);
|
||||
|
||||
if (!DBM::is_result($r)) {
|
||||
notice("Failed updating '$table_name': " . dba::errorMessage());
|
||||
notice("Failed updating '$table_name': " . DBA::errorMessage());
|
||||
goaway('admin/site');
|
||||
}
|
||||
}
|
||||
|
@ -1731,7 +1731,7 @@ function admin_page_users(App $a)
|
|||
{
|
||||
if ($a->argc > 2) {
|
||||
$uid = $a->argv[3];
|
||||
$user = dba::selectFirst('user', ['username', 'blocked'], ['uid' => $uid]);
|
||||
$user = DBA::selectFirst('user', ['username', 'blocked'], ['uid' => $uid]);
|
||||
if (!DBM::is_result($user)) {
|
||||
notice('User not found' . EOL);
|
||||
goaway('admin/users');
|
||||
|
|
|
@ -7,7 +7,7 @@ use Friendica\App;
|
|||
use Friendica\Content\ContactSelector;
|
||||
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\GContact;
|
||||
|
@ -35,7 +35,7 @@ function allfriends_content(App $a)
|
|||
|
||||
$uid = $a->user['uid'];
|
||||
|
||||
$contact = dba::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => local_user()]);
|
||||
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => local_user()]);
|
||||
|
||||
if (!DBM::is_result($contact)) {
|
||||
return;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -22,7 +22,7 @@ function attach_init(App $a)
|
|||
|
||||
// Check for existence, which will also provide us the owner uid
|
||||
|
||||
$r = dba::selectFirst('attach', [], ['id' => $item_id]);
|
||||
$r = DBA::selectFirst('attach', [], ['id' => $item_id]);
|
||||
if (!DBM::is_result($r)) {
|
||||
notice(L10n::t('Item was not found.'). EOL);
|
||||
return;
|
||||
|
|
|
@ -13,7 +13,7 @@ use Friendica\Content\Widget;
|
|||
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;
|
||||
|
@ -37,7 +37,7 @@ function cal_init(App $a)
|
|||
|
||||
if ($a->argc > 1) {
|
||||
$nick = $a->argv[1];
|
||||
$user = dba::selectFirst('user', [], ['nickname' => $nick, 'blocked' => false]);
|
||||
$user = DBA::selectFirst('user', [], ['nickname' => $nick, 'blocked' => false]);
|
||||
if (!DBM::is_result($user)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
|
@ -38,14 +38,14 @@ function common_content(App $a)
|
|||
}
|
||||
|
||||
if ($cmd === 'loc' && $cid) {
|
||||
$contact = dba::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => $uid]);
|
||||
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => $uid]);
|
||||
|
||||
if (DBM::is_result($contact)) {
|
||||
$a->page['aside'] = "";
|
||||
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
|
||||
}
|
||||
} else {
|
||||
$contact = dba::selectFirst('contact', ['name', 'url', 'photo'], ['self' => true, 'uid' => $uid]);
|
||||
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['self' => true, 'uid' => $uid]);
|
||||
|
||||
if (DBM::is_result($contact)) {
|
||||
$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [
|
||||
|
@ -66,11 +66,11 @@ function common_content(App $a)
|
|||
}
|
||||
|
||||
if (!$cid && Profile::getMyURL()) {
|
||||
$contact = dba::selectFirst('contact', ['id'], ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $uid]);
|
||||
$contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $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'];
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ use Friendica\Core\ACL;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
function community_init(App $a)
|
||||
|
@ -190,7 +190,7 @@ function community_content(App $a, $update = 0)
|
|||
function community_getitems($start, $itemspage, $content)
|
||||
{
|
||||
if ($content == 'local') {
|
||||
$r = dba::p("SELECT `item`.`uri`, `author`.`url` AS `author-link` FROM `thread`
|
||||
$r = DBA::p("SELECT `item`.`uri`, `author`.`url` AS `author-link` FROM `thread`
|
||||
INNER JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall`
|
||||
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||
INNER JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
|
||||
|
@ -198,14 +198,14 @@ function community_getitems($start, $itemspage, $content)
|
|||
AND NOT `thread`.`private` AND `thread`.`wall` AND `thread`.`origin`
|
||||
ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage)
|
||||
);
|
||||
return dba::inArray($r);
|
||||
return DBA::inArray($r);
|
||||
} elseif ($content == 'global') {
|
||||
$r = dba::p("SELECT `uri` FROM `thread`
|
||||
$r = DBA::p("SELECT `uri` FROM `thread`
|
||||
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||
INNER JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
|
||||
WHERE `thread`.`uid` = 0 AND NOT `author`.`hidden` AND NOT `author`.`blocked`
|
||||
ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage));
|
||||
return dba::inArray($r);
|
||||
return DBA::inArray($r);
|
||||
}
|
||||
|
||||
// Should never happen
|
||||
|
|
|
@ -12,7 +12,7 @@ use Friendica\Core\Addon;
|
|||
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\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
|
@ -42,7 +42,7 @@ function contacts_init(App $a)
|
|||
$contact = null;
|
||||
if ((($a->argc == 2) && intval($a->argv[1])) || (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts"))) {
|
||||
$contact_id = intval($a->argv[1]);
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
|
||||
}
|
||||
|
||||
if (DBM::is_result($contact)) {
|
||||
|
@ -181,7 +181,7 @@ function contacts_post(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!dba::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
|
||||
if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
|
||||
notice(L10n::t('Could not access contact record.') . EOL);
|
||||
goaway('contacts');
|
||||
return; // NOTREACHED
|
||||
|
@ -191,7 +191,7 @@ function contacts_post(App $a)
|
|||
|
||||
$profile_id = intval($_POST['profile-assign']);
|
||||
if ($profile_id) {
|
||||
if (!dba::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) {
|
||||
if (!DBA::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) {
|
||||
notice(L10n::t('Could not locate selected profile.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ function contacts_post(App $a)
|
|||
notice(L10n::t('Failed to update contact record.') . EOL);
|
||||
}
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
|
||||
if (DBM::is_result($contact)) {
|
||||
$a->data['contact'] = $contact;
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ function contacts_post(App $a)
|
|||
|
||||
function _contact_update($contact_id)
|
||||
{
|
||||
$contact = dba::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
|
||||
$contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
return;
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ function _contact_update($contact_id)
|
|||
|
||||
function _contact_update_profile($contact_id)
|
||||
{
|
||||
$contact = dba::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
|
||||
$contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
return;
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ function contacts_content(App $a)
|
|||
|
||||
$cmd = $a->argv[2];
|
||||
|
||||
$orig_record = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'self' => false]);
|
||||
$orig_record = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'self' => false]);
|
||||
if (!DBM::is_result($orig_record)) {
|
||||
notice(L10n::t('Could not access contact record.') . EOL);
|
||||
goaway('contacts');
|
||||
|
@ -910,7 +910,7 @@ function contact_posts($a, $contact_id)
|
|||
{
|
||||
$o = contacts_tab($a, $contact_id, 1);
|
||||
|
||||
$contact = dba::selectFirst('contact', ['url'], ['id' => $contact_id]);
|
||||
$contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id]);
|
||||
if (DBM::is_result($contact)) {
|
||||
$a->page['aside'] = "";
|
||||
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
|
@ -21,7 +21,7 @@ function crepair_init(App $a)
|
|||
|
||||
$contact = null;
|
||||
if (($a->argc == 2) && intval($a->argv[1])) {
|
||||
$contact = dba::selectFirst('contact', [], ['uid' => local_user(), 'id' => $a->argv[1]]);
|
||||
$contact = DBA::selectFirst('contact', [], ['uid' => local_user(), 'id' => $a->argv[1]]);
|
||||
}
|
||||
|
||||
if (!x($a->page, 'aside')) {
|
||||
|
@ -44,7 +44,7 @@ function crepair_post(App $a)
|
|||
|
||||
$contact = null;
|
||||
if ($cid) {
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
|
||||
}
|
||||
|
||||
if (!DBM::is_result($contact)) {
|
||||
|
@ -105,7 +105,7 @@ function crepair_content(App $a)
|
|||
|
||||
$contact = null;
|
||||
if ($cid) {
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
|
||||
}
|
||||
|
||||
if (!DBM::is_result($contact)) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\User;
|
||||
|
||||
|
@ -34,7 +34,7 @@ function delegate_post(App $a)
|
|||
$parent_password = defaults($_POST, 'parent_password', '');
|
||||
|
||||
if ($parent_uid != 0) {
|
||||
$user = dba::selectFirst('user', ['nickname'], ['uid' => $parent_uid]);
|
||||
$user = DBA::selectFirst('user', ['nickname'], ['uid' => $parent_uid]);
|
||||
if (!DBM::is_result($user)) {
|
||||
notice(L10n::t('Parent user not found.') . EOL);
|
||||
return;
|
||||
|
@ -47,7 +47,7 @@ function delegate_post(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
dba::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
|
||||
DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
|
||||
}
|
||||
|
||||
function delegate_content(App $a)
|
||||
|
@ -65,14 +65,14 @@ function delegate_content(App $a)
|
|||
|
||||
$user_id = $a->argv[2];
|
||||
|
||||
$user = dba::selectFirst('user', ['nickname'], ['uid' => $user_id]);
|
||||
$user = DBA::selectFirst('user', ['nickname'], ['uid' => $user_id]);
|
||||
if (DBM::is_result($user)) {
|
||||
$condition = [
|
||||
'uid' => local_user(),
|
||||
'nurl' => normalise_link(System::baseUrl() . '/profile/' . $user['nickname'])
|
||||
];
|
||||
if (dba::exists('contact', $condition)) {
|
||||
dba::insert('manage', ['uid' => $user_id, 'mid' => local_user()]);
|
||||
if (DBA::exists('contact', $condition)) {
|
||||
DBA::insert('manage', ['uid' => $user_id, 'mid' => local_user()]);
|
||||
}
|
||||
}
|
||||
goaway(System::baseUrl() . '/delegate');
|
||||
|
@ -84,7 +84,7 @@ function delegate_content(App $a)
|
|||
goaway(System::baseUrl() . '/delegate');
|
||||
}
|
||||
|
||||
dba::delete('manage', ['uid' => $a->argv[2], 'mid' => local_user()]);
|
||||
DBA::delete('manage', ['uid' => $a->argv[2], 'mid' => local_user()]);
|
||||
goaway(System::baseUrl() . '/delegate');
|
||||
}
|
||||
|
||||
|
@ -136,19 +136,19 @@ function delegate_content(App $a)
|
|||
|
||||
settings_init($a);
|
||||
|
||||
$user = dba::selectFirst('user', ['parent-uid', 'email'], ['uid' => local_user()]);
|
||||
$user = DBA::selectFirst('user', ['parent-uid', 'email'], ['uid' => local_user()]);
|
||||
|
||||
$parent_user = null;
|
||||
|
||||
if (DBM::is_result($user)) {
|
||||
if (!dba::exists('user', ['parent-uid' => local_user()])) {
|
||||
if (!DBA::exists('user', ['parent-uid' => local_user()])) {
|
||||
$parent_uid = $user['parent-uid'];
|
||||
$parents = [0 => L10n::t('No parent user')];
|
||||
|
||||
$fields = ['uid', 'username', 'nickname'];
|
||||
$condition = ['email' => $user['email'], 'verified' => true, 'blocked' => false, 'parent-uid' => 0];
|
||||
$parent_users = dba::select('user', $fields, $condition);
|
||||
while ($parent = dba::fetch($parent_users)) {
|
||||
$parent_users = DBA::select('user', $fields, $condition);
|
||||
while ($parent = DBA::fetch($parent_users)) {
|
||||
if ($parent['uid'] != local_user()) {
|
||||
$parents[$parent['uid']] = sprintf('%s (%s)', $parent['username'], $parent['nickname']);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ use Friendica\App;
|
|||
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\Group;
|
||||
|
@ -67,7 +67,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
return;
|
||||
}
|
||||
|
||||
$user = dba::selectFirst('user', [], ['uid' => $uid]);
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $uid]);
|
||||
if (!DBM::is_result($user)) {
|
||||
notice(L10n::t('Profile not found.') . EOL);
|
||||
return;
|
||||
|
@ -280,13 +280,13 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
}
|
||||
|
||||
if (($status == 0) && $intro_id) {
|
||||
$intro = dba::selectFirst('intro', ['note'], ['id' => $intro_id]);
|
||||
$intro = DBA::selectFirst('intro', ['note'], ['id' => $intro_id]);
|
||||
if (DBM::is_result($intro)) {
|
||||
dba::update('contact', ['reason' => $intro['note']], ['id' => $contact_id]);
|
||||
DBA::update('contact', ['reason' => $intro['note']], ['id' => $contact_id]);
|
||||
}
|
||||
|
||||
// Success. Delete the notification.
|
||||
dba::delete('intro', ['id' => $intro_id]);
|
||||
DBA::delete('intro', ['id' => $intro_id]);
|
||||
}
|
||||
|
||||
if ($status != 0) {
|
||||
|
@ -358,7 +358,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
}
|
||||
}
|
||||
|
||||
dba::delete('intro', ['id' => $intro_id]);
|
||||
DBA::delete('intro', ['id' => $intro_id]);
|
||||
|
||||
$r = q("UPDATE `contact` SET `name-date` = '%s',
|
||||
`uri-date` = '%s',
|
||||
|
@ -391,7 +391,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
}
|
||||
|
||||
// reload contact info
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $contact_id]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
|
||||
if ((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) {
|
||||
if (DBM::is_result($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
|
||||
$ret = Diaspora::sendShare($user, $contact);
|
||||
|
@ -443,7 +443,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
}
|
||||
|
||||
// Find our user's account
|
||||
$user = dba::selectFirst('user', [], ['nickname' => $node]);
|
||||
$user = DBA::selectFirst('user', [], ['nickname' => $node]);
|
||||
if (!DBM::is_result($user)) {
|
||||
$message = L10n::t('No user record found for \'%s\' ', $node);
|
||||
System::xmlExit(3, $message); // failure
|
||||
|
@ -471,7 +471,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
// NOTREACHED
|
||||
}
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['url' => $decrypted_source_url, 'uid' => $local_uid]);
|
||||
$contact = DBA::selectFirst('contact', [], ['url' => $decrypted_source_url, 'uid' => $local_uid]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
if (strstr($decrypted_source_url, 'http:')) {
|
||||
$newurl = str_replace('http:', 'https:', $decrypted_source_url);
|
||||
|
@ -479,7 +479,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
$newurl = str_replace('https:', 'http:', $decrypted_source_url);
|
||||
}
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['url' => $newurl, 'uid' => $local_uid]);
|
||||
$contact = DBA::selectFirst('contact', [], ['url' => $newurl, 'uid' => $local_uid]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
// this is either a bogus confirmation (?) or we deleted the original introduction.
|
||||
$message = L10n::t('Contact record was not found for you on our site.');
|
||||
|
@ -511,7 +511,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
$dfrn_pubkey = $public_key;
|
||||
}
|
||||
|
||||
if (dba::exists('contact', ['dfrn-id' => $decrypted_dfrn_id])) {
|
||||
if (DBA::exists('contact', ['dfrn-id' => $decrypted_dfrn_id])) {
|
||||
$message = L10n::t('The ID provided by your system is a duplicate on our system. It should work if you try again.');
|
||||
System::xmlExit(1, $message); // Birthday paradox - duplicate dfrn-id
|
||||
// NOTREACHED
|
||||
|
@ -537,7 +537,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
}
|
||||
|
||||
// We're good but now we have to scrape the profile photo and send notifications.
|
||||
$contact = dba::selectFirst('contact', ['photo'], ['id' => $dfrn_record]);
|
||||
$contact = DBA::selectFirst('contact', ['photo'], ['id' => $dfrn_record]);
|
||||
if (DBM::is_result($contact)) {
|
||||
$photo = $contact['photo'];
|
||||
} else {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Protocol\DFRN;
|
||||
|
@ -27,7 +27,7 @@ function dfrn_notify_post(App $a) {
|
|||
if (is_object($data)) {
|
||||
$nick = defaults($a->argv, 1, '');
|
||||
|
||||
$user = dba::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
|
||||
$user = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
|
||||
if (!DBM::is_result($user)) {
|
||||
System::httpExit(500);
|
||||
}
|
||||
|
@ -63,12 +63,12 @@ function dfrn_notify_post(App $a) {
|
|||
$dfrn_id = substr($dfrn_id, 2);
|
||||
}
|
||||
|
||||
if (!dba::exists('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge])) {
|
||||
if (!DBA::exists('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge])) {
|
||||
logger('could not match challenge to dfrn_id ' . $dfrn_id . ' challenge=' . $challenge);
|
||||
System::xmlExit(3, 'Could not match challenge');
|
||||
}
|
||||
|
||||
dba::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
|
||||
DBA::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
|
||||
|
||||
// find the local user who owns this relationship.
|
||||
|
||||
|
@ -121,7 +121,7 @@ function dfrn_notify_post(App $a) {
|
|||
if ((($writable != (-1)) && ($writable != $importer['writable'])) || ($importer['forum'] != $forum) || ($importer['prv'] != $prv)) {
|
||||
$fields = ['writable' => ($writable == (-1)) ? $importer['writable'] : $writable,
|
||||
'forum' => $forum, 'prv' => $prv];
|
||||
dba::update('contact', $fields, ['id' => $importer['id']]);
|
||||
DBA::update('contact', $fields, ['id' => $importer['id']]);
|
||||
|
||||
if ($writable != (-1)) {
|
||||
$importer['writable'] = $writable;
|
||||
|
@ -213,7 +213,7 @@ function dfrn_dispatch_public($postdata)
|
|||
}
|
||||
|
||||
// We now have some contact, so we fetch it
|
||||
$importer = dba::fetch_first("SELECT *, `name` as `senderName`
|
||||
$importer = DBA::fetch_first("SELECT *, `name` as `senderName`
|
||||
FROM `contact`
|
||||
WHERE NOT `blocked` AND `id` = ? LIMIT 1",
|
||||
$contact['id']);
|
||||
|
@ -252,7 +252,7 @@ function dfrn_dispatch_private($user, $postdata)
|
|||
}
|
||||
|
||||
// We now have some contact, so we fetch it
|
||||
$importer = dba::fetch_first("SELECT *, `name` as `senderName`
|
||||
$importer = DBA::fetch_first("SELECT *, `name` as `senderName`
|
||||
FROM `contact`
|
||||
WHERE NOT `blocked` AND `id` = ? LIMIT 1",
|
||||
$cid);
|
||||
|
@ -302,11 +302,11 @@ function dfrn_notify_content(App $a) {
|
|||
|
||||
$status = 0;
|
||||
|
||||
dba::delete('challenge', ["`expire` < ?", time()]);
|
||||
DBA::delete('challenge', ["`expire` < ?", time()]);
|
||||
|
||||
$fields = ['challenge' => $hash, 'dfrn-id' => $dfrn_id, 'expire' => time() + 90,
|
||||
'type' => $type, 'last_update' => $last_update];
|
||||
dba::insert('challenge', $fields);
|
||||
DBA::insert('challenge', $fields);
|
||||
|
||||
logger('challenge=' . $hash, LOGGER_DATA);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\App;
|
|||
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\Module\Login;
|
||||
use Friendica\Protocol\DFRN;
|
||||
|
@ -143,7 +143,7 @@ function dfrn_poll_init(App $a)
|
|||
|
||||
if ($type === 'profile-check' && $dfrn_version < 2.2) {
|
||||
if ((strlen($challenge)) && (strlen($sec))) {
|
||||
dba::delete('profile_check', ["`expire` < ?", time()]);
|
||||
DBA::delete('profile_check', ["`expire` < ?", time()]);
|
||||
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
|
||||
dbesc($sec)
|
||||
);
|
||||
|
@ -208,7 +208,7 @@ function dfrn_poll_init(App $a)
|
|||
break;
|
||||
}
|
||||
|
||||
dba::delete('profile_check', ["`expire` < ?", time()]);
|
||||
DBA::delete('profile_check', ["`expire` < ?", time()]);
|
||||
$r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC",
|
||||
dbesc($dfrn_id));
|
||||
if (DBM::is_result($r)) {
|
||||
|
@ -235,7 +235,7 @@ function dfrn_poll_post(App $a)
|
|||
if (strlen($challenge) && strlen($sec)) {
|
||||
logger('dfrn_poll: POST: profile-check');
|
||||
|
||||
dba::delete('profile_check', ["`expire` < ?", time()]);
|
||||
DBA::delete('profile_check', ["`expire` < ?", time()]);
|
||||
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
|
||||
dbesc($sec)
|
||||
);
|
||||
|
@ -308,7 +308,7 @@ function dfrn_poll_post(App $a)
|
|||
$type = $r[0]['type'];
|
||||
$last_update = $r[0]['last_update'];
|
||||
|
||||
dba::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
|
||||
DBA::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
|
||||
|
||||
$sql_extra = '';
|
||||
switch ($direction) {
|
||||
|
@ -413,7 +413,7 @@ function dfrn_poll_content(App $a)
|
|||
|
||||
$status = 0;
|
||||
|
||||
dba::delete('challenge', ["`expire` < ?", time()]);
|
||||
DBA::delete('challenge', ["`expire` < ?", time()]);
|
||||
|
||||
if ($type !== 'profile') {
|
||||
$r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` , `type`, `last_update` )
|
||||
|
|
|
@ -16,7 +16,7 @@ use Friendica\App;
|
|||
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\Group;
|
||||
|
@ -262,9 +262,9 @@ function dfrn_request_post(App $a)
|
|||
if (DBM::is_result($r)) {
|
||||
foreach ($r as $rr) {
|
||||
if (!$rr['rel']) {
|
||||
dba::delete('contact', ['id' => $rr['cid'], 'self' => false]);
|
||||
DBA::delete('contact', ['id' => $rr['cid'], 'self' => false]);
|
||||
}
|
||||
dba::delete('intro', ['id' => $rr['iid']]);
|
||||
DBA::delete('intro', ['id' => $rr['iid']]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use Friendica\Content\Widget;
|
|||
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\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
|
@ -83,7 +83,7 @@ function directory_content(App $a)
|
|||
$publish = (Config::get('system', 'publish_all') ? '' : " AND `publish` = 1 " );
|
||||
|
||||
|
||||
$cnt = dba::fetch_first("SELECT COUNT(*) AS `total` FROM `profile`
|
||||
$cnt = DBA::fetch_first("SELECT COUNT(*) AS `total` FROM `profile`
|
||||
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
||||
WHERE `is-default` $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` $sql_extra");
|
||||
if (DBM::is_result($cnt)) {
|
||||
|
@ -94,7 +94,7 @@ function directory_content(App $a)
|
|||
|
||||
$limit = intval($a->pager['start'])."," . intval($a->pager['itemspage']);
|
||||
|
||||
$r = dba::p("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` , `user`.`page-flags`,
|
||||
$r = DBA::p("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` , `user`.`page-flags`,
|
||||
`contact`.`addr`, `contact`.`url` AS profile_url FROM `profile`
|
||||
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
||||
LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid`
|
||||
|
@ -108,7 +108,7 @@ function directory_content(App $a)
|
|||
$photo = 'photo';
|
||||
}
|
||||
|
||||
while ($rr = dba::fetch($r)) {
|
||||
while ($rr = DBA::fetch($r)) {
|
||||
$itemurl= '';
|
||||
|
||||
$itemurl = (($rr['addr'] != "") ? $rr['addr'] : $rr['profile_url']);
|
||||
|
@ -196,7 +196,7 @@ function directory_content(App $a)
|
|||
|
||||
$entries[] = $arr['entry'];
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
|
||||
$tpl = get_markup_template('directory_header.tpl');
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use Friendica\Core\Config;
|
|||
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\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
|
@ -203,7 +203,7 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
if ($jj->cid > 0) {
|
||||
$connlnk = "";
|
||||
$conntxt = "";
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $jj->cid]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $jj->cid]);
|
||||
if (DBM::is_result($contact)) {
|
||||
$photo_menu = Contact::photoMenu($contact);
|
||||
$details = _contact_detail_for_template($contact);
|
||||
|
|
|
@ -11,7 +11,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
|
@ -87,7 +87,7 @@ function display_init(App $a)
|
|||
$nickname = str_replace(normalise_link(System::baseUrl())."/profile/", "", normalise_link($profiledata["url"]));
|
||||
|
||||
if (($nickname != $a->user["nickname"])) {
|
||||
$profile = dba::fetch_first("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
|
||||
$profile = DBA::fetch_first("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
|
||||
INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
|
||||
WHERE `user`.`nickname` = ? AND `profile`.`is-default` AND `contact`.`self` LIMIT 1",
|
||||
$nickname
|
||||
|
@ -106,7 +106,7 @@ function display_init(App $a)
|
|||
|
||||
function display_fetchauthor($a, $item)
|
||||
{
|
||||
$author = dba::selectFirst('contact', ['name', 'nick', 'photo', 'network', 'url'], ['id' => $item['author-id']]);
|
||||
$author = DBA::selectFirst('contact', ['name', 'nick', 'photo', 'network', 'url'], ['id' => $item['author-id']]);
|
||||
|
||||
$profiledata = [];
|
||||
$profiledata['uid'] = -1;
|
||||
|
@ -248,7 +248,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
}
|
||||
|
||||
// We are displaying an "alternate" link if that post was public. See issue 2864
|
||||
$is_public = dba::exists('item', ['id' => $item_id, 'private' => [0, 2]]);
|
||||
$is_public = DBA::exists('item', ['id' => $item_id, 'private' => [0, 2]]);
|
||||
if ($is_public) {
|
||||
// For the atom feed the nickname doesn't matter at all, we only need the item id.
|
||||
$alternate = System::baseUrl().'/display/feed-item/'.$item_id.'.atom';
|
||||
|
@ -280,7 +280,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
|
||||
if ($contact_id) {
|
||||
$groups = Group::getIdsByContactId($contact_id);
|
||||
$remote_contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $a->profile['uid']]);
|
||||
$remote_contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $a->profile['uid']]);
|
||||
if (DBM::is_result($remote_contact)) {
|
||||
$contact = $remote_contact;
|
||||
$is_remote_contact = true;
|
||||
|
@ -294,7 +294,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
}
|
||||
}
|
||||
|
||||
$page_contact = dba::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);
|
||||
$page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);
|
||||
if (DBM::is_result($page_contact)) {
|
||||
$a->page_contact = $page_contact;
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
|
||||
if (local_user() && (local_user() == $a->profile['uid'])) {
|
||||
$condition = ['parent-uri' => $item_parent_uri, 'uid' => local_user(), 'unseen' => true];
|
||||
$unseen = dba::exists('item', $condition);
|
||||
$unseen = DBA::exists('item', $condition);
|
||||
} else {
|
||||
$unseen = false;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Protocol\Feed;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -26,11 +26,11 @@ function feedtest_content(App $a)
|
|||
if (!empty($_REQUEST['url'])) {
|
||||
$url = $_REQUEST['url'];
|
||||
|
||||
$importer = dba::selectFirst('user', [], ['uid' => local_user()]);
|
||||
$importer = DBA::selectFirst('user', [], ['uid' => local_user()]);
|
||||
|
||||
$contact_id = Contact::getIdForURL($url, local_user(), true);
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $contact_id]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
|
||||
|
||||
$ret = Network::curl($contact['poll']);
|
||||
$xml = $ret['body'];
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
|
||||
|
@ -47,7 +47,7 @@ function hovercard_content()
|
|||
$cid = 0;
|
||||
if (strpos($profileurl, 'redir/') === 0) {
|
||||
$cid = intval(substr($profileurl, 6));
|
||||
$remote_contact = dba::selectFirst('contact', ['nurl'], ['id' => $cid]);
|
||||
$remote_contact = DBA::selectFirst('contact', ['nurl'], ['id' => $cid]);
|
||||
$profileurl = defaults($remote_contact, 'nurl', '');
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Install;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
|
@ -53,7 +53,7 @@ function install_post(App $a) {
|
|||
$phpath = notags(trim($_POST['phpath']));
|
||||
|
||||
require_once("include/dba.php");
|
||||
if (!dba::connect($dbhost, $dbuser, $dbpass, $dbdata)) {
|
||||
if (!DBA::connect($dbhost, $dbuser, $dbpass, $dbdata)) {
|
||||
$a->data['db_conn_failed'] = true;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ function install_post(App $a) {
|
|||
$adminmail = notags(trim($_POST['adminmail']));
|
||||
|
||||
// connect to db
|
||||
dba::connect($dbhost, $dbuser, $dbpass, $dbdata);
|
||||
DBA::connect($dbhost, $dbuser, $dbpass, $dbdata);
|
||||
|
||||
Install::install($urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $phpath, $timezone, $language, $adminmail);
|
||||
|
||||
|
@ -112,7 +112,7 @@ function install_content(App $a) {
|
|||
$db_return_text .= $txt;
|
||||
}
|
||||
|
||||
if (dba::$connected) {
|
||||
if (DBA::$connected) {
|
||||
$r = q("SELECT COUNT(*) as `total` FROM `user`");
|
||||
if (DBM::is_result($r) && $r[0]['total']) {
|
||||
$tpl = get_markup_template('install.tpl');
|
||||
|
|
36
mod/item.php
36
mod/item.php
|
@ -23,7 +23,7 @@ use Friendica\Core\Config;
|
|||
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\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -146,7 +146,7 @@ function item_post(App $a) {
|
|||
|
||||
// Check for multiple posts with the same message id (when the post was created via API)
|
||||
if (($message_id != '') && ($profile_uid != 0)) {
|
||||
if (dba::exists('item', ['uri' => $message_id, 'uid' => $profile_uid])) {
|
||||
if (DBA::exists('item', ['uri' => $message_id, 'uid' => $profile_uid])) {
|
||||
logger("Message with URI ".$message_id." already exists for user ".$profile_uid, LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ function item_post(App $a) {
|
|||
$orig_post = Item::selectFirst(Item::ITEM_FIELDLIST, ['id' => $post_id]);
|
||||
}
|
||||
|
||||
$user = dba::selectFirst('user', [], ['uid' => $profile_uid]);
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $profile_uid]);
|
||||
|
||||
if (!DBM::is_result($user) && !$parent) {
|
||||
return;
|
||||
|
@ -268,7 +268,7 @@ function item_post(App $a) {
|
|||
// if using the API, we won't see pubmail_enable - figure out if it should be set
|
||||
if ($api_source && $profile_uid && $profile_uid == local_user() && !$private) {
|
||||
if (function_exists('imap_open') && !Config::get('system', 'imap_disabled')) {
|
||||
$pubmail_enabled = dba::exists('mailacct', ["`uid` = ? AND `server` != ? AND `pubmail`", local_user(), '']);
|
||||
$pubmail_enabled = DBA::exists('mailacct', ["`uid` = ? AND `server` != ? AND `pubmail`", local_user(), '']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ function item_post(App $a) {
|
|||
|
||||
if (local_user() && ((local_user() == $profile_uid) || $allow_comment)) {
|
||||
$self = true;
|
||||
$author = dba::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
|
||||
$author = DBA::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
|
||||
} elseif (remote_user()) {
|
||||
if (x($_SESSION, 'remote') && is_array($_SESSION['remote'])) {
|
||||
foreach ($_SESSION['remote'] as $v) {
|
||||
|
@ -316,7 +316,7 @@ function item_post(App $a) {
|
|||
}
|
||||
}
|
||||
if ($contact_id) {
|
||||
$author = dba::selectFirst('contact', [], ['id' => $contact_id]);
|
||||
$author = DBA::selectFirst('contact', [], ['id' => $contact_id]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@ function item_post(App $a) {
|
|||
if ($profile_uid == local_user() || $allow_comment) {
|
||||
$contact_record = $author;
|
||||
} else {
|
||||
$contact_record = dba::selectFirst('contact', [], ['uid' => $profile_uid, 'self' => true]);
|
||||
$contact_record = DBA::selectFirst('contact', [], ['uid' => $profile_uid, 'self' => true]);
|
||||
}
|
||||
|
||||
// Look for any tags and linkify them
|
||||
|
@ -458,14 +458,14 @@ function item_post(App $a) {
|
|||
|
||||
$condition = ['allow_cid' => $srch, 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '',
|
||||
'resource-id' => $image_uri, 'uid' => $profile_uid];
|
||||
if (!dba::exists('photo', $condition)) {
|
||||
if (!DBA::exists('photo', $condition)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
|
||||
'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny];
|
||||
$condition = ['resource-id' => $image_uri, 'uid' => $profile_uid, 'album' => L10n::t('Wall Photos')];
|
||||
dba::update('photo', $fields, $condition);
|
||||
DBA::update('photo', $fields, $condition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -486,14 +486,14 @@ function item_post(App $a) {
|
|||
|
||||
$condition = ['allow_cid' => $srch, 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '',
|
||||
'id' => $attach];
|
||||
if (!dba::exists('attach', $condition)) {
|
||||
if (!DBA::exists('attach', $condition)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
|
||||
'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny];
|
||||
$condition = ['id' => $attach];
|
||||
dba::update('attach', $fields, $condition);
|
||||
DBA::update('attach', $fields, $condition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ function item_post(App $a) {
|
|||
if (preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
|
||||
foreach ($match[2] as $mtch) {
|
||||
$fields = ['id', 'filename', 'filesize', 'filetype'];
|
||||
$attachment = dba::selectFirst('attach', $fields, ['id' => $mtch]);
|
||||
$attachment = DBA::selectFirst('attach', $fields, ['id' => $mtch]);
|
||||
if (DBM::is_result($attachment)) {
|
||||
if (strlen($attachments)) {
|
||||
$attachments .= ',';
|
||||
|
@ -636,7 +636,7 @@ function item_post(App $a) {
|
|||
// This field is for storing the raw conversation data
|
||||
$datarray['protocol'] = PROTOCOL_DFRN;
|
||||
|
||||
$conversation = dba::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $datarray['parent-uri']]);
|
||||
$conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $datarray['parent-uri']]);
|
||||
if (DBM::is_result($conversation)) {
|
||||
if ($conversation['conversation-uri'] != '') {
|
||||
$datarray['conversation-uri'] = $conversation['conversation-uri'];
|
||||
|
@ -960,32 +960,32 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n
|
|||
if (strrpos($name, '+')) {
|
||||
// Is it in format @nick+number?
|
||||
$tagcid = intval(substr($name, strrpos($name, '+') + 1));
|
||||
$contact = dba::selectFirst('contact', $fields, ['id' => $tagcid, 'uid' => $profile_uid]);
|
||||
$contact = DBA::selectFirst('contact', $fields, ['id' => $tagcid, 'uid' => $profile_uid]);
|
||||
}
|
||||
|
||||
// select someone by nick or attag in the current network
|
||||
if (!DBM::is_result($contact) && ($network != "")) {
|
||||
$condition = ["(`nick` = ? OR `attag` = ?) AND `network` = ? AND `uid` = ?",
|
||||
$name, $name, $network, $profile_uid];
|
||||
$contact = dba::selectFirst('contact', $fields, $condition);
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
}
|
||||
|
||||
//select someone by name in the current network
|
||||
if (!DBM::is_result($contact) && ($network != "")) {
|
||||
$condition = ['name' => $name, 'network' => $network, 'uid' => $profile_uid];
|
||||
$contact = dba::selectFirst('contact', $fields, $condition);
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
}
|
||||
|
||||
// select someone by nick or attag in any network
|
||||
if (!DBM::is_result($contact)) {
|
||||
$condition = ["(`nick` = ? OR `attag` = ?) AND `uid` = ?", $name, $name, $profile_uid];
|
||||
$contact = dba::selectFirst('contact', $fields, $condition);
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
}
|
||||
|
||||
// select someone by name in any network
|
||||
if (!DBM::is_result($contact)) {
|
||||
$condition = ['name' => $name, 'uid' => $profile_uid];
|
||||
$contact = dba::selectFirst('contact', $fields, $condition);
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use Friendica\App;
|
|||
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\User;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -24,7 +24,7 @@ function lostpass_post(App $a)
|
|||
}
|
||||
|
||||
$condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame];
|
||||
$user = dba::selectFirst('user', ['uid', 'username', 'email'], $condition);
|
||||
$user = DBA::selectFirst('user', ['uid', 'username', 'email'], $condition);
|
||||
if (!DBM::is_result($user)) {
|
||||
notice(L10n::t('No valid account found.') . EOL);
|
||||
goaway(System::baseUrl());
|
||||
|
@ -36,7 +36,7 @@ function lostpass_post(App $a)
|
|||
'pwdreset' => $pwdreset_token,
|
||||
'pwdreset_time' => DateTimeFormat::utcNow()
|
||||
];
|
||||
$result = dba::update('user', $fields, ['uid' => $user['uid']]);
|
||||
$result = DBA::update('user', $fields, ['uid' => $user['uid']]);
|
||||
if ($result) {
|
||||
info(L10n::t('Password reset request issued. Check your email.') . EOL);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ function lostpass_content(App $a)
|
|||
if ($a->argc > 1) {
|
||||
$pwdreset_token = $a->argv[1];
|
||||
|
||||
$user = dba::selectFirst('user', ['uid', 'username', 'email', 'pwdreset_time'], ['pwdreset' => $pwdreset_token]);
|
||||
$user = DBA::selectFirst('user', ['uid', 'username', 'email', 'pwdreset_time'], ['pwdreset' => $pwdreset_token]);
|
||||
if (!DBM::is_result($user)) {
|
||||
notice(L10n::t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
|
||||
|
||||
|
@ -99,7 +99,7 @@ function lostpass_content(App $a)
|
|||
'pwdreset' => null,
|
||||
'pwdreset_time' => null
|
||||
];
|
||||
dba::update('user', $fields, ['uid' => $user['uid']]);
|
||||
DBA::update('user', $fields, ['uid' => $user['uid']]);
|
||||
|
||||
notice(L10n::t('Request has expired, please make a new one.'));
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\ACL;
|
||||
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\Mail;
|
||||
|
@ -150,7 +150,7 @@ function message_content(App $a)
|
|||
|
||||
$cmd = $a->argv[1];
|
||||
if ($cmd === 'drop') {
|
||||
if (dba::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
|
||||
if (DBA::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
|
||||
info(L10n::t('Message deleted.') . EOL);
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ function message_content(App $a)
|
|||
$parent = $r[0]['parent-uri'];
|
||||
$convid = $r[0]['convid'];
|
||||
|
||||
if (dba::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
|
||||
if (DBA::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
|
||||
info(L10n::t('Conversation removed.') . EOL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,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\Group;
|
||||
|
@ -41,13 +41,13 @@ function network_init(App $a)
|
|||
}
|
||||
|
||||
if (x($_GET, 'save')) {
|
||||
$exists = dba::exists('search', ['uid' => local_user(), 'term' => $search]);
|
||||
$exists = DBA::exists('search', ['uid' => local_user(), 'term' => $search]);
|
||||
if (!$exists) {
|
||||
dba::insert('search', ['uid' => local_user(), 'term' => $search]);
|
||||
DBA::insert('search', ['uid' => local_user(), 'term' => $search]);
|
||||
}
|
||||
}
|
||||
if (x($_GET, 'remove')) {
|
||||
dba::delete('search', ['uid' => local_user(), 'term' => $search]);
|
||||
DBA::delete('search', ['uid' => local_user(), 'term' => $search]);
|
||||
}
|
||||
|
||||
$is_a_date_query = false;
|
||||
|
@ -182,10 +182,10 @@ function saved_searches($search)
|
|||
|
||||
$o = '';
|
||||
|
||||
$terms = dba::select('search', ['id', 'term'], ['uid' => local_user()]);
|
||||
$terms = DBA::select('search', ['id', 'term'], ['uid' => local_user()]);
|
||||
$saved = [];
|
||||
|
||||
while ($rr = dba::fetch($terms)) {
|
||||
while ($rr = DBA::fetch($terms)) {
|
||||
$saved[] = [
|
||||
'id' => $rr['id'],
|
||||
'term' => $rr['term'],
|
||||
|
@ -317,7 +317,7 @@ function networkSetSeen($condition)
|
|||
return;
|
||||
}
|
||||
|
||||
$unseen = dba::exists('item', $condition);
|
||||
$unseen = DBA::exists('item', $condition);
|
||||
|
||||
if ($unseen) {
|
||||
$r = Item::update(['unseen' => false], $condition);
|
||||
|
@ -442,13 +442,13 @@ function networkFlatView(App $a, $update = 0)
|
|||
$condition = ["`term` = ? AND `otype` = ? AND `type` = ? AND `uid` = ?",
|
||||
$file, TERM_OBJ_POST, TERM_FILE, local_user()];
|
||||
$params = ['order' => ['tid' => true], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
|
||||
$result = dba::select('term', ['oid'], $condition);
|
||||
$result = DBA::select('term', ['oid'], $condition);
|
||||
|
||||
$posts = [];
|
||||
while ($term = dba::fetch($result)) {
|
||||
while ($term = DBA::fetch($result)) {
|
||||
$posts[] = $term['oid'];
|
||||
}
|
||||
dba::close($terms);
|
||||
DBA::close($terms);
|
||||
|
||||
$condition = ['uid' => local_user(), 'id' => $posts];
|
||||
} else {
|
||||
|
@ -525,10 +525,10 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
}
|
||||
|
||||
if ($nets) {
|
||||
$r = dba::select('contact', ['id'], ['uid' => local_user(), 'network' => $nets], ['self' => false]);
|
||||
$r = DBA::select('contact', ['id'], ['uid' => local_user(), 'network' => $nets], ['self' => false]);
|
||||
|
||||
$str = '';
|
||||
while ($rr = dba::fetch($r)) {
|
||||
while ($rr = DBA::fetch($r)) {
|
||||
$str .= '<' . $rr['id'] . '>';
|
||||
}
|
||||
if (strlen($str)) {
|
||||
|
@ -556,7 +556,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
if ($cid) {
|
||||
// If $cid belongs to a communitity forum or a privat goup,.add a mention to the status editor
|
||||
$condition = ["`id` = ? AND (`forum` OR `prv`)", $cid];
|
||||
$contact = dba::selectFirst('contact', ['addr', 'nick'], $condition);
|
||||
$contact = DBA::selectFirst('contact', ['addr', 'nick'], $condition);
|
||||
if (DBM::is_result($contact)) {
|
||||
if ($contact['addr'] != '') {
|
||||
$content = '!' . $contact['addr'];
|
||||
|
@ -609,7 +609,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
$sql_tag_nets = (($nets) ? sprintf(" AND `item`.`network` = '%s' ", dbesc($nets)) : '');
|
||||
|
||||
if ($gid) {
|
||||
$group = dba::selectFirst('group', ['name'], ['id' => $gid, 'uid' => local_user()]);
|
||||
$group = DBA::selectFirst('group', ['name'], ['id' => $gid, 'uid' => local_user()]);
|
||||
if (!DBM::is_result($group)) {
|
||||
if ($update) {
|
||||
killme();
|
||||
|
@ -625,7 +625,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
$contact_str_self = '';
|
||||
|
||||
$contact_str = implode(',', $contacts);
|
||||
$self = dba::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
|
||||
$self = DBA::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
|
||||
if (DBM::is_result($self)) {
|
||||
$contact_str_self = $self['id'];
|
||||
}
|
||||
|
@ -645,7 +645,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
$fields = ['id', 'name', 'network', 'writable', 'nurl',
|
||||
'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location'];
|
||||
$condition = ["`id` = ? AND (NOT `blocked` OR `pending`)", $cid];
|
||||
$contact = dba::selectFirst('contact', $fields, $condition);
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
if (DBM::is_result($contact)) {
|
||||
$sql_extra = " AND " . $sql_table . ".`contact-id` = " . intval($cid);
|
||||
|
||||
|
@ -835,7 +835,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
$top_limit = DateTimeFormat::utcNow();
|
||||
}
|
||||
|
||||
$items = dba::p("SELECT `item`.`parent-uri` AS `uri`, 0 AS `item_id`, `item`.$ordering AS `order_date`, `author`.`url` AS `author-link` FROM `item`
|
||||
$items = DBA::p("SELECT `item`.`parent-uri` AS `uri`, 0 AS `item_id`, `item`.$ordering AS `order_date`, `author`.`url` AS `author-link` FROM `item`
|
||||
STRAIGHT_JOIN (SELECT `oid` FROM `term` WHERE `term` IN
|
||||
(SELECT SUBSTR(`term`, 2) FROM `search` WHERE `uid` = ? AND `term` LIKE '#%') AND `otype` = ? AND `type` = ? AND `uid` = 0) AS `term`
|
||||
ON `item`.`id` = `term`.`oid`
|
||||
|
@ -845,7 +845,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
local_user(), TERM_OBJ_POST, TERM_HASHTAG,
|
||||
$top_limit, $bottom_limit);
|
||||
|
||||
$data = dba::inArray($items);
|
||||
$data = DBA::inArray($items);
|
||||
|
||||
if (count($data) > 0) {
|
||||
$tag_top_limit = current($data)['order_date'];
|
||||
|
@ -862,7 +862,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
// Don't show hash tag posts from blocked or ignored contacts
|
||||
$condition = ["`nurl` = ? AND `uid` = ? AND (`blocked` OR `readonly`)",
|
||||
normalise_link($item['author-link']), local_user()];
|
||||
if (!dba::exists('contact', $condition)) {
|
||||
if (!DBA::exists('contact', $condition)) {
|
||||
$s[$item['uri']] = $item;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\Network;
|
||||
require_once 'include/dba.php';
|
||||
|
||||
|
@ -215,11 +215,11 @@ function nodeinfo_cron() {
|
|||
logger('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$local_posts = dba::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
|
||||
$local_posts = DBA::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
|
||||
Config::set('nodeinfo', 'local_posts', $local_posts);
|
||||
logger('local_posts: ' . $local_posts, LOGGER_DEBUG);
|
||||
|
||||
$local_comments = dba::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
|
||||
$local_comments = DBA::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
|
||||
Config::set('nodeinfo', 'local_comments', $local_comments);
|
||||
logger('local_comments: ' . $local_comments, LOGGER_DEBUG);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Profile;
|
||||
|
||||
|
@ -45,7 +45,7 @@ function noscrape_init(App $a)
|
|||
$keywords = str_replace(['#',',',' ',',,'], ['',' ',',',','], $keywords);
|
||||
$keywords = explode(',', $keywords);
|
||||
|
||||
$contactPhoto = dba::selectFirst('contact', ['photo'], ['self' => true, 'uid' => $a->profile['uid']]);
|
||||
$contactPhoto = DBA::selectFirst('contact', ['photo'], ['self' => true, 'uid' => $a->profile['uid']]);
|
||||
|
||||
$json_info['fn'] = $a->profile['name'];
|
||||
$json_info['photo'] = $contactPhoto["photo"];
|
||||
|
@ -74,13 +74,13 @@ function noscrape_init(App $a)
|
|||
// We display the last activity (post or login), reduced to year and week number
|
||||
$last_active = 0;
|
||||
$condition = ['uid' => $a->profile['uid'], 'self' => true];
|
||||
$contact = dba::selectFirst('contact', ['last-item'], $condition);
|
||||
$contact = DBA::selectFirst('contact', ['last-item'], $condition);
|
||||
if (DBM::is_result($contact)) {
|
||||
$last_active = strtotime($contact['last-item']);
|
||||
}
|
||||
|
||||
$condition = ['uid' => $a->profile['uid']];
|
||||
$user = dba::selectFirst('user', ['login_date'], $condition);
|
||||
$user = DBA::selectFirst('user', ['login_date'], $condition);
|
||||
if (DBM::is_result($user)) {
|
||||
if ($last_active < strtotime($user['login_date'])) {
|
||||
$last_active = strtotime($user['login_date']);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
|
@ -74,7 +74,7 @@ function notes_content(App $a, $update = false)
|
|||
while ($rr = Item::fetch($r)) {
|
||||
$parents_arr[] = $rr['id'];
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
|
||||
$condition = ['uid' => local_user(), 'parent' => $parents_arr];
|
||||
$result = Item::selectForUser(local_user(), [], $condition);
|
||||
|
|
|
@ -10,7 +10,7 @@ use Friendica\Content\Nav;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\NotificationsManager;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
function notifications_post(App $a)
|
||||
|
@ -26,7 +26,7 @@ function notifications_post(App $a)
|
|||
}
|
||||
|
||||
if ($request_id) {
|
||||
$intro = dba::selectFirst('intro', ['id', 'contact-id', 'fid'], ['id' => $request_id, 'uid' => local_user()]);
|
||||
$intro = DBA::selectFirst('intro', ['id', 'contact-id', 'fid'], ['id' => $request_id, 'uid' => local_user()]);
|
||||
|
||||
if (DBM::is_result($intro)) {
|
||||
$intro_id = $intro['id'];
|
||||
|
@ -42,20 +42,20 @@ function notifications_post(App $a)
|
|||
$fid = $intro['fid'];
|
||||
|
||||
if ($_POST['submit'] == L10n::t('Discard')) {
|
||||
dba::delete('intro', ['id' => $intro_id]);
|
||||
DBA::delete('intro', ['id' => $intro_id]);
|
||||
|
||||
if (!$fid) {
|
||||
// The check for blocked and pending is in case the friendship was already approved
|
||||
// and we just want to get rid of the now pointless notification
|
||||
$condition = ['id' => $contact_id, 'uid' => local_user(),
|
||||
'self' => false, 'blocked' => true, 'pending' => true];
|
||||
dba::delete('contact', $condition);
|
||||
DBA::delete('contact', $condition);
|
||||
}
|
||||
goaway('notifications/intros');
|
||||
}
|
||||
|
||||
if ($_POST['submit'] == L10n::t('Ignore')) {
|
||||
dba::update('intro', ['ignore' => true], ['id' => $intro_id]);
|
||||
DBA::update('intro', ['ignore' => true], ['id' => $intro_id]);
|
||||
goaway('notifications/intros');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ use Friendica\Core\Config;
|
|||
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\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
|
@ -1350,7 +1350,7 @@ function photos_content(App $a)
|
|||
$link_item = Item::selectFirst([], ['id' => $linked_items[0]['id']]);
|
||||
|
||||
$condition = ["`parent` = ? AND `parent` != `id`", $link_item['parent']];
|
||||
$a->set_pager_total(dba::count('item', $condition));
|
||||
$a->set_pager_total(DBA::count('item', $condition));
|
||||
|
||||
$params = ['order' => ['id'], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
|
||||
$result = Item::selectForUser($link_item['uid'], [], $condition, $params);
|
||||
|
|
|
@ -12,7 +12,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\Group;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -347,7 +347,7 @@ function profile_content(App $a, $update = 0)
|
|||
|
||||
|
||||
if ($is_owner) {
|
||||
$unseen = dba::exists('item', ['wall' => true, 'unseen' => true, 'uid' => local_user()]);
|
||||
$unseen = DBA::exists('item', ['wall' => true, 'unseen' => true, 'uid' => local_user()]);
|
||||
if ($unseen) {
|
||||
$r = Item::update(['unseen' => false],
|
||||
['wall' => true, 'unseen' => true, 'uid' => local_user()]);
|
||||
|
|
|
@ -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\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
|
@ -123,7 +123,7 @@ function profiles_init(App $a) {
|
|||
$r1[0]['net-publish'] = 0;
|
||||
$r1[0]['profile-name'] = dbesc($name);
|
||||
|
||||
dba::insert('profile', $r1[0]);
|
||||
DBA::insert('profile', $r1[0]);
|
||||
|
||||
$r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile-name` = '%s' LIMIT 1",
|
||||
intval(local_user()),
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Object\Image;
|
||||
|
@ -150,7 +150,7 @@ function proxy_init(App $a) {
|
|||
$valid = true;
|
||||
$photo = null;
|
||||
if (!$direct_cache && ($cachefile == '')) {
|
||||
$photo = dba::selectFirst('photo', ['data', 'desc'], ['resource-id' => $urlhash]);
|
||||
$photo = DBA::selectFirst('photo', ['data', 'desc'], ['resource-id' => $urlhash]);
|
||||
if (DBM::is_result($photo)) {
|
||||
$img_str = $photo['data'];
|
||||
$mime = $photo['desc'];
|
||||
|
@ -193,7 +193,7 @@ function proxy_init(App $a) {
|
|||
'filename' => basename($_REQUEST['url']), 'type' => '', 'album' => '', 'height' => imagesy($image), 'width' => imagesx($image),
|
||||
'datasize' => 0, 'data' => $img_str, 'scale' => 100, 'profile' => 0,
|
||||
'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '', 'desc' => $mime];
|
||||
dba::insert('photo', $fields);
|
||||
DBA::insert('photo', $fields);
|
||||
} else {
|
||||
$Image = new Image($img_str, $mime);
|
||||
if ($Image->isValid() && !$direct_cache && ($cachefile == '')) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Protocol\OStatus;
|
||||
|
||||
|
@ -44,7 +44,7 @@ function pubsub_init(App $a)
|
|||
|
||||
$subscribe = (($hub_mode === 'subscribe') ? 1 : 0);
|
||||
|
||||
$owner = dba::selectFirst('user', ['uid'], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
|
||||
$owner = DBA::selectFirst('user', ['uid'], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
|
||||
if (!DBM::is_result($owner)) {
|
||||
logger('Local account not found: ' . $nick);
|
||||
hub_return(false, '');
|
||||
|
@ -56,7 +56,7 @@ function pubsub_init(App $a)
|
|||
$condition['hub-verify'] = $hub_verify;
|
||||
}
|
||||
|
||||
$contact = dba::selectFirst('contact', ['id', 'poll'], $condition);
|
||||
$contact = DBA::selectFirst('contact', ['id', 'poll'], $condition);
|
||||
if (!DBM::is_result($contact)) {
|
||||
logger('Contact ' . $contact_id . ' not found.');
|
||||
hub_return(false, '');
|
||||
|
@ -76,7 +76,7 @@ function pubsub_init(App $a)
|
|||
}
|
||||
|
||||
if (!empty($hub_mode)) {
|
||||
dba::update('contact', ['subhub' => $subscribe], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['subhub' => $subscribe], ['id' => $contact['id']]);
|
||||
logger($hub_mode . ' success for contact ' . $contact_id . '.');
|
||||
}
|
||||
hub_return(true, $hub_challenge);
|
||||
|
@ -93,19 +93,19 @@ function pubsub_post(App $a)
|
|||
$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
|
||||
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 );
|
||||
|
||||
$importer = dba::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
|
||||
$importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
|
||||
if (!DBM::is_result($importer)) {
|
||||
hub_post_return();
|
||||
}
|
||||
|
||||
$condition = ['id' => $contact_id, 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
|
||||
$contact = dba::selectFirst('contact', [], $condition);
|
||||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
|
||||
if (!DBM::is_result($contact)) {
|
||||
$author = OStatus::salmonAuthor($xml, $importer);
|
||||
if (!empty($author['contact-id'])) {
|
||||
$condition = ['id' => $author['contact-id'], 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
|
||||
$contact = dba::selectFirst('contact', [], $condition);
|
||||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
logger('No record for ' . $nick .' with contact id ' . $contact_id . ' - using '.$author['contact-id'].' instead.');
|
||||
}
|
||||
if (!DBM::is_result($contact)) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\PushSubscriber;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -64,7 +64,7 @@ function pubsubhubbub_init(App $a) {
|
|||
|
||||
// fetch user from database given the nickname
|
||||
$condition = ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false];
|
||||
$owner = dba::selectFirst('user', ['uid', 'hidewall'], $condition);
|
||||
$owner = DBA::selectFirst('user', ['uid', 'hidewall'], $condition);
|
||||
if (!DBM::is_result($owner)) {
|
||||
logger('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
|
||||
System::httpExit(404);
|
||||
|
@ -79,7 +79,7 @@ function pubsubhubbub_init(App $a) {
|
|||
// get corresponding row from contact table
|
||||
$condition = ['uid' => $owner['uid'], 'blocked' => false,
|
||||
'pending' => false, 'self' => true];
|
||||
$contact = dba::selectFirst('contact', ['poll'], $condition);
|
||||
$contact = DBA::selectFirst('contact', ['poll'], $condition);
|
||||
if (!DBM::is_result($contact)) {
|
||||
logger('Self contact for user ' . $owner['uid'] . ' not found.');
|
||||
System::httpExit(404);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
|
||||
|
@ -34,7 +34,7 @@ function receive_post(App $a)
|
|||
}
|
||||
$guid = $a->argv[2];
|
||||
|
||||
$importer = dba::selectFirst('user', [], ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]);
|
||||
$importer = DBA::selectFirst('user', [], ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]);
|
||||
if (!DBM::is_result($importer)) {
|
||||
System::httpExit(500);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use Friendica\App;
|
||||
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\Profile;
|
||||
|
@ -24,7 +24,7 @@ function redir_init(App $a) {
|
|||
|
||||
if (!empty($cid)) {
|
||||
$fields = ['id', 'uid', 'nurl', 'url', 'addr', 'name', 'network', 'poll', 'issued-id', 'dfrn-id', 'duplex'];
|
||||
$contact = dba::selectFirst('contact', $fields, ['id' => $cid, 'uid' => [0, local_user()]]);
|
||||
$contact = DBA::selectFirst('contact', $fields, ['id' => $cid, 'uid' => [0, local_user()]]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
notice(L10n::t('Contact not found.'));
|
||||
goaway(System::baseUrl());
|
||||
|
@ -42,7 +42,7 @@ function redir_init(App $a) {
|
|||
if ($contact['uid'] == 0 && local_user()) {
|
||||
// Let's have a look if there is an established connection
|
||||
// between the puplic contact we have found and the local user.
|
||||
$contact = dba::selectFirst('contact', $fields, ['nurl' => $contact['nurl'], 'uid' => local_user()]);
|
||||
$contact = DBA::selectFirst('contact', $fields, ['nurl' => $contact['nurl'], 'uid' => local_user()]);
|
||||
|
||||
if (DBM::is_result($contact)) {
|
||||
$cid = $contact['id'];
|
||||
|
@ -96,7 +96,7 @@ function redir_init(App $a) {
|
|||
|
||||
$fields = ['uid' => local_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id,
|
||||
'sec' => $sec, 'expire' => time() + 45];
|
||||
dba::insert('profile_check', $fields);
|
||||
DBA::insert('profile_check', $fields);
|
||||
|
||||
logger('mod_redir: ' . $contact['name'] . ' ' . $sec, LOGGER_DEBUG);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\Core\Config;
|
|||
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\Model\User;
|
||||
use Friendica\Module\Login;
|
||||
|
@ -89,8 +89,8 @@ function user_deny($hash)
|
|||
intval($register[0]['uid'])
|
||||
);
|
||||
|
||||
dba::delete('user', ['uid' => $register[0]['uid']]);
|
||||
dba::delete('register', ['hash' => $register[0]['hash']]);
|
||||
DBA::delete('user', ['uid' => $register[0]['uid']]);
|
||||
DBA::delete('register', ['hash' => $register[0]['hash']]);
|
||||
|
||||
notice(L10n::t('Registration revoked for %s', $user[0]['username']) . EOL);
|
||||
return true;
|
||||
|
|
|
@ -7,7 +7,7 @@ use Friendica\App;
|
|||
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\User;
|
||||
|
||||
|
@ -39,7 +39,7 @@ function removeme_post(App $a)
|
|||
// send email to admins
|
||||
$admin_mails = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
|
||||
foreach ($admin_mails as $mail) {
|
||||
$admin = dba::selectFirst('user', ['uid', 'language', 'email'], ['email' => $mail]);
|
||||
$admin = DBA::selectFirst('user', ['uid', 'language', 'email'], ['email' => $mail]);
|
||||
if (!DBM::is_result($admin)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -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\Model\Item;
|
||||
|
||||
|
@ -69,11 +69,11 @@ function search_init(App $a) {
|
|||
dbesc($search)
|
||||
);
|
||||
if (!DBM::is_result($r)) {
|
||||
dba::insert('search', ['uid' => local_user(), 'term' => $search]);
|
||||
DBA::insert('search', ['uid' => local_user(), 'term' => $search]);
|
||||
}
|
||||
}
|
||||
if (x($_GET,'remove') && $search) {
|
||||
dba::delete('search', ['uid' => local_user(), 'term' => $search]);
|
||||
DBA::delete('search', ['uid' => local_user(), 'term' => $search]);
|
||||
}
|
||||
|
||||
/// @todo Check if there is a case at all that "aside" is prefilled here
|
||||
|
@ -210,13 +210,13 @@ function search_content(App $a) {
|
|||
local_user(), TERM_OBJ_POST, TERM_HASHTAG, $search];
|
||||
$params = ['order' => ['created' => true],
|
||||
'limit' => [$a->pager['start'], $a->pager['itemspage']]];
|
||||
$terms = dba::select('term', ['oid'], $condition, $params);
|
||||
$terms = DBA::select('term', ['oid'], $condition, $params);
|
||||
|
||||
$itemids = [];
|
||||
while ($term = dba::fetch($terms)) {
|
||||
while ($term = DBA::fetch($terms)) {
|
||||
$itemids[] = $term['oid'];
|
||||
}
|
||||
dba::close($terms);
|
||||
DBA::close($terms);
|
||||
|
||||
if (!empty($itemids)) {
|
||||
$params = ['order' => ['id' => true]];
|
||||
|
|
|
@ -14,7 +14,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
|
@ -150,7 +150,7 @@ function settings_post(App $a)
|
|||
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
|
||||
|
||||
$key = $_POST['remove'];
|
||||
dba::delete('tokens', ['id' => $key, 'uid' => local_user()]);
|
||||
DBA::delete('tokens', ['id' => $key, 'uid' => local_user()]);
|
||||
goaway(System::baseUrl(true)."/settings/oauth/");
|
||||
return;
|
||||
}
|
||||
|
@ -241,12 +241,12 @@ function settings_post(App $a)
|
|||
intval(local_user())
|
||||
);
|
||||
if (!DBM::is_result($r)) {
|
||||
dba::insert('mailacct', ['uid' => local_user()]);
|
||||
DBA::insert('mailacct', ['uid' => local_user()]);
|
||||
}
|
||||
if (strlen($mail_pass)) {
|
||||
$pass = '';
|
||||
openssl_public_encrypt($mail_pass, $pass, $a->user['pubkey']);
|
||||
dba::update('mailacct', ['pass' => bin2hex($pass)], ['uid' => local_user()]);
|
||||
DBA::update('mailacct', ['pass' => bin2hex($pass)], ['uid' => local_user()]);
|
||||
}
|
||||
$r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s',
|
||||
`action` = %d, `movetofolder` = '%s',
|
||||
|
@ -706,7 +706,7 @@ function settings_content(App $a)
|
|||
if (($a->argc > 3) && ($a->argv[2] === 'delete')) {
|
||||
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't');
|
||||
|
||||
dba::delete('clients', ['client_id' => $a->argv[3], 'uid' => local_user()]);
|
||||
DBA::delete('clients', ['client_id' => $a->argv[3], 'uid' => local_user()]);
|
||||
goaway(System::baseUrl(true)."/settings/oauth/");
|
||||
return;
|
||||
}
|
||||
|
@ -989,7 +989,7 @@ function settings_content(App $a)
|
|||
* ACCOUNT SETTINGS
|
||||
*/
|
||||
|
||||
$profile = dba::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]);
|
||||
$profile = DBA::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]);
|
||||
if (!DBM::is_result($profile)) {
|
||||
notice(L10n::t('Unable to find your profile. Please contact your admin.') . EOL);
|
||||
return;
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\Content\ContactSelector;
|
|||
use Friendica\Content\Widget;
|
||||
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\GContact;
|
||||
|
@ -46,7 +46,7 @@ function suggest_init(App $a) {
|
|||
}
|
||||
// Now check how the user responded to the confirmation query
|
||||
if (!$_REQUEST['canceled']) {
|
||||
dba::insert('gcign', ['uid' => local_user(), 'gcid' => $_GET['ignore']]);
|
||||
DBA::insert('gcign', ['uid' => local_user(), 'gcid' => $_GET['ignore']]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
use Friendica\App;
|
||||
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\Profile;
|
||||
|
@ -30,7 +30,7 @@ function unfollow_post(App $a)
|
|||
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
||||
$uid, CONTACT_IS_FRIEND, normalise_link($url),
|
||||
normalise_link($url), $url, NETWORK_STATUSNET];
|
||||
$contact = dba::selectFirst('contact', [], $condition);
|
||||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
|
||||
if (!DBM::is_result($contact)) {
|
||||
notice(L10n::t("Contact wasn't found or can't be unfollowed."));
|
||||
|
@ -44,7 +44,7 @@ function unfollow_post(App $a)
|
|||
Contact::terminateFriendship($r[0], $contact);
|
||||
}
|
||||
}
|
||||
dba::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
|
||||
|
||||
info(L10n::t('Contact unfollowed').EOL);
|
||||
goaway(System::baseUrl().'/contacts/'.$contact['id']);
|
||||
|
@ -69,7 +69,7 @@ function unfollow_content(App $a)
|
|||
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
||||
local_user(), CONTACT_IS_FRIEND, normalise_link($url),
|
||||
normalise_link($url), $url, NETWORK_STATUSNET];
|
||||
$contact = dba::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
|
||||
$contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
|
||||
|
||||
if (!DBM::is_result($contact)) {
|
||||
notice(L10n::t("You aren't a friend of this contact.").EOL);
|
||||
|
|
|
@ -7,7 +7,7 @@ use Friendica\App;
|
|||
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\Mimetype;
|
||||
|
@ -130,7 +130,7 @@ function wall_attach_post(App $a) {
|
|||
'filesize' => $filesize, 'data' => $filedata, 'created' => $created, 'edited' => $created,
|
||||
'allow_cid' => '<' . $page_owner_cid . '>', 'allow_gid' => '','deny_cid' => '', 'deny_gid' => ''];
|
||||
|
||||
$r = dba::insert('attach', $fields);
|
||||
$r = DBA::insert('attach', $fields);
|
||||
|
||||
@unlink($src);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
function worker_init()
|
||||
|
@ -44,7 +44,7 @@ function worker_init()
|
|||
|
||||
$fields = ['executed' => DateTimeFormat::utcNow(), 'pid' => getmypid(), 'done' => false];
|
||||
$condition = ['id' => $r[0]["id"], 'pid' => 0];
|
||||
if (dba::update('workerqueue', $fields, $condition)) {
|
||||
if (DBA::update('workerqueue', $fields, $condition)) {
|
||||
Worker::execute($r[0]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Protocol\Salmon;
|
||||
|
||||
|
@ -39,7 +39,7 @@ function xrd_init(App $a)
|
|||
$name = substr($local, 0, strpos($local, '@'));
|
||||
}
|
||||
|
||||
$user = dba::selectFirst('user', [], ['nickname' => $name]);
|
||||
$user = DBA::selectFirst('user', [], ['nickname' => $name]);
|
||||
if (!DBM::is_result($user)) {
|
||||
killme();
|
||||
}
|
||||
|
|
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) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue