Rename DBM method calls to DBA method calls

This commit is contained in:
Hypolite Petovan 2018-07-21 08:40:21 -04:00 committed by Hypolite Petovan
parent 8ddb94ef06
commit 0ec44f3e8a
153 changed files with 813 additions and 918 deletions

View file

@ -19,7 +19,6 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Event;
use Friendica\Model\GContact;
@ -133,7 +132,7 @@ class DFRN
dbesc($owner_nick)
);
if (! DBM::is_result($r)) {
if (! DBA::is_result($r)) {
logger(sprintf('No contact found for nickname=%d', $owner_nick), LOGGER_WARNING);
killme();
}
@ -169,7 +168,7 @@ class DFRN
intval($owner_id)
);
if (! DBM::is_result($r)) {
if (! DBA::is_result($r)) {
logger(sprintf('No contact found for uid=%d', $owner_id), LOGGER_WARNING);
killme();
}
@ -278,7 +277,7 @@ class DFRN
/// @TODO This hook can't work anymore
// Addon::callHooks('atom_feed', $atom);
if (!DBM::is_result($items) || $onlyheader) {
if (!DBA::is_result($items) || $onlyheader) {
$atom = trim($doc->saveXML());
Addon::callHooks('atom_feed_end', $atom);
@ -333,7 +332,7 @@ class DFRN
$ret = Item::select(Item::DELIVER_FIELDLIST, $condition);
$items = Item::inArray($ret);
if (!DBM::is_result($items)) {
if (!DBA::is_result($items)) {
killme();
}
@ -599,7 +598,7 @@ class DFRN
WHERE (`hidewall` OR NOT `net-publish`) AND `user`.`uid` = %d",
intval($owner['uid'])
);
if (DBM::is_result($r)) {
if (DBA::is_result($r)) {
$hidewall = true;
} else {
$hidewall = false;
@ -658,7 +657,7 @@ class DFRN
WHERE `profile`.`is-default` AND NOT `user`.`hidewall` AND `user`.`uid` = %d",
intval($owner['uid'])
);
if (DBM::is_result($r)) {
if (DBA::is_result($r)) {
$profile = $r[0];
XML::addElement($doc, $author, "poco:displayName", $profile["name"]);
@ -953,7 +952,7 @@ class DFRN
if (isset($parent_item)) {
$conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $item['parent-uri']]);
if (DBM::is_result($conversation)) {
if (DBA::is_result($conversation)) {
if ($conversation['conversation-uri'] != '') {
$conversation_uri = $conversation['conversation-uri'];
}
@ -1077,7 +1076,7 @@ class DFRN
dbesc(normalise_link($mention))
);
if (DBM::is_result($r) && ($r[0]["forum"] || $r[0]["prv"])) {
if (DBA::is_result($r) && ($r[0]["forum"] || $r[0]["prv"])) {
XML::addElement(
$doc,
$entry,
@ -1503,7 +1502,7 @@ class DFRN
dbesc('birthday')
);
if (DBM::is_result($r)) {
if (DBA::is_result($r)) {
return;
}
@ -1552,7 +1551,7 @@ class DFRN
$importer["importer_uid"], normalise_link($author["link"]), NETWORK_STATUSNET];
$contact_old = DBA::selectFirst('contact', $fields, $condition);
if (DBM::is_result($contact_old)) {
if (DBA::is_result($contact_old)) {
$author["contact-id"] = $contact_old["id"];
$author["network"] = $contact_old["network"];
} else {
@ -1595,7 +1594,7 @@ class DFRN
$author["avatar"] = current($avatarlist);
}
if (DBM::is_result($contact_old) && !$onlyfetch) {
if (DBA::is_result($contact_old) && !$onlyfetch) {
logger("Check if contact details for contact " . $contact_old["id"] . " (" . $contact_old["nick"] . ") have to be updated.", LOGGER_DEBUG);
$poco = ["url" => $contact_old["url"]];
@ -1927,7 +1926,7 @@ class DFRN
*
* @see https://github.com/friendica/friendica/pull/3254#discussion_r107315246
*/
if (DBM::is_result($r)) {
if (DBA::is_result($r)) {
return false;
}
@ -1940,7 +1939,7 @@ class DFRN
dbesc($suggest["name"]),
dbesc($suggest["request"])
);
if (DBM::is_result($r)) {
if (DBA::is_result($r)) {
$fid = $r[0]["id"];
// OK, we do. Do we already have an introduction for this person ?
@ -1957,7 +1956,7 @@ class DFRN
*
* @see https://github.com/friendica/friendica/pull/3254#discussion_r107315246
*/
if (DBM::is_result($r)) {
if (DBA::is_result($r)) {
return false;
}
}
@ -1981,7 +1980,7 @@ class DFRN
* If no record in fcontact is found, below INSERT statement will not
* link an introduction to it.
*/
if (!DBM::is_result($r)) {
if (!DBA::is_result($r)) {
// Database record did not get created. Quietly give up.
killme();
}
@ -2067,7 +2066,7 @@ class DFRN
intval($importer["importer_uid"])
);
if (!DBM::is_result($r)) {
if (!DBA::is_result($r)) {
logger("Query failed to execute, no result returned in " . __FUNCTION__);
return false;
}
@ -2165,7 +2164,7 @@ class DFRN
$is_a_remote_action = false;
$parent = Item::selectFirst(['parent-uri'], ['uri' => $item["parent-uri"]]);
if (DBM::is_result($parent)) {
if (DBA::is_result($parent)) {
$r = q(
"SELECT `item`.`forum_mode`, `item`.`wall` FROM `item`
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
@ -2178,7 +2177,7 @@ class DFRN
dbesc($parent["parent-uri"]),
intval($importer["importer_uid"])
);
if (DBM::is_result($r)) {
if (DBA::is_result($r)) {
$is_a_remote_action = true;
}
}
@ -2337,7 +2336,7 @@ class DFRN
if ($xt->type == ACTIVITY_OBJ_NOTE) {
$item_tag = Item::selectFirst(['id', 'tag'], ['uri' => $xt->id, 'uid' => $importer["importer_uid"]]);
if (!DBM::is_result($item_tag)) {
if (!DBA::is_result($item_tag)) {
logger("Query failed to execute, no result returned in " . __FUNCTION__);
return false;
}
@ -2428,7 +2427,7 @@ class DFRN
['uri' => $item["uri"], 'uid' => $importer["importer_uid"]]
);
// Is there an existing item?
if (DBM::is_result($current) && !self::isEditedTimestampNewer($current, $item)) {
if (DBA::is_result($current) && !self::isEditedTimestampNewer($current, $item)) {
logger("Item ".$item["uri"]." (".$item['edited'].") already existed.", LOGGER_DEBUG);
return;
}
@ -2649,7 +2648,7 @@ class DFRN
dbesc($item["uri"]),
intval($importer["importer_uid"])
);
if (DBM::is_result($r)) {
if (DBA::is_result($r)) {
$ev["id"] = $r[0]["id"];
}
@ -2673,7 +2672,7 @@ class DFRN
// Update content if 'updated' changes
if (DBM::is_result($current)) {
if (DBA::is_result($current)) {
if (self::updateContent($current, $item, $importer, $entrytype)) {
logger("Item ".$item["uri"]." was updated.", LOGGER_DEBUG);
} else {
@ -2765,7 +2764,7 @@ class DFRN
$condition = ['uri' => $uri, 'uid' => $importer["importer_uid"]];
$item = Item::selectFirst(['id', 'parent', 'contact-id', 'file', 'deleted'], $condition);
if (!DBM::is_result($item)) {
if (!DBA::is_result($item)) {
logger("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", LOGGER_DEBUG);
return;
}
@ -2958,7 +2957,7 @@ class DFRN
dbesc($baseurl),
dbesc($nurl)
);
if ((! DBM::is_result($r)) || $r[0]['id'] == remote_user()) {
if ((! DBA::is_result($r)) || $r[0]['id'] == remote_user()) {
return;
}
@ -2969,7 +2968,7 @@ class DFRN
intval(local_user()),
dbesc($baseurl)
);
if (! DBM::is_result($r)) {
if (! DBA::is_result($r)) {
return;
}
@ -3036,7 +3035,7 @@ class DFRN
$u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
if (!DBM::is_result($u)) {
if (!DBA::is_result($u)) {
return false;
}