Rename DBA::is_result to DBA::isResult

This commit is contained in:
Hypolite Petovan 2018-07-21 08:46:04 -04:00 committed by Hypolite Petovan
parent 0ec44f3e8a
commit ecea7425f8
152 changed files with 765 additions and 765 deletions

View file

@ -194,7 +194,7 @@ class Cron
dbesc(NETWORK_MAIL)
);
if (!DBA::is_result($contacts)) {
if (!DBA::isResult($contacts)) {
return;
}

View file

@ -92,7 +92,7 @@ class CronJobs
private static function updatePhotoAlbums()
{
$r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND NOT `account_removed`");
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return;
}
@ -230,7 +230,7 @@ class CronJobs
$r = q("SELECT `id`, `url` FROM `contact`
WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA));
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return;
}
@ -265,7 +265,7 @@ class CronJobs
// Sometimes there seem to be issues where the "self" contact vanishes.
// We haven't found the origin of the problem by now.
$r = q("SELECT `uid` FROM `user` WHERE NOT EXISTS (SELECT `uid` FROM `contact` WHERE `contact`.`uid` = `user`.`uid` AND `contact`.`self`)");
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r AS $user) {
logger('Create missing self contact for user ' . $user['uid']);
Contact::createSelfFromUserId($user['uid']);
@ -281,7 +281,7 @@ class CronJobs
// Update the global contacts for local users
$r = q("SELECT `uid` FROM `user` WHERE `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired`");
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r AS $user) {
GContact::updateForUser($user["uid"]);
}

View file

@ -39,14 +39,14 @@ class Delivery extends BaseObject
if ($cmd == self::MAIL) {
$target_item = DBA::selectFirst('mail', [], ['id' => $item_id]);
if (!DBA::is_result($target_item)) {
if (!DBA::isResult($target_item)) {
return;
}
$uid = $target_item['uid'];
$items = [];
} elseif ($cmd == self::SUGGESTION) {
$target_item = DBA::selectFirst('fsuggest', [], ['id' => $item_id]);
if (!DBA::is_result($target_item)) {
if (!DBA::isResult($target_item)) {
return;
}
$uid = $target_item['uid'];
@ -54,7 +54,7 @@ class Delivery extends BaseObject
$uid = $item_id;
} else {
$item = Item::selectFirst(['parent'], ['id' => $item_id]);
if (!DBA::is_result($item) || empty($item['parent'])) {
if (!DBA::isResult($item) || empty($item['parent'])) {
return;
}
$parent_id = intval($item['parent']);
@ -132,7 +132,7 @@ class Delivery extends BaseObject
}
$owner = User::getOwnerDataById($uid);
if (!DBA::is_result($owner)) {
if (!DBA::isResult($owner)) {
return;
}
@ -140,7 +140,7 @@ class Delivery extends BaseObject
$contact = DBA::selectFirst('contact', [],
['id' => $contact_id, 'blocked' => false, 'pending' => false, 'self' => false]
);
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
return;
}
@ -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);
if (!DBA::is_result($target_self)) {
if (!DBA::isResult($target_self)) {
return;
}
$target_uid = $target_self['uid'];
@ -259,7 +259,7 @@ class Delivery extends BaseObject
$cid);
// This should never fail
if (!DBA::is_result($target_importer)) {
if (!DBA::isResult($target_importer)) {
return;
}
@ -404,7 +404,7 @@ class Delivery extends BaseObject
}
$local_user = DBA::selectFirst('user', [], ['uid' => $owner['uid']]);
if (!DBA::is_result($local_user)) {
if (!DBA::isResult($local_user)) {
return;
}
@ -412,7 +412,7 @@ class Delivery extends BaseObject
$reply_to = '';
$mailacct = DBA::selectFirst('mailacct', ['reply_to'], ['uid' => $owner['uid']]);
if (DBA::is_result($mailacct) && !empty($mailacct['reply_to'])) {
if (DBA::isResult($mailacct) && !empty($mailacct['reply_to'])) {
$reply_to = $mailacct['reply_to'];
}
@ -445,12 +445,12 @@ class Delivery extends BaseObject
if (empty($target_item['title'])) {
$condition = ['uri' => $target_item['parent-uri'], 'uid' => $owner['uid']];
$title = Item::selectFirst(['title'], $condition);
if (DBA::is_result($title) && ($title['title'] != '')) {
if (DBA::isResult($title) && ($title['title'] != '')) {
$subject = $title['title'];
} else {
$condition = ['parent-uri' => $target_item['parent-uri'], 'uid' => $owner['uid']];
$title = Item::selectFirst(['title'], $condition);
if (DBA::is_result($title) && ($title['title'] != '')) {
if (DBA::isResult($title) && ($title['title'] != '')) {
$subject = $title['title'];
}
}

View file

@ -48,7 +48,7 @@ class Directory
WHERE `contact`.`self` AND `profile`.`net-publish` AND `profile`.`is-default` AND
NOT `user`.`account_expired` AND `user`.`verified`");
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r AS $user) {
Worker::add(PRIORITY_LOW, 'Directory', $user['url']);
}

View file

@ -118,7 +118,7 @@ class DiscoverPoCo
private static function updateServer() {
$r = q("SELECT `url`, `created`, `last_failure`, `last_contact` FROM `gserver` ORDER BY rand()");
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return;
}
@ -224,7 +224,7 @@ class DiscoverPoCo
foreach ($j->results as $jj) {
// Check if the contact already exists
$exists = q("SELECT `id`, `last_contact`, `last_failure`, `updated` FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($jj->url));
if (DBA::is_result($exists)) {
if (DBA::isResult($exists)) {
logger("Profile ".$jj->url." already exists (".$search.")", LOGGER_DEBUG);
if (($exists[0]["last_contact"] < $exists[0]["last_failure"]) &&

View file

@ -67,7 +67,7 @@ class Expire
return;
} elseif (intval($param) > 0) {
$user = DBA::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
if (DBA::is_result($user)) {
if (DBA::isResult($user)) {
logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG);
Item::expire($user['uid'], $user['expire']);
logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - done ', LOGGER_DEBUG);

View file

@ -25,7 +25,7 @@ class GProbe {
logger("gprobe start for ".normalise_link($url), LOGGER_DEBUG);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
// Is it a DDoS attempt?
$urlparts = parse_url($url);
@ -52,7 +52,7 @@ class GProbe {
dbesc(normalise_link($url))
);
}
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
// Check for accessibility and do a poco discovery
if (PortableContact::lastUpdated($r[0]['url'], true) && ($r[0]["network"] == NETWORK_DFRN)) {
PortableContact::loadWorker(0, 0, $r[0]['id'], str_replace('/profile/', '/poco/', $r[0]['url']));

View file

@ -65,7 +65,7 @@ class Notifier
if ($cmd == Delivery::MAIL) {
$normal_mode = false;
$message = DBA::selectFirst('mail', ['uid', 'contact-id'], ['id' => $item_id]);
if (!DBA::is_result($message)) {
if (!DBA::isResult($message)) {
return;
}
$uid = $message['uid'];
@ -73,7 +73,7 @@ class Notifier
} elseif ($cmd == Delivery::SUGGESTION) {
$normal_mode = false;
$suggest = DBA::selectFirst('fsuggest', ['uid', 'cid'], ['id' => $item_id]);
if (!DBA::is_result($suggest)) {
if (!DBA::isResult($suggest)) {
return;
}
$uid = $suggest['uid'];
@ -109,7 +109,7 @@ class Notifier
$condition = ['id' => $item_id, 'visible' => true, 'moderated' => false];
$target_item = Item::selectFirst([], $condition);
if (!DBA::is_result($target_item) || !intval($target_item['parent'])) {
if (!DBA::isResult($target_item) || !intval($target_item['parent'])) {
return;
}
@ -121,7 +121,7 @@ class Notifier
$params = ['order' => ['id']];
$ret = Item::select([], $condition, $params);
if (!DBA::is_result($ret)) {
if (!DBA::isResult($ret)) {
return;
}
@ -223,7 +223,7 @@ class Notifier
$fields = ['forum', 'prv'];
$condition = ['id' => $target_item['contact-id']];
$contact = DBA::selectFirst('contact', $fields, $condition);
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
// Should never happen
return false;
}
@ -260,7 +260,7 @@ class Notifier
intval($uid),
dbesc(NETWORK_DFRN)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r as $rr) {
$recipients_followup[] = $rr['id'];
}
@ -343,14 +343,14 @@ class Notifier
// Send a salmon to the parent author
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
if (DBA::is_result($probed_contact) && !empty($probed_contact["notify"])) {
if (DBA::isResult($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']]);
if (DBA::is_result($probed_contact) && !empty($probed_contact["notify"])) {
if (DBA::isResult($probed_contact) && !empty($probed_contact["notify"])) {
logger('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]);
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
}
@ -387,7 +387,7 @@ class Notifier
intval($uid),
dbesc(NETWORK_MAIL)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r as $rr) {
$recipients[] = $rr['id'];
}
@ -411,7 +411,7 @@ class Notifier
}
// delivery loop
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r as $contact) {
logger("Deliver ".$item_id." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG);
@ -461,7 +461,7 @@ class Notifier
$r = array_merge($r2, $r1);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG);
foreach ($r as $rr) {

View file

@ -47,7 +47,7 @@ class OnePoll
$d = DateTimeFormat::utcNow();
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
logger('Contact not found or cannot be used.');
return;
}
@ -60,7 +60,7 @@ class OnePoll
WHERE `cid` = %d AND updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
intval($contact['id'])
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
if (!$r[0]['total']) {
PortableContact::loadWorker($contact['id'], $importer_uid, 0, $contact['poco']);
}
@ -145,7 +145,7 @@ class OnePoll
intval($importer_uid)
);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
logger('No self contact for user '.$importer_uid);
// set the last-update so we don't keep polling
@ -348,7 +348,7 @@ class OnePoll
$condition = ["`server` != '' AND `uid` = ?", $importer_uid];
$mailconf = DBA::selectFirst('mailacct', [], $condition);
if (DBA::is_result($user) && DBA::is_result($mailconf)) {
if (DBA::isResult($user) && DBA::isResult($mailconf)) {
$mailbox = Email::constructMailboxName($mailconf);
$password = '';
openssl_private_decrypt(hex2bin($mailconf['pass']), $password, $user['prvkey']);
@ -391,7 +391,7 @@ class OnePoll
$fields = ['deleted', 'id'];
$condition = ['uid' => $importer_uid, 'uri' => $datarray['uri']];
$item = Item::selectFirst($fields, $condition);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
logger("Mail: Seen before ".$msg_uid." for ".$mailconf['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
// Only delete when mails aren't automatically moved or deleted
@ -441,7 +441,7 @@ class OnePoll
}
$condition = ['uri' => $refs_arr, 'uid' => $importer_uid];
$parent = Item::selectFirst(['parent-uri'], $condition);
if (DBA::is_result($parent)) {
if (DBA::isResult($parent)) {
$datarray['parent-uri'] = $parent['parent-uri']; // Set the parent as the top-level item
}
}
@ -474,7 +474,7 @@ class OnePoll
$condition = ['title' => $datarray['title'], 'uid' => importer_uid, 'network' => NETWORK_MAIL];
$params = ['order' => ['created' => true]];
$parent = Item::selectFirst(['parent-uri'], $condition, $params);
if (DBA::is_result($parent)) {
if (DBA::isResult($parent)) {
$datarray['parent-uri'] = $parent['parent-uri'];
}
}

View file

@ -30,7 +30,7 @@ class PubSubPublish
$a = BaseObject::getApp();
$subscriber = DBA::selectFirst('push_subscriber', [], ['id' => $id]);
if (!DBA::is_result($subscriber)) {
if (!DBA::isResult($subscriber)) {
return;
}

View file

@ -39,7 +39,7 @@ class Queue
Addon::callHooks('queue_predeliver', $r);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r as $q_item) {
logger('Call queue for id ' . $q_item['id']);
Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], "Queue", (int) $q_item['id']);
@ -52,12 +52,12 @@ class Queue
// delivering
$q_item = DBA::selectFirst('queue', [], ['id' => $queue_id]);
if (!DBA::is_result($q_item)) {
if (!DBA::isResult($q_item)) {
return;
}
$contact = DBA::selectFirst('contact', [], ['id' => $q_item['cid']]);
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
QueueModel::removeItem($q_item['id']);
return;
}
@ -97,7 +97,7 @@ class Queue
}
$user = DBA::selectFirst('user', [], ['uid' => $contact['uid']]);
if (!DBA::is_result($user)) {
if (!DBA::isResult($user)) {
QueueModel::removeItem($q_item['id']);
return;
}

View file

@ -24,7 +24,7 @@ class UpdateGContact
$r = q("SELECT * FROM `gcontact` WHERE `id` = %d", intval($contact_id));
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return;
}