Rename DBA::fetch_first to DBA::fetchFirst

This commit is contained in:
Hypolite Petovan 2018-07-20 22:01:53 -04:00
parent 591939dfc0
commit f051ae1698
12 changed files with 18 additions and 18 deletions

View file

@ -213,7 +213,7 @@ function dfrn_dispatch_public($postdata)
}
// We now have some contact, so we fetch it
$importer = DBA::fetch_first("SELECT *, `name` as `senderName`
$importer = DBA::fetchFirst("SELECT *, `name` as `senderName`
FROM `contact`
WHERE NOT `blocked` AND `id` = ? LIMIT 1",
$contact['id']);
@ -252,7 +252,7 @@ function dfrn_dispatch_private($user, $postdata)
}
// We now have some contact, so we fetch it
$importer = DBA::fetch_first("SELECT *, `name` as `senderName`
$importer = DBA::fetchFirst("SELECT *, `name` as `senderName`
FROM `contact`
WHERE NOT `blocked` AND `id` = ? LIMIT 1",
$cid);

View file

@ -83,7 +83,7 @@ function directory_content(App $a)
$publish = (Config::get('system', 'publish_all') ? '' : " AND `publish` = 1 " );
$cnt = DBA::fetch_first("SELECT COUNT(*) AS `total` FROM `profile`
$cnt = DBA::fetchFirst("SELECT COUNT(*) AS `total` FROM `profile`
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` $sql_extra");
if (DBM::is_result($cnt)) {

View file

@ -87,7 +87,7 @@ function display_init(App $a)
$nickname = str_replace(normalise_link(System::baseUrl())."/profile/", "", normalise_link($profiledata["url"]));
if (($nickname != $a->user["nickname"])) {
$profile = DBA::fetch_first("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
$profile = DBA::fetchFirst("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`nickname` = ? AND `profile`.`is-default` AND `contact`.`self` LIMIT 1",
$nickname

View file

@ -496,7 +496,7 @@ class App
$this->mode |= App::MODE_DBAVAILABLE;
if (DBA::fetch_first("SHOW TABLES LIKE 'config'") === false) {
if (DBA::fetchFirst("SHOW TABLES LIKE 'config'") === false) {
return;
}

View file

@ -102,7 +102,7 @@ class ContactSelector
$networkname = str_replace($search, $replace, $s);
if ((in_array($s, [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) && ($profile != "")) {
$r = DBA::fetch_first("SELECT `gserver`.`platform` FROM `gcontact`
$r = DBA::fetchFirst("SELECT `gserver`.`platform` FROM `gcontact`
INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url`
WHERE `gcontact`.`nurl` = ? AND `platform` != ''", normalise_link($profile));

View file

@ -477,7 +477,7 @@ class Worker
if ($max == 0) {
// the maximum number of possible user connections can be a system variable
$r = DBA::fetch_first("SHOW VARIABLES WHERE `variable_name` = 'max_user_connections'");
$r = DBA::fetchFirst("SHOW VARIABLES WHERE `variable_name` = 'max_user_connections'");
if (DBM::is_result($r)) {
$max = $r["Value"];
}
@ -513,7 +513,7 @@ class Worker
// We will now check for the system values.
// This limit could be reached although the user limits are fine.
$r = DBA::fetch_first("SHOW VARIABLES WHERE `variable_name` = 'max_connections'");
$r = DBA::fetchFirst("SHOW VARIABLES WHERE `variable_name` = 'max_connections'");
if (!DBM::is_result($r)) {
return false;
}
@ -521,7 +521,7 @@ class Worker
if ($max == 0) {
return false;
}
$r = DBA::fetch_first("SHOW STATUS WHERE `variable_name` = 'Threads_connected'");
$r = DBA::fetchFirst("SHOW STATUS WHERE `variable_name` = 'Threads_connected'");
if (!DBM::is_result($r)) {
return false;
}

View file

@ -683,7 +683,7 @@ class DBA
* @param string $sql SQL statement
* @return array first row of query
*/
public static function fetch_first($sql) {
public static function fetchFirst($sql) {
$params = self::getParam(func_get_args());
$stmt = self::p($sql, $params);
@ -1344,7 +1344,7 @@ class DBA
$sql = "SELECT COUNT(*) AS `count` FROM `".$table."`".$condition_string;
$row = self::fetch_first($sql, $condition);
$row = self::fetchFirst($sql, $condition);
return $row['count'];
}

View file

@ -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`

View file

@ -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`.*,

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`,

View file

@ -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::fetchFirst("SELECT *, `name` as `senderName`
FROM `contact`
WHERE NOT `blocked` AND `id` = ? LIMIT 1",
$cid);