mirror of
https://github.com/friendica/friendica
synced 2025-05-10 21:44:09 +02:00
Rename Friendica\Database\dba to Friendica\Database\DBA
This commit is contained in:
parent
b6a1df0598
commit
af6dbc654f
127 changed files with 1169 additions and 1169 deletions
|
@ -8,7 +8,7 @@ use Friendica\BaseObject;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
|
@ -102,11 +102,11 @@ class Cron
|
|||
if (Config::get('system', 'last_cron_hourly', 0) + 3600 < time()) {
|
||||
|
||||
// Delete all done workerqueue entries
|
||||
dba::delete('workerqueue', ['`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 1 HOUR']);
|
||||
DBA::delete('workerqueue', ['`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 1 HOUR']);
|
||||
|
||||
// Optimizing this table only last seconds
|
||||
if (Config::get('system', 'optimize_workerqueue', false)) {
|
||||
dba::e("OPTIMIZE TABLE `workerqueue`");
|
||||
DBA::e("OPTIMIZE TABLE `workerqueue`");
|
||||
}
|
||||
|
||||
Config::set('system', 'last_cron_hourly', time());
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\App;
|
|||
use Friendica\BaseObject;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Database\PostUpdate;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -109,18 +109,18 @@ class CronJobs
|
|||
{
|
||||
// expire any expired regular accounts. Don't expire forums.
|
||||
$condition = ["NOT `account_expired` AND `account_expires_on` > ? AND `account_expires_on` < UTC_TIMESTAMP() AND `page-flags` = 0", NULL_DATE];
|
||||
dba::update('user', ['account_expired' => true], $condition);
|
||||
DBA::update('user', ['account_expired' => true], $condition);
|
||||
|
||||
// Remove any freshly expired account
|
||||
$users = dba::select('user', ['uid'], ['account_expired' => true, 'account_removed' => false]);
|
||||
while ($user = dba::fetch($users)) {
|
||||
$users = DBA::select('user', ['uid'], ['account_expired' => true, 'account_removed' => false]);
|
||||
while ($user = DBA::fetch($users)) {
|
||||
User::remove($user['uid']);
|
||||
}
|
||||
|
||||
// delete user records for recently removed accounts
|
||||
$users = dba::select('user', ['uid'], ["`account_removed` AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY"]);
|
||||
while ($user = dba::fetch($users)) {
|
||||
dba::delete('user', ['uid' => $user['uid']]);
|
||||
$users = DBA::select('user', ['uid'], ["`account_removed` AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY"]);
|
||||
while ($user = DBA::fetch($users)) {
|
||||
DBA::delete('user', ['uid' => $user['uid']]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,14 +165,14 @@ class CronJobs
|
|||
$cachetime = PROXY_DEFAULT_TIME;
|
||||
}
|
||||
$condition = ['`uid` = 0 AND `resource-id` LIKE "pic:%" AND `created` < NOW() - INTERVAL ? SECOND', $cachetime];
|
||||
dba::delete('photo', $condition);
|
||||
DBA::delete('photo', $condition);
|
||||
}
|
||||
|
||||
// Delete the cached OEmbed entries that are older than three month
|
||||
dba::delete('oembed', ["`created` < NOW() - INTERVAL 3 MONTH"]);
|
||||
DBA::delete('oembed', ["`created` < NOW() - INTERVAL 3 MONTH"]);
|
||||
|
||||
// Delete the cached "parse_url" entries that are older than three month
|
||||
dba::delete('parsed_url', ["`created` < NOW() - INTERVAL 3 MONTH"]);
|
||||
DBA::delete('parsed_url', ["`created` < NOW() - INTERVAL 3 MONTH"]);
|
||||
|
||||
// Maximum table size in megabyte
|
||||
$max_tablesize = intval(Config::get('system', 'optimize_max_tablesize')) * 1000000;
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Friendica\Worker;
|
|||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
|
@ -81,22 +81,22 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-1', 0);
|
||||
|
||||
logger("Deleting old global item entries from item table without user copy. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||
$r = DBA::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
||||
`received` < UTC_TIMESTAMP() - INTERVAL ? DAY AND `id` >= ?
|
||||
ORDER BY `id` LIMIT ".intval($limit), $days_unclaimed, $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found global item orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('item', ['id' => $orphan["id"]]);
|
||||
DBA::delete('item', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 1, $last_id);
|
||||
} else {
|
||||
logger("No global item orphans found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." old global item entries from item table without user copy. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-1', $last_id);
|
||||
|
@ -104,21 +104,21 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-2', 0);
|
||||
|
||||
logger("Deleting items without parents. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `id` FROM `item`
|
||||
$r = DBA::p("SELECT `id` FROM `item`
|
||||
WHERE NOT EXISTS (SELECT `id` FROM `item` AS `i` WHERE `item`.`parent` = `i`.`id`)
|
||||
AND `id` >= ? ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found item orphans without parents: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('item', ['id' => $orphan["id"]]);
|
||||
DBA::delete('item', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 2, $last_id);
|
||||
} else {
|
||||
logger("No item orphans without parents found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." items without parents. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-2', $last_id);
|
||||
|
@ -130,21 +130,21 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-3', 0);
|
||||
|
||||
logger("Deleting orphaned data from thread table. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `iid` FROM `thread`
|
||||
$r = DBA::p("SELECT `iid` FROM `thread`
|
||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `thread`.`iid`) AND `iid` >= ?
|
||||
ORDER BY `iid` LIMIT ".intval($limit), $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found thread orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["iid"];
|
||||
dba::delete('thread', ['iid' => $orphan["iid"]]);
|
||||
DBA::delete('thread', ['iid' => $orphan["iid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 3, $last_id);
|
||||
} else {
|
||||
logger("No thread orphans found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." orphaned data from thread table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-3', $last_id);
|
||||
|
@ -156,21 +156,21 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-4', 0);
|
||||
|
||||
logger("Deleting orphaned data from notify table. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `iid`, `id` FROM `notify`
|
||||
$r = DBA::p("SELECT `iid`, `id` FROM `notify`
|
||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `notify`.`iid`) AND `id` >= ?
|
||||
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found notify orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('notify', ['iid' => $orphan["iid"]]);
|
||||
DBA::delete('notify', ['iid' => $orphan["iid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 4, $last_id);
|
||||
} else {
|
||||
logger("No notify orphans found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." orphaned data from notify table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-4', $last_id);
|
||||
|
@ -182,21 +182,21 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-5', 0);
|
||||
|
||||
logger("Deleting orphaned data from notify-threads table. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `id` FROM `notify-threads`
|
||||
$r = DBA::p("SELECT `id` FROM `notify-threads`
|
||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `notify-threads`.`master-parent-item`) AND `id` >= ?
|
||||
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found notify-threads orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('notify-threads', ['id' => $orphan["id"]]);
|
||||
DBA::delete('notify-threads', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 5, $last_id);
|
||||
} else {
|
||||
logger("No notify-threads orphans found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." orphaned data from notify-threads table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-5', $last_id);
|
||||
|
@ -208,21 +208,21 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-6', 0);
|
||||
|
||||
logger("Deleting orphaned data from sign table. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `iid`, `id` FROM `sign`
|
||||
$r = DBA::p("SELECT `iid`, `id` FROM `sign`
|
||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `sign`.`iid`) AND `id` >= ?
|
||||
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found sign orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('sign', ['iid' => $orphan["iid"]]);
|
||||
DBA::delete('sign', ['iid' => $orphan["iid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 6, $last_id);
|
||||
} else {
|
||||
logger("No sign orphans found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." orphaned data from sign table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-6', $last_id);
|
||||
|
@ -234,21 +234,21 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-7', 0);
|
||||
|
||||
logger("Deleting orphaned data from term table. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `oid`, `tid` FROM `term`
|
||||
$r = DBA::p("SELECT `oid`, `tid` FROM `term`
|
||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `term`.`oid`) AND `tid` >= ?
|
||||
ORDER BY `tid` LIMIT ".intval($limit), $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found term orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["tid"];
|
||||
dba::delete('term', ['oid' => $orphan["oid"]]);
|
||||
DBA::delete('term', ['oid' => $orphan["oid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 7, $last_id);
|
||||
} else {
|
||||
logger("No term orphans found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." orphaned data from term table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-7', $last_id);
|
||||
|
@ -264,7 +264,7 @@ class DBClean {
|
|||
$last_id = Config::get('system', 'dbclean-last-id-8', 0);
|
||||
|
||||
logger("Deleting expired threads. Last ID: ".$last_id);
|
||||
$r = dba::p("SELECT `thread`.`iid` FROM `thread`
|
||||
$r = DBA::p("SELECT `thread`.`iid` FROM `thread`
|
||||
INNER JOIN `contact` ON `thread`.`contact-id` = `contact`.`id` AND NOT `notify_new_posts`
|
||||
WHERE `thread`.`received` < UTC_TIMESTAMP() - INTERVAL ? DAY
|
||||
AND NOT `thread`.`mention` AND NOT `thread`.`starred`
|
||||
|
@ -276,18 +276,18 @@ class DBClean {
|
|||
OR (`item`.`attach` != '') OR `item`.`wall` OR `item`.`origin`)
|
||||
AND `item`.`parent` = `thread`.`iid`)
|
||||
ORDER BY `thread`.`iid` LIMIT 1000", $days, $last_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found expired threads: ".$count);
|
||||
while ($thread = dba::fetch($r)) {
|
||||
while ($thread = DBA::fetch($r)) {
|
||||
$last_id = $thread["iid"];
|
||||
dba::delete('thread', ['iid' => $thread["iid"]]);
|
||||
DBA::delete('thread', ['iid' => $thread["iid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 8, $last_id);
|
||||
} else {
|
||||
logger("No expired threads found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." expired threads. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-8', $last_id);
|
||||
|
@ -300,22 +300,22 @@ class DBClean {
|
|||
$till_id = Config::get('system', 'dbclean-last-id-8', 0);
|
||||
|
||||
logger("Deleting old global item entries from expired threads from ID ".$last_id." to ID ".$till_id);
|
||||
$r = dba::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||
$r = DBA::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
||||
`received` < UTC_TIMESTAMP() - INTERVAL 90 DAY AND `id` >= ? AND `id` <= ?
|
||||
ORDER BY `id` LIMIT ".intval($limit), $last_id, $till_id);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found global item entries from expired threads: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('item', ['id' => $orphan["id"]]);
|
||||
DBA::delete('item', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 9, $last_id);
|
||||
} else {
|
||||
logger("No global item entries from expired threads");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." old global item entries from expired threads. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-9', $last_id);
|
||||
|
@ -324,21 +324,21 @@ class DBClean {
|
|||
$days = intval(Config::get('system', 'dbclean_expire_conversation', 90));
|
||||
|
||||
logger("Deleting old conversations. Last created: ".$last_id);
|
||||
$r = dba::p("SELECT `received`, `item-uri` FROM `conversation`
|
||||
$r = DBA::p("SELECT `received`, `item-uri` FROM `conversation`
|
||||
WHERE `received` < UTC_TIMESTAMP() - INTERVAL ? DAY
|
||||
ORDER BY `received` LIMIT ".intval($limit), $days);
|
||||
$count = dba::num_rows($r);
|
||||
$count = DBA::num_rows($r);
|
||||
if ($count > 0) {
|
||||
logger("found old conversations: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["received"];
|
||||
dba::delete('conversation', ['item-uri' => $orphan["item-uri"]]);
|
||||
DBA::delete('conversation', ['item-uri' => $orphan["item-uri"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 10, $last_id);
|
||||
} else {
|
||||
logger("No old conversations found");
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
logger("Done deleting ".$count." conversations. Last created: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-10', $last_id);
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\BaseObject;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -39,14 +39,14 @@ class Delivery extends BaseObject
|
|||
$public_message = false;
|
||||
|
||||
if ($cmd == self::MAIL) {
|
||||
$target_item = dba::selectFirst('mail', [], ['id' => $item_id]);
|
||||
$target_item = DBA::selectFirst('mail', [], ['id' => $item_id]);
|
||||
if (!DBM::is_result($target_item)) {
|
||||
return;
|
||||
}
|
||||
$uid = $target_item['uid'];
|
||||
$items = [];
|
||||
} elseif ($cmd == self::SUGGESTION) {
|
||||
$target_item = dba::selectFirst('fsuggest', [], ['id' => $item_id]);
|
||||
$target_item = DBA::selectFirst('fsuggest', [], ['id' => $item_id]);
|
||||
if (!DBM::is_result($target_item)) {
|
||||
return;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ class Delivery extends BaseObject
|
|||
}
|
||||
$items[] = $item;
|
||||
}
|
||||
dba::close($itemdata);
|
||||
DBA::close($itemdata);
|
||||
|
||||
$uid = $target_item['contact-uid'];
|
||||
|
||||
|
@ -138,7 +138,7 @@ class Delivery extends BaseObject
|
|||
}
|
||||
|
||||
// We don't deliver our items to blocked or pending contacts, and not to ourselves either
|
||||
$contact = dba::selectFirst('contact', [],
|
||||
$contact = DBA::selectFirst('contact', [],
|
||||
['id' => $contact_id, 'blocked' => false, 'pending' => false, 'self' => false]
|
||||
);
|
||||
if (!DBM::is_result($contact)) {
|
||||
|
@ -210,7 +210,7 @@ class Delivery extends BaseObject
|
|||
} elseif ($cmd == self::SUGGESTION) {
|
||||
$item = $target_item;
|
||||
$atom = DFRN::fsuggest($item, $owner);
|
||||
dba::delete('fsuggest', ['id' => $item['id']]);
|
||||
DBA::delete('fsuggest', ['id' => $item['id']]);
|
||||
} elseif ($cmd == self::RELOCATION) {
|
||||
$atom = DFRN::relocate($owner, $owner['uid']);
|
||||
} elseif ($followup) {
|
||||
|
@ -237,7 +237,7 @@ class Delivery extends BaseObject
|
|||
|
||||
if (link_compare($basepath, System::baseUrl())) {
|
||||
$condition = ['nurl' => normalise_link($contact['url']), 'self' => true];
|
||||
$target_self = dba::selectFirst('contact', ['uid'], $condition);
|
||||
$target_self = DBA::selectFirst('contact', ['uid'], $condition);
|
||||
if (!DBM::is_result($target_self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ class Delivery extends BaseObject
|
|||
}
|
||||
|
||||
// We now have some contact, so we fetch it
|
||||
$target_importer = dba::fetch_first("SELECT *, `name` as `senderName`
|
||||
$target_importer = DBA::fetch_first("SELECT *, `name` as `senderName`
|
||||
FROM `contact`
|
||||
WHERE NOT `blocked` AND `id` = ? LIMIT 1",
|
||||
$cid);
|
||||
|
@ -264,7 +264,7 @@ class Delivery extends BaseObject
|
|||
return;
|
||||
}
|
||||
|
||||
$user = dba::selectFirst('user', [], ['uid' => $target_uid]);
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $target_uid]);
|
||||
|
||||
$target_importer = array_merge($target_importer, $user);
|
||||
|
||||
|
@ -404,7 +404,7 @@ class Delivery extends BaseObject
|
|||
return;
|
||||
}
|
||||
|
||||
$local_user = dba::selectFirst('user', [], ['uid' => $owner['uid']]);
|
||||
$local_user = DBA::selectFirst('user', [], ['uid' => $owner['uid']]);
|
||||
if (!DBM::is_result($local_user)) {
|
||||
return;
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ class Delivery extends BaseObject
|
|||
logger('Deliver ' . $target_item["guid"] . ' via mail to ' . $contact['addr']);
|
||||
|
||||
$reply_to = '';
|
||||
$mailacct = dba::selectFirst('mailacct', ['reply_to'], ['uid' => $owner['uid']]);
|
||||
$mailacct = DBA::selectFirst('mailacct', ['reply_to'], ['uid' => $owner['uid']]);
|
||||
if (DBM::is_result($mailacct) && !empty($mailacct['reply_to'])) {
|
||||
$reply_to = $mailacct['reply_to'];
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Friendica\Worker;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Network\Probe;
|
||||
|
@ -160,7 +160,7 @@ class DiscoverPoCo
|
|||
|
||||
$urlparts = parse_url($user["url"]);
|
||||
if (!isset($urlparts["scheme"])) {
|
||||
dba::update('gcontact', ['network' => NETWORK_PHANTOM],
|
||||
DBA::update('gcontact', ['network' => NETWORK_PHANTOM],
|
||||
['nurl' => normalise_link($user["url"])]);
|
||||
continue;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ class DiscoverPoCo
|
|||
"identi.ca" => NETWORK_PUMPIO,
|
||||
"alpha.app.net" => NETWORK_APPNET];
|
||||
|
||||
dba::update('gcontact', ['network' => $networks[$urlparts["host"]]],
|
||||
DBA::update('gcontact', ['network' => $networks[$urlparts["host"]]],
|
||||
['nurl' => normalise_link($user["url"])]);
|
||||
continue;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ class DiscoverPoCo
|
|||
return;
|
||||
}
|
||||
} else {
|
||||
dba::update('gcontact', ['last_failure' => DateTimeFormat::utcNow()],
|
||||
DBA::update('gcontact', ['last_failure' => DateTimeFormat::utcNow()],
|
||||
['nurl' => normalise_link($user["url"])]);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use Friendica\BaseObject;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Item;
|
||||
|
||||
|
@ -30,44 +30,44 @@ class Expire
|
|||
logger('Delete expired items', LOGGER_DEBUG);
|
||||
// physically remove anything that has been deleted for more than two months
|
||||
$condition = ["`deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY"];
|
||||
$rows = dba::select('item', ['id', 'iaid', 'icid', 'psid'], $condition);
|
||||
while ($row = dba::fetch($rows)) {
|
||||
dba::delete('item', ['id' => $row['id']]);
|
||||
if (!empty($row['iaid']) && !dba::exists('item', ['iaid' => $row['iaid']])) {
|
||||
dba::delete('item-activity', ['id' => $row['iaid']]);
|
||||
$rows = DBA::select('item', ['id', 'iaid', 'icid', 'psid'], $condition);
|
||||
while ($row = DBA::fetch($rows)) {
|
||||
DBA::delete('item', ['id' => $row['id']]);
|
||||
if (!empty($row['iaid']) && !DBA::exists('item', ['iaid' => $row['iaid']])) {
|
||||
DBA::delete('item-activity', ['id' => $row['iaid']]);
|
||||
}
|
||||
if (!empty($row['icid']) && !dba::exists('item', ['icid' => $row['icid']])) {
|
||||
dba::delete('item-content', ['id' => $row['icid']]);
|
||||
if (!empty($row['icid']) && !DBA::exists('item', ['icid' => $row['icid']])) {
|
||||
DBA::delete('item-content', ['id' => $row['icid']]);
|
||||
}
|
||||
// When the permission set will be used in photo and events as well.
|
||||
// this query here needs to be extended.
|
||||
if (!empty($row['psid']) && !dba::exists('item', ['psid' => $row['psid']])) {
|
||||
dba::delete('permissionset', ['id' => $row['psid']]);
|
||||
if (!empty($row['psid']) && !DBA::exists('item', ['psid' => $row['psid']])) {
|
||||
DBA::delete('permissionset', ['id' => $row['psid']]);
|
||||
}
|
||||
}
|
||||
dba::close($rows);
|
||||
DBA::close($rows);
|
||||
|
||||
// Normally we shouldn't have orphaned data at all.
|
||||
// If we do have some, then we have to check why.
|
||||
logger('Deleting orphaned item activities - start', LOGGER_DEBUG);
|
||||
$condition = ["NOT EXISTS (SELECT `iaid` FROM `item` WHERE `item`.`iaid` = `item-activity`.`id`)"];
|
||||
dba::delete('item-activity', $condition);
|
||||
logger('Orphaned item activities deleted: ' . dba::affected_rows(), LOGGER_DEBUG);
|
||||
DBA::delete('item-activity', $condition);
|
||||
logger('Orphaned item activities deleted: ' . DBA::affected_rows(), LOGGER_DEBUG);
|
||||
|
||||
logger('Deleting orphaned item content - start', LOGGER_DEBUG);
|
||||
$condition = ["NOT EXISTS (SELECT `icid` FROM `item` WHERE `item`.`icid` = `item-content`.`id`)"];
|
||||
dba::delete('item-content', $condition);
|
||||
logger('Orphaned item content deleted: ' . dba::affected_rows(), LOGGER_DEBUG);
|
||||
DBA::delete('item-content', $condition);
|
||||
logger('Orphaned item content deleted: ' . DBA::affected_rows(), LOGGER_DEBUG);
|
||||
|
||||
// make this optional as it could have a performance impact on large sites
|
||||
if (intval(Config::get('system', 'optimize_items'))) {
|
||||
dba::e("OPTIMIZE TABLE `item`");
|
||||
DBA::e("OPTIMIZE TABLE `item`");
|
||||
}
|
||||
|
||||
logger('Delete expired items - done', LOGGER_DEBUG);
|
||||
return;
|
||||
} elseif (intval($param) > 0) {
|
||||
$user = dba::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
|
||||
$user = DBA::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
|
||||
if (DBM::is_result($user)) {
|
||||
logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG);
|
||||
Item::expire($user['uid'], $user['expire']);
|
||||
|
@ -89,13 +89,13 @@ class Expire
|
|||
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
|
||||
'Expire', 'delete');
|
||||
|
||||
$r = dba::p("SELECT `uid`, `username` FROM `user` WHERE `expire` != 0");
|
||||
while ($row = dba::fetch($r)) {
|
||||
$r = DBA::p("SELECT `uid`, `username` FROM `user` WHERE `expire` != 0");
|
||||
while ($row = DBA::fetch($r)) {
|
||||
logger('Calling expiry for user '.$row['uid'].' ('.$row['username'].')', LOGGER_DEBUG);
|
||||
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
|
||||
'Expire', (int)$row['uid']);
|
||||
}
|
||||
dba::close($r);
|
||||
DBA::close($r);
|
||||
|
||||
logger('expire: calling hooks');
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\BaseObject;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
|
@ -65,7 +65,7 @@ class Notifier
|
|||
|
||||
if ($cmd == Delivery::MAIL) {
|
||||
$normal_mode = false;
|
||||
$message = dba::selectFirst('mail', ['uid', 'contact-id'], ['id' => $item_id]);
|
||||
$message = DBA::selectFirst('mail', ['uid', 'contact-id'], ['id' => $item_id]);
|
||||
if (!DBM::is_result($message)) {
|
||||
return;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class Notifier
|
|||
$recipients[] = $message['contact-id'];
|
||||
} elseif ($cmd == Delivery::SUGGESTION) {
|
||||
$normal_mode = false;
|
||||
$suggest = dba::selectFirst('fsuggest', ['uid', 'cid'], ['id' => $item_id]);
|
||||
$suggest = DBA::selectFirst('fsuggest', ['uid', 'cid'], ['id' => $item_id]);
|
||||
if (!DBM::is_result($suggest)) {
|
||||
return;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ class Notifier
|
|||
|
||||
$fields = ['forum', 'prv'];
|
||||
$condition = ['id' => $target_item['contact-id']];
|
||||
$contact = dba::selectFirst('contact', $fields, $condition);
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
if (!DBM::is_result($contact)) {
|
||||
// Should never happen
|
||||
return false;
|
||||
|
@ -343,14 +343,14 @@ class Notifier
|
|||
logger('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent['author-id']." - Owner: ".$thr_parent['owner-id'], LOGGER_DEBUG);
|
||||
|
||||
// Send a salmon to the parent author
|
||||
$probed_contact = dba::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
|
||||
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
|
||||
if (DBM::is_result($probed_contact) && !empty($probed_contact["notify"])) {
|
||||
logger('Notify parent author '.$probed_contact["url"].': '.$probed_contact["notify"]);
|
||||
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
|
||||
}
|
||||
|
||||
// Send a salmon to the parent owner
|
||||
$probed_contact = dba::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]);
|
||||
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]);
|
||||
if (DBM::is_result($probed_contact) && !empty($probed_contact["notify"])) {
|
||||
logger('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]);
|
||||
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
|
||||
|
@ -407,8 +407,8 @@ class Notifier
|
|||
if (!empty($networks)) {
|
||||
$condition['network'] = $networks;
|
||||
}
|
||||
$contacts = dba::select('contact', ['id', 'url', 'network'], $condition);
|
||||
$r = dba::inArray($contacts);
|
||||
$contacts = DBA::select('contact', ['id', 'url', 'network'], $condition);
|
||||
$r = DBA::inArray($contacts);
|
||||
}
|
||||
|
||||
// delivery loop
|
||||
|
@ -458,7 +458,7 @@ class Notifier
|
|||
|
||||
$condition = ['network' => NETWORK_DFRN, 'uid' => $owner['uid'], 'blocked' => false,
|
||||
'pending' => false, 'archive' => false, 'rel' => [CONTACT_IS_FOLLOWER, CONTACT_IS_FRIEND]];
|
||||
$r2 = dba::inArray(dba::select('contact', ['id', 'name', 'network'], $condition));
|
||||
$r2 = DBA::inArray(DBA::select('contact', ['id', 'name', 'network'], $condition));
|
||||
|
||||
$r = array_merge($r2, $r1);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\BaseObject;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -47,7 +47,7 @@ class OnePoll
|
|||
|
||||
$d = DateTimeFormat::utcNow();
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $contact_id]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
logger('Contact not found or cannot be used.');
|
||||
return;
|
||||
|
@ -118,7 +118,7 @@ class OnePoll
|
|||
logger("Skipping probably dead contact ".$contact['url']);
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ class OnePoll
|
|||
logger('Contact is marked dead');
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
return;
|
||||
} else {
|
||||
Contact::unmarkForArchival($contact);
|
||||
|
@ -138,7 +138,7 @@ class OnePoll
|
|||
logger('Ignore public contacts');
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ class OnePoll
|
|||
logger('No self contact for user '.$importer_uid);
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ class OnePoll
|
|||
|
||||
if (!intval($contact['writable'])) {
|
||||
$fields = ['writable' => true];
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
DBA::update('contact', $fields, ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
$url = $contact['poll'] . '?dfrn_id=' . $idtosend
|
||||
|
@ -187,7 +187,7 @@ class OnePoll
|
|||
|
||||
if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
}
|
||||
|
@ -243,13 +243,13 @@ class OnePoll
|
|||
|
||||
if ((intval($res->status) != 0) || !strlen($res->challenge) || !strlen($res->dfrn_id)) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (((float)$res->dfrn_version > 2.21) && ($contact['poco'] == '')) {
|
||||
$fields = ['poco' => str_replace('/profile/', '/poco/', $contact['url'])];
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
DBA::update('contact', $fields, ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
$postvars = [];
|
||||
|
@ -278,7 +278,7 @@ class OnePoll
|
|||
logger('ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id);
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
}
|
||||
|
@ -306,14 +306,14 @@ class OnePoll
|
|||
|
||||
if ($stat_writeable != $contact['writable']) {
|
||||
$fields = ['writable' => $stat_writeable];
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
DBA::update('contact', $fields, ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
// Are we allowed to import from this person?
|
||||
|
||||
if ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked']) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ class OnePoll
|
|||
|
||||
if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ class OnePoll
|
|||
$mail_disabled = ((function_exists('imap_open') && (! Config::get('system', 'imap_disabled'))) ? 0 : 1);
|
||||
if ($mail_disabled) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
}
|
||||
|
@ -345,10 +345,10 @@ class OnePoll
|
|||
logger("Mail: Enabled", LOGGER_DEBUG);
|
||||
|
||||
$mbox = null;
|
||||
$user = dba::selectFirst('user', ['prvkey'], ['uid' => $importer_uid]);
|
||||
$user = DBA::selectFirst('user', ['prvkey'], ['uid' => $importer_uid]);
|
||||
|
||||
$condition = ["`server` != '' AND `uid` = ?", $importer_uid];
|
||||
$mailconf = dba::selectFirst('mailacct', [], $condition);
|
||||
$mailconf = DBA::selectFirst('mailacct', [], $condition);
|
||||
if (DBM::is_result($user) && DBM::is_result($mailconf)) {
|
||||
$mailbox = Email::constructMailboxName($mailconf);
|
||||
$password = '';
|
||||
|
@ -358,7 +358,7 @@ class OnePoll
|
|||
logger("Mail: Connect to " . $mailconf['user']);
|
||||
if ($mbox) {
|
||||
$fields = ['last_check' => DateTimeFormat::utcNow()];
|
||||
dba::update('mailacct', $fields, ['id' => $mailconf['id']]);
|
||||
DBA::update('mailacct', $fields, ['id' => $mailconf['id']]);
|
||||
logger("Mail: Connected to " . $mailconf['user']);
|
||||
} else {
|
||||
logger("Mail: Connection error ".$mailconf['user']." ".print_r(imap_errors(), true));
|
||||
|
@ -620,17 +620,17 @@ class OnePoll
|
|||
$updated = DateTimeFormat::utcNow();
|
||||
|
||||
self::updateContact($contact, ['last-update' => $updated, 'success_update' => $updated]);
|
||||
dba::update('gcontact', ['last_contact' => $updated], ['nurl' => $contact['nurl']]);
|
||||
DBA::update('gcontact', ['last_contact' => $updated], ['nurl' => $contact['nurl']]);
|
||||
Contact::unmarkForArchival($contact);
|
||||
} elseif (in_array($contact["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_FEED])) {
|
||||
$updated = DateTimeFormat::utcNow();
|
||||
|
||||
self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]);
|
||||
dba::update('gcontact', ['last_failure' => $updated], ['nurl' => $contact['nurl']]);
|
||||
DBA::update('gcontact', ['last_failure' => $updated], ['nurl' => $contact['nurl']]);
|
||||
Contact::markForArchival($contact);
|
||||
} else {
|
||||
$updated = DateTimeFormat::utcNow();
|
||||
dba::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -653,7 +653,7 @@ class OnePoll
|
|||
*/
|
||||
private static function updateContact($contact, $fields)
|
||||
{
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
dba::update('contact', $fields, ['uid' => 0, 'nurl' => $contact['nurl']]);
|
||||
DBA::update('contact', $fields, ['id' => $contact['id']]);
|
||||
DBA::update('contact', $fields, ['uid' => 0, 'nurl' => $contact['nurl']]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Friendica\Worker;
|
|||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\PushSubscriber;
|
||||
use Friendica\Protocol\OStatus;
|
||||
|
@ -30,7 +30,7 @@ class PubSubPublish
|
|||
{
|
||||
$a = BaseObject::getApp();
|
||||
|
||||
$subscriber = dba::selectFirst('push_subscriber', [], ['id' => $id]);
|
||||
$subscriber = DBA::selectFirst('push_subscriber', [], ['id' => $id]);
|
||||
if (!DBM::is_result($subscriber)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\PushSubscriber;
|
||||
use Friendica\Model\Queue as QueueModel;
|
||||
|
@ -36,7 +36,7 @@ class Queue
|
|||
// Handling the pubsubhubbub requests
|
||||
PushSubscriber::requeue();
|
||||
|
||||
$r = dba::inArray(dba::p("SELECT `id` FROM `queue` WHERE `next` < UTC_TIMESTAMP() ORDER BY `batch`, `cid`"));
|
||||
$r = DBA::inArray(DBA::p("SELECT `id` FROM `queue` WHERE `next` < UTC_TIMESTAMP() ORDER BY `batch`, `cid`"));
|
||||
|
||||
Addon::callHooks('queue_predeliver', $r);
|
||||
|
||||
|
@ -52,12 +52,12 @@ class Queue
|
|||
|
||||
|
||||
// delivering
|
||||
$q_item = dba::selectFirst('queue', [], ['id' => $queue_id]);
|
||||
$q_item = DBA::selectFirst('queue', [], ['id' => $queue_id]);
|
||||
if (!DBM::is_result($q_item)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $q_item['cid']]);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $q_item['cid']]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
QueueModel::removeItem($q_item['id']);
|
||||
return;
|
||||
|
@ -97,7 +97,7 @@ class Queue
|
|||
}
|
||||
}
|
||||
|
||||
$user = dba::selectFirst('user', [], ['uid' => $contact['uid']]);
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $contact['uid']]);
|
||||
if (!DBM::is_result($user)) {
|
||||
QueueModel::removeItem($q_item['id']);
|
||||
return;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
|
@ -13,12 +13,12 @@ class RemoveContact {
|
|||
public static function execute($id) {
|
||||
|
||||
// Only delete if the contact doesn't exist (anymore)
|
||||
$r = dba::exists('contact', ['id' => $id]);
|
||||
$r = DBA::exists('contact', ['id' => $id]);
|
||||
if ($r) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Now we delete all the depending table entries
|
||||
dba::delete('contact', ['id' => $id]);
|
||||
DBA::delete('contact', ['id' => $id]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,38 +2,38 @@
|
|||
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
class TagUpdate
|
||||
{
|
||||
public static function execute()
|
||||
{
|
||||
$messages = dba::p("SELECT `oid`,`item`.`guid`, `item`.`created`, `item`.`received` FROM `term` INNER JOIN `item` ON `item`.`id`=`term`.`oid` WHERE `term`.`otype` = 1 AND `term`.`guid` = ''");
|
||||
$messages = DBA::p("SELECT `oid`,`item`.`guid`, `item`.`created`, `item`.`received` FROM `term` INNER JOIN `item` ON `item`.`id`=`term`.`oid` WHERE `term`.`otype` = 1 AND `term`.`guid` = ''");
|
||||
|
||||
logger('fetched messages: ' . dba::num_rows($messages));
|
||||
while ($message = dba::fetch($messages)) {
|
||||
logger('fetched messages: ' . DBA::num_rows($messages));
|
||||
while ($message = DBA::fetch($messages)) {
|
||||
if ($message['uid'] == 0) {
|
||||
$global = true;
|
||||
|
||||
dba::update('term', ['global' => true], ['otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
|
||||
DBA::update('term', ['global' => true], ['otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
|
||||
} else {
|
||||
$global = (dba::count('term', ['uid' => 0, 'otype' => TERM_OBJ_POST, 'guid' => $message['guid']]) > 0);
|
||||
$global = (DBA::count('term', ['uid' => 0, 'otype' => TERM_OBJ_POST, 'guid' => $message['guid']]) > 0);
|
||||
}
|
||||
|
||||
$fields = ['guid' => $message['guid'], 'created' => $message['created'],
|
||||
'received' => $message['received'], 'global' => $global];
|
||||
dba::update('term', $fields, ['otype' => TERM_OBJ_POST, 'oid' => $message['oid']]);
|
||||
DBA::update('term', $fields, ['otype' => TERM_OBJ_POST, 'oid' => $message['oid']]);
|
||||
}
|
||||
|
||||
dba::close($messages);
|
||||
DBA::close($messages);
|
||||
|
||||
$messages = dba::select('item', ['guid'], ['uid' => 0]);
|
||||
$messages = DBA::select('item', ['guid'], ['uid' => 0]);
|
||||
|
||||
logger('fetched messages: ' . dba::num_rows($messages));
|
||||
while ($message = dba::fetch(messages)) {
|
||||
dba::update('item', ['global' => true], ['guid' => $message['guid']]);
|
||||
logger('fetched messages: ' . DBA::num_rows($messages));
|
||||
while ($message = DBA::fetch(messages)) {
|
||||
DBA::update('item', ['global' => true], ['guid' => $message['guid']]);
|
||||
}
|
||||
|
||||
dba::close($messages);
|
||||
DBA::close($messages);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue