mirror of
https://github.com/friendica/friendica
synced 2025-04-29 10:24:23 +02:00
Rename DBM method calls to DBA method calls
This commit is contained in:
parent
8ddb94ef06
commit
0ec44f3e8a
153 changed files with 813 additions and 918 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Group;
|
||||
|
@ -71,7 +70,7 @@ class Diaspora
|
|||
if (Config::get("system", "relay_directly", false)) {
|
||||
// We distribute our stuff based on the parent to ensure that the thread will be complete
|
||||
$parent = Item::selectFirst(['parent'], ['id' => $item_id]);
|
||||
if (!DBM::is_result($parent)) {
|
||||
if (!DBA::is_result($parent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -148,7 +147,7 @@ class Diaspora
|
|||
'contact-type' => ACCOUNT_TYPE_RELAY];
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
|
||||
if (DBM::is_result($contact)) {
|
||||
if (DBA::is_result($contact)) {
|
||||
if ($contact['archive'] || $contact['blocked']) {
|
||||
return false;
|
||||
}
|
||||
|
@ -157,7 +156,7 @@ class Diaspora
|
|||
self::setRelayContact($server_url);
|
||||
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
if (DBM::is_result($contact)) {
|
||||
if (DBA::is_result($contact)) {
|
||||
return $contact;
|
||||
}
|
||||
}
|
||||
|
@ -900,7 +899,7 @@ class Diaspora
|
|||
$update = false;
|
||||
|
||||
$person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
|
||||
if (DBM::is_result($person)) {
|
||||
if (DBA::is_result($person)) {
|
||||
logger("In cache " . print_r($person, true), LOGGER_DEBUG);
|
||||
|
||||
// update record occasionally so it doesn't get stale
|
||||
|
@ -914,7 +913,7 @@ class Diaspora
|
|||
}
|
||||
}
|
||||
|
||||
if (!DBM::is_result($person) || $update) {
|
||||
if (!DBA::is_result($person) || $update) {
|
||||
logger("create or refresh", LOGGER_DEBUG);
|
||||
$r = Probe::uri($handle, NETWORK_DIASPORA);
|
||||
|
||||
|
@ -925,7 +924,7 @@ class Diaspora
|
|||
|
||||
// Fetch the updated or added contact
|
||||
$person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
|
||||
if (!DBM::is_result($person)) {
|
||||
if (!DBA::is_result($person)) {
|
||||
$person = $r;
|
||||
}
|
||||
}
|
||||
|
@ -974,7 +973,7 @@ class Diaspora
|
|||
intval($pcontact_id)
|
||||
);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
if (DBA::is_result($r)) {
|
||||
return strtolower($r[0]["addr"]);
|
||||
}
|
||||
}
|
||||
|
@ -984,7 +983,7 @@ class Diaspora
|
|||
intval($contact_id)
|
||||
);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
if (DBA::is_result($r)) {
|
||||
$contact = $r[0];
|
||||
|
||||
logger("contact 'self' = ".$contact['self']." 'url' = ".$contact['url'], LOGGER_DEBUG);
|
||||
|
@ -1021,7 +1020,7 @@ class Diaspora
|
|||
dbesc($fcontact_guid)
|
||||
);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
if (DBA::is_result($r)) {
|
||||
return $r[0]['url'];
|
||||
}
|
||||
|
||||
|
@ -1053,7 +1052,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $cid]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
if (!DBA::is_result($contact)) {
|
||||
// This here shouldn't happen at all
|
||||
logger("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG);
|
||||
return false;
|
||||
|
@ -1154,7 +1153,7 @@ class Diaspora
|
|||
private static function messageExists($uid, $guid)
|
||||
{
|
||||
$item = Item::selectFirst(['id'], ['uid' => $uid, 'guid' => $guid]);
|
||||
if (DBM::is_result($item)) {
|
||||
if (DBA::is_result($item)) {
|
||||
logger("message ".$guid." already exists for user ".$uid);
|
||||
return $item["id"];
|
||||
}
|
||||
|
@ -1374,7 +1373,7 @@ class Diaspora
|
|||
$condition = ['uid' => $uid, 'guid' => $guid];
|
||||
$item = Item::selectFirst($fields, $condition);
|
||||
|
||||
if (!DBM::is_result($item)) {
|
||||
if (!DBA::is_result($item)) {
|
||||
$result = self::storeByGuid($guid, $contact["url"], $uid);
|
||||
|
||||
if (!$result) {
|
||||
|
@ -1389,7 +1388,7 @@ class Diaspora
|
|||
}
|
||||
}
|
||||
|
||||
if (!DBM::is_result($item)) {
|
||||
if (!DBA::is_result($item)) {
|
||||
logger("parent item not found: parent: ".$guid." - user: ".$uid);
|
||||
return false;
|
||||
} else {
|
||||
|
@ -1413,7 +1412,7 @@ class Diaspora
|
|||
{
|
||||
$condition = ['nurl' => normalise_link($person["url"]), 'uid' => $uid];
|
||||
$contact = DBA::selectFirst('contact', ['id', 'network'], $condition);
|
||||
if (DBM::is_result($contact)) {
|
||||
if (DBA::is_result($contact)) {
|
||||
$cid = $contact["id"];
|
||||
$network = $contact["network"];
|
||||
} else {
|
||||
|
@ -1569,7 +1568,7 @@ class Diaspora
|
|||
private static function getUriFromGuid($author, $guid, $onlyfound = false)
|
||||
{
|
||||
$item = Item::selectFirst(['uri'], ['guid' => $guid]);
|
||||
if (DBM::is_result($item)) {
|
||||
if (DBA::is_result($item)) {
|
||||
return $item["uri"];
|
||||
} elseif (!$onlyfound) {
|
||||
$contact = Contact::getDetailsByAddr($author, 0);
|
||||
|
@ -1599,7 +1598,7 @@ class Diaspora
|
|||
private static function getGuidFromUri($uri, $uid)
|
||||
{
|
||||
$item = Item::selectFirst(['guid'], ['uri' => $uri, 'uid' => $uid]);
|
||||
if (DBM::is_result($item)) {
|
||||
if (DBA::is_result($item)) {
|
||||
return $item["guid"];
|
||||
} else {
|
||||
return false;
|
||||
|
@ -1616,10 +1615,10 @@ class Diaspora
|
|||
private static function importerForGuid($guid)
|
||||
{
|
||||
$item = Item::selectFirst(['uid'], ['origin' => true, 'guid' => $guid]);
|
||||
if (DBM::is_result($item)) {
|
||||
if (DBA::is_result($item)) {
|
||||
logger("Found user ".$item['uid']." as owner of item ".$guid, LOGGER_DEBUG);
|
||||
$contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $item['uid']]);
|
||||
if (DBM::is_result($contact)) {
|
||||
if (DBA::is_result($contact)) {
|
||||
return $contact;
|
||||
}
|
||||
}
|
||||
|
@ -1791,7 +1790,7 @@ class Diaspora
|
|||
dbesc($msg_guid),
|
||||
intval($importer["uid"])
|
||||
);
|
||||
if (DBM::is_result($r)) {
|
||||
if (DBA::is_result($r)) {
|
||||
logger("duplicate message already delivered.", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
@ -2078,7 +2077,7 @@ class Diaspora
|
|||
dbesc($guid),
|
||||
intval($importer["uid"])
|
||||
);
|
||||
if (DBM::is_result($r)) {
|
||||
if (DBA::is_result($r)) {
|
||||
logger("duplicate message already delivered.", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
@ -2134,7 +2133,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
$item = Item::selectFirst(['id'], ['guid' => $parent_guid, 'origin' => true, 'private' => false]);
|
||||
if (!DBM::is_result($item)) {
|
||||
if (!DBA::is_result($item)) {
|
||||
logger('Item not found, no origin or private: '.$parent_guid);
|
||||
return false;
|
||||
}
|
||||
|
@ -2518,7 +2517,7 @@ class Diaspora
|
|||
$condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => false];
|
||||
$item = Item::selectFirst($fields, $condition);
|
||||
|
||||
if (DBM::is_result($item)) {
|
||||
if (DBA::is_result($item)) {
|
||||
logger("reshared message ".$guid." already exists on system.");
|
||||
|
||||
// Maybe it is already a reshared item?
|
||||
|
@ -2540,7 +2539,7 @@ class Diaspora
|
|||
}
|
||||
}
|
||||
|
||||
if (!DBM::is_result($item)) {
|
||||
if (!DBA::is_result($item)) {
|
||||
if (empty($orig_author)) {
|
||||
logger('Empty author for guid ' . $guid . '. Quitting.');
|
||||
return false;
|
||||
|
@ -2562,7 +2561,7 @@ class Diaspora
|
|||
$condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => false];
|
||||
$item = Item::selectFirst($fields, $condition);
|
||||
|
||||
if (DBM::is_result($item)) {
|
||||
if (DBA::is_result($item)) {
|
||||
// If it is a reshared post from another network then reformat to avoid display problems with two share elements
|
||||
if (self::isReshare($item["body"], false)) {
|
||||
$item["body"] = Markdown::toBBCode(BBCode::toMarkdown($item["body"]));
|
||||
|
@ -2704,7 +2703,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
$r = Item::select($fields, $condition);
|
||||
if (!DBM::is_result($r)) {
|
||||
if (!DBA::is_result($r)) {
|
||||
logger("Target guid ".$target_guid." was not found on this system for user ".$importer['uid'].".");
|
||||
return false;
|
||||
}
|
||||
|
@ -3357,7 +3356,7 @@ class Diaspora
|
|||
if (($guid != "") && $complete) {
|
||||
$condition = ['guid' => $guid, 'network' => [NETWORK_DFRN, NETWORK_DIASPORA]];
|
||||
$item = Item::selectFirst(['contact-id'], $condition);
|
||||
if (DBM::is_result($item)) {
|
||||
if (DBA::is_result($item)) {
|
||||
$ret= [];
|
||||
$ret["root_handle"] = self::handleFromContact($item["contact-id"]);
|
||||
$ret["root_guid"] = $guid;
|
||||
|
@ -3410,7 +3409,7 @@ class Diaspora
|
|||
private static function buildEvent($event_id)
|
||||
{
|
||||
$r = q("SELECT `guid`, `uid`, `start`, `finish`, `nofinish`, `summary`, `desc`, `location`, `adjust` FROM `event` WHERE `id` = %d", intval($event_id));
|
||||
if (!DBM::is_result($r)) {
|
||||
if (!DBA::is_result($r)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -3419,14 +3418,14 @@ class Diaspora
|
|||
$eventdata = [];
|
||||
|
||||
$r = q("SELECT `timezone` FROM `user` WHERE `uid` = %d", intval($event['uid']));
|
||||
if (!DBM::is_result($r)) {
|
||||
if (!DBA::is_result($r)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$user = $r[0];
|
||||
|
||||
$r = q("SELECT `addr`, `nick` FROM `contact` WHERE `uid` = %d AND `self`", intval($event['uid']));
|
||||
if (!DBM::is_result($r)) {
|
||||
if (!DBA::is_result($r)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -3624,7 +3623,7 @@ class Diaspora
|
|||
private static function constructLike(array $item, array $owner)
|
||||
{
|
||||
$parent = Item::selectFirst(['guid', 'uri', 'parent-uri'], ['uri' => $item["thr-parent"]]);
|
||||
if (!DBM::is_result($parent)) {
|
||||
if (!DBA::is_result($parent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3655,7 +3654,7 @@ class Diaspora
|
|||
private static function constructAttend(array $item, array $owner)
|
||||
{
|
||||
$parent = Item::selectFirst(['guid', 'uri', 'parent-uri'], ['uri' => $item["thr-parent"]]);
|
||||
if (!DBM::is_result($parent)) {
|
||||
if (!DBA::is_result($parent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3699,7 +3698,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
$parent = Item::selectFirst(['guid'], ['id' => $item["parent"], 'parent' => $item["parent"]]);
|
||||
if (!DBM::is_result($parent)) {
|
||||
if (!DBA::is_result($parent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3925,7 +3924,7 @@ class Diaspora
|
|||
intval($item["uid"])
|
||||
);
|
||||
|
||||
if (!DBM::is_result($r)) {
|
||||
if (!DBA::is_result($r)) {
|
||||
logger("conversation not found.");
|
||||
return;
|
||||
}
|
||||
|
@ -4165,14 +4164,14 @@ class Diaspora
|
|||
}
|
||||
|
||||
$r = q("SELECT `prvkey` FROM `user` WHERE `uid` = %d LIMIT 1", intval($contact['uid']));
|
||||
if (!DBM::is_result($r)) {
|
||||
if (!DBA::is_result($r)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$contact["uprvkey"] = $r[0]['prvkey'];
|
||||
|
||||
$item = Item::selectFirst([], ['id' => $post_id]);
|
||||
if (!DBM::is_result($item)) {
|
||||
if (!DBA::is_result($item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use DOMDocument;
|
|||
use DOMXPath;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\XML;
|
||||
|
@ -246,7 +246,7 @@ class Feed {
|
|||
$condition = ["`uid` = ? AND `uri` = ? AND `network` IN (?, ?)",
|
||||
$importer["uid"], $item["uri"], NETWORK_FEED, NETWORK_DFRN];
|
||||
$previous = Item::selectFirst(['id'], $condition);
|
||||
if (DBM::is_result($previous)) {
|
||||
if (DBA::is_result($previous)) {
|
||||
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\Lock;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Conversation;
|
||||
use Friendica\Model\GContact;
|
||||
|
@ -81,7 +80,7 @@ class OStatus
|
|||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
}
|
||||
|
||||
if (!DBM::is_result($contact) && $author["author-link"] != '') {
|
||||
if (!DBA::is_result($contact) && $author["author-link"] != '') {
|
||||
if ($aliaslink == "") {
|
||||
$aliaslink = $author["author-link"];
|
||||
}
|
||||
|
@ -92,14 +91,14 @@ class OStatus
|
|||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
}
|
||||
|
||||
if (!DBM::is_result($contact) && ($addr != '')) {
|
||||
if (!DBA::is_result($contact) && ($addr != '')) {
|
||||
$condition = ["`uid` = ? AND `addr` = ? AND `network` != ? AND `rel` IN (?, ?)",
|
||||
$importer["uid"], $addr, NETWORK_STATUSNET,
|
||||
CONTACT_IS_SHARING, CONTACT_IS_FRIEND];
|
||||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
}
|
||||
|
||||
if (DBM::is_result($contact)) {
|
||||
if (DBA::is_result($contact)) {
|
||||
if ($contact['blocked']) {
|
||||
$contact['id'] = -1;
|
||||
}
|
||||
|
@ -136,7 +135,7 @@ class OStatus
|
|||
$author["owner-id"] = $author["author-id"];
|
||||
|
||||
// Only update the contacts if it is an OStatus contact
|
||||
if (DBM::is_result($contact) && ($contact['id'] > 0) && !$onlyfetch && ($contact["network"] == NETWORK_OSTATUS)) {
|
||||
if (DBA::is_result($contact) && ($contact['id'] > 0) && !$onlyfetch && ($contact["network"] == NETWORK_OSTATUS)) {
|
||||
|
||||
// Update contact data
|
||||
$current = $contact;
|
||||
|
@ -897,7 +896,7 @@ class OStatus
|
|||
{
|
||||
$condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $related_uri, PROTOCOL_DFRN, PROTOCOL_OSTATUS_SALMON];
|
||||
$conversation = DBA::selectFirst('conversation', ['source', 'protocol'], $condition);
|
||||
if (DBM::is_result($conversation)) {
|
||||
if (DBA::is_result($conversation)) {
|
||||
$stored = true;
|
||||
$xml = $conversation['source'];
|
||||
if (self::process($xml, $importer, $contact, $hub, $stored, false)) {
|
||||
|
@ -977,7 +976,7 @@ class OStatus
|
|||
if ($xml == '') {
|
||||
$condition = ['item-uri' => $related_uri, 'protocol' => PROTOCOL_SPLITTED_CONV];
|
||||
$conversation = DBA::selectFirst('conversation', ['source'], $condition);
|
||||
if (DBM::is_result($conversation)) {
|
||||
if (DBA::is_result($conversation)) {
|
||||
$stored = true;
|
||||
logger('Got cached XML from conversation for URI '.$related_uri, LOGGER_DEBUG);
|
||||
$xml = $conversation['source'];
|
||||
|
@ -1453,7 +1452,7 @@ class OStatus
|
|||
}
|
||||
}
|
||||
|
||||
if (DBM::is_result($profile) && !$show_profile) {
|
||||
if (DBA::is_result($profile) && !$show_profile) {
|
||||
if (trim($profile["homepage"]) != "") {
|
||||
$urls = $doc->createElement("poco:urls");
|
||||
XML::addElement($doc, $urls, "poco:type", "homepage");
|
||||
|
@ -1577,24 +1576,24 @@ class OStatus
|
|||
dbesc(normalise_link($url)),
|
||||
intval($owner["uid"])
|
||||
);
|
||||
if (DBM::is_result($r)) {
|
||||
if (DBA::is_result($r)) {
|
||||
$contact = $r[0];
|
||||
$contact["uid"] = -1;
|
||||
}
|
||||
|
||||
if (!DBM::is_result($r)) {
|
||||
if (!DBA::is_result($r)) {
|
||||
$r = q(
|
||||
"SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($url))
|
||||
);
|
||||
if (DBM::is_result($r)) {
|
||||
if (DBA::is_result($r)) {
|
||||
$contact = $r[0];
|
||||
$contact["uid"] = -1;
|
||||
$contact["success_update"] = $contact["updated"];
|
||||
}
|
||||
}
|
||||
|
||||
if (!DBM::is_result($r)) {
|
||||
if (!DBA::is_result($r)) {
|
||||
$contact = owner;
|
||||
}
|
||||
|
||||
|
@ -1636,7 +1635,7 @@ class OStatus
|
|||
$condition = ['uid' => $owner["uid"], 'guid' => $repeated_guid, 'private' => false,
|
||||
'network' => [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]];
|
||||
$repeated_item = Item::selectFirst([], $condition);
|
||||
if (!DBM::is_result($repeated_item)) {
|
||||
if (!DBA::is_result($repeated_item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1794,7 +1793,7 @@ class OStatus
|
|||
dbesc(normalise_link($contact["url"]))
|
||||
);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
if (DBA::is_result($r)) {
|
||||
$connect_id = $r[0]['id'];
|
||||
} else {
|
||||
$connect_id = 0;
|
||||
|
@ -1963,7 +1962,7 @@ class OStatus
|
|||
|
||||
$thrparent = Item::selectFirst(['guid', 'author-link', 'owner-link', 'plink'], ['uid' => $owner["uid"], 'uri' => $parent_item]);
|
||||
|
||||
if (DBM::is_result($thrparent)) {
|
||||
if (DBA::is_result($thrparent)) {
|
||||
$mentioned[$thrparent["author-link"]] = $thrparent["author-link"];
|
||||
$mentioned[$thrparent["owner-link"]] = $thrparent["owner-link"];
|
||||
$parent_plink = $thrparent["plink"];
|
||||
|
@ -1990,7 +1989,7 @@ class OStatus
|
|||
|
||||
if (isset($parent_item)) {
|
||||
$conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $parent_item]);
|
||||
if (DBM::is_result($conversation)) {
|
||||
if (DBA::is_result($conversation)) {
|
||||
if ($conversation['conversation-uri'] != '') {
|
||||
$conversation_uri = $conversation['conversation-uri'];
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ use Friendica\Content\Text\HTML;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Network\Probe;
|
||||
|
@ -68,7 +67,7 @@ class PortableContact
|
|||
if ($cid) {
|
||||
if (!$url || !$uid) {
|
||||
$contact = DBA::selectFirst('contact', ['poco', 'uid'], ['id' => $cid]);
|
||||
if (DBM::is_result($contact)) {
|
||||
if (DBA::is_result($contact)) {
|
||||
$url = $contact['poco'];
|
||||
$uid = $contact['uid'];
|
||||
}
|
||||
|
@ -285,7 +284,7 @@ class PortableContact
|
|||
dbesc(normalise_link($server_url))
|
||||
);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
if (DBA::is_result($r)) {
|
||||
return $server_url;
|
||||
}
|
||||
|
||||
|
@ -310,7 +309,7 @@ class PortableContact
|
|||
dbesc(normalise_link($profile))
|
||||
);
|
||||
|
||||
if (!DBM::is_result($gcontacts)) {
|
||||
if (!DBA::is_result($gcontacts)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -931,7 +930,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
$gserver = DBA::selectFirst('gserver', [], ['nurl' => normalise_link($server_url)]);
|
||||
if (DBM::is_result($gserver)) {
|
||||
if (DBA::is_result($gserver)) {
|
||||
if ($gserver["created"] <= NULL_DATE) {
|
||||
$fields = ['created' => DateTimeFormat::utcNow()];
|
||||
$condition = ['nurl' => normalise_link($server_url)];
|
||||
|
@ -1002,7 +1001,7 @@ class PortableContact
|
|||
|
||||
// Quit if there is a timeout.
|
||||
// But we want to make sure to only quit if we are mostly sure that this server url fits.
|
||||
if (DBM::is_result($gserver) && ($orig_server_url == $server_url) &&
|
||||
if (DBA::is_result($gserver) && ($orig_server_url == $server_url) &&
|
||||
(!empty($serverret["errno"]) && ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT))) {
|
||||
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
|
||||
DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
|
||||
|
@ -1421,7 +1420,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
$gserver = DBA::selectFirst('gserver', ['id', 'relay-subscribe', 'relay-scope'], ['nurl' => normalise_link($server_url)]);
|
||||
if (!DBM::is_result($gserver)) {
|
||||
if (!DBA::is_result($gserver)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1483,7 +1482,7 @@ class PortableContact
|
|||
dbesc(NETWORK_OSTATUS)
|
||||
);
|
||||
|
||||
if (!DBM::is_result($r)) {
|
||||
if (!DBA::is_result($r)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1511,7 +1510,7 @@ class PortableContact
|
|||
$server_url = str_replace("/index.php", "", $server->url);
|
||||
|
||||
$r = q("SELECT `nurl` FROM `gserver` WHERE `nurl` = '%s'", dbesc(normalise_link($server_url)));
|
||||
if (!DBM::is_result($r)) {
|
||||
if (!DBA::is_result($r)) {
|
||||
logger("Call server check for server ".$server_url, LOGGER_DEBUG);
|
||||
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", $server_url);
|
||||
}
|
||||
|
@ -1580,7 +1579,7 @@ class PortableContact
|
|||
public static function discoverSingleServer($id)
|
||||
{
|
||||
$r = q("SELECT `poco`, `nurl`, `url`, `network` FROM `gserver` WHERE `id` = %d", intval($id));
|
||||
if (!DBM::is_result($r)) {
|
||||
if (!DBA::is_result($r)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1656,7 +1655,7 @@ class PortableContact
|
|||
$last_update = date("c", time() - (60 * 60 * 24 * $requery_days));
|
||||
|
||||
$r = q("SELECT `id`, `url`, `nurl`, `network` FROM `gserver` WHERE `last_contact` >= `last_failure` AND `poco` != '' AND `last_poco_query` < '%s' ORDER BY RAND()", dbesc($last_update));
|
||||
if (DBM::is_result($r)) {
|
||||
if (DBA::is_result($r)) {
|
||||
foreach ($r as $server) {
|
||||
if (!self::checkServer($server["url"], $server["network"])) {
|
||||
// The server is not reachable? Okay, then we will try it later
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue