From f051ae169868905d3f3debbed37c8cf0f8b2be35 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 20 Jul 2018 22:01:53 -0400 Subject: [PATCH] Rename DBA::fetch_first to DBA::fetchFirst --- mod/dfrn_notify.php | 4 ++-- mod/directory.php | 2 +- mod/display.php | 2 +- src/App.php | 2 +- src/Content/ContactSelector.php | 2 +- src/Core/Worker.php | 6 +++--- src/Database/DBA.php | 4 ++-- src/Model/Contact.php | 2 +- src/Model/Item.php | 4 ++-- src/Model/Profile.php | 4 ++-- src/Model/User.php | 2 +- src/Worker/Delivery.php | 2 +- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 726f8335db..08c43d0fbf 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -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); diff --git a/mod/directory.php b/mod/directory.php index 2f5d364e91..08354e3a90 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -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)) { diff --git a/mod/display.php b/mod/display.php index e615b68437..98478024f6 100644 --- a/mod/display.php +++ b/mod/display.php @@ -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 diff --git a/src/App.php b/src/App.php index 1e24c3214f..815b583c38 100644 --- a/src/App.php +++ b/src/App.php @@ -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; } diff --git a/src/Content/ContactSelector.php b/src/Content/ContactSelector.php index 797ec78610..64b6ca7c6e 100644 --- a/src/Content/ContactSelector.php +++ b/src/Content/ContactSelector.php @@ -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)); diff --git a/src/Core/Worker.php b/src/Core/Worker.php index 633b8e12e9..2d4a8cb94b 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -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; } diff --git a/src/Database/DBA.php b/src/Database/DBA.php index f7fc8a6ae6..64ee3a00dc 100644 --- a/src/Database/DBA.php +++ b/src/Database/DBA.php @@ -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']; } diff --git a/src/Model/Contact.php b/src/Model/Contact.php index f8957c8a63..14382d4188 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -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` diff --git a/src/Model/Item.php b/src/Model/Item.php index 85c4ce3c01..b9ba0d4c37 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -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` diff --git a/src/Model/Profile.php b/src/Model/Profile.php index d975dbb3f4..82507b9c03 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -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`.*, diff --git a/src/Model/User.php b/src/Model/User.php index 125b722bcf..8d4e52cacc 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -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`, diff --git a/src/Worker/Delivery.php b/src/Worker/Delivery.php index 28658e5cdb..0727658683 100644 --- a/src/Worker/Delivery.php +++ b/src/Worker/Delivery.php @@ -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); -- 2.39.5