Merge pull request #5431 from MrPetovan/task/5410-rename-database-methods

Move DBA to src/ part 3.1: Rename DBA methods
This commit is contained in:
Michael Vogel 2018-07-23 15:18:58 +02:00 committed by GitHub
commit 2d0a749734
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 142 additions and 142 deletions

View file

@ -55,7 +55,7 @@ class Contact extends BaseObject
local_user()
);
if (DBM::is_result($stmt)) {
$return = DBA::inArray($stmt);
$return = DBA::toArray($stmt);
}
}
@ -72,7 +72,7 @@ class Contact extends BaseObject
{
$return = 0;
if (intval($gid)) {
$contacts = DBA::fetch_first('SELECT COUNT(*) AS `count`
$contacts = DBA::fetchFirst('SELECT COUNT(*) AS `count`
FROM `contact`
INNER JOIN `group_member`
ON `contact`.`id` = `group_member`.`contact-id`
@ -401,14 +401,14 @@ class Contact extends BaseObject
$s = DBA::p("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, `self`
FROM `contact` WHERE `nurl` = ? AND `uid` = ?", normalise_link($url), $uid);
$r = DBA::inArray($s);
$r = DBA::toArray($s);
// Fetch contact data from the contact table for the given user, checking with the alias
if (!DBM::is_result($r)) {
$s = DBA::p("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, `self`
FROM `contact` WHERE `alias` IN (?, ?, ?) AND `uid` = ?", normalise_link($url), $url, $ssl_url, $uid);
$r = DBA::inArray($s);
$r = DBA::toArray($s);
}
// Fetch the data from the contact table with "uid=0" (which is filled automatically)
@ -416,7 +416,7 @@ class Contact extends BaseObject
$s = DBA::p("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self`
FROM `contact` WHERE `nurl` = ? AND `uid` = 0", normalise_link($url));
$r = DBA::inArray($s);
$r = DBA::toArray($s);
}
// Fetch the data from the contact table with "uid=0" (which is filled automatically) - checked with the alias
@ -424,7 +424,7 @@ class Contact extends BaseObject
$s = DBA::p("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self`
FROM `contact` WHERE `alias` IN (?, ?, ?) AND `uid` = 0", normalise_link($url), $url, $ssl_url);
$r = DBA::inArray($s);
$r = DBA::toArray($s);
}
// Fetch the data from the gcontact table
@ -432,7 +432,7 @@ class Contact extends BaseObject
$s = DBA::p("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`,
`keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, 0 AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self`
FROM `gcontact` WHERE `nurl` = ?", normalise_link($url));
$r = DBA::inArray($s);
$r = DBA::toArray($s);
}
if (DBM::is_result($r)) {
@ -866,7 +866,7 @@ class Contact extends BaseObject
);
$s = DBA::select('contact', ['id'], ['nurl' => normalise_link($data["url"]), 'uid' => $uid], ['order' => ['id'], 'limit' => 2]);
$contacts = DBA::inArray($s);
$contacts = DBA::toArray($s);
if (!DBM::is_result($contacts)) {
return 0;
}

View file

@ -739,7 +739,7 @@ class Event extends BaseObject
$events = DBA::select('event', $fields, $conditions);
if (DBM::is_result($events)) {
$return = DBA::inArray($events);
$return = DBA::toArray($events);
}
return $return;

View file

@ -114,7 +114,7 @@ class Group extends BaseObject
local_user()
);
return DBA::inArray($stmt);
return DBA::toArray($stmt);
}
/**

View file

@ -272,7 +272,7 @@ class Item extends BaseObject
if (is_bool($stmt)) {
$retval = $stmt;
} else {
$retval = (DBA::num_rows($stmt) > 0);
$retval = (DBA::numRows($stmt) > 0);
}
DBA::close($stmt);
@ -809,7 +809,7 @@ class Item extends BaseObject
}
// When there is no content for the "old" item table, this will count the fetched items
$rows = DBA::affected_rows();
$rows = DBA::affectedRows();
while ($item = DBA::fetch($items)) {
@ -2427,7 +2427,7 @@ class Item extends BaseObject
// Does the given user have this item?
if ($uid) {
$item = DBA::fetch_first("SELECT `item`.`id`, `user`.`nickname` FROM `item`
$item = DBA::fetchFirst("SELECT `item`.`id`, `user`.`nickname` FROM `item`
INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
AND `item`.`guid` = ? AND `item`.`uid` = ?", $guid, $uid);
@ -2439,7 +2439,7 @@ class Item extends BaseObject
// Or is it anywhere on the server?
if ($nick == "") {
$item = DBA::fetch_first("SELECT `item`.`id`, `user`.`nickname` FROM `item`
$item = DBA::fetchFirst("SELECT `item`.`id`, `user`.`nickname` FROM `item`
INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
AND NOT `item`.`private` AND `item`.`wall`

View file

@ -210,7 +210,7 @@ class Profile
$profile = null;
if ($profile_id) {
$profile = DBA::fetch_first(
$profile = DBA::fetchFirst(
"SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` AS `contact_photo`,
`contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
`profile`.`uid` AS `profile_uid`, `profile`.*,
@ -224,7 +224,7 @@ class Profile
);
}
if (!DBM::is_result($profile)) {
$profile = DBA::fetch_first(
$profile = DBA::fetchFirst(
"SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` as `contact_photo`,
`contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
`profile`.`uid` AS `profile_uid`, `profile`.*,
@ -557,7 +557,7 @@ class Profile
DateTimeFormat::utcNow()
);
if (DBM::is_result($s)) {
$r = DBA::inArray($s);
$r = DBA::toArray($s);
Cache::set($cachekey, $r, CACHE_HOUR);
}
}

View file

@ -38,7 +38,7 @@ class User
* @return boolean|array
*/
public static function getOwnerDataById($uid) {
$r = DBA::fetch_first("SELECT
$r = DBA::fetchFirst("SELECT
`contact`.*,
`user`.`prvkey` AS `uprvkey`,
`user`.`timezone`,