]> git.mxchange.org Git - friendica.git/commitdiff
Rename Friendica\Database\dba to Friendica\Database\DBA
authorHypolite Petovan <mrpetovan@gmail.com>
Fri, 20 Jul 2018 12:19:26 +0000 (08:19 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Fri, 20 Jul 2018 12:19:26 +0000 (08:19 -0400)
127 files changed:
bin/daemon.php
include/api.php
include/conversation.php
include/dba.php
include/enotify.php
include/items.php
include/security.php
index.php
mod/acl.php
mod/admin.php
mod/allfriends.php
mod/attach.php
mod/cal.php
mod/common.php
mod/community.php
mod/contacts.php
mod/crepair.php
mod/delegate.php
mod/dfrn_confirm.php
mod/dfrn_notify.php
mod/dfrn_poll.php
mod/dfrn_request.php
mod/directory.php
mod/dirfind.php
mod/display.php
mod/feedtest.php
mod/hovercard.php
mod/install.php
mod/item.php
mod/lostpass.php
mod/message.php
mod/network.php
mod/nodeinfo.php
mod/noscrape.php
mod/notes.php
mod/notifications.php
mod/photos.php
mod/profile.php
mod/profiles.php
mod/proxy.php
mod/pubsub.php
mod/pubsubhubbub.php
mod/receive.php
mod/redir.php
mod/regmod.php
mod/removeme.php
mod/search.php
mod/settings.php
mod/suggest.php
mod/unfollow.php
mod/wall_attach.php
mod/worker.php
mod/xrd.php
src/App.php
src/Content/ContactSelector.php
src/Content/ForumManager.php
src/Content/Nav.php
src/Content/OEmbed.php
src/Content/Widget.php
src/Content/Widget/TagCloud.php
src/Core/ACL.php
src/Core/Addon.php
src/Core/Cache/DatabaseCacheDriver.php
src/Core/Config/JITConfigAdapter.php
src/Core/Config/JITPConfigAdapter.php
src/Core/Config/PreloadConfigAdapter.php
src/Core/Config/PreloadPConfigAdapter.php
src/Core/Console/ArchiveContact.php
src/Core/Console/AutomaticInstallation.php
src/Core/Console/DatabaseStructure.php
src/Core/Console/GlobalCommunitySilence.php
src/Core/Console/NewPassword.php
src/Core/L10n.php
src/Core/Lock/DatabaseLockDriver.php
src/Core/Session/DatabaseSessionHandler.php
src/Core/UserImport.php
src/Core/Worker.php
src/Database/DBA.php
src/Database/DBM.php
src/Database/DBStructure.php
src/Database/PostUpdate.php
src/Model/Contact.php
src/Model/Conversation.php
src/Model/Event.php
src/Model/GContact.php
src/Model/Group.php
src/Model/Item.php
src/Model/Mail.php
src/Model/OpenWebAuthToken.php
src/Model/PermissionSet.php
src/Model/Photo.php
src/Model/Process.php
src/Model/Profile.php
src/Model/PushSubscriber.php
src/Model/Queue.php
src/Model/Term.php
src/Model/User.php
src/Module/Hashtag.php
src/Module/Login.php
src/Module/Magic.php
src/Module/Owa.php
src/Network/FKOAuth1.php
src/Network/FKOAuthDataStore.php
src/Network/Probe.php
src/Object/Post.php
src/Protocol/DFRN.php
src/Protocol/Diaspora.php
src/Protocol/OStatus.php
src/Protocol/PortableContact.php
src/Util/ExAuth.php
src/Util/HTTPSignature.php
src/Util/ParseUrl.php
src/Worker/Cron.php
src/Worker/CronJobs.php
src/Worker/DBClean.php
src/Worker/Delivery.php
src/Worker/DiscoverPoCo.php
src/Worker/Expire.php
src/Worker/Notifier.php
src/Worker/OnePoll.php
src/Worker/PubSubPublish.php
src/Worker/Queue.php
src/Worker/RemoveContact.php
src/Worker/TagUpdate.php
tests/DatabaseTest.php
tests/src/Core/Lock/DatabaseLockDriverTest.php
update.php

index 6ab2f761026099278b07974f96060e86c39c0802..475bafc09de0f03c8c5ae12e4b821ee4f53644e5 100755 (executable)
@@ -10,7 +10,7 @@
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 
 // Ensure that daemon.php is executed from the base path of the installation
 if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
@@ -114,7 +114,7 @@ if (!$foreground) {
        // fclose(STDOUT); // file descriptors as we
        // fclose(STDERR); // are running as a daemon.
 
-       dba::disconnect();
+       DBA::disconnect();
 
        register_shutdown_function('shutdown');
 
@@ -155,7 +155,7 @@ while (true) {
        if ($do_cron) {
                // We force a reconnect of the database connection.
                // This is done to ensure that the connection don't get lost over time.
-               dba::reconnect();
+               DBA::reconnect();
 
                $last_cron = time();
        }
index a6196852bf229f6f9ed890820aae6aa7b2e0b3cc..b119177d285215cfa014fcb5fd81272815118dc2 100644 (file)
@@ -19,7 +19,7 @@ use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
@@ -231,7 +231,7 @@ function api_login(App $a)
        } else {
                $user_id = User::authenticate(trim($user), trim($password));
                if ($user_id !== false) {
-                       $record = dba::selectFirst('user', [], ['uid' => $user_id]);
+                       $record = DBA::selectFirst('user', [], ['uid' => $user_id]);
                }
        }
 
@@ -499,7 +499,7 @@ function api_rss_extra(App $a, $arr, $user_info)
  */
 function api_unique_id_to_nurl($id)
 {
-       $r = dba::selectFirst('contact', ['nurl'], ['id' => $id]);
+       $r = DBA::selectFirst('contact', ['nurl'], ['id' => $id]);
 
        if (DBM::is_result($r)) {
                return $r["nurl"];
@@ -696,8 +696,8 @@ function api_get_user(App $a, $contact_id = null)
                        $uinfo[0]['network'] = NETWORK_DFRN;
                }
 
-               $usr = dba::selectFirst('user', ['default-location'], ['uid' => api_user()]);
-               $profile = dba::selectFirst('profile', ['about'], ['uid' => api_user(), 'is-default' => true]);
+               $usr = DBA::selectFirst('user', ['default-location'], ['uid' => api_user()]);
+               $profile = DBA::selectFirst('profile', ['about'], ['uid' => api_user(), 'is-default' => true]);
        }
        $countitems = 0;
        $countfriends = 0;
@@ -770,7 +770,7 @@ function api_get_user(App $a, $contact_id = null)
 
        // If this is a local user and it uses Frio, we can get its color preferences.
        if ($ret['self']) {
-               $theme_info = dba::selectFirst('user', ['theme'], ['uid' => $ret['uid']]);
+               $theme_info = DBA::selectFirst('user', ['theme'], ['uid' => $ret['uid']]);
                if ($theme_info['theme'] === 'frio') {
                        $schema = PConfig::get($ret['uid'], 'frio', 'schema');
 
@@ -1131,7 +1131,7 @@ function api_statuses_update($type)
                        $datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60);
 
                        $condition = ["`uid` = ? AND `wall` AND `created` > ? AND `id` = `parent`", api_user(), $datefrom];
-                       $posts_day = dba::count('item', $condition);
+                       $posts_day = DBA::count('item', $condition);
 
                        if ($posts_day > $throttle_day) {
                                logger('Daily posting limit reached for user '.api_user(), LOGGER_DEBUG);
@@ -1145,7 +1145,7 @@ function api_statuses_update($type)
                        $datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*7);
 
                        $condition = ["`uid` = ? AND `wall` AND `created` > ? AND `id` = `parent`", api_user(), $datefrom];
-                       $posts_week = dba::count('item', $condition);
+                       $posts_week = DBA::count('item', $condition);
 
                        if ($posts_week > $throttle_week) {
                                logger('Weekly posting limit reached for user '.api_user(), LOGGER_DEBUG);
@@ -1159,7 +1159,7 @@ function api_statuses_update($type)
                        $datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*30);
 
                        $condition = ["`uid` = ? AND `wall` AND `created` > ? AND `id` = `parent`", api_user(), $datefrom];
-                       $posts_month = dba::count('item', $condition);
+                       $posts_month = DBA::count('item', $condition);
 
                        if ($posts_month > $throttle_month) {
                                logger('Monthly posting limit reached for user '.api_user(), LOGGER_DEBUG);
@@ -2768,7 +2768,7 @@ function api_format_items_activities(&$item, $type = "json")
                }
        }
 
-       dba::close($ret);
+       DBA::close($ret);
 
        if ($type == "xml") {
                $xml_activities = [];
@@ -3048,7 +3048,7 @@ function api_lists_ownerships($type)
        $user_info = api_get_user($a);
        $uid = $user_info['uid'];
 
-       $groups = dba::select('group', [], ['deleted' => 0, 'uid' => $uid]);
+       $groups = DBA::select('group', [], ['deleted' => 0, 'uid' => $uid]);
 
        // loop through all groups
        $lists = [];
@@ -3867,7 +3867,7 @@ function api_fr_photoalbum_delete($type)
        }
 
        // now let's delete all photos from the album
-       $result = dba::delete('photo', ['uid' => api_user(), 'album' => $album]);
+       $result = DBA::delete('photo', ['uid' => api_user(), 'album' => $album]);
 
        // return success of deletion or error message
        if ($result) {
@@ -3901,11 +3901,11 @@ function api_fr_photoalbum_update($type)
                throw new BadRequestException("no new albumname specified");
        }
        // check if album is existing
-       if (!dba::exists('photo', ['uid' => api_user(), 'album' => $album])) {
+       if (!DBA::exists('photo', ['uid' => api_user(), 'album' => $album])) {
                throw new BadRequestException("album not available");
        }
        // now let's update all photos to the albumname
-       $result = dba::update('photo', ['album' => $album_new], ['uid' => api_user(), 'album' => $album]);
+       $result = DBA::update('photo', ['album' => $album_new], ['uid' => api_user(), 'album' => $album]);
 
        // return success of updating or error message
        if ($result) {
@@ -4139,7 +4139,7 @@ function api_fr_photo_delete($type)
                throw new BadRequestException("photo not available");
        }
        // now we can perform on the deletion of the photo
-       $result = dba::delete('photo', ['uid' => api_user(), 'resource-id' => $photo_id]);
+       $result = DBA::delete('photo', ['uid' => api_user(), 'resource-id' => $photo_id]);
 
        // return success of deletion or error message
        if ($result) {
@@ -4212,7 +4212,7 @@ function api_account_update_profile_image($type)
 
        // check if specified profile id is valid
        if ($profile_id != 0) {
-               $profile = dba::selectFirst('profile', ['is-default'], ['uid' => api_user(), 'id' => $profile_id]);
+               $profile = DBA::selectFirst('profile', ['is-default'], ['uid' => api_user(), 'id' => $profile_id]);
                // error message if specified profile id is not in database
                if (!DBM::is_result($profile)) {
                        throw new BadRequestException("profile_id not available");
@@ -4249,11 +4249,11 @@ function api_account_update_profile_image($type)
        // change specified profile or all profiles to the new resource-id
        if ($is_default_profile) {
                $condition = ["`profile` AND `resource-id` != ? AND `uid` = ?", $data['photo']['id'], api_user()];
-               dba::update('photo', ['profile' => false], $condition);
+               DBA::update('photo', ['profile' => false], $condition);
        } else {
                $fields = ['photo' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $filetype,
                        'thumb' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $filetype];
-               dba::update('profile', $fields, ['id' => $_REQUEST['profile'], 'uid' => api_user()]);
+               DBA::update('profile', $fields, ['id' => $_REQUEST['profile'], 'uid' => api_user()]);
        }
 
        Contact::updateSelfFromUserID(api_user(), true);
@@ -4298,16 +4298,16 @@ function api_account_update_profile($type)
        $api_user = api_get_user(get_app());
 
        if (!empty($_POST['name'])) {
-               dba::update('profile', ['name' => $_POST['name']], ['uid' => $local_user]);
-               dba::update('user', ['username' => $_POST['name']], ['uid' => $local_user]);
-               dba::update('contact', ['name' => $_POST['name']], ['uid' => $local_user, 'self' => 1]);
-               dba::update('contact', ['name' => $_POST['name']], ['id' => $api_user['id']]);
+               DBA::update('profile', ['name' => $_POST['name']], ['uid' => $local_user]);
+               DBA::update('user', ['username' => $_POST['name']], ['uid' => $local_user]);
+               DBA::update('contact', ['name' => $_POST['name']], ['uid' => $local_user, 'self' => 1]);
+               DBA::update('contact', ['name' => $_POST['name']], ['id' => $api_user['id']]);
        }
 
        if (isset($_POST['description'])) {
-               dba::update('profile', ['about' => $_POST['description']], ['uid' => $local_user]);
-               dba::update('contact', ['about' => $_POST['description']], ['uid' => $local_user, 'self' => 1]);
-               dba::update('contact', ['about' => $_POST['description']], ['id' => $api_user['id']]);
+               DBA::update('profile', ['about' => $_POST['description']], ['uid' => $local_user]);
+               DBA::update('contact', ['about' => $_POST['description']], ['uid' => $local_user, 'self' => 1]);
+               DBA::update('contact', ['about' => $_POST['description']], ['id' => $api_user['id']]);
        }
 
        Worker::add(PRIORITY_LOW, 'ProfileUpdate', $local_user);
@@ -4701,7 +4701,7 @@ function api_friendica_remoteauth()
 
        // traditional DFRN
 
-       $contact = dba::selectFirst('contact', [], ['uid' => api_user(), 'nurl' => $c_url]);
+       $contact = DBA::selectFirst('contact', [], ['uid' => api_user(), 'nurl' => $c_url]);
 
        if (!DBM::is_result($contact) || ($contact['network'] !== NETWORK_DFRN)) {
                throw new BadRequestException("Unknown contact");
@@ -4724,7 +4724,7 @@ function api_friendica_remoteauth()
 
        $fields = ['uid' => api_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id,
                'sec' => $sec, 'expire' => time() + 45];
-       dba::insert('profile_check', $fields);
+       DBA::insert('profile_check', $fields);
 
        logger($contact['name'] . ' ' . $sec, LOGGER_DEBUG);
        $dest = ($url ? '&destination_url=' . $url : '');
@@ -5252,7 +5252,7 @@ function api_lists_destroy($type)
        }
 
        // get data of the specified group id
-       $group = dba::selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
+       $group = DBA::selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
        // error message if specified gid is not in database
        if (!$group) {
                throw new BadRequestException('gid not available');
@@ -5506,7 +5506,7 @@ function api_lists_update($type)
        }
 
        // get data of the specified group id
-       $group = dba::selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
+       $group = DBA::selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
        // error message if specified gid is not in database
        if (!$group) {
                throw new BadRequestException('gid not available');
@@ -5676,13 +5676,13 @@ function api_friendica_direct_messages_setseen($type)
        }
 
        // error message if specified id is not in database
-       if (!dba::exists('mail', ['id' => $id, 'uid' => $uid])) {
+       if (!DBA::exists('mail', ['id' => $id, 'uid' => $uid])) {
                $answer = ['result' => 'error', 'message' => 'message id not in database'];
                return api_format_data("direct_messages_setseen", $type, ['$result' => $answer]);
        }
 
        // update seen indicator
-       $result = dba::update('mail', ['seen' => true], ['id' => $id]);
+       $result = DBA::update('mail', ['seen' => true], ['id' => $id]);
 
        if ($result) {
                // return success
@@ -5852,7 +5852,7 @@ api_register_func('api/friendica/profile/show', 'api_friendica_profile_show', tr
  */
 function api_saved_searches_list($type)
 {
-       $terms = dba::select('search', ['id', 'term'], ['uid' => local_user()]);
+       $terms = DBA::select('search', ['id', 'term'], ['uid' => local_user()]);
 
        $result = [];
        while ($term = $terms->fetch()) {
@@ -5866,7 +5866,7 @@ function api_saved_searches_list($type)
                ];
        }
 
-       dba::close($terms);
+       DBA::close($terms);
 
        return api_format_data("terms", $type, ['terms' => $result]);
 }
index 9b37e32687d7fe09fd3eb35ea200879c08f33192..5dfd571ea58a3b1bcfbdd7fcccf6e3936fafe105 100644 (file)
@@ -12,7 +12,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
@@ -829,7 +829,7 @@ function item_photo_menu($item) {
        $network = '';
        $rel = 0;
        $condition = ['uid' => local_user(), 'nurl' => normalise_link($item['author-link'])];
-       $contact = dba::selectFirst('contact', ['id', 'network', 'rel'], $condition);
+       $contact = DBA::selectFirst('contact', ['id', 'network', 'rel'], $condition);
        if (DBM::is_result($contact)) {
                $cid = $contact['id'];
                $network = $contact['network'];
index a560c023121bc87f59f32829a81ce428e74381ec..57a277f3407a8223a45414313e51af785ab466ce 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 
 function dbesc($str) {
-       if (dba::$connected) {
-               return(dba::escape($str));
+       if (DBA::$connected) {
+               return(DBA::escape($str));
        } else {
                return(str_replace("'","\\'",$str));
        }
@@ -24,24 +24,24 @@ function q($sql) {
        $args = func_get_args();
        unset($args[0]);
 
-       if (!dba::$connected) {
+       if (!DBA::$connected) {
                return false;
        }
 
-       $sql = dba::clean_query($sql);
-       $sql = dba::any_value_fallback($sql);
+       $sql = DBA::clean_query($sql);
+       $sql = DBA::any_value_fallback($sql);
 
        $stmt = @vsprintf($sql, $args);
 
-       $ret = dba::p($stmt);
+       $ret = DBA::p($stmt);
 
        if (is_bool($ret)) {
                return $ret;
        }
 
-       $columns = dba::columnCount($ret);
+       $columns = DBA::columnCount($ret);
 
-       $data = dba::inArray($ret);
+       $data = DBA::inArray($ret);
 
        if ((count($data) == 0) && ($columns == 0)) {
                return true;
index 30ebe5d1ac7320ede7a1e243119167c852e888e4..b0a8c4b660aa635713e5e905f60d106a603e046b 100644 (file)
@@ -8,7 +8,7 @@ use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Item;
 use Friendica\Util\DateTimeFormat;
@@ -50,7 +50,7 @@ function notification($params)
        $sender_email = $a->getSenderEmailAddress();
 
        if ($params['type'] != SYSTEM_EMAIL) {
-               $user = dba::selectFirst('user', ['nickname', 'page-flags'],
+               $user = DBA::selectFirst('user', ['nickname', 'page-flags'],
                        ['uid' => $params['uid']]);
 
                // There is no need to create notifications for forum accounts
@@ -107,7 +107,7 @@ function notification($params)
        }
 
        if ($params['type'] == NOTIFY_COMMENT) {
-               $thread = dba::selectFirst('thread', ['ignored'], ['iid' => $parent_id]);
+               $thread = DBA::selectFirst('thread', ['ignored'], ['iid' => $parent_id]);
                if (DBM::is_result($thread) && $thread["ignored"]) {
                        logger("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
                        return;
@@ -506,7 +506,7 @@ function notification($params)
                );
                if ($p && (count($p) > 1)) {
                        for ($d = 1; $d < count($p); $d ++) {
-                               dba::delete('notify', ['id' => $p[$d]['id']]);
+                               DBA::delete('notify', ['id' => $p[$d]['id']]);
                        }
 
                        // only continue on if we stored the first one
@@ -666,13 +666,13 @@ function notification($params)
  */
 function check_user_notification($itemid) {
        // fetch all users in the thread
-       $users = dba::p("SELECT DISTINCT(`contact`.`uid`) FROM `item`
+       $users = DBA::p("SELECT DISTINCT(`contact`.`uid`) FROM `item`
                        INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` != 0
                        WHERE `parent` IN (SELECT `parent` FROM `item` WHERE `id`=?)", $itemid);
-       while ($user = dba::fetch($users)) {
+       while ($user = DBA::fetch($users)) {
                check_item_notification($itemid, $user['uid']);
        }
-       dba::close($users);
+       DBA::close($users);
 }
 
 /**
@@ -689,12 +689,12 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
        $profiles = $notification_data["profiles"];
 
        $fields = ['notify-flags', 'language', 'username', 'email', 'nickname'];
-       $user = dba::selectFirst('user', $fields, ['uid' => $uid]);
+       $user = DBA::selectFirst('user', $fields, ['uid' => $uid]);
        if (!DBM::is_result($user)) {
                return false;
        }
 
-       $owner = dba::selectFirst('contact', ['url'], ['self' => true, 'uid' => $uid]);
+       $owner = DBA::selectFirst('contact', ['url'], ['self' => true, 'uid' => $uid]);
        if (!DBM::is_result($owner)) {
                return false;
        }
@@ -727,17 +727,17 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
 
        $profiles = $profiles2;
 
-       $ret = dba::select('contact', ['id'], ['uid' => 0, 'nurl' => $profiles]);
+       $ret = DBA::select('contact', ['id'], ['uid' => 0, 'nurl' => $profiles]);
 
        $contacts = [];
 
-       while ($contact = dba::fetch($ret)) {
+       while ($contact = DBA::fetch($ret)) {
                $contacts[] = $contact['id'];
        }
 
        $contact_list = implode(',', $contacts);
 
-       dba::close($ret);
+       DBA::close($ret);
 
        // Only act if it is a "real" post
        // We need the additional check for the "local_profile" because of mixed situations on connector networks
@@ -767,7 +767,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
 
        if ($item["parent-uri"] === $item["uri"]) {
                // Send a notification for every new post?
-               $send_notification = dba::exists('contact', ['id' => $item['contact-id'], 'notify_new_posts' => true]);
+               $send_notification = DBA::exists('contact', ['id' => $item['contact-id'], 'notify_new_posts' => true]);
 
                if (!$send_notification) {
                        $tags = q("SELECT `url` FROM `term` WHERE `otype` = %d AND `oid` = %d AND `type` = %d AND `uid` = %d",
@@ -776,7 +776,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
                        if (DBM::is_result($tags)) {
                                foreach ($tags AS $tag) {
                                        $condition = ['nurl' => normalise_link($tag["url"]), 'uid' => $uid, 'notify_new_posts' => true];
-                                       $r = dba::exists('contact', $condition);
+                                       $r = DBA::exists('contact', $condition);
                                        if ($r) {
                                                $send_notification = true;
                                        }
index 14a74c8e51ea5afa0ff7e91cda3cd9aead2419b3..69472e96f6a9d93984753795e59747c1776fb480 100644 (file)
@@ -9,7 +9,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Item;
 use Friendica\Protocol\DFRN;
@@ -304,7 +304,7 @@ function subscribe_to_hub($url, $importer, $contact, $hubmode = 'subscribe') {
        logger('subscribe_to_hub: ' . $hubmode . ' ' . $contact['name'] . ' to hub ' . $url . ' endpoint: '  . $push_url . ' with verifier ' . $verify_token);
 
        if (!strlen($contact['hub-verify']) || ($contact['hub-verify'] != $verify_token)) {
-               dba::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]);
+               DBA::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]);
        }
 
        Network::post($url, $params);
index 64f32bd55e237ae4d1b362376bfb1929996b25ec..987f3b08e288de336c9ad47f184e1f6701669dc8 100644 (file)
@@ -8,7 +8,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Group;
 use Friendica\Util\DateTimeFormat;
@@ -100,7 +100,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
        $master_record = $a->user;
 
        if ((x($_SESSION, 'submanage')) && intval($_SESSION['submanage'])) {
-               $user = dba::selectFirst('user', [], ['uid' => $_SESSION['submanage']]);
+               $user = DBA::selectFirst('user', [], ['uid' => $_SESSION['submanage']]);
                if (DBM::is_result($user)) {
                        $master_record = $user;
                }
@@ -113,38 +113,38 @@ function authenticate_success($user_record, $login_initial = false, $interactive
                                'nickname' => $master_record['nickname']]];
 
                // Then add all the children
-               $r = dba::select('user', ['uid', 'username', 'nickname'],
+               $r = DBA::select('user', ['uid', 'username', 'nickname'],
                        ['parent-uid' => $master_record['uid'], 'account_removed' => false]);
                if (DBM::is_result($r)) {
-                       $a->identities = array_merge($a->identities, dba::inArray($r));
+                       $a->identities = array_merge($a->identities, DBA::inArray($r));
                }
        } else {
                // Just ensure that the array is always defined
                $a->identities = [];
 
                // First entry is our parent
-               $r = dba::select('user', ['uid', 'username', 'nickname'],
+               $r = DBA::select('user', ['uid', 'username', 'nickname'],
                        ['uid' => $master_record['parent-uid'], 'account_removed' => false]);
                if (DBM::is_result($r)) {
-                       $a->identities = dba::inArray($r);
+                       $a->identities = DBA::inArray($r);
                }
 
                // Then add all siblings
-               $r = dba::select('user', ['uid', 'username', 'nickname'],
+               $r = DBA::select('user', ['uid', 'username', 'nickname'],
                        ['parent-uid' => $master_record['parent-uid'], 'account_removed' => false]);
                if (DBM::is_result($r)) {
-                       $a->identities = array_merge($a->identities, dba::inArray($r));
+                       $a->identities = array_merge($a->identities, DBA::inArray($r));
                }
        }
 
-       $r = dba::p("SELECT `user`.`uid`, `user`.`username`, `user`.`nickname`
+       $r = DBA::p("SELECT `user`.`uid`, `user`.`username`, `user`.`nickname`
                FROM `manage`
                INNER JOIN `user` ON `manage`.`mid` = `user`.`uid`
                WHERE `user`.`account_removed` = 0 AND `manage`.`uid` = ?",
                $master_record['uid']
        );
        if (DBM::is_result($r)) {
-               $a->identities = array_merge($a->identities, dba::inArray($r));
+               $a->identities = array_merge($a->identities, DBA::inArray($r));
        }
 
        if ($login_initial) {
@@ -154,7 +154,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
                logger('auth_identities refresh: ' . print_r($a->identities, true), LOGGER_DEBUG);
        }
 
-       $contact = dba::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => true]);
+       $contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => true]);
        if (DBM::is_result($contact)) {
                $a->contact = $contact;
                $a->cid = $contact['id'];
@@ -164,10 +164,10 @@ function authenticate_success($user_record, $login_initial = false, $interactive
        header('X-Account-Management-Status: active; name="' . $a->user['username'] . '"; id="' . $a->user['nickname'] . '"');
 
        if ($login_initial || $login_refresh) {
-               dba::update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $_SESSION['uid']]);
+               DBA::update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $_SESSION['uid']]);
 
                // Set the login date for all identities of the user
-               dba::update('user', ['login_date' => DateTimeFormat::utcNow()],
+               DBA::update('user', ['login_date' => DateTimeFormat::utcNow()],
                        ['parent-uid' => $master_record['uid'], 'account_removed' => false]);
        }
 
index 8cdef23ccbf70307be1ed79c0e05842227465c03..f3655ff723ae36e4af9b395919f59084e3612efa 100644 (file)
--- a/index.php
+++ b/index.php
@@ -17,7 +17,7 @@ use Friendica\Core\Session;
 use Friendica\Core\System;
 use Friendica\Core\Theme;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Profile;
 use Friendica\Module\Login;
@@ -94,7 +94,7 @@ if (!$a->is_backend()) {
  */
 if (x($_SESSION, 'authenticated') && !x($_SESSION, 'language')) {
        // we haven't loaded user data yet, but we need user language
-       $user = dba::selectFirst('user', ['language'], ['uid' => $_SESSION['uid']]);
+       $user = DBA::selectFirst('user', ['language'], ['uid' => $_SESSION['uid']]);
        $_SESSION['language'] = $lang;
        if (DBM::is_result($user)) {
                $_SESSION['language'] = $user['language'];
index 32b86d90bbc338a703537d95068c5ab589155246..c1467d593016c9b488f45efa488b9657cde7f504 100644 (file)
@@ -6,7 +6,7 @@ use Friendica\App;
 use Friendica\Content\Widget;
 use Friendica\Core\ACL;
 use Friendica\Core\Addon;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
@@ -264,7 +264,7 @@ function acl_content(App $a)
                while ($author = Item::fetch($authors)) {
                        $item_authors[$author['author-link']] = $author['author-link'];
                }
-               dba::close($authors);
+               DBA::close($authors);
 
                foreach ($item_authors as $author) {
                        if (in_array($author, $known_contacts)) {
index 9a289dda5a2365ce6950b820205fd069605121e0..03035d9e11cbf06e87451d1864142323a89724fe 100644 (file)
@@ -14,7 +14,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Core\Theme;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Database\DBStructure;
 use Friendica\Model\Contact;
@@ -472,14 +472,14 @@ function admin_page_contactblock(App $a)
 {
        $condition = ['uid' => 0, 'blocked' => true];
 
-       $total = dba::count('contact', $condition);
+       $total = DBA::count('contact', $condition);
 
        $a->set_pager_total($total);
        $a->set_pager_itemspage(30);
 
-       $statement = dba::select('contact', [], $condition, ['limit' => [$a->pager['start'], $a->pager['itemspage']]]);
+       $statement = DBA::select('contact', [], $condition, ['limit' => [$a->pager['start'], $a->pager['itemspage']]]);
 
-       $contacts = dba::inArray($statement);
+       $contacts = DBA::inArray($statement);
 
        $t = get_markup_template('admin/contactblock.tpl');
        $o = replace_macros($t, [
@@ -781,8 +781,8 @@ function admin_page_queue(App $a)
 function admin_page_workerqueue(App $a)
 {
        // get jobs from the workerqueue table
-       $statement = dba::select('workerqueue', ['id', 'parameter', 'created', 'priority'], ['done' => 0], ['order'=> ['priority']]);
-       $r = dba::inArray($statement);
+       $statement = DBA::select('workerqueue', ['id', 'parameter', 'created', 'priority'], ['done' => 0], ['order'=> ['priority']]);
+       $r = DBA::inArray($statement);
 
        for($i = 0; $i < count($r); $i++) {
                $r[$i]['parameter'] = stripslashes(implode(': ', explode('","', $r[$i]['parameter'])));
@@ -817,7 +817,7 @@ function admin_page_workerqueue(App $a)
 function admin_page_summary(App $a)
 {
        // are there MyISAM tables in the DB? If so, trigger a warning message
-       $r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1", dbesc(dba::database_name()));
+       $r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1", dbesc(DBA::database_name()));
        $showwarning = false;
        $warningtext = [];
        if (DBM::is_result($r)) {
@@ -963,7 +963,7 @@ function admin_page_site_post(App $a)
                        $r = q("UPDATE %s SET %s;", $table_name, $upds);
 
                        if (!DBM::is_result($r)) {
-                               notice("Failed updating '$table_name': " . dba::errorMessage());
+                               notice("Failed updating '$table_name': " . DBA::errorMessage());
                                goaway('admin/site');
                        }
                }
@@ -1731,7 +1731,7 @@ function admin_page_users(App $a)
 {
        if ($a->argc > 2) {
                $uid = $a->argv[3];
-               $user = dba::selectFirst('user', ['username', 'blocked'], ['uid' => $uid]);
+               $user = DBA::selectFirst('user', ['username', 'blocked'], ['uid' => $uid]);
                if (!DBM::is_result($user)) {
                        notice('User not found' . EOL);
                        goaway('admin/users');
index e9d964847c8daa842bf59cf13c427bcf2371e754..585f787cd70e77051ab87dcb4b489a2038aa11b5 100644 (file)
@@ -7,7 +7,7 @@ use Friendica\App;
 use Friendica\Content\ContactSelector;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
@@ -35,7 +35,7 @@ function allfriends_content(App $a)
 
        $uid = $a->user['uid'];
 
-       $contact = dba::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => local_user()]);
+       $contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => local_user()]);
 
        if (!DBM::is_result($contact)) {
                return;
index 0b88fe28fc4a769533a9a80a0b3937c8156dc32a..e76fe8486960a116de0310cad8c4f575c4e15201 100644 (file)
@@ -5,7 +5,7 @@
 
 use Friendica\App;
 use Friendica\Core\L10n;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 require_once 'include/dba.php';
@@ -22,7 +22,7 @@ function attach_init(App $a)
 
        // Check for existence, which will also provide us the owner uid
 
-       $r = dba::selectFirst('attach', [], ['id' => $item_id]);
+       $r = DBA::selectFirst('attach', [], ['id' => $item_id]);
        if (!DBM::is_result($r)) {
                notice(L10n::t('Item was not found.'). EOL);
                return;
index 246d8a6447b6c7376fc3e00711a5ab6229422ce5..3c55a9cc811c97b0aa8a75330a4bfbb3f42b2ebc 100644 (file)
@@ -13,7 +13,7 @@ use Friendica\Content\Widget;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Event;
@@ -37,7 +37,7 @@ function cal_init(App $a)
 
        if ($a->argc > 1) {
                $nick = $a->argv[1];
-               $user = dba::selectFirst('user', [], ['nickname' => $nick, 'blocked' => false]);
+               $user = DBA::selectFirst('user', [], ['nickname' => $nick, 'blocked' => false]);
                if (!DBM::is_result($user)) {
                        return;
                }
index f6f826789bc23461b9c1eba6a50523a3cb3ba8e1..3fb67b20ea72a9b2c63ca04e4f54a018a38273b8 100644 (file)
@@ -6,7 +6,7 @@
 use Friendica\App;
 use Friendica\Content\ContactSelector;
 use Friendica\Core\L10n;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
@@ -38,14 +38,14 @@ function common_content(App $a)
        }
 
        if ($cmd === 'loc' && $cid) {
-               $contact = dba::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => $uid]);
+               $contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => $uid]);
 
                if (DBM::is_result($contact)) {
                        $a->page['aside'] = "";
                        Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
                }
        } else {
-               $contact = dba::selectFirst('contact', ['name', 'url', 'photo'], ['self' => true, 'uid' => $uid]);
+               $contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['self' => true, 'uid' => $uid]);
 
                if (DBM::is_result($contact)) {
                        $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [
@@ -66,11 +66,11 @@ function common_content(App $a)
        }
 
        if (!$cid && Profile::getMyURL()) {
-               $contact = dba::selectFirst('contact', ['id'], ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $uid]);
+               $contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $uid]);
                if (DBM::is_result($contact)) {
                        $cid = $contact['id'];
                } else {
-                       $gcontact = dba::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
+                       $gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
                        if (DBM::is_result($gcontact)) {
                                $zcid = $gcontact['id'];
                        }
index 97ecf00831567a48afc8858f6f161a462d5ff465..7775fdba4ab845d36c83c7618e22a6fa38ac12fb 100644 (file)
@@ -9,7 +9,7 @@ use Friendica\Core\ACL;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 function community_init(App $a)
@@ -190,7 +190,7 @@ function community_content(App $a, $update = 0)
 function community_getitems($start, $itemspage, $content)
 {
        if ($content == 'local') {
-               $r = dba::p("SELECT `item`.`uri`, `author`.`url` AS `author-link` FROM `thread`
+               $r = DBA::p("SELECT `item`.`uri`, `author`.`url` AS `author-link` FROM `thread`
                        INNER JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall`
                        INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
                        INNER JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
@@ -198,14 +198,14 @@ function community_getitems($start, $itemspage, $content)
                        AND NOT `thread`.`private` AND `thread`.`wall` AND `thread`.`origin`
                        ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage)
                );
-               return dba::inArray($r);
+               return DBA::inArray($r);
        } elseif ($content == 'global') {
-               $r = dba::p("SELECT `uri` FROM `thread`
+               $r = DBA::p("SELECT `uri` FROM `thread`
                                INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
                                INNER JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
                                WHERE `thread`.`uid` = 0 AND NOT `author`.`hidden` AND NOT `author`.`blocked`
                                ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage));
-               return dba::inArray($r);
+               return DBA::inArray($r);
        }
 
        // Should never happen
index 736d16dfb94cdf279634b0425bed461c26097cec..8832862b8777b4fec734df4cfc3054a58587076f 100644 (file)
@@ -12,7 +12,7 @@ use Friendica\Core\Addon;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
@@ -42,7 +42,7 @@ function contacts_init(App $a)
        $contact = null;
        if ((($a->argc == 2) && intval($a->argv[1])) || (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts"))) {
                $contact_id = intval($a->argv[1]);
-               $contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
+               $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
        }
 
        if (DBM::is_result($contact)) {
@@ -181,7 +181,7 @@ function contacts_post(App $a)
                return;
        }
 
-       if (!dba::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
+       if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
                notice(L10n::t('Could not access contact record.') . EOL);
                goaway('contacts');
                return; // NOTREACHED
@@ -191,7 +191,7 @@ function contacts_post(App $a)
 
        $profile_id = intval($_POST['profile-assign']);
        if ($profile_id) {
-               if (!dba::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) {
+               if (!DBA::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) {
                        notice(L10n::t('Could not locate selected profile.') . EOL);
                        return;
                }
@@ -231,7 +231,7 @@ function contacts_post(App $a)
                notice(L10n::t('Failed to update contact record.') . EOL);
        }
 
-       $contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
+       $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
        if (DBM::is_result($contact)) {
                $a->data['contact'] = $contact;
        }
@@ -243,7 +243,7 @@ function contacts_post(App $a)
 
 function _contact_update($contact_id)
 {
-       $contact = dba::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
+       $contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
        if (!DBM::is_result($contact)) {
                return;
        }
@@ -264,7 +264,7 @@ function _contact_update($contact_id)
 
 function _contact_update_profile($contact_id)
 {
-       $contact = dba::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
+       $contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
        if (!DBM::is_result($contact)) {
                return;
        }
@@ -396,7 +396,7 @@ function contacts_content(App $a)
 
                $cmd = $a->argv[2];
 
-               $orig_record = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'self' => false]);
+               $orig_record = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'self' => false]);
                if (!DBM::is_result($orig_record)) {
                        notice(L10n::t('Could not access contact record.') . EOL);
                        goaway('contacts');
@@ -910,7 +910,7 @@ function contact_posts($a, $contact_id)
 {
        $o = contacts_tab($a, $contact_id, 1);
 
-       $contact = dba::selectFirst('contact', ['url'], ['id' => $contact_id]);
+       $contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id]);
        if (DBM::is_result($contact)) {
                $a->page['aside'] = "";
                Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
index e23e082240c8ee4d14d7f006971f1dbd4dcc6316..12ec9672f4965d80451575e93f0ff7c0c33daacb 100644 (file)
@@ -6,7 +6,7 @@
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Profile;
@@ -21,7 +21,7 @@ function crepair_init(App $a)
 
        $contact = null;
        if (($a->argc == 2) && intval($a->argv[1])) {
-               $contact = dba::selectFirst('contact', [], ['uid' => local_user(), 'id' => $a->argv[1]]);
+               $contact = DBA::selectFirst('contact', [], ['uid' => local_user(), 'id' => $a->argv[1]]);
        }
 
        if (!x($a->page, 'aside')) {
@@ -44,7 +44,7 @@ function crepair_post(App $a)
 
        $contact = null;
        if ($cid) {
-               $contact = dba::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
+               $contact = DBA::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
        }
 
        if (!DBM::is_result($contact)) {
@@ -105,7 +105,7 @@ function crepair_content(App $a)
 
                $contact = null;
        if ($cid) {
-               $contact = dba::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
+               $contact = DBA::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
        }
 
        if (!DBM::is_result($contact)) {
index 60cf13046455832bc9038d0064723b5a7f97cf94..7a98be75513e87bc87b202d6c7617010dcda2ee2 100644 (file)
@@ -6,7 +6,7 @@
 use Friendica\App;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\User;
 
@@ -34,7 +34,7 @@ function delegate_post(App $a)
        $parent_password = defaults($_POST, 'parent_password', '');
 
        if ($parent_uid != 0) {
-               $user = dba::selectFirst('user', ['nickname'], ['uid' => $parent_uid]);
+               $user = DBA::selectFirst('user', ['nickname'], ['uid' => $parent_uid]);
                if (!DBM::is_result($user)) {
                        notice(L10n::t('Parent user not found.') . EOL);
                        return;
@@ -47,7 +47,7 @@ function delegate_post(App $a)
                }
        }
 
-       dba::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
+       DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
 }
 
 function delegate_content(App $a)
@@ -65,14 +65,14 @@ function delegate_content(App $a)
 
                $user_id = $a->argv[2];
 
-               $user = dba::selectFirst('user', ['nickname'], ['uid' => $user_id]);
+               $user = DBA::selectFirst('user', ['nickname'], ['uid' => $user_id]);
                if (DBM::is_result($user)) {
                        $condition = [
                                'uid' => local_user(),
                                'nurl' => normalise_link(System::baseUrl() . '/profile/' . $user['nickname'])
                        ];
-                       if (dba::exists('contact', $condition)) {
-                               dba::insert('manage', ['uid' => $user_id, 'mid' => local_user()]);
+                       if (DBA::exists('contact', $condition)) {
+                               DBA::insert('manage', ['uid' => $user_id, 'mid' => local_user()]);
                        }
                }
                goaway(System::baseUrl() . '/delegate');
@@ -84,7 +84,7 @@ function delegate_content(App $a)
                        goaway(System::baseUrl() . '/delegate');
                }
 
-               dba::delete('manage', ['uid' => $a->argv[2], 'mid' => local_user()]);
+               DBA::delete('manage', ['uid' => $a->argv[2], 'mid' => local_user()]);
                goaway(System::baseUrl() . '/delegate');
        }
 
@@ -136,19 +136,19 @@ function delegate_content(App $a)
 
        settings_init($a);
 
-       $user = dba::selectFirst('user', ['parent-uid', 'email'], ['uid' => local_user()]);
+       $user = DBA::selectFirst('user', ['parent-uid', 'email'], ['uid' => local_user()]);
 
        $parent_user = null;
 
        if (DBM::is_result($user)) {
-               if (!dba::exists('user', ['parent-uid' => local_user()])) {
+               if (!DBA::exists('user', ['parent-uid' => local_user()])) {
                        $parent_uid = $user['parent-uid'];
                        $parents = [0 => L10n::t('No parent user')];
 
                        $fields = ['uid', 'username', 'nickname'];
                        $condition = ['email' => $user['email'], 'verified' => true, 'blocked' => false, 'parent-uid' => 0];
-                       $parent_users = dba::select('user', $fields, $condition);
-                       while ($parent = dba::fetch($parent_users)) {
+                       $parent_users = DBA::select('user', $fields, $condition);
+                       while ($parent = DBA::fetch($parent_users)) {
                                if ($parent['uid'] != local_user()) {
                                        $parents[$parent['uid']] = sprintf('%s (%s)', $parent['username'], $parent['nickname']);
                                }
index 32a9d59f9e874111fa3b98526e666734bf8cfbdc..317eb9e2e7bceb3b8c606271e1582e910df7bdd6 100644 (file)
@@ -21,7 +21,7 @@ use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
@@ -67,7 +67,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                        return;
                }
 
-               $user = dba::selectFirst('user', [], ['uid' => $uid]);
+               $user = DBA::selectFirst('user', [], ['uid' => $uid]);
                if (!DBM::is_result($user)) {
                        notice(L10n::t('Profile not found.') . EOL);
                        return;
@@ -280,13 +280,13 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                        }
 
                        if (($status == 0) && $intro_id) {
-                               $intro = dba::selectFirst('intro', ['note'], ['id' => $intro_id]);
+                               $intro = DBA::selectFirst('intro', ['note'], ['id' => $intro_id]);
                                if (DBM::is_result($intro)) {
-                                       dba::update('contact', ['reason' => $intro['note']], ['id' => $contact_id]);
+                                       DBA::update('contact', ['reason' => $intro['note']], ['id' => $contact_id]);
                                }
 
                                // Success. Delete the notification.
-                               dba::delete('intro', ['id' => $intro_id]);
+                               DBA::delete('intro', ['id' => $intro_id]);
                        }
 
                        if ($status != 0) {
@@ -358,7 +358,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                                }
                        }
 
-                       dba::delete('intro', ['id' => $intro_id]);
+                       DBA::delete('intro', ['id' => $intro_id]);
 
                        $r = q("UPDATE `contact` SET `name-date` = '%s',
                                `uri-date` = '%s',
@@ -391,7 +391,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                }
 
                // reload contact info
-               $contact = dba::selectFirst('contact', [], ['id' => $contact_id]);
+               $contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
                if ((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) {
                        if (DBM::is_result($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
                                $ret = Diaspora::sendShare($user, $contact);
@@ -443,7 +443,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                }
 
                // Find our user's account
-               $user = dba::selectFirst('user', [], ['nickname' => $node]);
+               $user = DBA::selectFirst('user', [], ['nickname' => $node]);
                if (!DBM::is_result($user)) {
                        $message = L10n::t('No user record found for \'%s\' ', $node);
                        System::xmlExit(3, $message); // failure
@@ -471,7 +471,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                        // NOTREACHED
                }
 
-               $contact = dba::selectFirst('contact', [], ['url' => $decrypted_source_url, 'uid' => $local_uid]);
+               $contact = DBA::selectFirst('contact', [], ['url' => $decrypted_source_url, 'uid' => $local_uid]);
                if (!DBM::is_result($contact)) {
                        if (strstr($decrypted_source_url, 'http:')) {
                                $newurl = str_replace('http:', 'https:', $decrypted_source_url);
@@ -479,7 +479,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                                $newurl = str_replace('https:', 'http:', $decrypted_source_url);
                        }
 
-                       $contact = dba::selectFirst('contact', [], ['url' => $newurl, 'uid' => $local_uid]);
+                       $contact = DBA::selectFirst('contact', [], ['url' => $newurl, 'uid' => $local_uid]);
                        if (!DBM::is_result($contact)) {
                                // this is either a bogus confirmation (?) or we deleted the original introduction.
                                $message = L10n::t('Contact record was not found for you on our site.');
@@ -511,7 +511,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                        $dfrn_pubkey = $public_key;
                }
 
-               if (dba::exists('contact', ['dfrn-id' => $decrypted_dfrn_id])) {
+               if (DBA::exists('contact', ['dfrn-id' => $decrypted_dfrn_id])) {
                        $message = L10n::t('The ID provided by your system is a duplicate on our system. It should work if you try again.');
                        System::xmlExit(1, $message); // Birthday paradox - duplicate dfrn-id
                        // NOTREACHED
@@ -537,7 +537,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                }
 
                // We're good but now we have to scrape the profile photo and send notifications.
-               $contact = dba::selectFirst('contact', ['photo'], ['id' => $dfrn_record]);
+               $contact = DBA::selectFirst('contact', ['photo'], ['id' => $dfrn_record]);
                if (DBM::is_result($contact)) {
                        $photo = $contact['photo'];
                } else {
index e3569965720af8b5b400df5e236ab745841f041e..726f8335db4f76336cf405af2be653f4f530cfa2 100644 (file)
@@ -9,7 +9,7 @@
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Protocol\DFRN;
@@ -27,7 +27,7 @@ function dfrn_notify_post(App $a) {
                if (is_object($data)) {
                        $nick = defaults($a->argv, 1, '');
 
-                       $user = dba::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
+                       $user = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
                        if (!DBM::is_result($user)) {
                                System::httpExit(500);
                        }
@@ -63,12 +63,12 @@ function dfrn_notify_post(App $a) {
                $dfrn_id = substr($dfrn_id, 2);
        }
 
-       if (!dba::exists('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge])) {
+       if (!DBA::exists('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge])) {
                logger('could not match challenge to dfrn_id ' . $dfrn_id . ' challenge=' . $challenge);
                System::xmlExit(3, 'Could not match challenge');
        }
 
-       dba::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
+       DBA::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
 
        // find the local user who owns this relationship.
 
@@ -121,7 +121,7 @@ function dfrn_notify_post(App $a) {
        if ((($writable != (-1)) && ($writable != $importer['writable'])) || ($importer['forum'] != $forum) || ($importer['prv'] != $prv)) {
                $fields = ['writable' => ($writable == (-1)) ? $importer['writable'] : $writable,
                        'forum' => $forum, 'prv' => $prv];
-               dba::update('contact', $fields, ['id' => $importer['id']]);
+               DBA::update('contact', $fields, ['id' => $importer['id']]);
 
                if ($writable != (-1)) {
                        $importer['writable'] = $writable;
@@ -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::fetch_first("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::fetch_first("SELECT *, `name` as `senderName`
                                        FROM `contact`
                                        WHERE NOT `blocked` AND `id` = ? LIMIT 1",
                                        $cid);
@@ -302,11 +302,11 @@ function dfrn_notify_content(App $a) {
 
                $status = 0;
 
-               dba::delete('challenge', ["`expire` < ?", time()]);
+               DBA::delete('challenge', ["`expire` < ?", time()]);
 
                $fields = ['challenge' => $hash, 'dfrn-id' => $dfrn_id, 'expire' => time() + 90,
                        'type' => $type, 'last_update' => $last_update];
-               dba::insert('challenge', $fields);
+               DBA::insert('challenge', $fields);
 
                logger('challenge=' . $hash, LOGGER_DATA);
 
index 32a8013c3169d4cf61e8e41c430f2cd964e73251..fa9ad13f5679d1b0b4978d3232818c5409853fe1 100644 (file)
@@ -8,7 +8,7 @@ use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Module\Login;
 use Friendica\Protocol\DFRN;
@@ -143,7 +143,7 @@ function dfrn_poll_init(App $a)
 
        if ($type === 'profile-check' && $dfrn_version < 2.2) {
                if ((strlen($challenge)) && (strlen($sec))) {
-                       dba::delete('profile_check', ["`expire` < ?", time()]);
+                       DBA::delete('profile_check', ["`expire` < ?", time()]);
                        $r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
                                dbesc($sec)
                        );
@@ -208,7 +208,7 @@ function dfrn_poll_init(App $a)
                                        break;
                        }
 
-                       dba::delete('profile_check', ["`expire` < ?", time()]);
+                       DBA::delete('profile_check', ["`expire` < ?", time()]);
                        $r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC",
                                dbesc($dfrn_id));
                        if (DBM::is_result($r)) {
@@ -235,7 +235,7 @@ function dfrn_poll_post(App $a)
                if (strlen($challenge) && strlen($sec)) {
                        logger('dfrn_poll: POST: profile-check');
 
-                       dba::delete('profile_check', ["`expire` < ?", time()]);
+                       DBA::delete('profile_check', ["`expire` < ?", time()]);
                        $r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
                                dbesc($sec)
                        );
@@ -308,7 +308,7 @@ function dfrn_poll_post(App $a)
        $type = $r[0]['type'];
        $last_update = $r[0]['last_update'];
 
-       dba::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
+       DBA::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
 
        $sql_extra = '';
        switch ($direction) {
@@ -413,7 +413,7 @@ function dfrn_poll_content(App $a)
 
                $status = 0;
 
-               dba::delete('challenge', ["`expire` < ?", time()]);
+               DBA::delete('challenge', ["`expire` < ?", time()]);
 
                if ($type !== 'profile') {
                        $r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` , `type`, `last_update` )
index 8713785ad4e983410bc836b24a52aa486d94595d..fd0498a5f2f23ced1976a6650e27c12be7f0aa32 100644 (file)
@@ -16,7 +16,7 @@ use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
@@ -262,9 +262,9 @@ function dfrn_request_post(App $a)
                if (DBM::is_result($r)) {
                        foreach ($r as $rr) {
                                if (!$rr['rel']) {
-                                       dba::delete('contact', ['id' => $rr['cid'], 'self' => false]);
+                                       DBA::delete('contact', ['id' => $rr['cid'], 'self' => false]);
                                }
-                               dba::delete('intro', ['id' => $rr['iid']]);
+                               DBA::delete('intro', ['id' => $rr['iid']]);
                        }
                }
 
index 85bcbf81303085e63c8fcd775bd41d7f2d42158c..2f5d364e911ad864918654bdbc41f4f3ef969d28 100644 (file)
@@ -9,7 +9,7 @@ use Friendica\Content\Widget;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Profile;
@@ -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::fetch_first("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)) {
@@ -94,7 +94,7 @@ function directory_content(App $a)
 
        $limit = intval($a->pager['start'])."," . intval($a->pager['itemspage']);
 
-       $r = dba::p("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` , `user`.`page-flags`,
+       $r = DBA::p("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` , `user`.`page-flags`,
                        `contact`.`addr`, `contact`.`url` AS profile_url FROM `profile`
                        LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
                        LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid`
@@ -108,7 +108,7 @@ function directory_content(App $a)
                        $photo = 'photo';
                }
 
-               while ($rr = dba::fetch($r)) {
+               while ($rr = DBA::fetch($r)) {
                        $itemurl= '';
 
                        $itemurl = (($rr['addr'] != "") ? $rr['addr'] : $rr['profile_url']);
@@ -196,7 +196,7 @@ function directory_content(App $a)
 
                        $entries[] = $arr['entry'];
                }
-               dba::close($r);
+               DBA::close($r);
 
                $tpl = get_markup_template('directory_header.tpl');
 
index 257c8b11aa44be12f7637feb9557a0449be28e97..04fb104de977894b2a9b586e1da657e7e79dda1d 100644 (file)
@@ -10,7 +10,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
@@ -203,7 +203,7 @@ function dirfind_content(App $a, $prefix = "") {
                                if ($jj->cid > 0) {
                                        $connlnk = "";
                                        $conntxt = "";
-                                       $contact = dba::selectFirst('contact', [], ['id' => $jj->cid]);
+                                       $contact = DBA::selectFirst('contact', [], ['id' => $jj->cid]);
                                        if (DBM::is_result($contact)) {
                                                $photo_menu = Contact::photoMenu($contact);
                                                $details = _contact_detail_for_template($contact);
index 3775d263c851b42893c1d633e71e2d1990e9730e..e615b68437b45fd8c9d44a8ae0b5a70e277812e8 100644 (file)
@@ -11,7 +11,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\Protocol;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
@@ -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::fetch_first("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
@@ -106,7 +106,7 @@ function display_init(App $a)
 
 function display_fetchauthor($a, $item)
 {
-       $author = dba::selectFirst('contact', ['name', 'nick', 'photo', 'network', 'url'], ['id' => $item['author-id']]);
+       $author = DBA::selectFirst('contact', ['name', 'nick', 'photo', 'network', 'url'], ['id' => $item['author-id']]);
 
        $profiledata = [];
        $profiledata['uid'] = -1;
@@ -248,7 +248,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
        }
 
        // We are displaying an "alternate" link if that post was public. See issue 2864
-       $is_public = dba::exists('item', ['id' => $item_id, 'private' => [0, 2]]);
+       $is_public = DBA::exists('item', ['id' => $item_id, 'private' => [0, 2]]);
        if ($is_public) {
                // For the atom feed the nickname doesn't matter at all, we only need the item id.
                $alternate = System::baseUrl().'/display/feed-item/'.$item_id.'.atom';
@@ -280,7 +280,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
 
        if ($contact_id) {
                $groups = Group::getIdsByContactId($contact_id);
-               $remote_contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $a->profile['uid']]);
+               $remote_contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $a->profile['uid']]);
                if (DBM::is_result($remote_contact)) {
                        $contact = $remote_contact;
                        $is_remote_contact = true;
@@ -294,7 +294,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
                }
        }
 
-       $page_contact = dba::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);
+       $page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);
        if (DBM::is_result($page_contact)) {
                $a->page_contact = $page_contact;
        }
@@ -325,7 +325,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
 
        if (local_user() && (local_user() == $a->profile['uid'])) {
                $condition = ['parent-uri' => $item_parent_uri, 'uid' => local_user(), 'unseen' => true];
-               $unseen = dba::exists('item', $condition);
+               $unseen = DBA::exists('item', $condition);
        } else {
                $unseen = false;
        }
index a96b1f5d031c78537b8e85c49cafbbac1d58763b..d9a9abb91fc670c7a7545a1636610d6ccb383fd7 100644 (file)
@@ -6,7 +6,7 @@
 
 use Friendica\App;
 use Friendica\Core\L10n;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Model\Contact;
 use Friendica\Protocol\Feed;
 use Friendica\Util\Network;
@@ -26,11 +26,11 @@ function feedtest_content(App $a)
        if (!empty($_REQUEST['url'])) {
                $url = $_REQUEST['url'];
 
-               $importer = dba::selectFirst('user', [], ['uid' => local_user()]);
+               $importer = DBA::selectFirst('user', [], ['uid' => local_user()]);
 
                $contact_id = Contact::getIdForURL($url, local_user(), true);
 
-               $contact = dba::selectFirst('contact', [], ['id' => $contact_id]);
+               $contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
 
                $ret = Network::curl($contact['poll']);
                $xml = $ret['body'];
index dfec16854113bea9ada0a4fdbd1ee704fb129645..f0dbe4873c7108aed1597ce22d46f8b402cb335e 100644 (file)
@@ -11,7 +11,7 @@
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
 
@@ -47,7 +47,7 @@ function hovercard_content()
        $cid = 0;
        if (strpos($profileurl, 'redir/') === 0) {
                $cid = intval(substr($profileurl, 6));
-               $remote_contact = dba::selectFirst('contact', ['nurl'], ['id' => $cid]);
+               $remote_contact = DBA::selectFirst('contact', ['nurl'], ['id' => $cid]);
                $profileurl = defaults($remote_contact, 'nurl', '');
        }
 
index 59dcf92c56cba012850c7ef2e365b55038a99310..d55ee6ea8bbbc644f1ac1750e8d304251faab1c9 100644 (file)
@@ -7,7 +7,7 @@ use Friendica\App;
 use Friendica\Core\Install;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Util\Temporal;
 
@@ -53,7 +53,7 @@ function install_post(App $a) {
                        $phpath = notags(trim($_POST['phpath']));
 
                        require_once("include/dba.php");
-                       if (!dba::connect($dbhost, $dbuser, $dbpass, $dbdata)) {
+                       if (!DBA::connect($dbhost, $dbuser, $dbpass, $dbdata)) {
                                $a->data['db_conn_failed'] = true;
                        }
 
@@ -71,7 +71,7 @@ function install_post(App $a) {
                        $adminmail = notags(trim($_POST['adminmail']));
 
                        // connect to db
-                       dba::connect($dbhost, $dbuser, $dbpass, $dbdata);
+                       DBA::connect($dbhost, $dbuser, $dbpass, $dbdata);
 
                        Install::install($urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $phpath, $timezone, $language, $adminmail);
 
@@ -112,7 +112,7 @@ function install_content(App $a) {
                $db_return_text .= $txt;
        }
 
-       if (dba::$connected) {
+       if (DBA::$connected) {
                $r = q("SELECT COUNT(*) as `total` FROM `user`");
                if (DBM::is_result($r) && $r[0]['total']) {
                        $tpl = get_markup_template('install.tpl');
index 7bcfdfbe35934ecebb2d8260739c711f9b9cf9eb..72e9f5252a16e0482993e5913cdc65fb04c52b52 100644 (file)
@@ -23,7 +23,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
@@ -146,7 +146,7 @@ function item_post(App $a) {
 
        // Check for multiple posts with the same message id (when the post was created via API)
        if (($message_id != '') && ($profile_uid != 0)) {
-               if (dba::exists('item', ['uri' => $message_id, 'uid' => $profile_uid])) {
+               if (DBA::exists('item', ['uri' => $message_id, 'uid' => $profile_uid])) {
                        logger("Message with URI ".$message_id." already exists for user ".$profile_uid, LOGGER_DEBUG);
                        return;
                }
@@ -174,7 +174,7 @@ function item_post(App $a) {
                $orig_post = Item::selectFirst(Item::ITEM_FIELDLIST, ['id' => $post_id]);
        }
 
-       $user = dba::selectFirst('user', [], ['uid' => $profile_uid]);
+       $user = DBA::selectFirst('user', [], ['uid' => $profile_uid]);
 
        if (!DBM::is_result($user) && !$parent) {
                return;
@@ -268,7 +268,7 @@ function item_post(App $a) {
                // if using the API, we won't see pubmail_enable - figure out if it should be set
                if ($api_source && $profile_uid && $profile_uid == local_user() && !$private) {
                        if (function_exists('imap_open') && !Config::get('system', 'imap_disabled')) {
-                               $pubmail_enabled = dba::exists('mailacct', ["`uid` = ? AND `server` != ? AND `pubmail`", local_user(), '']);
+                               $pubmail_enabled = DBA::exists('mailacct', ["`uid` = ? AND `server` != ? AND `pubmail`", local_user(), '']);
                        }
                }
 
@@ -305,7 +305,7 @@ function item_post(App $a) {
 
        if (local_user() && ((local_user() == $profile_uid) || $allow_comment)) {
                $self = true;
-               $author = dba::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
+               $author = DBA::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
        } elseif (remote_user()) {
                if (x($_SESSION, 'remote') && is_array($_SESSION['remote'])) {
                        foreach ($_SESSION['remote'] as $v) {
@@ -316,7 +316,7 @@ function item_post(App $a) {
                        }
                }
                if ($contact_id) {
-                       $author = dba::selectFirst('contact', [], ['id' => $contact_id]);
+                       $author = DBA::selectFirst('contact', [], ['id' => $contact_id]);
                }
        }
 
@@ -328,7 +328,7 @@ function item_post(App $a) {
        if ($profile_uid == local_user() || $allow_comment) {
                $contact_record = $author;
        } else {
-               $contact_record = dba::selectFirst('contact', [], ['uid' => $profile_uid, 'self' => true]);
+               $contact_record = DBA::selectFirst('contact', [], ['uid' => $profile_uid, 'self' => true]);
        }
 
        // Look for any tags and linkify them
@@ -458,14 +458,14 @@ function item_post(App $a) {
 
                                $condition = ['allow_cid' => $srch, 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '',
                                                'resource-id' => $image_uri, 'uid' => $profile_uid];
-                               if (!dba::exists('photo', $condition)) {
+                               if (!DBA::exists('photo', $condition)) {
                                        continue;
                                }
 
                                $fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
                                                'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny];
                                $condition = ['resource-id' => $image_uri, 'uid' => $profile_uid, 'album' => L10n::t('Wall Photos')];
-                               dba::update('photo', $fields, $condition);
+                               DBA::update('photo', $fields, $condition);
                        }
                }
        }
@@ -486,14 +486,14 @@ function item_post(App $a) {
 
                                $condition = ['allow_cid' => $srch, 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '',
                                                'id' => $attach];
-                               if (!dba::exists('attach', $condition)) {
+                               if (!DBA::exists('attach', $condition)) {
                                        continue;
                                }
 
                                $fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
                                                'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny];
                                $condition = ['id' => $attach];
-                               dba::update('attach', $fields, $condition);
+                               DBA::update('attach', $fields, $condition);
                        }
                }
        }
@@ -536,7 +536,7 @@ function item_post(App $a) {
        if (preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
                foreach ($match[2] as $mtch) {
                        $fields = ['id', 'filename', 'filesize', 'filetype'];
-                       $attachment = dba::selectFirst('attach', $fields, ['id' => $mtch]);
+                       $attachment = DBA::selectFirst('attach', $fields, ['id' => $mtch]);
                        if (DBM::is_result($attachment)) {
                                if (strlen($attachments)) {
                                        $attachments .= ',';
@@ -636,7 +636,7 @@ function item_post(App $a) {
        // This field is for storing the raw conversation data
        $datarray['protocol'] = PROTOCOL_DFRN;
 
-       $conversation = dba::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $datarray['parent-uri']]);
+       $conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $datarray['parent-uri']]);
        if (DBM::is_result($conversation)) {
                if ($conversation['conversation-uri'] != '') {
                        $datarray['conversation-uri'] = $conversation['conversation-uri'];
@@ -960,32 +960,32 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n
                        if (strrpos($name, '+')) {
                                // Is it in format @nick+number?
                                $tagcid = intval(substr($name, strrpos($name, '+') + 1));
-                               $contact = dba::selectFirst('contact', $fields, ['id' => $tagcid, 'uid' => $profile_uid]);
+                               $contact = DBA::selectFirst('contact', $fields, ['id' => $tagcid, 'uid' => $profile_uid]);
                        }
 
                        // select someone by nick or attag in the current network
                        if (!DBM::is_result($contact) && ($network != "")) {
                                $condition = ["(`nick` = ? OR `attag` = ?) AND `network` = ? AND `uid` = ?",
                                                $name, $name, $network, $profile_uid];
-                               $contact = dba::selectFirst('contact', $fields, $condition);
+                               $contact = DBA::selectFirst('contact', $fields, $condition);
                        }
 
                        //select someone by name in the current network
                        if (!DBM::is_result($contact) && ($network != "")) {
                                $condition = ['name' => $name, 'network' => $network, 'uid' => $profile_uid];
-                               $contact = dba::selectFirst('contact', $fields, $condition);
+                               $contact = DBA::selectFirst('contact', $fields, $condition);
                        }
 
                        // select someone by nick or attag in any network
                        if (!DBM::is_result($contact)) {
                                $condition = ["(`nick` = ? OR `attag` = ?) AND `uid` = ?", $name, $name, $profile_uid];
-                               $contact = dba::selectFirst('contact', $fields, $condition);
+                               $contact = DBA::selectFirst('contact', $fields, $condition);
                        }
 
                        // select someone by name in any network
                        if (!DBM::is_result($contact)) {
                                $condition = ['name' => $name, 'uid' => $profile_uid];
-                               $contact = dba::selectFirst('contact', $fields, $condition);
+                               $contact = DBA::selectFirst('contact', $fields, $condition);
                        }
                }
 
index 07c24f158016df4519234e0b5a10c29fe18efd05..59071b1045bda27c276143931967436635ea44a1 100644 (file)
@@ -7,7 +7,7 @@ use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\User;
 use Friendica\Util\DateTimeFormat;
@@ -24,7 +24,7 @@ function lostpass_post(App $a)
        }
 
        $condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame];
-       $user = dba::selectFirst('user', ['uid', 'username', 'email'], $condition);
+       $user = DBA::selectFirst('user', ['uid', 'username', 'email'], $condition);
        if (!DBM::is_result($user)) {
                notice(L10n::t('No valid account found.') . EOL);
                goaway(System::baseUrl());
@@ -36,7 +36,7 @@ function lostpass_post(App $a)
                'pwdreset' => $pwdreset_token,
                'pwdreset_time' => DateTimeFormat::utcNow()
        ];
-       $result = dba::update('user', $fields, ['uid' => $user['uid']]);
+       $result = DBA::update('user', $fields, ['uid' => $user['uid']]);
        if ($result) {
                info(L10n::t('Password reset request issued. Check your email.') . EOL);
        }
@@ -86,7 +86,7 @@ function lostpass_content(App $a)
        if ($a->argc > 1) {
                $pwdreset_token = $a->argv[1];
 
-               $user = dba::selectFirst('user', ['uid', 'username', 'email', 'pwdreset_time'], ['pwdreset' => $pwdreset_token]);
+               $user = DBA::selectFirst('user', ['uid', 'username', 'email', 'pwdreset_time'], ['pwdreset' => $pwdreset_token]);
                if (!DBM::is_result($user)) {
                        notice(L10n::t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
 
@@ -99,7 +99,7 @@ function lostpass_content(App $a)
                                'pwdreset' => null,
                                'pwdreset_time' => null
                        ];
-                       dba::update('user', $fields, ['uid' => $user['uid']]);
+                       DBA::update('user', $fields, ['uid' => $user['uid']]);
 
                        notice(L10n::t('Request has expired, please make a new one.'));
 
index ccdb377b2f2a6f8c67098d8ff016c0044fd5da7a..61af60530249c1df6b8e8d8658ccc392f407661c 100644 (file)
@@ -10,7 +10,7 @@ use Friendica\Content\Text\BBCode;
 use Friendica\Core\ACL;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Mail;
@@ -150,7 +150,7 @@ function message_content(App $a)
 
                $cmd = $a->argv[1];
                if ($cmd === 'drop') {
-                       if (dba::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
+                       if (DBA::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
                                info(L10n::t('Message deleted.') . EOL);
                        }
 
@@ -165,7 +165,7 @@ function message_content(App $a)
                                $parent = $r[0]['parent-uri'];
                                $convid = $r[0]['convid'];
 
-                               if (dba::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
+                               if (DBA::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
                                        info(L10n::t('Conversation removed.') . EOL);
                                }
                        }
index af9e111c9fd89de98f11d3cc278323ca98d48eee..79910152b3937e3f8cb05a379a0efcf26642ff1a 100644 (file)
@@ -15,7 +15,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
@@ -41,13 +41,13 @@ function network_init(App $a)
        }
 
        if (x($_GET, 'save')) {
-               $exists = dba::exists('search', ['uid' => local_user(), 'term' => $search]);
+               $exists = DBA::exists('search', ['uid' => local_user(), 'term' => $search]);
                if (!$exists) {
-                       dba::insert('search', ['uid' => local_user(), 'term' => $search]);
+                       DBA::insert('search', ['uid' => local_user(), 'term' => $search]);
                }
        }
        if (x($_GET, 'remove')) {
-               dba::delete('search', ['uid' => local_user(), 'term' => $search]);
+               DBA::delete('search', ['uid' => local_user(), 'term' => $search]);
        }
 
        $is_a_date_query = false;
@@ -182,10 +182,10 @@ function saved_searches($search)
 
        $o = '';
 
-       $terms = dba::select('search', ['id', 'term'], ['uid' => local_user()]);
+       $terms = DBA::select('search', ['id', 'term'], ['uid' => local_user()]);
        $saved = [];
 
-       while ($rr = dba::fetch($terms)) {
+       while ($rr = DBA::fetch($terms)) {
                $saved[] = [
                        'id'          => $rr['id'],
                        'term'        => $rr['term'],
@@ -317,7 +317,7 @@ function networkSetSeen($condition)
                return;
        }
 
-       $unseen = dba::exists('item', $condition);
+       $unseen = DBA::exists('item', $condition);
 
        if ($unseen) {
                $r = Item::update(['unseen' => false], $condition);
@@ -442,13 +442,13 @@ function networkFlatView(App $a, $update = 0)
                $condition = ["`term` = ? AND `otype` = ? AND `type` = ? AND `uid` = ?",
                        $file, TERM_OBJ_POST, TERM_FILE, local_user()];
                $params = ['order' => ['tid' => true], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
-               $result = dba::select('term', ['oid'], $condition);
+               $result = DBA::select('term', ['oid'], $condition);
 
                $posts = [];
-               while ($term = dba::fetch($result)) {
+               while ($term = DBA::fetch($result)) {
                        $posts[] = $term['oid'];
                }
-               dba::close($terms);
+               DBA::close($terms);
 
                $condition = ['uid' => local_user(), 'id' => $posts];
        } else {
@@ -525,10 +525,10 @@ function networkThreadedView(App $a, $update, $parent)
        }
 
        if ($nets) {
-               $r = dba::select('contact', ['id'], ['uid' => local_user(), 'network' => $nets], ['self' => false]);
+               $r = DBA::select('contact', ['id'], ['uid' => local_user(), 'network' => $nets], ['self' => false]);
 
                $str = '';
-               while ($rr = dba::fetch($r)) {
+               while ($rr = DBA::fetch($r)) {
                        $str .= '<' . $rr['id'] . '>';
                }
                if (strlen($str)) {
@@ -556,7 +556,7 @@ function networkThreadedView(App $a, $update, $parent)
                if ($cid) {
                        // If $cid belongs to a communitity forum or a privat goup,.add a mention to the status editor
                        $condition = ["`id` = ? AND (`forum` OR `prv`)", $cid];
-                       $contact = dba::selectFirst('contact', ['addr', 'nick'], $condition);
+                       $contact = DBA::selectFirst('contact', ['addr', 'nick'], $condition);
                        if (DBM::is_result($contact)) {
                                if ($contact['addr'] != '') {
                                        $content = '!' . $contact['addr'];
@@ -609,7 +609,7 @@ function networkThreadedView(App $a, $update, $parent)
        $sql_tag_nets = (($nets) ? sprintf(" AND `item`.`network` = '%s' ", dbesc($nets)) : '');
 
        if ($gid) {
-               $group = dba::selectFirst('group', ['name'], ['id' => $gid, 'uid' => local_user()]);
+               $group = DBA::selectFirst('group', ['name'], ['id' => $gid, 'uid' => local_user()]);
                if (!DBM::is_result($group)) {
                        if ($update) {
                                killme();
@@ -625,7 +625,7 @@ function networkThreadedView(App $a, $update, $parent)
                        $contact_str_self = '';
 
                        $contact_str = implode(',', $contacts);
-                       $self = dba::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
+                       $self = DBA::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
                        if (DBM::is_result($self)) {
                                $contact_str_self = $self['id'];
                        }
@@ -645,7 +645,7 @@ function networkThreadedView(App $a, $update, $parent)
                $fields = ['id', 'name', 'network', 'writable', 'nurl',
                        'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location'];
                $condition = ["`id` = ? AND (NOT `blocked` OR `pending`)", $cid];
-               $contact = dba::selectFirst('contact', $fields, $condition);
+               $contact = DBA::selectFirst('contact', $fields, $condition);
                if (DBM::is_result($contact)) {
                        $sql_extra = " AND " . $sql_table . ".`contact-id` = " . intval($cid);
 
@@ -835,7 +835,7 @@ function networkThreadedView(App $a, $update, $parent)
                        $top_limit = DateTimeFormat::utcNow();
                }
 
-               $items = dba::p("SELECT `item`.`parent-uri` AS `uri`, 0 AS `item_id`, `item`.$ordering AS `order_date`, `author`.`url` AS `author-link` FROM `item`
+               $items = DBA::p("SELECT `item`.`parent-uri` AS `uri`, 0 AS `item_id`, `item`.$ordering AS `order_date`, `author`.`url` AS `author-link` FROM `item`
                        STRAIGHT_JOIN (SELECT `oid` FROM `term` WHERE `term` IN
                                (SELECT SUBSTR(`term`, 2) FROM `search` WHERE `uid` = ? AND `term` LIKE '#%') AND `otype` = ? AND `type` = ? AND `uid` = 0) AS `term`
                        ON `item`.`id` = `term`.`oid`
@@ -845,7 +845,7 @@ function networkThreadedView(App $a, $update, $parent)
                        local_user(), TERM_OBJ_POST, TERM_HASHTAG,
                        $top_limit, $bottom_limit);
 
-               $data = dba::inArray($items);
+               $data = DBA::inArray($items);
 
                if (count($data) > 0) {
                        $tag_top_limit = current($data)['order_date'];
@@ -862,7 +862,7 @@ function networkThreadedView(App $a, $update, $parent)
                                // Don't show hash tag posts from blocked or ignored contacts
                                $condition = ["`nurl` = ? AND `uid` = ? AND (`blocked` OR `readonly`)",
                                        normalise_link($item['author-link']), local_user()];
-                               if (!dba::exists('contact', $condition)) {
+                               if (!DBA::exists('contact', $condition)) {
                                        $s[$item['uri']] = $item;
                                }
                        }
index 57b083a7612c9edb3e439d073c0838849afb163c..84a0bae09f34f5ef052d7e131b7fb061a674aa97 100644 (file)
@@ -9,7 +9,7 @@ use Friendica\App;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Util\Network;
 require_once 'include/dba.php';
 
@@ -215,11 +215,11 @@ function nodeinfo_cron() {
                logger('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, LOGGER_DEBUG);
        }
 
-       $local_posts = dba::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
+       $local_posts = DBA::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
        Config::set('nodeinfo', 'local_posts', $local_posts);
        logger('local_posts: ' . $local_posts, LOGGER_DEBUG);
 
-       $local_comments = dba::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
+       $local_comments = DBA::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
        Config::set('nodeinfo', 'local_comments', $local_comments);
        logger('local_comments: ' . $local_comments, LOGGER_DEBUG);
 
index d17937ff5d39fb7b9cee7b37333902ef7a4e6bcf..e9ced2518c3b50f893f381b6c5d163d2562516d4 100644 (file)
@@ -5,7 +5,7 @@
 
 use Friendica\App;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Profile;
 
@@ -45,7 +45,7 @@ function noscrape_init(App $a)
        $keywords = str_replace(['#',',',' ',',,'], ['',' ',',',','], $keywords);
        $keywords = explode(',', $keywords);
 
-       $contactPhoto = dba::selectFirst('contact', ['photo'], ['self' => true, 'uid' => $a->profile['uid']]);
+       $contactPhoto = DBA::selectFirst('contact', ['photo'], ['self' => true, 'uid' => $a->profile['uid']]);
 
        $json_info['fn'] = $a->profile['name'];
        $json_info['photo'] = $contactPhoto["photo"];
@@ -74,13 +74,13 @@ function noscrape_init(App $a)
        // We display the last activity (post or login), reduced to year and week number
        $last_active = 0;
        $condition = ['uid' => $a->profile['uid'], 'self' => true];
-       $contact = dba::selectFirst('contact', ['last-item'], $condition);
+       $contact = DBA::selectFirst('contact', ['last-item'], $condition);
        if (DBM::is_result($contact)) {
                $last_active = strtotime($contact['last-item']);
        }
 
        $condition = ['uid' => $a->profile['uid']];
-       $user = dba::selectFirst('user', ['login_date'], $condition);
+       $user = DBA::selectFirst('user', ['login_date'], $condition);
        if (DBM::is_result($user)) {
                if ($last_active < strtotime($user['login_date'])) {
                        $last_active = strtotime($user['login_date']);
index af7bd71793bc854b656c17f020df7e39198c6b7b..f83195ff1ccdb1e1a16f75375d8df20bd1b27ad9 100644 (file)
@@ -6,7 +6,7 @@
 use Friendica\App;
 use Friendica\Content\Nav;
 use Friendica\Core\L10n;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Item;
 use Friendica\Model\Profile;
@@ -74,7 +74,7 @@ function notes_content(App $a, $update = false)
                while ($rr = Item::fetch($r)) {
                        $parents_arr[] = $rr['id'];
                }
-               dba::close($r);
+               DBA::close($r);
 
                $condition = ['uid' => local_user(), 'parent' => $parents_arr];
                $result = Item::selectForUser(local_user(), [], $condition);
index 0b7ac14d45e68378189ab6ae5d9893508c3dae4e..b639b089f84fa73e8896d828e6f77c9b47fcae53 100644 (file)
@@ -10,7 +10,7 @@ use Friendica\Content\Nav;
 use Friendica\Core\L10n;
 use Friendica\Core\NotificationsManager;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 function notifications_post(App $a)
@@ -26,7 +26,7 @@ function notifications_post(App $a)
        }
 
        if ($request_id) {
-               $intro = dba::selectFirst('intro', ['id', 'contact-id', 'fid'], ['id' => $request_id, 'uid' => local_user()]);
+               $intro = DBA::selectFirst('intro', ['id', 'contact-id', 'fid'], ['id' => $request_id, 'uid' => local_user()]);
 
                if (DBM::is_result($intro)) {
                        $intro_id = $intro['id'];
@@ -42,20 +42,20 @@ function notifications_post(App $a)
                $fid = $intro['fid'];
 
                if ($_POST['submit'] == L10n::t('Discard')) {
-                       dba::delete('intro', ['id' => $intro_id]);
+                       DBA::delete('intro', ['id' => $intro_id]);
 
                        if (!$fid) {
                                // The check for blocked and pending is in case the friendship was already approved
                                // and we just want to get rid of the now pointless notification
                                $condition = ['id' => $contact_id, 'uid' => local_user(),
                                        'self' => false, 'blocked' => true, 'pending' => true];
-                               dba::delete('contact', $condition);
+                               DBA::delete('contact', $condition);
                        }
                        goaway('notifications/intros');
                }
 
                if ($_POST['submit'] == L10n::t('Ignore')) {
-                       dba::update('intro', ['ignore' => true], ['id' => $intro_id]);
+                       DBA::update('intro', ['ignore' => true], ['id' => $intro_id]);
                        goaway('notifications/intros');
                }
        }
index 4058ac5c18fdfcb3cbaf684983b74260775167d4..de691de4ffbe84db28605ce6a69291c1feded362 100644 (file)
@@ -13,7 +13,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
@@ -1350,7 +1350,7 @@ function photos_content(App $a)
                        $link_item = Item::selectFirst([], ['id' => $linked_items[0]['id']]);
 
                        $condition = ["`parent` = ? AND `parent` != `id`",  $link_item['parent']];
-                       $a->set_pager_total(dba::count('item', $condition));
+                       $a->set_pager_total(DBA::count('item', $condition));
 
                        $params = ['order' => ['id'], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
                        $result = Item::selectForUser($link_item['uid'], [], $condition, $params);
index 6ac7d41fe08047701ba3385b086516a802cd45f0..9550fe25e1776f862de48d01644162f0ad3e4525 100644 (file)
@@ -12,7 +12,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Group;
 use Friendica\Model\Item;
@@ -347,7 +347,7 @@ function profile_content(App $a, $update = 0)
 
 
        if ($is_owner) {
-               $unseen = dba::exists('item', ['wall' => true, 'unseen' => true, 'uid' => local_user()]);
+               $unseen = DBA::exists('item', ['wall' => true, 'unseen' => true, 'uid' => local_user()]);
                if ($unseen) {
                        $r = Item::update(['unseen' => false],
                                        ['wall' => true, 'unseen' => true, 'uid' => local_user()]);
index db4a7deae5ba82633cbbed9982a384595c2a4575..448463554d4ab055470f2dd2dabb2426d0016f43 100644 (file)
@@ -13,7 +13,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
@@ -123,7 +123,7 @@ function profiles_init(App $a) {
                $r1[0]['net-publish'] = 0;
                $r1[0]['profile-name'] = dbesc($name);
 
-               dba::insert('profile', $r1[0]);
+               DBA::insert('profile', $r1[0]);
 
                $r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile-name` = '%s' LIMIT 1",
                        intval(local_user()),
index 6dc396787664ff64211f5d3c9a4bc2987a6be7fe..6546ce435e5062f4951f79d42bc39932765d8b4b 100644 (file)
@@ -7,7 +7,7 @@
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Photo;
 use Friendica\Object\Image;
@@ -150,7 +150,7 @@ function proxy_init(App $a) {
        $valid = true;
        $photo = null;
        if (!$direct_cache && ($cachefile == '')) {
-               $photo = dba::selectFirst('photo', ['data', 'desc'], ['resource-id' => $urlhash]);
+               $photo = DBA::selectFirst('photo', ['data', 'desc'], ['resource-id' => $urlhash]);
                if (DBM::is_result($photo)) {
                        $img_str = $photo['data'];
                        $mime = $photo['desc'];
@@ -193,7 +193,7 @@ function proxy_init(App $a) {
                                'filename' => basename($_REQUEST['url']), 'type' => '', 'album' => '', 'height' => imagesy($image), 'width' => imagesx($image),
                                'datasize' => 0, 'data' => $img_str, 'scale' => 100, 'profile' => 0,
                                'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '', 'desc' => $mime];
-                       dba::insert('photo', $fields);
+                       DBA::insert('photo', $fields);
                } else {
                        $Image = new Image($img_str, $mime);
                        if ($Image->isValid() && !$direct_cache && ($cachefile == '')) {
index fb6de40523945d1aa254998b636777fcb5ee0588..7843f7352ce0b581d3024c9c6393ab9c523bb1ba 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 use Friendica\App;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Protocol\OStatus;
 
@@ -44,7 +44,7 @@ function pubsub_init(App $a)
 
                $subscribe = (($hub_mode === 'subscribe') ? 1 : 0);
 
-               $owner = dba::selectFirst('user', ['uid'], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
+               $owner = DBA::selectFirst('user', ['uid'], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
                if (!DBM::is_result($owner)) {
                        logger('Local account not found: ' . $nick);
                        hub_return(false, '');
@@ -56,7 +56,7 @@ function pubsub_init(App $a)
                        $condition['hub-verify'] = $hub_verify;
                }
 
-               $contact = dba::selectFirst('contact', ['id', 'poll'], $condition);
+               $contact = DBA::selectFirst('contact', ['id', 'poll'], $condition);
                if (!DBM::is_result($contact)) {
                        logger('Contact ' . $contact_id . ' not found.');
                        hub_return(false, '');
@@ -76,7 +76,7 @@ function pubsub_init(App $a)
                }
 
                if (!empty($hub_mode)) {
-                       dba::update('contact', ['subhub' => $subscribe], ['id' => $contact['id']]);
+                       DBA::update('contact', ['subhub' => $subscribe], ['id' => $contact['id']]);
                        logger($hub_mode . ' success for contact ' . $contact_id . '.');
                }
                hub_return(true, $hub_challenge);
@@ -93,19 +93,19 @@ function pubsub_post(App $a)
        $nick       = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
        $contact_id = (($a->argc > 2) ? intval($a->argv[2])       : 0 );
 
-       $importer = dba::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
+       $importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
        if (!DBM::is_result($importer)) {
                hub_post_return();
        }
 
        $condition = ['id' => $contact_id, 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
-       $contact = dba::selectFirst('contact', [], $condition);
+       $contact = DBA::selectFirst('contact', [], $condition);
 
        if (!DBM::is_result($contact)) {
                $author = OStatus::salmonAuthor($xml, $importer);
                if (!empty($author['contact-id'])) {
                        $condition = ['id' => $author['contact-id'], 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
-                       $contact = dba::selectFirst('contact', [], $condition);
+                       $contact = DBA::selectFirst('contact', [], $condition);
                        logger('No record for ' . $nick .' with contact id ' . $contact_id . ' - using '.$author['contact-id'].' instead.');
                }
                if (!DBM::is_result($contact)) {
index 53b9c01c157e7ecebda7240d0a118993b95bd630..1128e8b4546cde0bf399d34b06b03620855e1fc9 100644 (file)
@@ -3,7 +3,7 @@
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\PushSubscriber;
 use Friendica\Util\Network;
@@ -64,7 +64,7 @@ function pubsubhubbub_init(App $a) {
 
                // fetch user from database given the nickname
                $condition = ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false];
-               $owner = dba::selectFirst('user', ['uid', 'hidewall'], $condition);
+               $owner = DBA::selectFirst('user', ['uid', 'hidewall'], $condition);
                if (!DBM::is_result($owner)) {
                        logger('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
                        System::httpExit(404);
@@ -79,7 +79,7 @@ function pubsubhubbub_init(App $a) {
                // get corresponding row from contact table
                $condition = ['uid' => $owner['uid'], 'blocked' => false,
                        'pending' => false, 'self' => true];
-               $contact = dba::selectFirst('contact', ['poll'], $condition);
+               $contact = DBA::selectFirst('contact', ['poll'], $condition);
                if (!DBM::is_result($contact)) {
                        logger('Self contact for user ' . $owner['uid'] . ' not found.');
                        System::httpExit(404);
index 352ba94986ed5cfbc0ac963bcd23d464d7d93f75..ebc20cfcd82759285f7c51308544e3d16c45492a 100644 (file)
@@ -7,7 +7,7 @@
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Protocol\Diaspora;
 
@@ -34,7 +34,7 @@ function receive_post(App $a)
                }
                $guid = $a->argv[2];
 
-               $importer = dba::selectFirst('user', [], ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]);
+               $importer = DBA::selectFirst('user', [], ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]);
                if (!DBM::is_result($importer)) {
                        System::httpExit(500);
                }
index 8f112a3c5d24938d83d8dd4b16df8ff14f6ff332..20e2050764a3890420f68c0b529da7f8e1d3501f 100644 (file)
@@ -3,7 +3,7 @@
 use Friendica\App;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Profile;
@@ -24,7 +24,7 @@ function redir_init(App $a) {
 
        if (!empty($cid)) {
                $fields = ['id', 'uid', 'nurl', 'url', 'addr', 'name', 'network', 'poll', 'issued-id', 'dfrn-id', 'duplex'];
-               $contact = dba::selectFirst('contact', $fields, ['id' => $cid, 'uid' => [0, local_user()]]);
+               $contact = DBA::selectFirst('contact', $fields, ['id' => $cid, 'uid' => [0, local_user()]]);
                if (!DBM::is_result($contact)) {
                        notice(L10n::t('Contact not found.'));
                        goaway(System::baseUrl());
@@ -42,7 +42,7 @@ function redir_init(App $a) {
                if ($contact['uid'] == 0 && local_user()) {
                        // Let's have a look if there is an established connection
                        // between the puplic contact we have found and the local user.
-                       $contact = dba::selectFirst('contact', $fields, ['nurl' => $contact['nurl'], 'uid' => local_user()]);
+                       $contact = DBA::selectFirst('contact', $fields, ['nurl' => $contact['nurl'], 'uid' => local_user()]);
 
                        if (DBM::is_result($contact)) {
                                $cid = $contact['id'];
@@ -96,7 +96,7 @@ function redir_init(App $a) {
 
                        $fields = ['uid' => local_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id,
                                'sec' => $sec, 'expire' => time() + 45];
-                       dba::insert('profile_check', $fields);
+                       DBA::insert('profile_check', $fields);
 
                        logger('mod_redir: ' . $contact['name'] . ' ' . $sec, LOGGER_DEBUG);
 
index b96cd02448b85fa34178daa224784873d97142eb..283b23dfb02e0343af9103bbce7358fd437007e3 100644 (file)
@@ -8,7 +8,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\User;
 use Friendica\Module\Login;
@@ -89,8 +89,8 @@ function user_deny($hash)
                intval($register[0]['uid'])
        );
 
-       dba::delete('user', ['uid' => $register[0]['uid']]);
-       dba::delete('register', ['hash' => $register[0]['hash']]);
+       DBA::delete('user', ['uid' => $register[0]['uid']]);
+       DBA::delete('register', ['hash' => $register[0]['hash']]);
 
        notice(L10n::t('Registration revoked for %s', $user[0]['username']) . EOL);
        return true;
index adc788983efd9a5ef3381e41f1e5e7be5334cf22..1676b7b5713d5e79d74d25801f85e14afdce4e4f 100644 (file)
@@ -7,7 +7,7 @@ use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\User;
 
@@ -39,7 +39,7 @@ function removeme_post(App $a)
        // send email to admins
        $admin_mails = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
        foreach ($admin_mails as $mail) {
-               $admin = dba::selectFirst('user', ['uid', 'language', 'email'], ['email' => $mail]);
+               $admin = DBA::selectFirst('user', ['uid', 'language', 'email'], ['email' => $mail]);
                if (!DBM::is_result($admin)) {
                        continue;
                }
index b425464dcc40bb2f31e2c1e9d14fb35fd2683606..8f3d897ae4a815d6a559a2c58f27df64c67a108a 100644 (file)
@@ -10,7 +10,7 @@ use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Item;
 
@@ -69,11 +69,11 @@ function search_init(App $a) {
                                dbesc($search)
                        );
                        if (!DBM::is_result($r)) {
-                               dba::insert('search', ['uid' => local_user(), 'term' => $search]);
+                               DBA::insert('search', ['uid' => local_user(), 'term' => $search]);
                        }
                }
                if (x($_GET,'remove') && $search) {
-                       dba::delete('search', ['uid' => local_user(), 'term' => $search]);
+                       DBA::delete('search', ['uid' => local_user(), 'term' => $search]);
                }
 
                /// @todo Check if there is a case at all that "aside" is prefilled here
@@ -210,13 +210,13 @@ function search_content(App $a) {
                        local_user(), TERM_OBJ_POST, TERM_HASHTAG, $search];
                $params = ['order' => ['created' => true],
                        'limit' => [$a->pager['start'], $a->pager['itemspage']]];
-               $terms = dba::select('term', ['oid'], $condition, $params);
+               $terms = DBA::select('term', ['oid'], $condition, $params);
 
                $itemids = [];
-               while ($term = dba::fetch($terms)) {
+               while ($term = DBA::fetch($terms)) {
                        $itemids[] = $term['oid'];
                }
-               dba::close($terms);
+               DBA::close($terms);
 
                if (!empty($itemids)) {
                        $params = ['order' => ['id' => true]];
index c4a114ab810c6ea04f3d19974f97d48259df22cf..d984819593e19f6e57376959ee8e57113a9a0d19 100644 (file)
@@ -14,7 +14,7 @@ use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Core\Theme;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
@@ -150,7 +150,7 @@ function settings_post(App $a)
                check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
 
                $key = $_POST['remove'];
-               dba::delete('tokens', ['id' => $key, 'uid' => local_user()]);
+               DBA::delete('tokens', ['id' => $key, 'uid' => local_user()]);
                goaway(System::baseUrl(true)."/settings/oauth/");
                return;
        }
@@ -241,12 +241,12 @@ function settings_post(App $a)
                                        intval(local_user())
                                );
                                if (!DBM::is_result($r)) {
-                                       dba::insert('mailacct', ['uid' => local_user()]);
+                                       DBA::insert('mailacct', ['uid' => local_user()]);
                                }
                                if (strlen($mail_pass)) {
                                        $pass = '';
                                        openssl_public_encrypt($mail_pass, $pass, $a->user['pubkey']);
-                                       dba::update('mailacct', ['pass' => bin2hex($pass)], ['uid' => local_user()]);
+                                       DBA::update('mailacct', ['pass' => bin2hex($pass)], ['uid' => local_user()]);
                                }
                                $r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s',
                                        `action` = %d, `movetofolder` = '%s',
@@ -706,7 +706,7 @@ function settings_content(App $a)
                if (($a->argc > 3) && ($a->argv[2] === 'delete')) {
                        check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't');
 
-                       dba::delete('clients', ['client_id' => $a->argv[3], 'uid' => local_user()]);
+                       DBA::delete('clients', ['client_id' => $a->argv[3], 'uid' => local_user()]);
                        goaway(System::baseUrl(true)."/settings/oauth/");
                        return;
                }
@@ -989,7 +989,7 @@ function settings_content(App $a)
         * ACCOUNT SETTINGS
         */
 
-       $profile = dba::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]);
+       $profile = DBA::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]);
        if (!DBM::is_result($profile)) {
                notice(L10n::t('Unable to find your profile. Please contact your admin.') . EOL);
                return;
index 86c11803bebad4d24bbb13d01ff3e0443032839f..51ec06b10ad41a2d859728ac2448d622b535856c 100644 (file)
@@ -8,7 +8,7 @@ use Friendica\Content\ContactSelector;
 use Friendica\Content\Widget;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
@@ -46,7 +46,7 @@ function suggest_init(App $a) {
                }
                // Now check how the user responded to the confirmation query
                if (!$_REQUEST['canceled']) {
-                       dba::insert('gcign', ['uid' => local_user(), 'gcid' => $_GET['ignore']]);
+                       DBA::insert('gcign', ['uid' => local_user(), 'gcid' => $_GET['ignore']]);
                }
        }
 
index 9ee92b3ba9ed7fff5ace231e4a43907697ace40f..545faf8fdae90c3bb721f39975fcc14f543c29e0 100644 (file)
@@ -6,7 +6,7 @@
 use Friendica\App;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Profile;
@@ -30,7 +30,7 @@ function unfollow_post(App $a)
        $condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
                        $uid, CONTACT_IS_FRIEND, normalise_link($url),
                        normalise_link($url), $url, NETWORK_STATUSNET];
-       $contact = dba::selectFirst('contact', [], $condition);
+       $contact = DBA::selectFirst('contact', [], $condition);
 
        if (!DBM::is_result($contact)) {
                notice(L10n::t("Contact wasn't found or can't be unfollowed."));
@@ -44,7 +44,7 @@ function unfollow_post(App $a)
                                Contact::terminateFriendship($r[0], $contact);
                        }
                }
-               dba::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
+               DBA::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
 
                info(L10n::t('Contact unfollowed').EOL);
                goaway(System::baseUrl().'/contacts/'.$contact['id']);
@@ -69,7 +69,7 @@ function unfollow_content(App $a)
        $condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
                        local_user(), CONTACT_IS_FRIEND, normalise_link($url),
                        normalise_link($url), $url, NETWORK_STATUSNET];
-       $contact = dba::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
+       $contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
 
        if (!DBM::is_result($contact)) {
                notice(L10n::t("You aren't a friend of this contact.").EOL);
index 69763c2fe5f17a3b3155007c1838e863aee71a4a..cf5d11f8bf26d1429a6e213beb2318e95b063ece 100644 (file)
@@ -7,7 +7,7 @@ use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Mimetype;
@@ -130,7 +130,7 @@ function wall_attach_post(App $a) {
                'filesize' => $filesize, 'data' => $filedata, 'created' => $created, 'edited' => $created,
                'allow_cid' => '<' . $page_owner_cid . '>', 'allow_gid' => '','deny_cid' => '', 'deny_gid' => ''];
 
-       $r = dba::insert('attach', $fields);
+       $r = DBA::insert('attach', $fields);
 
        @unlink($src);
 
index da354445f4588b24c7396fc18dbe1ee56647af71..c18155c5fe598ef91f97479b0ae9b58bdc2f46a5 100644 (file)
@@ -6,7 +6,7 @@
 
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Util\DateTimeFormat;
 
 function worker_init()
@@ -44,7 +44,7 @@ function worker_init()
 
                $fields = ['executed' => DateTimeFormat::utcNow(), 'pid' => getmypid(), 'done' => false];
                $condition =  ['id' => $r[0]["id"], 'pid' => 0];
-               if (dba::update('workerqueue', $fields, $condition)) {
+               if (DBA::update('workerqueue', $fields, $condition)) {
                        Worker::execute($r[0]);
                }
        }
index 230cdbf63776944f94a3488d08b4cd8eedf8ac16..cd72e5018862fae1e12be48a73b6974ee29c811c 100644 (file)
@@ -6,7 +6,7 @@
 use Friendica\App;
 use Friendica\Core\Addon;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Protocol\Salmon;
 
@@ -39,7 +39,7 @@ function xrd_init(App $a)
                $name = substr($local, 0, strpos($local, '@'));
        }
 
-       $user = dba::selectFirst('user', [], ['nickname' => $name]);
+       $user = DBA::selectFirst('user', [], ['nickname' => $name]);
        if (!DBM::is_result($user)) {
                killme();
        }
index 0359d8309c12fca1859e835a620872ab717bfc8d..1e24c3214f7030130060b0a620499fff45e57380 100644 (file)
@@ -10,7 +10,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 require_once 'boot.php';
@@ -490,13 +490,13 @@ class App
 
                $this->mode |= App::MODE_LOCALCONFIGPRESENT;
 
-               if (!dba::connected()) {
+               if (!DBA::connected()) {
                        return;
                }
 
                $this->mode |= App::MODE_DBAVAILABLE;
 
-               if (dba::fetch_first("SHOW TABLES LIKE 'config'") === false) {
+               if (DBA::fetch_first("SHOW TABLES LIKE 'config'") === false) {
                        return;
                }
 
@@ -511,7 +511,7 @@ class App
 
        public function loadDatabase()
        {
-               if (dba::connected()) {
+               if (DBA::connected()) {
                        return;
                }
 
@@ -542,7 +542,7 @@ class App
 
                $stamp1 = microtime(true);
 
-               dba::connect($db_host, $db_user, $db_pass, $db_data, $charset);
+               DBA::connect($db_host, $db_user, $db_pass, $db_data, $charset);
                unset($db_host, $db_user, $db_pass, $db_data, $charset);
 
                $this->save_timestamp($stamp1, 'network');
@@ -1383,7 +1383,7 @@ class App
                if ($this->profile_uid && ($this->profile_uid != local_user())) {
                        // Allow folks to override user themes and always use their own on their own site.
                        // This works only if the user is on the same server
-                       $user = dba::selectFirst('user', ['theme'], ['uid' => $this->profile_uid]);
+                       $user = DBA::selectFirst('user', ['theme'], ['uid' => $this->profile_uid]);
                        if (DBM::is_result($user) && !PConfig::get(local_user(), 'system', 'always_my_theme')) {
                                $page_theme = $user['theme'];
                        }
index 47df84f7a6f6d266acbe7a0c5dd1b5a40d05a665..797ec78610a01010a039473e886a41ca9cb4f1b0 100644 (file)
@@ -6,7 +6,7 @@ namespace Friendica\Content;
 
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 /**
@@ -26,8 +26,8 @@ class ContactSelector
 
                $o .= "<select id=\"contact-profile-selector\" class=\"form-control\" $disabled name=\"profile-assign\" >\r\n";
 
-               $s = dba::select('profile', ['id', 'profile-name', 'is-default'], ['uid' => $_SESSION['uid']]);
-               $r = dba::inArray($s);
+               $s = DBA::select('profile', ['id', 'profile-name', 'is-default'], ['uid' => $_SESSION['uid']]);
+               $r = DBA::inArray($s);
 
                if (DBM::is_result($r)) {
                        foreach ($r as $rr) {
@@ -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::fetch_first("SELECT `gserver`.`platform` FROM `gcontact`
                                        INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url`
                                        WHERE `gcontact`.`nurl` = ? AND `platform` != ''", normalise_link($profile));
 
index edbe0b64e98deb382d0edd01d0534636ca68d282..535f6483e4e55c2bf9f26f9916dd6744fe03ee3d 100644 (file)
@@ -8,7 +8,7 @@ namespace Friendica\Content;
 use Friendica\Content\Feature;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 
@@ -45,7 +45,7 @@ class ForumManager
                        $select = '(`forum` OR `prv`)';
                }
 
-               $contacts = dba::p(
+               $contacts = DBA::p(
                        "SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro`, `contact`.`thumb`
                        FROM `contact`
                                WHERE `network`= 'dfrn' AND $select AND `uid` = ?
@@ -59,7 +59,7 @@ class ForumManager
                        return($forumlist);
                }
 
-               while ($contact = dba::fetch($contacts)) {
+               while ($contact = DBA::fetch($contacts)) {
                        $forumlist[] = [
                                'url'   => $contact['url'],
                                'name'  => $contact['name'],
@@ -68,7 +68,7 @@ class ForumManager
                                'thumb' => $contact['thumb'],
                        ];
                }
-               dba::close($contacts);
+               DBA::close($contacts);
 
                return($forumlist);
        }
index 5f47875098c461cdd2537786fc20cbf0231fcf53..31911688d69ab3b77624ab7b84997424a1c37df0 100644 (file)
@@ -10,7 +10,7 @@ use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Profile;
 
@@ -105,7 +105,7 @@ class Nav
                        $nav['usermenu'][] = ['notes/', L10n::t('Personal notes'), '', L10n::t('Your personal notes')];
 
                        // user info
-                       $contact = dba::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
+                       $contact = DBA::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
                        $userinfo = [
                                'icon' => (DBM::is_result($contact) ? $a->remove_baseurl($contact['micro']) : 'images/person-48.jpg'),
                                'name' => $a->user['username'],
index 70556839e933bb4b17b8a4a70680f8ad3627be79..fe59567b2eec6409219266ed3f59c22c0ce48e6a 100644 (file)
@@ -15,7 +15,7 @@ use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
@@ -63,7 +63,7 @@ class OEmbed
                $a = get_app();
 
                $condition = ['url' => normalise_link($embedurl), 'maxwidth' => $a->videowidth];
-               $oembed = dba::selectFirst('oembed', ['content'], $condition);
+               $oembed = DBA::selectFirst('oembed', ['content'], $condition);
                if (DBM::is_result($oembed)) {
                        $txt = $oembed["content"];
                } else {
@@ -110,7 +110,7 @@ class OEmbed
                        } else { //save in cache
                                $j = json_decode($txt);
                                if (!empty($j->type) && $j->type != "error") {
-                                       dba::insert('oembed', [
+                                       DBA::insert('oembed', [
                                                'url' => normalise_link($embedurl),
                                                'maxwidth' => $a->videowidth,
                                                'content' => $txt,
index 76d51961c6d057f528d32dbfddac15cc23382cc4..230f2b6958f1685f888d04a1ad2be0e83a0d9568 100644 (file)
@@ -11,7 +11,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
@@ -143,18 +143,18 @@ class Widget
 
                $extra_sql = self::unavailableNetworks();
 
-               $r = dba::p("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = ? AND `network` != '' $extra_sql ORDER BY `network`",
+               $r = DBA::p("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = ? AND `network` != '' $extra_sql ORDER BY `network`",
                        local_user()
                );
 
                $nets = array();
-               while ($rr = dba::fetch($r)) {
+               while ($rr = DBA::fetch($r)) {
                        /// @TODO If 'network' is not there, this triggers an E_NOTICE
                        if ($rr['network']) {
                                $nets[] = array('ref' => $rr['network'], 'name' => ContactSelector::networkToName($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' ));
                        }
                }
-               dba::close($r);
+               DBA::close($r);
 
                if (count($nets) < 2) {
                        return '';
@@ -275,12 +275,12 @@ class Widget
 
                if (!$cid) {
                        if (Profile::getMyURL()) {
-                               $contact = dba::selectFirst('contact', ['id'],
+                               $contact = DBA::selectFirst('contact', ['id'],
                                                ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $profile_uid]);
                                if (DBM::is_result($contact)) {
                                        $cid = $contact['id'];
                                } else {
-                                       $gcontact = dba::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
+                                       $gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
                                        if (DBM::is_result($gcontact)) {
                                                $zcid = $gcontact['id'];
                                        }
index 9160dd579f00f36a354a609aa394a8443b898f2b..65646ba0dd6e37296d10e727a1f98388a5d038de 100644 (file)
@@ -8,7 +8,7 @@ namespace Friendica\Content\Widget;
 
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 require_once 'include/dba.php';
@@ -38,7 +38,7 @@ class TagCloud
                $o = '';
                $r = self::tagadelic($uid, $count, $owner_id, $flags, $type);
                if (count($r)) {
-                       $contact = dba::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
+                       $contact = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
                        $url = System::removedBaseUrl($contact['url']);
 
                        foreach ($r as $rr) {
@@ -88,7 +88,7 @@ class TagCloud
                }
 
                // Fetch tags
-               $r = dba::p("SELECT `term`, COUNT(`term`) AS `total` FROM `term`
+               $r = DBA::p("SELECT `term`, COUNT(`term`) AS `total` FROM `term`
                        LEFT JOIN `item` ON `term`.`oid` = `item`.`id`
                        WHERE `term`.`uid` = ? AND `term`.`type` = ?
                        AND `term`.`otype` = ?
index 95948af293c18870c69395313e22291df9727820..f05cf1f7915880c0a1bf9b5305bf2fcc651625a6 100644 (file)
@@ -8,7 +8,7 @@ namespace Friendica\Core;
 
 use Friendica\BaseObject;
 use Friendica\Content\Feature;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
@@ -100,13 +100,13 @@ class ACL extends BaseObject
                        $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" $tabindex >\r\n";
                }
 
-               $stmt = dba::p("SELECT `id`, `name`, `url`, `network` FROM `contact`
+               $stmt = DBA::p("SELECT `id`, `name`, `url`, `network` FROM `contact`
                        WHERE `uid` = ? AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
                        $sql_extra
                        ORDER BY `name` ASC ", intval(local_user())
                );
 
-               $contacts = dba::inArray($stmt);
+               $contacts = DBA::inArray($stmt);
 
                $arr = ['contact' => $contacts, 'entry' => $o];
 
@@ -165,13 +165,13 @@ class ACL extends BaseObject
 
                $o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\"$tabindex_attr$hidepreselected>\r\n";
 
-               $stmt = dba::p("SELECT `id`, `name`, `url`, `network` FROM `contact`
+               $stmt = DBA::p("SELECT `id`, `name`, `url`, `network` FROM `contact`
                        WHERE `uid` = ? AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
                        $sql_extra
                        ORDER BY `name` ASC ", intval(local_user())
                );
 
-               $contacts = dba::inArray($stmt);
+               $contacts = DBA::inArray($stmt);
 
                $arr = ['contact' => $contacts, 'entry' => $o];
 
@@ -268,7 +268,7 @@ class ACL extends BaseObject
                        $pubmail_enabled = false;
 
                        if (!$imap_disabled) {
-                               $mailacct = dba::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', local_user()]);
+                               $mailacct = DBA::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', local_user()]);
                                if (DBM::is_result($mailacct)) {
                                        $mail_enabled = true;
                                        $pubmail_enabled = !empty($mailacct['pubmail']);
index eb2b7d1aac6b6e22630d20ed45d8d77c913d4cd1..a663cff5041647cfd474f8a7b4bc200e8e9232e7 100644 (file)
@@ -5,7 +5,7 @@
 namespace Friendica\Core;
 
 use Friendica\App;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 require_once 'include/dba.php';
@@ -24,7 +24,7 @@ class Addon
        public static function uninstall($addon)
        {
                logger("Addons: uninstalling " . $addon);
-               dba::delete('addon', ['name' => $addon]);
+               DBA::delete('addon', ['name' => $addon]);
 
                @include_once('addon/' . $addon . '/' . $addon . '.php');
                if (function_exists($addon . '_uninstall')) {
@@ -55,7 +55,7 @@ class Addon
 
                        $addon_admin = (function_exists($addon."_addon_admin") ? 1 : 0);
 
-                       dba::insert('addon', ['name' => $addon, 'installed' => true,
+                       DBA::insert('addon', ['name' => $addon, 'installed' => true,
                                                'timestamp' => $t, 'plugin_admin' => $addon_admin]);
 
                        // we can add the following with the previous SQL
@@ -63,7 +63,7 @@ class Addon
                        // This way the system won't fall over dead during the update.
 
                        if (file_exists('addon/' . $addon . '/.hidden')) {
-                               dba::update('addon', ['hidden' => true], ['name' => $addon]);
+                               DBA::update('addon', ['hidden' => true], ['name' => $addon]);
                        }
                        return true;
                } else {
@@ -79,9 +79,9 @@ class Addon
        {
                $addons = Config::get('system', 'addon');
                if (strlen($addons)) {
-                       $r = dba::select('addon', [], ['installed' => 1]);
+                       $r = DBA::select('addon', [], ['installed' => 1]);
                        if (DBM::is_result($r)) {
-                               $installed = dba::inArray($r);
+                               $installed = DBA::inArray($r);
                        } else {
                                $installed = [];
                        }
@@ -108,7 +108,7 @@ class Addon
                                                                        $func = $addon . '_install';
                                                                        $func();
                                                                }
-                                                               dba::update('addon', ['timestamp' => $t], ['id' => $i['id']]);
+                                                               DBA::update('addon', ['timestamp' => $t], ['id' => $i['id']]);
                                                        }
                                                }
                                        }
@@ -125,7 +125,7 @@ class Addon
         */
        public static function isEnabled($addon)
        {
-               return dba::exists('addon', ['installed' => true, 'name' => $addon]);
+               return DBA::exists('addon', ['installed' => true, 'name' => $addon]);
        }
 
 
@@ -141,12 +141,12 @@ class Addon
        public static function registerHook($hook, $file, $function, $priority = 0)
        {
                $condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
-               $exists = dba::exists('hook', $condition);
+               $exists = DBA::exists('hook', $condition);
                if ($exists) {
                        return true;
                }
 
-               $r = dba::insert('hook', ['hook' => $hook, 'file' => $file, 'function' => $function, 'priority' => $priority]);
+               $r = DBA::insert('hook', ['hook' => $hook, 'file' => $file, 'function' => $function, 'priority' => $priority]);
 
                return $r;
        }
@@ -162,7 +162,7 @@ class Addon
        public static function unregisterHook($hook, $file, $function)
        {
                $condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
-               $r = dba::delete('hook', $condition);
+               $r = DBA::delete('hook', $condition);
                return $r;
        }
 
@@ -173,15 +173,15 @@ class Addon
        {
                $a = get_app();
                $a->hooks = [];
-               $r = dba::select('hook', ['hook', 'file', 'function'], [], ['order' => ['priority' => 'desc', 'file']]);
+               $r = DBA::select('hook', ['hook', 'file', 'function'], [], ['order' => ['priority' => 'desc', 'file']]);
 
-               while ($rr = dba::fetch($r)) {
+               while ($rr = DBA::fetch($r)) {
                        if (! array_key_exists($rr['hook'], $a->hooks)) {
                                $a->hooks[$rr['hook']] = [];
                        }
                        $a->hooks[$rr['hook']][] = [$rr['file'],$rr['function']];
                }
-               dba::close($r);
+               DBA::close($r);
        }
 
        /**
@@ -245,7 +245,7 @@ class Addon
                } else {
                        // remove orphan hooks
                        $condition = ['hook' => $name, 'file' => $hook[0], 'function' => $hook[1]];
-                       dba::delete('hook', $condition, ['cascade' => false]);
+                       DBA::delete('hook', $condition, ['cascade' => false]);
                }
        }
 
index 2e14567704336cd29149d166d6a32cd2a61c5927..2c85d5232d1a051e94f6ce9881d8979eac93f4ef 100644 (file)
@@ -3,7 +3,7 @@
 namespace Friendica\Core\Cache;
 
 use Friendica\Core\Cache;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Util\DateTimeFormat;
 
@@ -16,7 +16,7 @@ class DatabaseCacheDriver extends AbstractCacheDriver implements ICacheDriver
 {
        public function get($key)
        {
-               $cache = dba::selectFirst('cache', ['v'], ['`k` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
+               $cache = DBA::selectFirst('cache', ['v'], ['`k` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
 
                if (DBM::is_result($cache)) {
                        $cached = $cache['v'];
@@ -41,20 +41,20 @@ class DatabaseCacheDriver extends AbstractCacheDriver implements ICacheDriver
                        'updated' => DateTimeFormat::utcNow()
                ];
 
-               return dba::update('cache', $fields, ['k' => $key], true);
+               return DBA::update('cache', $fields, ['k' => $key], true);
        }
 
        public function delete($key)
        {
-               return dba::delete('cache', ['k' => $key]);
+               return DBA::delete('cache', ['k' => $key]);
        }
 
        public function clear($outdated = true)
        {
                if ($outdated) {
-                       return dba::delete('cache', ['`expires` < NOW()']);
+                       return DBA::delete('cache', ['`expires` < NOW()']);
                } else {
-                       return dba::delete('cache', ['`k` IS NOT NULL ']);
+                       return DBA::delete('cache', ['`k` IS NOT NULL ']);
                }
        }
 }
index 77902ffc82dfab07d8d2b3e96c8ba838eabb04b6..7b0c6b4173db3e02264cb6c9ca8fd2bfe0e3294b 100644 (file)
@@ -2,7 +2,7 @@
 namespace Friendica\Core\Config;
 
 use Friendica\BaseObject;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 require_once 'include/dba.php';
@@ -27,8 +27,8 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
                        return;
                }
 
-               $configs = dba::select('config', ['v', 'k'], ['cat' => $cat]);
-               while ($config = dba::fetch($configs)) {
+               $configs = DBA::select('config', ['v', 'k'], ['cat' => $cat]);
+               while ($config = DBA::fetch($configs)) {
                        $k = $config['k'];
 
                        self::getApp()->setConfigValue($cat, $k, $config['v']);
@@ -38,7 +38,7 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
                                $this->in_db[$cat][$k] = true;
                        }
                }
-               dba::close($configs);
+               DBA::close($configs);
        }
 
        public function get($cat, $k, $default_value = null, $refresh = false)
@@ -56,7 +56,7 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
                        }
                }
 
-               $config = dba::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]);
+               $config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]);
                if (DBM::is_result($config)) {
                        // manage array value
                        $value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
@@ -115,7 +115,7 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
                // manage array value
                $dbvalue = (is_array($value) ? serialize($value) : $dbvalue);
 
-               $result = dba::update('config', ['v' => $dbvalue], ['cat' => $cat, 'k' => $k], true);
+               $result = DBA::update('config', ['v' => $dbvalue], ['cat' => $cat, 'k' => $k], true);
 
                if ($result) {
                        $this->in_db[$cat][$k] = true;
@@ -131,7 +131,7 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
                        unset($this->in_db[$cat][$k]);
                }
 
-               $result = dba::delete('config', ['cat' => $cat, 'k' => $k]);
+               $result = DBA::delete('config', ['cat' => $cat, 'k' => $k]);
 
                return $result;
        }
index 6840fe7127570f8ca5c8a7a7bf8f89b48c09be78..07b15a360fc6c8ab52d6f712658e7c4fc38d21e8 100644 (file)
@@ -2,7 +2,7 @@
 namespace Friendica\Core\Config;
 
 use Friendica\BaseObject;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 require_once 'include/dba.php';
@@ -22,9 +22,9 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter
        {
                $a = self::getApp();
 
-               $pconfigs = dba::select('pconfig', ['v', 'k'], ['cat' => $cat, 'uid' => $uid]);
+               $pconfigs = DBA::select('pconfig', ['v', 'k'], ['cat' => $cat, 'uid' => $uid]);
                if (DBM::is_result($pconfigs)) {
-                       while ($pconfig = dba::fetch($pconfigs)) {
+                       while ($pconfig = DBA::fetch($pconfigs)) {
                                $k = $pconfig['k'];
 
                                self::getApp()->setPConfigValue($uid, $cat, $k, $pconfig['v']);
@@ -35,7 +35,7 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter
                        // Negative caching
                        $a->config[$uid][$cat] = "!<unset>!";
                }
-               dba::close($pconfigs);
+               DBA::close($pconfigs);
        }
 
        public function get($uid, $cat, $k, $default_value = null, $refresh = false)
@@ -58,7 +58,7 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter
                        }
                }
 
-               $pconfig = dba::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
+               $pconfig = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
                if (DBM::is_result($pconfig)) {
                        $val = (preg_match("|^a:[0-9]+:{.*}$|s", $pconfig['v']) ? unserialize($pconfig['v']) : $pconfig['v']);
 
@@ -94,7 +94,7 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter
                // manage array value
                $dbvalue = (is_array($value) ? serialize($value) : $dbvalue);
 
-               $result = dba::update('pconfig', ['v' => $dbvalue], ['uid' => $uid, 'cat' => $cat, 'k' => $k], true);
+               $result = DBA::update('pconfig', ['v' => $dbvalue], ['uid' => $uid, 'cat' => $cat, 'k' => $k], true);
 
                if ($result) {
                        $this->in_db[$uid][$cat][$k] = true;
@@ -111,7 +111,7 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter
                        unset($this->in_db[$uid][$cat][$k]);
                }
 
-               $result = dba::delete('pconfig', ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
+               $result = DBA::delete('pconfig', ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
 
                return $result;
        }
index 7a97854a43fc0dd1a75afc711e919e41d99acded..ec68665dc46d1031efffa6287c360d54085cf865 100644 (file)
@@ -4,7 +4,7 @@ namespace Friendica\Core\Config;
 
 use Exception;
 use Friendica\BaseObject;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 require_once 'include/dba.php';
@@ -31,11 +31,11 @@ class PreloadConfigAdapter extends BaseObject implements IConfigAdapter
                        return;
                }
 
-               $configs = dba::select('config', ['cat', 'v', 'k']);
-               while ($config = dba::fetch($configs)) {
+               $configs = DBA::select('config', ['cat', 'v', 'k']);
+               while ($config = DBA::fetch($configs)) {
                        self::getApp()->setConfigValue($config['cat'], $config['k'], $config['v']);
                }
-               dba::close($configs);
+               DBA::close($configs);
 
                $this->config_loaded = true;
        }
@@ -43,7 +43,7 @@ class PreloadConfigAdapter extends BaseObject implements IConfigAdapter
        public function get($cat, $k, $default_value = null, $refresh = false)
        {
                if ($refresh) {
-                       $config = dba::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]);
+                       $config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]);
                        if (DBM::is_result($config)) {
                                self::getApp()->setConfigValue($cat, $k, $config['v']);
                        }
@@ -70,7 +70,7 @@ class PreloadConfigAdapter extends BaseObject implements IConfigAdapter
                // manage array value
                $dbvalue = is_array($value) ? serialize($value) : $value;
 
-               $result = dba::update('config', ['v' => $dbvalue], ['cat' => $cat, 'k' => $k], true);
+               $result = DBA::update('config', ['v' => $dbvalue], ['cat' => $cat, 'k' => $k], true);
                if (!$result) {
                        throw new Exception('Unable to store config value in [' . $cat . '][' . $k . ']');
                }
@@ -82,7 +82,7 @@ class PreloadConfigAdapter extends BaseObject implements IConfigAdapter
        {
                self::getApp()->deleteConfigValue($cat, $k);
 
-               $result = dba::delete('config', ['cat' => $cat, 'k' => $k]);
+               $result = DBA::delete('config', ['cat' => $cat, 'k' => $k]);
 
                return $result;
        }
index 36b0f36362ccbf5c9aa2029355a4db3d08573d60..07d0adb44fcdfca636ef55a42dcb0312dc9f4ab4 100644 (file)
@@ -4,7 +4,7 @@ namespace Friendica\Core\Config;
 
 use Exception;
 use Friendica\BaseObject;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 require_once 'include/dba.php';
@@ -35,11 +35,11 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
                        return;
                }
 
-               $pconfigs = dba::select('pconfig', ['cat', 'v', 'k'], ['uid' => $uid]);
-               while ($pconfig = dba::fetch($pconfigs)) {
+               $pconfigs = DBA::select('pconfig', ['cat', 'v', 'k'], ['uid' => $uid]);
+               while ($pconfig = DBA::fetch($pconfigs)) {
                        self::getApp()->setPConfigValue($uid, $pconfig['cat'], $pconfig['k'], $pconfig['v']);
                }
-               dba::close($pconfigs);
+               DBA::close($pconfigs);
 
                $this->config_loaded = true;
        }
@@ -51,7 +51,7 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
                }
 
                if ($refresh) {
-                       $config = dba::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
+                       $config = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
                        if (DBM::is_result($config)) {
                                self::getApp()->setPConfigValue($uid, $cat, $k, $config['v']);
                        } else {
@@ -83,7 +83,7 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
                // manage array value
                $dbvalue = is_array($value) ? serialize($value) : $value;
 
-               $result = dba::update('pconfig', ['v' => $dbvalue], ['uid' => $uid, 'cat' => $cat, 'k' => $k], true);
+               $result = DBA::update('pconfig', ['v' => $dbvalue], ['uid' => $uid, 'cat' => $cat, 'k' => $k], true);
                if (!$result) {
                        throw new Exception('Unable to store config value in [' . $uid . '][' . $cat . '][' . $k . ']');
                }
@@ -99,7 +99,7 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
 
                self::getApp()->deletePConfigValue($uid, $cat, $k);
 
-               $result = dba::delete('pconfig', ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
+               $result = DBA::delete('pconfig', ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
 
                return $result;
        }
index fda398c8a2fd7a6ef1247ecfc4368f7c1e1bba8d..acdacbed1de9ac57b6bf2024a08855db51ba97bb 100644 (file)
@@ -4,7 +4,7 @@ namespace Friendica\Core\Console;
 
 use Friendica\App;
 use Friendica\Core\L10n;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use RuntimeException;
 
 /**
@@ -61,12 +61,12 @@ HELP;
                }
 
                $nurl = normalise_link($this->getArgument(0));
-               if (!dba::exists('contact', ['nurl' => $nurl, 'archive' => false])) {
+               if (!DBA::exists('contact', ['nurl' => $nurl, 'archive' => false])) {
                        throw new RuntimeException(L10n::t('Could not find any unarchived contact entry for this URL (%s)', $nurl));
                }
-               if (dba::update('contact', ['archive' => true], ['nurl' => $nurl])) {
+               if (DBA::update('contact', ['archive' => true], ['nurl' => $nurl])) {
                        $condition = ["`cid` IN (SELECT `id` FROM `contact` WHERE `archive`)"];
-                       dba::delete('queue', $condition);
+                       DBA::delete('queue', $condition);
                        $this->out(L10n::t('The contact entries have been archived'));
                } else {
                        throw new RuntimeException('The contact archival failed.');
index 76735ec9aeaefad160f8d865c93832461c64ad28..43c79bfb5712d5c3847c2537ba8e11615d20c05f 100644 (file)
@@ -7,7 +7,7 @@ use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\Install;
 use Friendica\Core\Theme;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use RuntimeException;
 
 require_once 'mod/install.php';
@@ -155,7 +155,7 @@ HELP;
                );
 
 
-               if (!dba::connect($db_host, $db_user, $db_pass, $db_data)) {
+               if (!DBA::connect($db_host, $db_user, $db_pass, $db_data)) {
                        $result['status'] = false;
                        $result['help'] = 'Failed, please check your MySQL settings and credentials.';
                }
index 8c26987d2cbfc3b458d732ccad29b27808a056d1..ee8370dfa154c190c095b2dfd649da273c8d1f5b 100644 (file)
@@ -3,7 +3,7 @@
 namespace Friendica\Core\Console;
 
 use Friendica\Core;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
 use RuntimeException;
 
@@ -58,7 +58,7 @@ HELP;
                        throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
                }
 
-               if (!dba::connected()) {
+               if (!DBA::connected()) {
                        throw new RuntimeException('Unable to connect to database');
                }
 
index 6330d08a12afc3f8055f733aae8673d8e0e18ad7..6220a507f3ca02f744519a685212f26f4cc505ee 100644 (file)
@@ -3,7 +3,7 @@
 namespace Friendica\Core\Console;
 
 use Friendica\Core\Protocol;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Network\Probe;
 use RuntimeException;
@@ -81,9 +81,9 @@ HELP;
                }
 
                $nurl = normalise_link($net['url']);
-               $contact = dba::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]);
+               $contact = DBA::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]);
                if (DBM::is_result($contact)) {
-                       dba::update("contact", ["hidden" => true], ["id" => $contact["id"]]);
+                       DBA::update("contact", ["hidden" => true], ["id" => $contact["id"]]);
                        $this->out('NOTICE: The account should be silenced from the global community page');
                } else {
                        throw new RuntimeException('NOTICE: Could not find any entry for this URL (' . $nurl . ')');
index cdf31422d157a90b1b25ff0a3364ad50ab579f8d..6a00e34887bfc8fe5cb2104efd6840bceeaba69e 100644 (file)
@@ -4,7 +4,7 @@ namespace Friendica\Core\Console;
 
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\User;
 use RuntimeException;
@@ -64,7 +64,7 @@ HELP;
 
                $nick = $this->getArgument(0);
 
-               $user = dba::selectFirst('user', ['uid'], ['nickname' => $nick]);
+               $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nick]);
                if (!DBM::is_result($user)) {
                        throw new RuntimeException(L10n::t('User not found'));
                }
index 32f87a4703c9728d7076ff4ae9e6d6f57f79a1f6..7470f698738aceda99174f8a392db7079f2699f3 100644 (file)
@@ -5,7 +5,7 @@
 namespace Friendica\Core;
 
 use Friendica\BaseObject;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 
 require_once 'boot.php';
 require_once 'include/dba.php';
@@ -111,8 +111,8 @@ class L10n extends BaseObject
 
                $a->strings = [];
                // load enabled addons strings
-               $addons = dba::select('addon', ['name'], ['installed' => true]);
-               while ($p = dba::fetch($addons)) {
+               $addons = DBA::select('addon', ['name'], ['installed' => true]);
+               while ($p = DBA::fetch($addons)) {
                        $name = $p['name'];
                        if (file_exists("addon/$name/lang/$lang/strings.php")) {
                                include "addon/$name/lang/$lang/strings.php";
index 10612a91e4abdb8ddf78c2a6a463cb439bf080f0..b46d17125301d7ccc8ec39a553e59ae0fe20bae5 100644 (file)
@@ -3,7 +3,7 @@
 namespace Friendica\Core\Lock;
 
 use Friendica\Core\Cache;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Util\DateTimeFormat;
 
@@ -21,8 +21,8 @@ class DatabaseLockDriver extends AbstractLockDriver
                $start = time();
 
                do {
-                       dba::lock('locks');
-                       $lock = dba::selectFirst('locks', ['locked', 'pid'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
+                       DBA::lock('locks');
+                       $lock = DBA::selectFirst('locks', ['locked', 'pid'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
 
                        if (DBM::is_result($lock)) {
                                if ($lock['locked']) {
@@ -32,16 +32,16 @@ class DatabaseLockDriver extends AbstractLockDriver
                                        }
                                }
                                if (!$lock['locked']) {
-                                       dba::update('locks', ['locked' => true, 'pid' => getmypid(), 'expires' => DateTimeFormat::utc('now + ' . $ttl . 'seconds')], ['name' => $key]);
+                                       DBA::update('locks', ['locked' => true, 'pid' => getmypid(), 'expires' => DateTimeFormat::utc('now + ' . $ttl . 'seconds')], ['name' => $key]);
                                        $got_lock = true;
                                }
                        } else {
-                               dba::insert('locks', ['name' => $key, 'locked' => true, 'pid' => getmypid(), 'expires' => DateTimeFormat::utc('now + ' . $ttl . 'seconds')]);
+                               DBA::insert('locks', ['name' => $key, 'locked' => true, 'pid' => getmypid(), 'expires' => DateTimeFormat::utc('now + ' . $ttl . 'seconds')]);
                                $got_lock = true;
                                $this->markAcquire($key);
                        }
 
-                       dba::unlock();
+                       DBA::unlock();
 
                        if (!$got_lock && ($timeout > 0)) {
                                usleep(rand(100000, 2000000));
@@ -56,7 +56,7 @@ class DatabaseLockDriver extends AbstractLockDriver
         */
        public function releaseLock($key)
        {
-               dba::delete('locks', ['name' => $key, 'pid' => getmypid()]);
+               DBA::delete('locks', ['name' => $key, 'pid' => getmypid()]);
 
                $this->markRelease($key);
 
@@ -68,7 +68,7 @@ class DatabaseLockDriver extends AbstractLockDriver
         */
        public function releaseAll()
        {
-               dba::delete('locks', ['pid' => getmypid()]);
+               DBA::delete('locks', ['pid' => getmypid()]);
 
                $this->acquiredLocks = [];
        }
@@ -78,7 +78,7 @@ class DatabaseLockDriver extends AbstractLockDriver
         */
        public function isLocked($key)
        {
-               $lock = dba::selectFirst('locks', ['locked'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
+               $lock = DBA::selectFirst('locks', ['locked'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
 
                if (DBM::is_result($lock)) {
                        return $lock['locked'] !== false;
index 82cb36aacb6d6e852f5be72db5d716b8b968879b..f9ceaabaf1910bd356f0a96aff3dfb44429cd375 100644 (file)
@@ -4,7 +4,7 @@ namespace Friendica\Core\Session;
 
 use Friendica\BaseObject;
 use Friendica\Core\Session;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use SessionHandlerInterface;
 
@@ -30,7 +30,7 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa
                        return '';
                }
 
-               $session = dba::selectFirst('session', ['data'], ['sid' => $session_id]);
+               $session = DBA::selectFirst('session', ['data'], ['sid' => $session_id]);
                if (DBM::is_result($session)) {
                        Session::$exists = true;
                        return $session['data'];
@@ -67,10 +67,10 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa
                if (Session::$exists) {
                        $fields = ['data' => $session_data, 'expire' => $expire];
                        $condition = ["`sid` = ? AND (`data` != ? OR `expire` != ?)", $session_id, $session_data, $expire];
-                       dba::update('session', $fields, $condition);
+                       DBA::update('session', $fields, $condition);
                } else {
                        $fields = ['sid' => $session_id, 'expire' => $default_expire, 'data' => $session_data];
-                       dba::insert('session', $fields);
+                       DBA::insert('session', $fields);
                }
 
                return true;
@@ -83,13 +83,13 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa
 
        public function destroy($id)
        {
-               dba::delete('session', ['sid' => $id]);
+               DBA::delete('session', ['sid' => $id]);
                return true;
        }
 
        public function gc($maxlifetime)
        {
-               dba::delete('session', ["`expire` < ?", time()]);
+               DBA::delete('session', ["`expire` < ?", time()]);
                return true;
        }
 }
index 1b25a66ba002c5b6ac4ed348d0cfb4ae567c0814..459dde890810a2178c75a841761f71d02503a97c 100644 (file)
@@ -5,7 +5,7 @@
 namespace Friendica\Core;
 
 use Friendica\App;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Model\Photo;
 use Friendica\Object\Image;
 
@@ -24,7 +24,7 @@ class UserImport
                        return 1;
                }
 
-               return dba::lastInsertId();
+               return DBA::lastInsertId();
        }
 
        /**
@@ -108,8 +108,8 @@ class UserImport
 
                // check for username
                // check if username matches deleted account
-               if (dba::exists('user', ['nickname' => $account['user']['nickname']])
-                       || dba::exists('userd', ['username' => $account['user']['nickname']])) {
+               if (DBA::exists('user', ['nickname' => $account['user']['nickname']])
+                       || DBA::exists('userd', ['username' => $account['user']['nickname']])) {
                        notice(L10n::t("User '%s' already exists on this server!", $account['user']['nickname']));
                        return;
                }
@@ -142,7 +142,7 @@ class UserImport
                // import user
                $r = self::dbImportAssoc('user', $account['user']);
                if ($r === false) {
-                       logger("uimport:insert user : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
+                       logger("uimport:insert user : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
                        notice(L10n::t("User creation error"));
                        return;
                }
@@ -160,9 +160,9 @@ class UserImport
                        $profile['uid'] = $newuid;
                        $r = self::dbImportAssoc('profile', $profile);
                        if ($r === false) {
-                               logger("uimport:insert profile " . $profile['profile-name'] . " : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
+                               logger("uimport:insert profile " . $profile['profile-name'] . " : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
                                info(L10n::t("User profile creation error"));
-                               dba::delete('user', ['uid' => $newuid]);
+                               DBA::delete('user', ['uid' => $newuid]);
                                return;
                        }
                }
@@ -198,7 +198,7 @@ class UserImport
                        $contact['uid'] = $newuid;
                        $r = self::dbImportAssoc('contact', $contact);
                        if ($r === false) {
-                               logger("uimport:insert contact " . $contact['nick'] . "," . $contact['network'] . " : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
+                               logger("uimport:insert contact " . $contact['nick'] . "," . $contact['network'] . " : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
                                $errorcount++;
                        } else {
                                $contact['newid'] = self::lastInsertId();
@@ -212,7 +212,7 @@ class UserImport
                        $group['uid'] = $newuid;
                        $r = self::dbImportAssoc('group', $group);
                        if ($r === false) {
-                               logger("uimport:insert group " . $group['name'] . " : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
+                               logger("uimport:insert group " . $group['name'] . " : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
                        } else {
                                $group['newid'] = self::lastInsertId();
                        }
@@ -237,7 +237,7 @@ class UserImport
                        if ($import == 2) {
                                $r = self::dbImportAssoc('group_member', $group_member);
                                if ($r === false) {
-                                       logger("uimport:insert group member " . $group_member['id'] . " : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
+                                       logger("uimport:insert group member " . $group_member['id'] . " : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
                                }
                        }
                }
@@ -255,7 +255,7 @@ class UserImport
                        );
 
                        if ($r === false) {
-                               logger("uimport:insert photo " . $photo['resource-id'] . "," . $photo['scale'] . " : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
+                               logger("uimport:insert photo " . $photo['resource-id'] . "," . $photo['scale'] . " : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
                        }
                }
 
@@ -263,7 +263,7 @@ class UserImport
                        $pconfig['uid'] = $newuid;
                        $r = self::dbImportAssoc('pconfig', $pconfig);
                        if ($r === false) {
-                               logger("uimport:insert pconfig " . $pconfig['id'] . " : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
+                               logger("uimport:insert pconfig " . $pconfig['id'] . " : ERROR : " . DBA::errorMessage(), LOGGER_NORMAL);
                        }
                }
 
index fbd162615f0f8a1a29c93762f43e27ec152de310..f649e7773e3b8725129571b735996d974c62461a 100644 (file)
@@ -4,7 +4,7 @@
  */
 namespace Friendica\Core;
 
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Process;
 use Friendica\Util\DateTimeFormat;
@@ -151,7 +151,7 @@ class Worker
         */
        private static function totalEntries()
        {
-               return dba::count('workerqueue', ["`executed` <= ? AND NOT `done`", NULL_DATE]);
+               return DBA::count('workerqueue', ["`executed` <= ? AND NOT `done`", NULL_DATE]);
        }
 
        /**
@@ -162,7 +162,7 @@ class Worker
        private static function highestPriority()
        {
                $condition = ["`executed` <= ? AND NOT `done`", NULL_DATE];
-               $workerqueue = dba::selectFirst('workerqueue', ['priority'], $condition, ['order' => ['priority']]);
+               $workerqueue = DBA::selectFirst('workerqueue', ['priority'], $condition, ['order' => ['priority']]);
                if (DBM::is_result($workerqueue)) {
                        return $workerqueue["priority"];
                } else {
@@ -180,7 +180,7 @@ class Worker
        private static function processWithPriorityActive($priority)
        {
                $condition = ["`priority` <= ? AND `executed` > ? AND NOT `done`", $priority, NULL_DATE];
-               return dba::exists('workerqueue', $condition);
+               return DBA::exists('workerqueue', $condition);
        }
 
        /**
@@ -230,7 +230,7 @@ class Worker
 
                        if ($age > 1) {
                                $stamp = (float)microtime(true);
-                               dba::update('workerqueue', ['executed' => DateTimeFormat::utcNow()], ['pid' => $mypid, 'done' => false]);
+                               DBA::update('workerqueue', ['executed' => DateTimeFormat::utcNow()], ['pid' => $mypid, 'done' => false]);
                                self::$db_duration += (microtime(true) - $stamp);
                        }
 
@@ -239,7 +239,7 @@ class Worker
                        self::execFunction($queue, $include, $argv, true);
 
                        $stamp = (float)microtime(true);
-                       if (dba::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
+                       if (DBA::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
                                Config::set('system', 'last_worker_execution', DateTimeFormat::utcNow());
                        }
                        self::$db_duration = (microtime(true) - $stamp);
@@ -254,7 +254,7 @@ class Worker
 
                if (!validate_include($include)) {
                        logger("Include file ".$argv[0]." is not valid!");
-                       dba::delete('workerqueue', ['id' => $queue["id"]]);
+                       DBA::delete('workerqueue', ['id' => $queue["id"]]);
                        return true;
                }
 
@@ -273,20 +273,20 @@ class Worker
 
                        if ($age > 1) {
                                $stamp = (float)microtime(true);
-                               dba::update('workerqueue', ['executed' => DateTimeFormat::utcNow()], ['pid' => $mypid, 'done' => false]);
+                               DBA::update('workerqueue', ['executed' => DateTimeFormat::utcNow()], ['pid' => $mypid, 'done' => false]);
                                self::$db_duration += (microtime(true) - $stamp);
                        }
 
                        self::execFunction($queue, $funcname, $argv, false);
 
                        $stamp = (float)microtime(true);
-                       if (dba::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
+                       if (DBA::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
                                Config::set('system', 'last_worker_execution', DateTimeFormat::utcNow());
                        }
                        self::$db_duration = (microtime(true) - $stamp);
                } else {
                        logger("Function ".$funcname." does not exist");
-                       dba::delete('workerqueue', ['id' => $queue["id"]]);
+                       DBA::delete('workerqueue', ['id' => $queue["id"]]);
                }
 
                return true;
@@ -477,13 +477,13 @@ 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::fetch_first("SHOW VARIABLES WHERE `variable_name` = 'max_user_connections'");
                        if (DBM::is_result($r)) {
                                $max = $r["Value"];
                        }
                        // Or it can be granted. This overrides the system variable
-                       $r = dba::p('SHOW GRANTS');
-                       while ($grants = dba::fetch($r)) {
+                       $r = DBA::p('SHOW GRANTS');
+                       while ($grants = DBA::fetch($r)) {
                                $grant = array_pop($grants);
                                if (stristr($grant, "GRANT USAGE ON")) {
                                        if (preg_match("/WITH MAX_USER_CONNECTIONS (\d*)/", $grant, $match)) {
@@ -491,15 +491,15 @@ class Worker
                                        }
                                }
                        }
-                       dba::close($r);
+                       DBA::close($r);
                }
 
                // If $max is set we will use the processlist to determine the current number of connections
                // The processlist only shows entries of the current user
                if ($max != 0) {
-                       $r = dba::p('SHOW PROCESSLIST');
-                       $used = dba::num_rows($r);
-                       dba::close($r);
+                       $r = DBA::p('SHOW PROCESSLIST');
+                       $used = DBA::num_rows($r);
+                       DBA::close($r);
 
                        logger("Connection usage (user values): ".$used."/".$max, LOGGER_DEBUG);
 
@@ -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::fetch_first("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::fetch_first("SHOW STATUS WHERE `variable_name` = 'Threads_connected'");
                if (!DBM::is_result($r)) {
                        return false;
                }
@@ -546,16 +546,16 @@ class Worker
         */
        private static function killStaleWorkers()
        {
-               $entries = dba::select(
+               $entries = DBA::select(
                        'workerqueue',
                        ['id', 'pid', 'executed', 'priority', 'parameter'],
                        ['`executed` > ? AND NOT `done` AND `pid` != 0', NULL_DATE],
                        ['order' => ['priority', 'created']]
                );
 
-               while ($entry = dba::fetch($entries)) {
+               while ($entry = DBA::fetch($entries)) {
                        if (!posix_kill($entry["pid"], 0)) {
-                               dba::update(
+                               DBA::update(
                                        'workerqueue',
                                        ['executed' => NULL_DATE, 'pid' => 0],
                                        ['id' => $entry["id"]]
@@ -591,7 +591,7 @@ class Worker
                                        } elseif ($entry["priority"] != PRIORITY_CRITICAL) {
                                                $new_priority = PRIORITY_NEGLIGIBLE;
                                        }
-                                       dba::update(
+                                       DBA::update(
                                                'workerqueue',
                                                ['executed' => NULL_DATE, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0],
                                                ['id' => $entry["id"]]
@@ -637,37 +637,37 @@ class Worker
                                $listitem = [];
 
                                // Adding all processes with no workerqueue entry
-                               $processes = dba::p(
+                               $processes = DBA::p(
                                        "SELECT COUNT(*) AS `running` FROM `process` WHERE NOT EXISTS
                                                        (SELECT id FROM `workerqueue`
                                                        WHERE `workerqueue`.`pid` = `process`.`pid` AND NOT `done` AND `pid` != ?)",
                                        getmypid()
                                );
 
-                               if ($process = dba::fetch($processes)) {
+                               if ($process = DBA::fetch($processes)) {
                                        $listitem[0] = "0:".$process["running"];
                                }
-                               dba::close($processes);
+                               DBA::close($processes);
 
                                // Now adding all processes with workerqueue entries
-                               $entries = dba::p("SELECT COUNT(*) AS `entries`, `priority` FROM `workerqueue` WHERE NOT `done` GROUP BY `priority`");
-                               while ($entry = dba::fetch($entries)) {
-                                       $processes = dba::p("SELECT COUNT(*) AS `running` FROM `process` INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` AND NOT `done` WHERE `priority` = ?", $entry["priority"]);
-                                       if ($process = dba::fetch($processes)) {
+                               $entries = DBA::p("SELECT COUNT(*) AS `entries`, `priority` FROM `workerqueue` WHERE NOT `done` GROUP BY `priority`");
+                               while ($entry = DBA::fetch($entries)) {
+                                       $processes = DBA::p("SELECT COUNT(*) AS `running` FROM `process` INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` AND NOT `done` WHERE `priority` = ?", $entry["priority"]);
+                                       if ($process = DBA::fetch($processes)) {
                                                $listitem[$entry["priority"]] = $entry["priority"].":".$process["running"]."/".$entry["entries"];
                                        }
-                                       dba::close($processes);
+                                       DBA::close($processes);
                                }
-                               dba::close($entries);
+                               DBA::close($entries);
 
                                $intervals = [1, 10, 60];
                                $jobs_per_minute = [];
                                foreach ($intervals as $interval) {
-                                       $jobs = dba::p("SELECT COUNT(*) AS `jobs` FROM `workerqueue` WHERE `done` AND `executed` > UTC_TIMESTAMP() - INTERVAL ".intval($interval)." MINUTE");
-                                       if ($job = dba::fetch($jobs)) {
+                                       $jobs = DBA::p("SELECT COUNT(*) AS `jobs` FROM `workerqueue` WHERE `done` AND `executed` > UTC_TIMESTAMP() - INTERVAL ".intval($interval)." MINUTE");
+                                       if ($job = DBA::fetch($jobs)) {
                                                $jobs_per_minute[$interval] = number_format($job['jobs'] / $interval, 0);
                                        }
-                                       dba::close($jobs);
+                                       DBA::close($jobs);
                                }
                                $processlist = ' - jpm: '.implode('/', $jobs_per_minute).' ('.implode(', ', $listitem).')';
                        }
@@ -712,7 +712,7 @@ class Worker
         */
        private static function activeWorkers()
        {
-               return dba::count('process', ['command' => 'Worker.php']);
+               return DBA::count('process', ['command' => 'Worker.php']);
        }
 
        /**
@@ -728,7 +728,7 @@ class Worker
        {
                $highest_priority = 0;
 
-               $r = dba::p(
+               $r = DBA::p(
                        "SELECT `priority`
                                FROM `process`
                                INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` AND NOT `done`"
@@ -739,10 +739,10 @@ class Worker
                        return false;
                }
                $priorities = [];
-               while ($line = dba::fetch($r)) {
+               while ($line = DBA::fetch($r)) {
                        $priorities[] = $line["priority"];
                }
-               dba::close($r);
+               DBA::close($r);
 
                // Should not happen
                if (count($priorities) == 0) {
@@ -801,33 +801,33 @@ class Worker
                $ids = [];
                if (self::passingSlow($highest_priority)) {
                        // Are there waiting processes with a higher priority than the currently highest?
-                       $result = dba::select(
+                       $result = DBA::select(
                                'workerqueue',
                                ['id'],
                                ["`executed` <= ? AND `priority` < ? AND NOT `done`", NULL_DATE, $highest_priority],
                                ['limit' => $limit, 'order' => ['priority', 'created']]
                        );
 
-                       while ($id = dba::fetch($result)) {
+                       while ($id = DBA::fetch($result)) {
                                $ids[] = $id["id"];
                        }
-                       dba::close($result);
+                       DBA::close($result);
 
                        $found = (count($ids) > 0);
 
                        if (!$found) {
                                // Give slower processes some processing time
-                               $result = dba::select(
+                               $result = DBA::select(
                                        'workerqueue',
                                        ['id'],
                                        ["`executed` <= ? AND `priority` > ? AND NOT `done`", NULL_DATE, $highest_priority],
                                        ['limit' => $limit, 'order' => ['priority', 'created']]
                                );
 
-                               while ($id = dba::fetch($result)) {
+                               while ($id = DBA::fetch($result)) {
                                        $ids[] = $id["id"];
                                }
-                               dba::close($result);
+                               DBA::close($result);
 
                                $found = (count($ids) > 0);
                                $passing_slow = $found;
@@ -836,17 +836,17 @@ class Worker
 
                // If there is no result (or we shouldn't pass lower processes) we check without priority limit
                if (!$found) {
-                       $result = dba::select(
+                       $result = DBA::select(
                                'workerqueue',
                                ['id'],
                                ["`executed` <= ? AND NOT `done`", NULL_DATE],
                                ['limit' => $limit, 'order' => ['priority', 'created']]
                        );
 
-                       while ($id = dba::fetch($result)) {
+                       while ($id = DBA::fetch($result)) {
                                $ids[] = $id["id"];
                        }
-                       dba::close($result);
+                       DBA::close($result);
 
                        $found = (count($ids) > 0);
                }
@@ -854,7 +854,7 @@ class Worker
                if ($found) {
                        $condition = "`id` IN (".substr(str_repeat("?, ", count($ids)), 0, -2).") AND `pid` = 0 AND NOT `done`";
                        array_unshift($ids, $condition);
-                       dba::update('workerqueue', ['executed' => DateTimeFormat::utcNow(), 'pid' => $mypid], $ids);
+                       DBA::update('workerqueue', ['executed' => DateTimeFormat::utcNow(), 'pid' => $mypid], $ids);
                }
 
                return $found;
@@ -871,12 +871,12 @@ class Worker
                $stamp = (float)microtime(true);
 
                // There can already be jobs for us in the queue.
-               $r = dba::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]);
+               $r = DBA::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]);
                if (DBM::is_result($r)) {
                        self::$db_duration += (microtime(true) - $stamp);
-                       return dba::inArray($r);
+                       return DBA::inArray($r);
                }
-               dba::close($r);
+               DBA::close($r);
 
                $stamp = (float)microtime(true);
                if (!Lock::acquire('worker_process')) {
@@ -891,8 +891,8 @@ class Worker
                Lock::release('worker_process');
 
                if ($found) {
-                       $r = dba::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]);
-                       return dba::inArray($r);
+                       $r = DBA::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]);
+                       return DBA::inArray($r);
                }
                return false;
        }
@@ -905,7 +905,7 @@ class Worker
        {
                $mypid = getmypid();
 
-               dba::update('workerqueue', ['executed' => NULL_DATE, 'pid' => 0], ['pid' => $mypid, 'done' => false]);
+               DBA::update('workerqueue', ['executed' => NULL_DATE, 'pid' => 0], ['pid' => $mypid, 'done' => false]);
        }
 
        /**
@@ -983,7 +983,7 @@ class Worker
                /// @todo We should clean up the corresponding workerqueue entries as well
                $condition = ["`created` < ? AND `command` = 'worker.php'",
                                DateTimeFormat::utc("now - ".$timeout." minutes")];
-               dba::delete('process', $condition);
+               DBA::delete('process', $condition);
        }
 
        /**
@@ -1076,15 +1076,15 @@ class Worker
                }
 
                $parameters = json_encode($args);
-               $found = dba::exists('workerqueue', ['parameter' => $parameters, 'done' => false]);
+               $found = DBA::exists('workerqueue', ['parameter' => $parameters, 'done' => false]);
 
                // Quit if there was a database error - a precaution for the update process to 3.5.3
-               if (dba::errorNo() != 0) {
+               if (DBA::errorNo() != 0) {
                        return false;
                }
 
                if (!$found) {
-                       dba::insert('workerqueue', ['parameter' => $parameters, 'created' => $created, 'priority' => $priority]);
+                       DBA::insert('workerqueue', ['parameter' => $parameters, 'created' => $created, 'priority' => $priority]);
                }
 
                // Should we quit and wait for the worker to be called as a cronjob?
@@ -1152,7 +1152,7 @@ class Worker
         */
        public static function IPCSetJobState($jobs)
        {
-               dba::update('worker-ipc', ['jobs' => $jobs], ['key' => 1], true);
+               DBA::update('worker-ipc', ['jobs' => $jobs], ['key' => 1], true);
        }
 
        /**
@@ -1163,7 +1163,7 @@ class Worker
         */
        public static function IPCJobsExists()
        {
-               $row = dba::selectFirst('worker-ipc', ['jobs'], ['key' => 1]);
+               $row = DBA::selectFirst('worker-ipc', ['jobs'], ['key' => 1]);
 
                // When we don't have a row, no job is running
                if (!DBM::is_result($row)) {
index 5635beb33077c23bb6c05a4326a1b8c784b9458a..987daf451737416a85a45a704415518e18ae3db7 100644 (file)
@@ -17,7 +17,7 @@ use PDOStatement;
  *
  * This class is for the low level database stuff that does driver specific things.
  */
-class dba
+class DBA
 {
        public static $connected = false;
 
index bbe60e0f2c5813edb8adbe49431b312747e783b0..ff57a065b86ff0832146b51f91d3b105691a091e 100644 (file)
@@ -64,7 +64,7 @@ class DBM
                }
 
                if (is_object($array)) {
-                       return dba::num_rows($array) > 0;
+                       return DBA::num_rows($array) > 0;
                }
 
                return (is_array($array) && (count($array) > 0));
index bfecdba20ef5f5d4cc7369ede2ef7e7a1a472a25..55188d2b39c19a42e3666721d2e4d0f6caf04221 100644 (file)
@@ -26,7 +26,7 @@ class DBStructure
         */
        public static function convertToInnoDB() {
                $r = q("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `engine` = 'MyISAM' AND `table_schema` = '%s'",
-                       dbesc(dba::database_name()));
+                       dbesc(DBA::database_name()));
 
                if (!DBM::is_result($r)) {
                        echo L10n::t('There are no tables on MyISAM.')."\n";
@@ -37,7 +37,7 @@ class DBStructure
                        $sql = sprintf("ALTER TABLE `%s` engine=InnoDB;", dbesc($table['TABLE_NAME']));
                        echo $sql."\n";
 
-                       $result = dba::e($sql);
+                       $result = DBA::e($sql);
                        if (!DBM::is_result($result)) {
                                self::printUpdateError($sql);
                        }
@@ -189,7 +189,7 @@ class DBStructure
         */
        private static function printUpdateError($message) {
                echo L10n::t("\nError %d occurred during database update:\n%s\n",
-                       dba::errorNo(), dba::errorMessage());
+                       DBA::errorNo(), DBA::errorMessage());
 
                return L10n::t('Errors encountered performing database changes: ').$message.EOL;
        }
@@ -236,8 +236,8 @@ class DBStructure
                }
 
                // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
-               if ((version_compare(dba::server_info(), '5.7.4') >= 0) &&
-                       !(strpos(dba::server_info(), 'MariaDB') !== false)) {
+               if ((version_compare(DBA::server_info(), '5.7.4') >= 0) &&
+                       !(strpos(DBA::server_info(), 'MariaDB') !== false)) {
                        $ignore = '';
                } else {
                        $ignore = ' IGNORE';
@@ -322,8 +322,8 @@ class DBStructure
                                                        $parameters['comment'] = "";
                                                }
 
-                                               $current_field_definition = dba::clean_query(implode(",", $field_definition));
-                                               $new_field_definition = dba::clean_query(implode(",", $parameters));
+                                               $current_field_definition = DBA::clean_query(implode(",", $field_definition));
+                                               $new_field_definition = DBA::clean_query(implode(",", $parameters));
                                                if ($current_field_definition != $new_field_definition) {
                                                        $sql2 = self::modifyTableField($fieldname, $parameters);
                                                        if ($sql3 == "") {
@@ -460,7 +460,7 @@ class DBStructure
                                                if ($ignore != "") {
                                                        echo "SET session old_alter_table=0;\n";
                                                } else {
-                                                       echo "INSERT INTO `".$temp_name."` SELECT ".dba::any_value_fallback($field_list)." FROM `".$name."`".$group_by.";\n";
+                                                       echo "INSERT INTO `".$temp_name."` SELECT ".DBA::any_value_fallback($field_list)." FROM `".$name."`".$group_by.";\n";
                                                        echo "DROP TABLE `".$name."`;\n";
                                                        echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
                                                }
@@ -475,15 +475,15 @@ class DBStructure
                                        // Ensure index conversion to unique removes duplicates
                                        if ($is_unique && ($temp_name != $name)) {
                                                if ($ignore != "") {
-                                                       dba::e("SET session old_alter_table=1;");
+                                                       DBA::e("SET session old_alter_table=1;");
                                                } else {
-                                                       $r = dba::e("DROP TABLE IF EXISTS `".$temp_name."`;");
+                                                       $r = DBA::e("DROP TABLE IF EXISTS `".$temp_name."`;");
                                                        if (!DBM::is_result($r)) {
                                                                $errors .= self::printUpdateError($sql3);
                                                                return $errors;
                                                        }
 
-                                                       $r = dba::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
+                                                       $r = DBA::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
                                                        if (!DBM::is_result($r)) {
                                                                $errors .= self::printUpdateError($sql3);
                                                                return $errors;
@@ -491,25 +491,25 @@ class DBStructure
                                                }
                                        }
 
-                                       $r = dba::e($sql3);
+                                       $r = DBA::e($sql3);
                                        if (!DBM::is_result($r)) {
                                                $errors .= self::printUpdateError($sql3);
                                        }
                                        if ($is_unique && ($temp_name != $name)) {
                                                if ($ignore != "") {
-                                                       dba::e("SET session old_alter_table=0;");
+                                                       DBA::e("SET session old_alter_table=0;");
                                                } else {
-                                                       $r = dba::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
+                                                       $r = DBA::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
                                                        if (!DBM::is_result($r)) {
                                                                $errors .= self::printUpdateError($sql3);
                                                                return $errors;
                                                        }
-                                                       $r = dba::e("DROP TABLE `".$name."`;");
+                                                       $r = DBA::e("DROP TABLE `".$name."`;");
                                                        if (!DBM::is_result($r)) {
                                                                $errors .= self::printUpdateError($sql3);
                                                                return $errors;
                                                        }
-                                                       $r = dba::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
+                                                       $r = DBA::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
                                                        if (!DBM::is_result($r)) {
                                                                $errors .= self::printUpdateError($sql3);
                                                                return $errors;
@@ -606,7 +606,7 @@ class DBStructure
                }
 
                if ($action) {
-                       $r = dba::e($sql);
+                       $r = DBA::e($sql);
                }
 
                return $r;
index 4ce89d49e5b67c1f6d97c51c2f30d7c1455e20a2..0a75a0f195d8c57a80e59467afc17c06dc894dad 100644 (file)
@@ -124,7 +124,7 @@ class PostUpdate
 
                // Check if the first step is done (Setting "author-id" and "owner-id" in the item table)
                $fields = ['author-link', 'author-name', 'author-avatar', 'owner-link', 'owner-name', 'owner-avatar', 'network', 'uid'];
-               $r = dba::select('item', $fields, ['author-id' => 0, 'owner-id' => 0], ['limit' => 1000]);
+               $r = DBA::select('item', $fields, ['author-id' => 0, 'owner-id' => 0], ['limit' => 1000]);
                if (!$r) {
                        // Are there unfinished entries in the thread table?
                        $r = q("SELECT COUNT(*) AS `total` FROM `thread`
@@ -180,7 +180,7 @@ class PostUpdate
                        if ($owner_id == 0) {
                                $owner_id = -1;
                        }
-                       dba::update('item', ['author-id' => $author_id, 'owner-id' => $owner_id], ['uid' => $item['uid'], 'author-link' => $item['author-link'], 'owner-link' => $item['owner-link'], 'author-id' => 0, 'owner-id' => 0]);
+                       DBA::update('item', ['author-id' => $author_id, 'owner-id' => $owner_id], ['uid' => $item['uid'], 'author-link' => $item['author-link'], 'owner-link' => $item['owner-link'], 'author-id' => 0, 'owner-id' => 0]);
                }
 
                logger("Updated items", LOGGER_DEBUG);
@@ -212,7 +212,7 @@ class PostUpdate
                }
                foreach ($r as $user) {
                        if (!empty($user["lastitem_date"]) && ($user["lastitem_date"] > $user["last-item"])) {
-                               dba::update('contact', ['last-item' => $user['lastitem_date']], ['id' => $user['id']]);
+                               DBA::update('contact', ['last-item' => $user['lastitem_date']], ['id' => $user['id']]);
                        }
                }
 
@@ -282,7 +282,7 @@ class PostUpdate
 
                        ++$rows;
                }
-               dba::close($items);
+               DBA::close($items);
 
                Config::set("system", "post_update_version_1279_id", $id);
 
index 13283009378787576cc28e50b919e1905efcb873..84580b0898997cba66222e95bcac51353ac992a4 100644 (file)
@@ -11,7 +11,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Network\Probe;
 use Friendica\Object\Image;
@@ -41,7 +41,7 @@ class Contact extends BaseObject
        {
                $return = [];
                if (intval($gid)) {
-                       $stmt = dba::p('SELECT `group_member`.`contact-id`, `contact`.*
+                       $stmt = DBA::p('SELECT `group_member`.`contact-id`, `contact`.*
                                FROM `contact`
                                INNER JOIN `group_member`
                                        ON `contact`.`id` = `group_member`.`contact-id`
@@ -55,7 +55,7 @@ class Contact extends BaseObject
                                local_user()
                        );
                        if (DBM::is_result($stmt)) {
-                               $return = dba::inArray($stmt);
+                               $return = DBA::inArray($stmt);
                        }
                }
 
@@ -72,7 +72,7 @@ class Contact extends BaseObject
        {
                $return = 0;
                if (intval($gid)) {
-                       $contacts = dba::fetch_first('SELECT COUNT(*) AS `count`
+                       $contacts = DBA::fetch_first('SELECT COUNT(*) AS `count`
                                FROM `contact`
                                INNER JOIN `group_member`
                                        ON `contact`.`id` = `group_member`.`contact-id`
@@ -99,16 +99,16 @@ class Contact extends BaseObject
        public static function createSelfFromUserId($uid)
        {
                // Only create the entry if it doesn't exist yet
-               if (dba::exists('contact', ['uid' => $uid, 'self' => true])) {
+               if (DBA::exists('contact', ['uid' => $uid, 'self' => true])) {
                        return true;
                }
 
-               $user = dba::selectFirst('user', ['uid', 'username', 'nickname'], ['uid' => $uid]);
+               $user = DBA::selectFirst('user', ['uid', 'username', 'nickname'], ['uid' => $uid]);
                if (!DBM::is_result($user)) {
                        return false;
                }
 
-               $return = dba::insert('contact', [
+               $return = DBA::insert('contact', [
                        'uid'         => $user['uid'],
                        'created'     => DateTimeFormat::utcNow(),
                        'self'        => 1,
@@ -146,20 +146,20 @@ class Contact extends BaseObject
        {
                $fields = ['id', 'name', 'nick', 'location', 'about', 'keywords', 'gender', 'avatar',
                        'xmpp', 'contact-type', 'forum', 'prv', 'avatar-date', 'nurl'];
-               $self = dba::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]);
+               $self = DBA::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]);
                if (!DBM::is_result($self)) {
                        return;
                }
 
                $fields = ['nickname', 'page-flags', 'account-type'];
-               $user = dba::selectFirst('user', $fields, ['uid' => $uid]);
+               $user = DBA::selectFirst('user', $fields, ['uid' => $uid]);
                if (!DBM::is_result($user)) {
                        return;
                }
 
                $fields = ['name', 'photo', 'thumb', 'about', 'address', 'locality', 'region',
                        'country-name', 'gender', 'pub_keywords', 'xmpp'];
-               $profile = dba::selectFirst('profile', $fields, ['uid' => $uid, 'is-default' => true]);
+               $profile = DBA::selectFirst('profile', $fields, ['uid' => $uid, 'is-default' => true]);
                if (!DBM::is_result($profile)) {
                        return;
                }
@@ -170,7 +170,7 @@ class Contact extends BaseObject
                        'gender' => $profile['gender'], 'avatar' => $profile['photo'],
                        'contact-type' => $user['account-type'], 'xmpp' => $profile['xmpp']];
 
-               $avatar = dba::selectFirst('photo', ['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
+               $avatar = DBA::selectFirst('photo', ['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
                if (DBM::is_result($avatar)) {
                        if ($update_avatar) {
                                $fields['avatar-date'] = DateTimeFormat::utcNow();
@@ -223,15 +223,15 @@ class Contact extends BaseObject
 
                if ($update) {
                        $fields['name-date'] = DateTimeFormat::utcNow();
-                       dba::update('contact', $fields, ['id' => $self['id']]);
+                       DBA::update('contact', $fields, ['id' => $self['id']]);
 
                        // Update the public contact as well
-                       dba::update('contact', $fields, ['uid' => 0, 'nurl' => $self['nurl']]);
+                       DBA::update('contact', $fields, ['uid' => 0, 'nurl' => $self['nurl']]);
 
                        // Update the profile
                        $fields = ['photo' => System::baseUrl() . '/photo/profile/' .$uid . '.jpg',
                                'thumb' => System::baseUrl() . '/photo/avatar/' . $uid .'.jpg'];
-                       dba::update('profile', $fields, ['uid' => $uid, 'is-default' => true]);
+                       DBA::update('profile', $fields, ['uid' => $uid, 'is-default' => true]);
                }
        }
 
@@ -244,18 +244,18 @@ class Contact extends BaseObject
        public static function remove($id)
        {
                // We want just to make sure that we don't delete our "self" contact
-               $contact = dba::selectFirst('contact', ['uid'], ['id' => $id, 'self' => false]);
+               $contact = DBA::selectFirst('contact', ['uid'], ['id' => $id, 'self' => false]);
                if (!DBM::is_result($contact) || !intval($contact['uid'])) {
                        return;
                }
 
                $archive = PConfig::get($contact['uid'], 'system', 'archive_removed_contacts');
                if ($archive) {
-                       dba::update('contact', ['archive' => true, 'network' => 'none', 'writable' => false], ['id' => $id]);
+                       DBA::update('contact', ['archive' => true, 'network' => 'none', 'writable' => false], ['id' => $id]);
                        return;
                }
 
-               dba::delete('contact', ['id' => $id]);
+               DBA::delete('contact', ['id' => $id]);
 
                // Delete the rest in the background
                Worker::add(PRIORITY_LOW, 'RemoveContact', $id);
@@ -305,10 +305,10 @@ class Contact extends BaseObject
                }
 
                if ($contact['term-date'] <= NULL_DATE) {
-                       dba::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
+                       DBA::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
 
                        if ($contact['url'] != '') {
-                               dba::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE]);
+                               DBA::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE]);
                        }
                } else {
                        /* @todo
@@ -326,10 +326,10 @@ class Contact extends BaseObject
                                 * delete, though if the owner tries to unarchive them we'll start
                                 * the whole process over again.
                                 */
-                               dba::update('contact', ['archive' => 1], ['id' => $contact['id']]);
+                               DBA::update('contact', ['archive' => 1], ['id' => $contact['id']]);
 
                                if ($contact['url'] != '') {
-                                       dba::update('contact', ['archive' => 1], ['nurl' => normalise_link($contact['url']), 'self' => false]);
+                                       DBA::update('contact', ['archive' => 1], ['nurl' => normalise_link($contact['url']), 'self' => false]);
                                }
                        }
                }
@@ -346,7 +346,7 @@ class Contact extends BaseObject
        public static function unmarkForArchival(array $contact)
        {
                $condition = ['`id` = ? AND (`term-date` > ? OR `archive`)', $contact['id'], NULL_DATE];
-               $exists = dba::exists('contact', $condition);
+               $exists = DBA::exists('contact', $condition);
 
                // We don't need to update, we never marked this contact for archival
                if (!$exists) {
@@ -355,15 +355,15 @@ class Contact extends BaseObject
 
                // It's a miracle. Our dead contact has inexplicably come back to life.
                $fields = ['term-date' => NULL_DATE, 'archive' => false];
-               dba::update('contact', $fields, ['id' => $contact['id']]);
+               DBA::update('contact', $fields, ['id' => $contact['id']]);
 
                if (!empty($contact['url'])) {
-                       dba::update('contact', $fields, ['nurl' => normalise_link($contact['url'])]);
+                       DBA::update('contact', $fields, ['nurl' => normalise_link($contact['url'])]);
                }
 
                if (!empty($contact['batch'])) {
                        $condition = ['batch' => $contact['batch'], 'contact-type' => ACCOUNT_TYPE_RELAY];
-                       dba::update('contact', $fields, $condition);
+                       DBA::update('contact', $fields, $condition);
                }
        }
 
@@ -398,41 +398,41 @@ class Contact extends BaseObject
                $ssl_url = str_replace('http://', 'https://', $url);
 
                // Fetch contact data from the contact table for the given user
-               $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`,
+               $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::inArray($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`,
+                       $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::inArray($s);
                }
 
                // Fetch the data from the contact table with "uid=0" (which is filled automatically)
                if (!DBM::is_result($r)) {
-                       $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`,
+                       $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::inArray($s);
                }
 
                // Fetch the data from the contact table with "uid=0" (which is filled automatically) - checked with the alias
                if (!DBM::is_result($r)) {
-                       $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`,
+                       $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::inArray($s);
                }
 
                // Fetch the data from the gcontact table
                if (!DBM::is_result($r)) {
-                       $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`,
+                       $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::inArray($s);
                }
 
                if (DBM::is_result($r)) {
@@ -602,7 +602,7 @@ class Contact extends BaseObject
                        }
 
                        // Look for our own contact if the uid doesn't match and isn't public
-                       $contact_own = dba::selectFirst('contact', [], ['nurl' => $contact['nurl'], 'network' => $contact['network'], 'uid' => $uid]);
+                       $contact_own = DBA::selectFirst('contact', [], ['nurl' => $contact['nurl'], 'network' => $contact['network'], 'uid' => $uid]);
                        if (DBM::is_result($contact_own)) {
                                return self::photoMenu($contact_own, $uid);
                        } else {
@@ -746,11 +746,11 @@ class Contact extends BaseObject
 
                /// @todo Verify if we can't use Contact::getDetailsByUrl instead of the following
                // We first try the nurl (http://server.tld/nick), most common case
-               $contact = dba::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['nurl' => normalise_link($url), 'uid' => $uid]);
+               $contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['nurl' => normalise_link($url), 'uid' => $uid]);
 
                // Then the addr (nick@server.tld)
                if (!DBM::is_result($contact)) {
-                       $contact = dba::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['addr' => $url, 'uid' => $uid]);
+                       $contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['addr' => $url, 'uid' => $uid]);
                }
 
                // Then the alias (which could be anything)
@@ -758,7 +758,7 @@ class Contact extends BaseObject
                        // The link could be provided as http although we stored it as https
                        $ssl_url = str_replace('http://', 'https://', $url);
                        $condition = ['`alias` IN (?, ?, ?) AND `uid` = ?', $url, normalise_link($url), $ssl_url, $uid];
-                       $contact = dba::selectFirst('contact', ['id', 'avatar', 'avatar-date'], $condition);
+                       $contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], $condition);
                }
 
                if (DBM::is_result($contact)) {
@@ -790,30 +790,30 @@ class Contact extends BaseObject
 
                        // Get data from the gcontact table
                        $fields = ['name', 'nick', 'url', 'photo', 'addr', 'alias', 'network'];
-                       $contact = dba::selectFirst('gcontact', $fields, ['nurl' => normalise_link($url)]);
+                       $contact = DBA::selectFirst('gcontact', $fields, ['nurl' => normalise_link($url)]);
                        if (!DBM::is_result($contact)) {
-                               $contact = dba::selectFirst('contact', $fields, ['nurl' => normalise_link($url)]);
+                               $contact = DBA::selectFirst('contact', $fields, ['nurl' => normalise_link($url)]);
                        }
 
                        if (!DBM::is_result($contact)) {
                                $fields = ['url', 'addr', 'alias', 'notify', 'poll', 'name', 'nick',
                                        'photo', 'keywords', 'location', 'about', 'network',
                                        'priority', 'batch', 'request', 'confirm', 'poco'];
-                               $contact = dba::selectFirst('contact', $fields, ['addr' => $url]);
+                               $contact = DBA::selectFirst('contact', $fields, ['addr' => $url]);
                        }
 
                        if (!DBM::is_result($contact)) {
                                // The link could be provided as http although we stored it as https
                                $ssl_url = str_replace('http://', 'https://', $url);
                                $condition = ['alias' => [$url, normalise_link($url), $ssl_url]];
-                               $contact = dba::selectFirst('contact', $fields, $condition);
+                               $contact = DBA::selectFirst('contact', $fields, $condition);
                        }
 
                        if (!DBM::is_result($contact)) {
                                $fields = ['url', 'addr', 'alias', 'notify', 'poll', 'name', 'nick',
                                        'photo', 'network', 'priority', 'batch', 'request', 'confirm'];
                                $condition = ['url' => [$url, normalise_link($url), $ssl_url]];
-                               $contact = dba::selectFirst('fcontact', $fields, $condition);
+                               $contact = DBA::selectFirst('fcontact', $fields, $condition);
                        }
 
                        if (!empty($default)) {
@@ -833,7 +833,7 @@ class Contact extends BaseObject
 
                $url = $data["url"];
                if (!$contact_id) {
-                       dba::insert('contact', [
+                       DBA::insert('contact', [
                                'uid'       => $uid,
                                'created'   => DateTimeFormat::utcNow(),
                                'url'       => $data["url"],
@@ -865,8 +865,8 @@ class Contact extends BaseObject
                                'pending'   => 0]
                        );
 
-                       $s = dba::select('contact', ['id'], ['nurl' => normalise_link($data["url"]), 'uid' => $uid], ['order' => ['id'], 'limit' => 2]);
-                       $contacts = dba::inArray($s);
+                       $s = DBA::select('contact', ['id'], ['nurl' => normalise_link($data["url"]), 'uid' => $uid], ['order' => ['id'], 'limit' => 2]);
+                       $contacts = DBA::inArray($s);
                        if (!DBM::is_result($contacts)) {
                                return 0;
                        }
@@ -874,7 +874,7 @@ class Contact extends BaseObject
                        $contact_id = $contacts[0]["id"];
 
                        // Update the newly created contact from data in the gcontact table
-                       $gcontact = dba::selectFirst('gcontact', ['location', 'about', 'keywords', 'gender'], ['nurl' => normalise_link($data["url"])]);
+                       $gcontact = DBA::selectFirst('gcontact', ['location', 'about', 'keywords', 'gender'], ['nurl' => normalise_link($data["url"])]);
                        if (DBM::is_result($gcontact)) {
                                // Only use the information when the probing hadn't fetched these values
                                if ($data['keywords'] != '') {
@@ -886,11 +886,11 @@ class Contact extends BaseObject
                                if ($data['about'] != '') {
                                        unset($gcontact['about']);
                                }
-                               dba::update('contact', $gcontact, ['id' => $contact_id]);
+                               DBA::update('contact', $gcontact, ['id' => $contact_id]);
                        }
 
                        if (count($contacts) > 1 && $uid == 0 && $contact_id != 0 && $data["url"] != "") {
-                               dba::delete('contact', ["`nurl` = ? AND `uid` = 0 AND `id` != ? AND NOT `self`",
+                               DBA::delete('contact', ["`nurl` = ? AND `uid` = 0 AND `id` != ? AND NOT `self`",
                                        normalise_link($data["url"]), $contact_id]);
                        }
                }
@@ -898,7 +898,7 @@ class Contact extends BaseObject
                self::updateAvatar($data["photo"], $uid, $contact_id);
 
                $fields = ['url', 'nurl', 'addr', 'alias', 'name', 'nick', 'keywords', 'location', 'about', 'avatar-date', 'pubkey'];
-               $contact = dba::selectFirst('contact', $fields, ['id' => $contact_id]);
+               $contact = DBA::selectFirst('contact', $fields, ['id' => $contact_id]);
 
                // This condition should always be true
                if (!DBM::is_result($contact)) {
@@ -953,7 +953,7 @@ class Contact extends BaseObject
 
                $updated['avatar-date'] = DateTimeFormat::utcNow();
 
-               dba::update('contact', $updated, ['id' => $contact_id], $contact);
+               DBA::update('contact', $updated, ['id' => $contact_id], $contact);
 
                return $contact_id;
        }
@@ -971,7 +971,7 @@ class Contact extends BaseObject
                        return false;
                }
 
-               $blocked = dba::selectFirst('contact', ['blocked'], ['id' => $cid]);
+               $blocked = DBA::selectFirst('contact', ['blocked'], ['id' => $cid]);
                if (!DBM::is_result($blocked)) {
                        return false;
                }
@@ -991,7 +991,7 @@ class Contact extends BaseObject
                        return false;
                }
 
-               $hidden = dba::selectFirst('contact', ['hidden'], ['id' => $cid]);
+               $hidden = DBA::selectFirst('contact', ['hidden'], ['id' => $cid]);
                if (!DBM::is_result($hidden)) {
                        return false;
                }
@@ -1107,7 +1107,7 @@ class Contact extends BaseObject
         */
        public static function block($uid)
        {
-               $return = dba::update('contact', ['blocked' => true], ['id' => $uid]);
+               $return = DBA::update('contact', ['blocked' => true], ['id' => $uid]);
 
                return $return;
        }
@@ -1120,7 +1120,7 @@ class Contact extends BaseObject
         */
        public static function unblock($uid)
        {
-               $return = dba::update('contact', ['blocked' => false], ['id' => $uid]);
+               $return = DBA::update('contact', ['blocked' => false], ['id' => $uid]);
 
                return $return;
        }
@@ -1137,7 +1137,7 @@ class Contact extends BaseObject
         */
        public static function updateAvatar($avatar, $uid, $cid, $force = false)
        {
-               $contact = dba::selectFirst('contact', ['avatar', 'photo', 'thumb', 'micro', 'nurl'], ['id' => $cid]);
+               $contact = DBA::selectFirst('contact', ['avatar', 'photo', 'thumb', 'micro', 'nurl'], ['id' => $cid]);
                if (!DBM::is_result($contact)) {
                        return false;
                } else {
@@ -1148,7 +1148,7 @@ class Contact extends BaseObject
                        $photos = Photo::importProfilePhoto($avatar, $uid, $cid, true);
 
                        if ($photos) {
-                               dba::update(
+                               DBA::update(
                                        'contact',
                                        ['avatar' => $avatar, 'photo' => $photos[0], 'thumb' => $photos[1], 'micro' => $photos[2], 'avatar-date' => DateTimeFormat::utcNow()],
                                        ['id' => $cid]
@@ -1156,7 +1156,7 @@ class Contact extends BaseObject
 
                                // Update the public contact (contact id = 0)
                                if ($uid != 0) {
-                                       $pcontact = dba::selectFirst('contact', ['id'], ['nurl' => $contact['nurl'], 'uid' => 0]);
+                                       $pcontact = DBA::selectFirst('contact', ['id'], ['nurl' => $contact['nurl'], 'uid' => 0]);
                                        if (DBM::is_result($pcontact)) {
                                                self::updateAvatar($avatar, 0, $pcontact['id'], $force);
                                        }
@@ -1181,7 +1181,7 @@ class Contact extends BaseObject
                 */
 
                $fields = ['url', 'nurl', 'addr', 'alias', 'batch', 'notify', 'poll', 'poco', 'network'];
-               $contact = dba::selectFirst('contact', $fields, ['id' => $id]);
+               $contact = DBA::selectFirst('contact', $fields, ['id' => $id]);
                if (!DBM::is_result($contact)) {
                        return false;
                }
@@ -1210,7 +1210,7 @@ class Contact extends BaseObject
                        return true;
                }
 
-               dba::update(
+               DBA::update(
                        'contact', [
                                'url'    => $ret['url'],
                                'nurl'   => normalise_link($ret['url']),
@@ -1378,12 +1378,12 @@ class Contact extends BaseObject
                        $new_relation = (($r[0]['rel'] == CONTACT_IS_FOLLOWER) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
 
                        $fields = ['rel' => $new_relation, 'subhub' => $subhub, 'readonly' => false];
-                       dba::update('contact', $fields, ['id' => $r[0]['id']]);
+                       DBA::update('contact', $fields, ['id' => $r[0]['id']]);
                } else {
                        $new_relation = ((in_array($ret['network'], [NETWORK_MAIL])) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
 
                        // create contact record
-                       dba::insert('contact', [
+                       DBA::insert('contact', [
                                'uid'     => $uid,
                                'created' => DateTimeFormat::utcNow(),
                                'url'     => $ret['url'],
@@ -1409,7 +1409,7 @@ class Contact extends BaseObject
                        ]);
                }
 
-               $contact = dba::selectFirst('contact', [], ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]);
+               $contact = DBA::selectFirst('contact', [], ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]);
                if (!DBM::is_result($contact)) {
                        $result['message'] .= L10n::t('Unable to retrieve contact information.') . EOL;
                        return $result;
@@ -1479,7 +1479,7 @@ class Contact extends BaseObject
                        $fields = ['url' => $contact['url'], 'request' => $contact['request'],
                                        'notify' => $contact['notify'], 'poll' => $contact['poll'],
                                        'confirm' => $contact['confirm'], 'poco' => $contact['poco']];
-                       dba::update('contact', $fields, ['id' => $contact['id']]);
+                       DBA::update('contact', $fields, ['id' => $contact['id']]);
                }
 
                return $contact;
@@ -1503,12 +1503,12 @@ class Contact extends BaseObject
                if (is_array($contact)) {
                        if (($contact['rel'] == CONTACT_IS_SHARING)
                                || ($sharing && $contact['rel'] == CONTACT_IS_FOLLOWER)) {
-                               dba::update('contact', ['rel' => CONTACT_IS_FRIEND, 'writable' => true],
+                               DBA::update('contact', ['rel' => CONTACT_IS_FRIEND, 'writable' => true],
                                                ['id' => $contact['id'], 'uid' => $importer['uid']]);
                        }
                        // send email notification to owner?
                } else {
-                       if (dba::exists('contact', ['nurl' => normalise_link($url), 'uid' => $importer['uid'], 'pending' => true])) {
+                       if (DBA::exists('contact', ['nurl' => normalise_link($url), 'uid' => $importer['uid'], 'pending' => true])) {
                                logger('ignoring duplicated connection request from pending contact ' . $url);
                                return;
                        }
@@ -1529,7 +1529,7 @@ class Contact extends BaseObject
                        );
 
                        $contact_record = [
-                               'id' => dba::lastInsertId(),
+                               'id' => DBA::lastInsertId(),
                                'network' => NETWORK_OSTATUS,
                                'name' => $name,
                                'url' => $url,
@@ -1540,13 +1540,13 @@ class Contact extends BaseObject
 
                        /// @TODO Encapsulate this into a function/method
                        $fields = ['uid', 'username', 'email', 'page-flags', 'notify-flags', 'language'];
-                       $user = dba::selectFirst('user', $fields, ['uid' => $importer['uid']]);
+                       $user = DBA::selectFirst('user', $fields, ['uid' => $importer['uid']]);
                        if (DBM::is_result($user) && !in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
                                // create notification
                                $hash = random_string();
 
                                if (is_array($contact_record)) {
-                                       dba::insert('intro', ['uid' => $importer['uid'], 'contact-id' => $contact_record['id'],
+                                       DBA::insert('intro', ['uid' => $importer['uid'], 'contact-id' => $contact_record['id'],
                                                                'blocked' => false, 'knowyou' => false,
                                                                'hash' => $hash, 'datetime' => DateTimeFormat::utcNow()]);
                                }
@@ -1584,7 +1584,7 @@ class Contact extends BaseObject
        public static function removeFollower($importer, $contact, array $datarray = [], $item = "") {
 
                if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_SHARING)) {
-                       dba::update('contact', ['rel' => CONTACT_IS_SHARING], ['id' => $contact['id']]);
+                       DBA::update('contact', ['rel' => CONTACT_IS_SHARING], ['id' => $contact['id']]);
                } else {
                        Contact::remove($contact['id']);
                }
@@ -1593,7 +1593,7 @@ class Contact extends BaseObject
        public static function removeSharer($importer, $contact, array $datarray = [], $item = "") {
 
                if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_FOLLOWER)) {
-                       dba::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
+                       DBA::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
                } else {
                        Contact::remove($contact['id']);
                }
@@ -1664,14 +1664,14 @@ class Contact extends BaseObject
 
                $str = dbesc(implode(',', $contact_ids));
 
-               $stmt = dba::p("SELECT `id` FROM `contact` WHERE `id` IN ( " . $str . ") AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0");
+               $stmt = DBA::p("SELECT `id` FROM `contact` WHERE `id` IN ( " . $str . ") AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0");
 
                $return = [];
-               while($contact = dba::fetch($stmt)) {
+               while($contact = DBA::fetch($stmt)) {
                        $return[] = $contact['id'];
                }
 
-               dba::close($stmt);
+               DBA::close($stmt);
 
                $contact_ids = $return;
        }
@@ -1704,7 +1704,7 @@ class Contact extends BaseObject
         */
        public static function magicLinkbyId($cid, $url = '')
        {
-               $contact = dba::selectFirst('contact', ['id', 'network', 'url', 'uid'], ['id' => $cid]);
+               $contact = DBA::selectFirst('contact', ['id', 'network', 'url', 'uid'], ['id' => $cid]);
 
                return self::magicLinkbyContact($contact, $url);
         }
index 4b1adc250fe36a860a003605d2457948ff4c80ff..8ad26c898dd89c801c6fbd0f3f76344c7bedc40b 100644 (file)
@@ -4,7 +4,7 @@
  */
 namespace Friendica\Model;
 
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 require_once "include/dba.php";
@@ -53,7 +53,7 @@ class Conversation
                        }
 
                        $fields = ['item-uri', 'reply-to-uri', 'conversation-uri', 'conversation-href', 'protocol', 'source'];
-                       $old_conv = dba::selectFirst('conversation', $fields, ['item-uri' => $conversation['item-uri']]);
+                       $old_conv = DBA::selectFirst('conversation', $fields, ['item-uri' => $conversation['item-uri']]);
                        if (DBM::is_result($old_conv)) {
                                // Don't update when only the source has changed.
                                // Only do this when there had been no source before.
@@ -65,11 +65,11 @@ class Conversation
                                        unset($conversation['protocol']);
                                        unset($conversation['source']);
                                }
-                               if (!dba::update('conversation', $conversation, ['item-uri' => $conversation['item-uri']], $old_conv)) {
+                               if (!DBA::update('conversation', $conversation, ['item-uri' => $conversation['item-uri']], $old_conv)) {
                                        logger('Conversation: update for '.$conversation['item-uri'].' from '.$old_conv['protocol'].' to '.$conversation['protocol'].' failed', LOGGER_DEBUG);
                                }
                        } else {
-                               if (!dba::insert('conversation', $conversation, true)) {
+                               if (!DBA::insert('conversation', $conversation, true)) {
                                        logger('Conversation: insert for '.$conversation['item-uri'].' (protocol '.$conversation['protocol'].') failed', LOGGER_DEBUG);
                                }
                        }
index bd614f0bfbfd503d81f6d9aec840994f9497c07c..be3c06eeb16d6c382ccd5199782db48bebb55428 100644 (file)
@@ -11,7 +11,7 @@ use Friendica\Core\Addon;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Map;
@@ -213,7 +213,7 @@ class Event extends BaseObject
                        return;
                }
 
-               dba::delete('event', ['id' => $event_id]);
+               DBA::delete('event', ['id' => $event_id]);
                logger("Deleted event ".$event_id, LOGGER_DEBUG);
        }
 
@@ -261,12 +261,12 @@ class Event extends BaseObject
                        $conditions['self'] = true;
                }
 
-               $contact = dba::selectFirst('contact', [], $conditions);
+               $contact = DBA::selectFirst('contact', [], $conditions);
 
                // Existing event being modified.
                if ($event['id']) {
                        // has the event actually changed?
-                       $existing_event = dba::selectFirst('event', ['edited'], ['id' => $event['id'], 'uid' => $event['uid']]);
+                       $existing_event = DBA::selectFirst('event', ['edited'], ['id' => $event['id'], 'uid' => $event['uid']]);
                        if (!DBM::is_result($existing_event) || ($existing_event['edited'] === $event['edited'])) {
 
                                $item = Item::selectFirst(['id'], ['event-id' => $event['id'], 'uid' => $event['uid']]);
@@ -286,7 +286,7 @@ class Event extends BaseObject
                                'nofinish' => $event['nofinish'],
                        ];
 
-                       dba::update('event', $updated_fields, ['id' => $event['id'], 'uid' => $event['uid']]);
+                       DBA::update('event', $updated_fields, ['id' => $event['id'], 'uid' => $event['uid']]);
 
                        $item = Item::selectFirst(['id'], ['event-id' => $event['id'], 'uid' => $event['uid']]);
                        if (DBM::is_result($item)) {
@@ -307,9 +307,9 @@ class Event extends BaseObject
                        $event['guid'] = System::createGUID(32);
 
                        // New event. Store it.
-                       dba::insert('event', $event);
+                       DBA::insert('event', $event);
 
-                       $event['id'] = dba::lastInsertId();
+                       $event['id'] = DBA::lastInsertId();
 
                        $item_arr = [];
 
@@ -737,9 +737,9 @@ class Event extends BaseObject
                        $conditions += ['allow_cid' => '', 'allow_gid' => ''];
                }
 
-               $events = dba::select('event', $fields, $conditions);
+               $events = DBA::select('event', $fields, $conditions);
                if (DBM::is_result($events)) {
-                       $return = dba::inArray($events);
+                       $return = DBA::inArray($events);
                }
 
                return $return;
@@ -761,7 +761,7 @@ class Event extends BaseObject
        {
                $process = false;
 
-               $user = dba::selectFirst('user', ['timezone'], ['uid' => $uid]);
+               $user = DBA::selectFirst('user', ['timezone'], ['uid' => $uid]);
                if (DBM::is_result($user)) {
                        $timezone = $user['timezone'];
                }
index a4682798533505b2d89ce814971ea9482bd01390..8dbc37c22860adc6454277be4528d85713666c0f 100644 (file)
@@ -10,7 +10,7 @@ use Exception;
 use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Network\Probe;
 use Friendica\Protocol\PortableContact;
@@ -60,7 +60,7 @@ class GContact
 
                $search .= "%";
 
-               $results = dba::p("SELECT `nurl` FROM `gcontact`
+               $results = DBA::p("SELECT `nurl` FROM `gcontact`
                        WHERE NOT `hide` AND `network` IN (?, ?, ?) AND
                                ((`last_contact` >= `last_failure`) OR (`updated` >= `last_failure`)) AND
                                (`addr` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?) $extra_sql
@@ -69,7 +69,7 @@ class GContact
                );
 
                $gcontacts = [];
-               while ($result = dba::fetch($results)) {
+               while ($result = DBA::fetch($results)) {
                        $urlparts = parse_url($result["nurl"]);
 
                        // Ignore results that look strange.
@@ -237,8 +237,8 @@ class GContact
 
                        if ($alternate && ($gcontact['network'] == NETWORK_OSTATUS)) {
                                // Delete the old entry - if it exists
-                               if (dba::exists('gcontact', ['nurl' => normalise_link($orig_profile)])) {
-                                       dba::delete('gcontact', ['nurl' => normalise_link($orig_profile)]);
+                               if (DBA::exists('gcontact', ['nurl' => normalise_link($orig_profile)])) {
+                                       DBA::delete('gcontact', ['nurl' => normalise_link($orig_profile)]);
                                }
                        }
                }
@@ -688,7 +688,7 @@ class GContact
                        $contact["url"] = self::cleanContactUrl($contact["url"]);
                }
 
-               dba::lock('gcontact');
+               DBA::lock('gcontact');
                $r = q(
                        "SELECT `id`, `last_contact`, `last_failure`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
                        dbesc(normalise_link($contact["url"]))
@@ -735,7 +735,7 @@ class GContact
                                $doprobing = in_array($r[0]["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""]);
                        }
                }
-               dba::unlock();
+               DBA::unlock();
 
                if ($doprobing) {
                        logger("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], LOGGER_DEBUG);
@@ -871,13 +871,13 @@ class GContact
                                        'generation' => $contact['generation'], 'updated' => $contact['updated'],
                                        'server_url' => $contact['server_url'], 'connect' => $contact['connect']];
 
-                       dba::update('gcontact', $updated, $condition, $fields);
+                       DBA::update('gcontact', $updated, $condition, $fields);
 
                        // Now update the contact entry with the user id "0" as well.
                        // This is used for the shadow copies of public items.
                        /// @todo Check if we really should do this.
                        // The quality of the gcontact table is mostly lower than the public contact
-                       $public_contact = dba::selectFirst('contact', ['id'], ['nurl' => normalise_link($contact["url"]), 'uid' => 0]);
+                       $public_contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link($contact["url"]), 'uid' => 0]);
                        if (DBM::is_result($public_contact)) {
                                logger("Update public contact ".$public_contact["id"], LOGGER_DEBUG);
 
@@ -887,7 +887,7 @@ class GContact
                                                'network', 'bd', 'gender',
                                                'keywords', 'alias', 'contact-type',
                                                'url', 'location', 'about'];
-                               $old_contact = dba::selectFirst('contact', $fields, ['id' => $public_contact["id"]]);
+                               $old_contact = DBA::selectFirst('contact', $fields, ['id' => $public_contact["id"]]);
 
                                // Update it with the current values
                                $fields = ['name' => $contact['name'], 'nick' => $contact['nick'],
@@ -903,7 +903,7 @@ class GContact
                                }
 
 
-                               dba::update('contact', $fields, ['id' => $public_contact["id"]], $old_contact);
+                               DBA::update('contact', $fields, ['id' => $public_contact["id"]], $old_contact);
                        }
                }
 
index 5247a055692ae058877e2621055ce67c2be2b1b2..b41866c6ef8007f7fee7cdc308062a1c68036bbe 100644 (file)
@@ -6,7 +6,7 @@ namespace Friendica\Model;
 
 use Friendica\BaseObject;
 use Friendica\Core\L10n;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 require_once 'boot.php';
@@ -38,17 +38,17 @@ class Group extends BaseObject
                                // all the old members are gone, but the group remains so we don't break any security
                                // access lists. What we're doing here is reviving the dead group, but old content which
                                // was restricted to this group may now be seen by the new group members.
-                               $group = dba::selectFirst('group', ['deleted'], ['id' => $gid]);
+                               $group = DBA::selectFirst('group', ['deleted'], ['id' => $gid]);
                                if (DBM::is_result($group) && $group['deleted']) {
-                                       dba::update('group', ['deleted' => 0], ['id' => $gid]);
+                                       DBA::update('group', ['deleted' => 0], ['id' => $gid]);
                                        notice(L10n::t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
                                }
                                return true;
                        }
 
-                       $return = dba::insert('group', ['uid' => $uid, 'name' => $name]);
+                       $return = DBA::insert('group', ['uid' => $uid, 'name' => $name]);
                        if ($return) {
-                               $return = dba::lastInsertId();
+                               $return = DBA::lastInsertId();
                        }
                }
                return $return;
@@ -64,7 +64,7 @@ class Group extends BaseObject
         */
        public static function update($id, $name)
        {
-               return dba::update('group', ['name' => $name], ['id' => $id]);
+               return DBA::update('group', ['name' => $name], ['id' => $id]);
        }
 
        /**
@@ -76,11 +76,11 @@ class Group extends BaseObject
        public static function getIdsByContactId($cid)
        {
                $condition = ['contact-id' => $cid];
-               $stmt = dba::select('group_member', ['gid'], $condition);
+               $stmt = DBA::select('group_member', ['gid'], $condition);
 
                $return = [];
 
-               while ($group = dba::fetch($stmt)) {
+               while ($group = DBA::fetch($stmt)) {
                        $return[] = $group['gid'];
                }
 
@@ -99,7 +99,7 @@ class Group extends BaseObject
         */
        public static function countUnseen()
        {
-               $stmt = dba::p("SELECT `group`.`id`, `group`.`name`,
+               $stmt = DBA::p("SELECT `group`.`id`, `group`.`name`,
                                (SELECT COUNT(*) FROM `item` FORCE INDEX (`uid_unseen_contactid`)
                                        WHERE `uid` = ?
                                        AND `unseen`
@@ -114,7 +114,7 @@ class Group extends BaseObject
                        local_user()
                );
 
-               return dba::inArray($stmt);
+               return DBA::inArray($stmt);
        }
 
        /**
@@ -132,7 +132,7 @@ class Group extends BaseObject
                        return false;
                }
 
-               $group = dba::selectFirst('group', ['id'], ['uid' => $uid, 'name' => $name]);
+               $group = DBA::selectFirst('group', ['id'], ['uid' => $uid, 'name' => $name]);
                if (DBM::is_result($group)) {
                        return $group['id'];
                }
@@ -151,13 +151,13 @@ class Group extends BaseObject
                        return false;
                }
 
-               $group = dba::selectFirst('group', ['uid'], ['id' => $gid]);
+               $group = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
                if (!DBM::is_result($group)) {
                        return false;
                }
 
                // remove group from default posting lists
-               $user = dba::selectFirst('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $group['uid']]);
+               $user = DBA::selectFirst('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $group['uid']]);
                if (DBM::is_result($user)) {
                        $change = false;
 
@@ -175,15 +175,15 @@ class Group extends BaseObject
                        }
 
                        if ($change) {
-                               dba::update('user', $user, ['uid' => $group['uid']]);
+                               DBA::update('user', $user, ['uid' => $group['uid']]);
                        }
                }
 
                // remove all members
-               dba::delete('group_member', ['gid' => $gid]);
+               DBA::delete('group_member', ['gid' => $gid]);
 
                // remove group
-               $return = dba::update('group', ['deleted' => 1], ['id' => $gid]);
+               $return = DBA::update('group', ['deleted' => 1], ['id' => $gid]);
 
                return $return;
        }
@@ -221,12 +221,12 @@ class Group extends BaseObject
                        return false;
                }
 
-               $row_exists = dba::exists('group_member', ['gid' => $gid, 'contact-id' => $cid]);
+               $row_exists = DBA::exists('group_member', ['gid' => $gid, 'contact-id' => $cid]);
                if ($row_exists) {
                        // Row already existing, nothing to do
                        $return = true;
                } else {
-                       $return = dba::insert('group_member', ['gid' => $gid, 'contact-id' => $cid]);
+                       $return = DBA::insert('group_member', ['gid' => $gid, 'contact-id' => $cid]);
                }
 
                return $return;
@@ -245,7 +245,7 @@ class Group extends BaseObject
                        return false;
                }
 
-               $return = dba::delete('group_member', ['gid' => $gid, 'contact-id' => $cid]);
+               $return = DBA::delete('group_member', ['gid' => $gid, 'contact-id' => $cid]);
 
                return $return;
        }
@@ -293,11 +293,11 @@ class Group extends BaseObject
                        $stmt = call_user_func_array('dba::p', $param_arr);
                } else {
                        $condition_array = array_merge([$condition], $group_ids);
-                       $stmt = dba::select('group_member', ['contact-id'], $condition_array);
+                       $stmt = DBA::select('group_member', ['contact-id'], $condition_array);
                }
 
                $return = [];
-               while($group_member = dba::fetch($stmt)) {
+               while($group_member = DBA::fetch($stmt)) {
                        $return[] = $group_member['contact-id'];
                }
 
@@ -319,7 +319,7 @@ class Group extends BaseObject
        {
                $o = '';
 
-               $stmt = dba::select('group', [], ['deleted' => 0, 'uid' => $uid], ['order' => ['name']]);
+               $stmt = DBA::select('group', [], ['deleted' => 0, 'uid' => $uid], ['order' => ['name']]);
 
                $display_groups = [
                        [
@@ -328,7 +328,7 @@ class Group extends BaseObject
                                'selected' => ''
                        ]
                ];
-               while ($group = dba::fetch($stmt)) {
+               while ($group = DBA::fetch($stmt)) {
                        $display_groups[] = [
                                'name' => $group['name'],
                                'id' => $group['id'],
@@ -378,14 +378,14 @@ class Group extends BaseObject
                        ]
                ];
 
-               $stmt = dba::select('group', [], ['deleted' => 0, 'uid' => local_user()], ['order' => ['name']]);
+               $stmt = DBA::select('group', [], ['deleted' => 0, 'uid' => local_user()], ['order' => ['name']]);
 
                $member_of = [];
                if ($cid) {
                        $member_of = self::getIdsByContactId($cid);
                }
 
-               while ($group = dba::fetch($stmt)) {
+               while ($group = DBA::fetch($stmt)) {
                        $selected = (($group_id == $group['id']) ? ' group-selected' : '');
 
                        if ($editmode == 'full') {
index 4f9f1cf9049992a4b86773f526ff663fa0a1b7b6..059fee93bdbb87d3a4774ba0353bb8714afe4ab3 100644 (file)
@@ -14,7 +14,7 @@ use Friendica\Core\Lock;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Object\Image;
 use Friendica\Protocol\Diaspora;
@@ -142,7 +142,7 @@ class Item extends BaseObject
         */
        public static function fetch($stmt)
        {
-               $row = dba::fetch($stmt);
+               $row = DBA::fetch($stmt);
 
                if (is_bool($row)) {
                        return $row;
@@ -254,7 +254,7 @@ class Item extends BaseObject
                        $data[] = $row;
                }
                if ($do_close) {
-                       dba::close($stmt);
+                       DBA::close($stmt);
                }
                return $data;
        }
@@ -272,10 +272,10 @@ class Item extends BaseObject
                if (is_bool($stmt)) {
                        $retval = $stmt;
                } else {
-                       $retval = (dba::num_rows($stmt) > 0);
+                       $retval = (DBA::num_rows($stmt) > 0);
                }
 
-               dba::close($stmt);
+               DBA::close($stmt);
 
                return $retval;
        }
@@ -289,7 +289,7 @@ class Item extends BaseObject
         * @param array  $condition
         * @param array  $params
         * @return bool|array
-        * @see dba::select
+        * @see DBA::select
         */
        public static function selectFirstForUser($uid, array $selected = [], array $condition = [], $params = [])
        {
@@ -331,7 +331,7 @@ class Item extends BaseObject
         * @param array  $condition
         * @param array  $params
         * @return bool|array
-        * @see dba::select
+        * @see DBA::select
         */
        public static function selectFirst(array $fields = [], array $condition = [], $params = [])
        {
@@ -343,7 +343,7 @@ class Item extends BaseObject
                        return $result;
                } else {
                        $row = self::fetch($result);
-                       dba::close($result);
+                       DBA::close($result);
                        return $row;
                }
        }
@@ -371,7 +371,7 @@ class Item extends BaseObject
 
                $select_fields = self::constructSelectFields($fields, $selected);
 
-               $condition_string = dba::buildCondition($condition);
+               $condition_string = DBA::buildCondition($condition);
 
                $condition_string = self::addTablesToFields($condition_string, $fields);
 
@@ -379,13 +379,13 @@ class Item extends BaseObject
                        $condition_string = $condition_string . ' AND ' . self::condition(false);
                }
 
-               $param_string = self::addTablesToFields(dba::buildParameter($params), $fields);
+               $param_string = self::addTablesToFields(DBA::buildParameter($params), $fields);
 
                $table = "`item` " . self::constructJoins($uid, $select_fields . $condition_string . $param_string, false, $usermode);
 
                $sql = "SELECT " . $select_fields . " FROM " . $table . $condition_string . $param_string;
 
-               return dba::p($sql, $condition);
+               return DBA::p($sql, $condition);
        }
 
        /**
@@ -418,7 +418,7 @@ class Item extends BaseObject
         * @param array  $condition
         * @param array  $params
         * @return bool|array
-        * @see dba::select
+        * @see DBA::select
         */
        public static function selectFirstThreadForUser($uid, array $selected = [], array $condition = [], $params = [])
        {
@@ -439,7 +439,7 @@ class Item extends BaseObject
         * @param array  $condition
         * @param array  $params
         * @return bool|array
-        * @see dba::select
+        * @see DBA::select
         */
        public static function selectFirstThread(array $fields = [], array $condition = [], $params = [])
        {
@@ -450,7 +450,7 @@ class Item extends BaseObject
                        return $result;
                } else {
                        $row = self::fetch($result);
-                       dba::close($result);
+                       DBA::close($result);
                        return $row;
                }
        }
@@ -483,7 +483,7 @@ class Item extends BaseObject
 
                $select_fields = self::constructSelectFields($fields, $selected);
 
-               $condition_string = dba::buildCondition($condition);
+               $condition_string = DBA::buildCondition($condition);
 
                $condition_string = self::addTablesToFields($condition_string, $threadfields);
                $condition_string = self::addTablesToFields($condition_string, $fields);
@@ -492,7 +492,7 @@ class Item extends BaseObject
                        $condition_string = $condition_string . ' AND ' . self::condition(true);
                }
 
-               $param_string = dba::buildParameter($params);
+               $param_string = DBA::buildParameter($params);
                $param_string = self::addTablesToFields($param_string, $threadfields);
                $param_string = self::addTablesToFields($param_string, $fields);
 
@@ -500,7 +500,7 @@ class Item extends BaseObject
 
                $sql = "SELECT " . $select_fields . " FROM " . $table . $condition_string . $param_string;
 
-               return dba::p($sql, $condition);
+               return DBA::p($sql, $condition);
        }
 
        /**
@@ -752,12 +752,12 @@ class Item extends BaseObject
                }
 
                // To ensure the data integrity we do it in an transaction
-               dba::transaction();
+               DBA::transaction();
 
                // We cannot simply expand the condition to check for origin entries
                // The condition needn't to be a simple array but could be a complex condition.
                // And we have to execute this query before the update to ensure to fetch the same data.
-               $items = dba::select('item', ['id', 'origin', 'uri', 'created', 'uri-hash', 'iaid', 'icid', 'tag', 'file'], $condition);
+               $items = DBA::select('item', ['id', 'origin', 'uri', 'created', 'uri-hash', 'iaid', 'icid', 'tag', 'file'], $condition);
 
                $content_fields = [];
                foreach (array_merge(self::CONTENT_FIELDLIST, self::MIXED_CONTENT_FIELDLIST) as $field) {
@@ -799,35 +799,35 @@ class Item extends BaseObject
                $fields['inform'] = null;
 
                if (!empty($fields)) {
-                       $success = dba::update('item', $fields, $condition);
+                       $success = DBA::update('item', $fields, $condition);
 
                        if (!$success) {
-                               dba::close($items);
-                               dba::rollback();
+                               DBA::close($items);
+                               DBA::rollback();
                                return false;
                        }
                }
 
                // When there is no content for the "old" item table, this will count the fetched items
-               $rows = dba::affected_rows();
+               $rows = DBA::affected_rows();
 
-               while ($item = dba::fetch($items)) {
+               while ($item = DBA::fetch($items)) {
 
                        // This part here can safely be removed when the legacy fields in the item had been removed
                        if (empty($item['uri-hash']) && !empty($item['uri']) && !empty($item['created'])) {
 
                                // Fetch the uri-hash from an existing item entry if there is one
                                $item_condition = ["`uri` = ? AND `uri-hash` != ''", $item['uri']];
-                               $existing = dba::selectfirst('item', ['uri-hash'], $item_condition);
+                               $existing = DBA::selectfirst('item', ['uri-hash'], $item_condition);
                                if (DBM::is_result($existing)) {
                                        $item['uri-hash'] = $existing['uri-hash'];
                                } else {
                                        $item['uri-hash'] = self::itemHash($item['uri'], $item['created']);
                                }
 
-                               dba::update('item', ['uri-hash' => $item['uri-hash']], ['id' => $item['id']]);
-                               dba::update('item-activity', ['uri-hash' => $item['uri-hash']], ["`uri` = ? AND `uri-hash` = ''", $item['uri']]);
-                               dba::update('item-content', ['uri-plink-hash' => $item['uri-hash']], ["`uri` = ? AND `uri-plink-hash` = ''", $item['uri']]);
+                               DBA::update('item', ['uri-hash' => $item['uri-hash']], ['id' => $item['id']]);
+                               DBA::update('item-activity', ['uri-hash' => $item['uri-hash']], ["`uri` = ? AND `uri-hash` = ''", $item['uri']]);
+                               DBA::update('item-content', ['uri-plink-hash' => $item['uri-hash']], ["`uri` = ? AND `uri-plink-hash` = ''", $item['uri']]);
                        }
 
                        if (!empty($item['iaid']) || (!empty($content_fields['verb']) && (self::activityToIndex($content_fields['verb']) >= 0))) {
@@ -839,7 +839,7 @@ class Item extends BaseObject
                                self::updateActivity($content_fields, $update_condition);
 
                                if (empty($item['iaid'])) {
-                                       $item_activity = dba::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]);
+                                       $item_activity = DBA::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]);
                                        if (DBM::is_result($item_activity)) {
                                                $item_fields = ['iaid' => $item_activity['id'], 'icid' => null];
                                                foreach (self::MIXED_CONTENT_FIELDLIST as $field) {
@@ -849,17 +849,17 @@ class Item extends BaseObject
                                                                unset($item_fields[$field]);
                                                        }
                                                }
-                                               dba::update('item', $item_fields, ['id' => $item['id']]);
+                                               DBA::update('item', $item_fields, ['id' => $item['id']]);
 
-                                               if (!empty($item['icid']) && !dba::exists('item', ['icid' => $item['icid']])) {
-                                                       dba::delete('item-content', ['id' => $item['icid']]);
+                                               if (!empty($item['icid']) && !DBA::exists('item', ['icid' => $item['icid']])) {
+                                                       DBA::delete('item-content', ['id' => $item['icid']]);
                                                }
                                        }
                                } elseif (!empty($item['icid'])) {
-                                       dba::update('item', ['icid' => null], ['id' => $item['id']]);
+                                       DBA::update('item', ['icid' => null], ['id' => $item['id']]);
 
-                                       if (!dba::exists('item', ['icid' => $item['icid']])) {
-                                               dba::delete('item-content', ['id' => $item['icid']]);
+                                       if (!DBA::exists('item', ['icid' => $item['icid']])) {
+                                               DBA::delete('item-content', ['id' => $item['icid']]);
                                        }
                                }
                        } else {
@@ -871,7 +871,7 @@ class Item extends BaseObject
                                self::updateContent($content_fields, $update_condition);
 
                                if (empty($item['icid'])) {
-                                       $item_content = dba::selectFirst('item-content', [], ['uri-plink-hash' => $item['uri-hash']]);
+                                       $item_content = DBA::selectFirst('item-content', [], ['uri-plink-hash' => $item['uri-hash']]);
                                        if (DBM::is_result($item_content)) {
                                                $item_fields = ['icid' => $item_content['id']];
                                                // Clear all fields in the item table that have a content in the item-content table
@@ -884,7 +884,7 @@ class Item extends BaseObject
                                                                }
                                                        }
                                                }
-                                               dba::update('item', $item_fields, ['id' => $item['id']]);
+                                               DBA::update('item', $item_fields, ['id' => $item['id']]);
                                        }
                                }
                        }
@@ -892,14 +892,14 @@ class Item extends BaseObject
                        if (!empty($tags)) {
                                Term::insertFromTagFieldByItemId($item['id'], $tags);
                                if (!empty($item['tag'])) {
-                                       dba::update('item', ['tag' => ''], ['id' => $item['id']]);
+                                       DBA::update('item', ['tag' => ''], ['id' => $item['id']]);
                                }
                        }
 
                        if (!empty($files)) {
                                Term::insertFromFileFieldByItemId($item['id'], $files);
                                if (!empty($item['file'])) {
-                                       dba::update('item', ['file' => ''], ['id' => $item['id']]);
+                                       DBA::update('item', ['file' => ''], ['id' => $item['id']]);
                                }
                        }
 
@@ -914,8 +914,8 @@ class Item extends BaseObject
                        }
                }
 
-               dba::close($items);
-               dba::commit();
+               DBA::close($items);
+               DBA::commit();
                return $rows;
        }
 
@@ -927,11 +927,11 @@ class Item extends BaseObject
         */
        public static function delete($condition, $priority = PRIORITY_HIGH)
        {
-               $items = dba::select('item', ['id'], $condition);
-               while ($item = dba::fetch($items)) {
+               $items = DBA::select('item', ['id'], $condition);
+               while ($item = DBA::fetch($items)) {
                        self::deleteById($item['id'], $priority);
                }
-               dba::close($items);
+               DBA::close($items);
        }
 
        /**
@@ -946,18 +946,18 @@ class Item extends BaseObject
                        return;
                }
 
-               $items = dba::select('item', ['id', 'uid'], $condition);
-               while ($item = dba::fetch($items)) {
+               $items = DBA::select('item', ['id', 'uid'], $condition);
+               while ($item = DBA::fetch($items)) {
                        // "Deleting" global items just means hiding them
                        if ($item['uid'] == 0) {
-                               dba::update('user-item', ['hidden' => true], ['iid' => $item['id'], 'uid' => $uid], true);
+                               DBA::update('user-item', ['hidden' => true], ['iid' => $item['id'], 'uid' => $uid], true);
                        } elseif ($item['uid'] == $uid) {
                                self::deleteById($item['id'], PRIORITY_HIGH);
                        } else {
                                logger('Wrong ownership. Not deleting item ' . $item['id']);
                        }
                }
-               dba::close($items);
+               DBA::close($items);
        }
 
        /**
@@ -1016,7 +1016,7 @@ class Item extends BaseObject
                 * generate a resource-id and therefore aren't intimately linked to the item.
                 */
                if (strlen($item['resource-id'])) {
-                       dba::delete('photo', ['resource-id' => $item['resource-id'], 'uid' => $item['uid']]);
+                       DBA::delete('photo', ['resource-id' => $item['resource-id'], 'uid' => $item['uid']]);
                }
 
                // If item is a link to an event, delete the event.
@@ -1028,7 +1028,7 @@ class Item extends BaseObject
                foreach (explode(", ", $item['attach']) as $attach) {
                        preg_match("|attach/(\d+)|", $attach, $matches);
                        if (is_array($matches) && count($matches) > 1) {
-                               dba::delete('attach', ['id' => $matches[1], 'uid' => $item['uid']]);
+                               DBA::delete('attach', ['id' => $matches[1], 'uid' => $item['uid']]);
                        }
                }
 
@@ -1041,7 +1041,7 @@ class Item extends BaseObject
                $item_fields = ['deleted' => true, 'edited' => DateTimeFormat::utcNow(), 'changed' => DateTimeFormat::utcNow(),
                        'body' => '', 'title' => '', 'content-warning' => '', 'rendered-hash' => '', 'rendered-html' => '',
                        'object' => '', 'target' => '', 'tag' => '', 'postopts' => '', 'attach' => '', 'file' => ''];
-               dba::update('item', $item_fields, ['id' => $item['id']]);
+               DBA::update('item', $item_fields, ['id' => $item['id']]);
 
                Term::insertFromTagFieldByItemId($item['id'], '');
                Term::insertFromFileFieldByItemId($item['id'], '');
@@ -1051,7 +1051,7 @@ class Item extends BaseObject
                        self::delete(['uri' => $item['uri'], 'uid' => 0, 'deleted' => false], $priority);
                }
 
-               dba::delete('item-delivery-data', ['iid' => $item['id']]);
+               DBA::delete('item-delivery-data', ['iid' => $item['id']]);
 
                // If it's the parent of a comment thread, kill all the kids
                if ($item['id'] == $item['parent']) {
@@ -1071,7 +1071,7 @@ class Item extends BaseObject
                        // When we delete just our local user copy of an item, we have to set a marker to hide it
                        $global_item = self::selectFirst(['id'], ['uri' => $item['uri'], 'uid' => 0, 'deleted' => false]);
                        if (DBM::is_result($global_item)) {
-                               dba::update('user-item', ['hidden' => true], ['iid' => $global_item['id'], 'uid' => $item['uid']], true);
+                               DBA::update('user-item', ['hidden' => true], ['iid' => $global_item['id'], 'uid' => $item['uid']], true);
                        }
                }
 
@@ -1194,7 +1194,7 @@ class Item extends BaseObject
 
                // Still missing? Then use the "self" contact of the current user
                if ($contact_id == 0) {
-                       $self = dba::selectFirst('contact', ['id'], ['self' => true, 'uid' => $item['uid']]);
+                       $self = DBA::selectFirst('contact', ['id'], ['self' => true, 'uid' => $item['uid']]);
                        if (DBM::is_result($self)) {
                                $contact_id = $self["id"];
                        }
@@ -1279,7 +1279,7 @@ class Item extends BaseObject
                // check for create date and expire time
                $expire_interval = Config::get('system', 'dbclean-expire-days', 0);
 
-               $user = dba::selectFirst('user', ['expire'], ['uid' => $uid]);
+               $user = DBA::selectFirst('user', ['expire'], ['uid' => $uid]);
                if (DBM::is_result($user) && ($user['expire'] > 0) && (($user['expire'] < $expire_interval) || ($expire_interval == 0))) {
                        $expire_interval = $user['expire'];
                }
@@ -1314,7 +1314,7 @@ class Item extends BaseObject
                }
 
                // Ensure to always have the same creation date.
-               $existing = dba::selectfirst('item', ['created', 'uri-hash'], ['uri' => $item['uri']]);
+               $existing = DBA::selectfirst('item', ['created', 'uri-hash'], ['uri' => $item['uri']]);
                if (DBM::is_result($existing)) {
                        $item['created'] = $existing['created'];
                        $item['uri-hash'] = $existing['uri-hash'];
@@ -1510,13 +1510,13 @@ class Item extends BaseObject
 
                                // If its a post from myself then tag the thread as "mention"
                                logger("Checking if parent ".$parent_id." has to be tagged as mention for user ".$item['uid'], LOGGER_DEBUG);
-                               $user = dba::selectFirst('user', ['nickname'], ['uid' => $item['uid']]);
+                               $user = DBA::selectFirst('user', ['nickname'], ['uid' => $item['uid']]);
                                if (DBM::is_result($user)) {
                                        $self = normalise_link(System::baseUrl() . '/profile/' . $user['nickname']);
                                        $self_id = Contact::getIdForURL($self, 0, true);
                                        logger("'myself' is ".$self_id." for parent ".$parent_id." checking against ".$item['author-id']." and ".$item['owner-id'], LOGGER_DEBUG);
                                        if (($item['author-id'] == $self_id) || ($item['owner-id'] == $self_id)) {
-                                               dba::update('thread', ['mention' => true], ['iid' => $parent_id]);
+                                               DBA::update('thread', ['mention' => true], ['iid' => $parent_id]);
                                                logger("tagged thread ".$parent_id." as mention for user ".$self, LOGGER_DEBUG);
                                        }
                                }
@@ -1568,7 +1568,7 @@ class Item extends BaseObject
                        $item["global"] = true;
 
                        // Set the global flag on all items if this was a global item entry
-                       dba::update('item', ['global' => true], ['uri' => $item["uri"]]);
+                       DBA::update('item', ['global' => true], ['uri' => $item["uri"]]);
                } else {
                        $item["global"] = self::exists(['uid' => 0, 'uri' => $item["uri"]]);
                }
@@ -1652,15 +1652,15 @@ class Item extends BaseObject
                unset($item['postopts']);
                unset($item['inform']);
 
-               dba::transaction();
-               $ret = dba::insert('item', $item);
+               DBA::transaction();
+               $ret = DBA::insert('item', $item);
 
                // When the item was successfully stored we fetch the ID of the item.
                if (DBM::is_result($ret)) {
-                       $current_post = dba::lastInsertId();
+                       $current_post = DBA::lastInsertId();
                } else {
                        // This can happen - for example - if there are locking timeouts.
-                       dba::rollback();
+                       DBA::rollback();
 
                        // Store the data into a spool file so that we can try again later.
 
@@ -1689,26 +1689,26 @@ class Item extends BaseObject
                if ($current_post == 0) {
                        // This is one of these error messages that never should occur.
                        logger("couldn't find created item - we better quit now.");
-                       dba::rollback();
+                       DBA::rollback();
                        return 0;
                }
 
                // How much entries have we created?
                // We wouldn't need this query when we could use an unique index - but MySQL has length problems with them.
-               $entries = dba::count('item', ['uri' => $item['uri'], 'uid' => $item['uid'], 'network' => $item['network']]);
+               $entries = DBA::count('item', ['uri' => $item['uri'], 'uid' => $item['uid'], 'network' => $item['network']]);
 
                if ($entries > 1) {
                        // There are duplicates. We delete our just created entry.
                        logger('Duplicated post occurred. uri = ' . $item['uri'] . ' uid = ' . $item['uid']);
 
                        // Yes, we could do a rollback here - but we are having many users with MyISAM.
-                       dba::delete('item', ['id' => $current_post]);
-                       dba::commit();
+                       DBA::delete('item', ['id' => $current_post]);
+                       DBA::commit();
                        return 0;
                } elseif ($entries == 0) {
                        // This really should never happen since we quit earlier if there were problems.
                        logger("Something is terribly wrong. We haven't found our created entry.");
-                       dba::rollback();
+                       DBA::rollback();
                        return 0;
                }
 
@@ -1720,7 +1720,7 @@ class Item extends BaseObject
                }
 
                // Set parent id
-               dba::update('item', ['parent' => $parent_id], ['id' => $current_post]);
+               DBA::update('item', ['parent' => $parent_id], ['id' => $current_post]);
 
                $item['id'] = $current_post;
                $item['parent'] = $parent_id;
@@ -1728,9 +1728,9 @@ class Item extends BaseObject
                // update the commented timestamp on the parent
                // Only update "commented" if it is really a comment
                if (($item['gravity'] != GRAVITY_ACTIVITY) || !Config::get("system", "like_no_comment")) {
-                       dba::update('item', ['commented' => DateTimeFormat::utcNow(), 'changed' => DateTimeFormat::utcNow()], ['id' => $parent_id]);
+                       DBA::update('item', ['commented' => DateTimeFormat::utcNow(), 'changed' => DateTimeFormat::utcNow()], ['id' => $parent_id]);
                } else {
-                       dba::update('item', ['changed' => DateTimeFormat::utcNow()], ['id' => $parent_id]);
+                       DBA::update('item', ['changed' => DateTimeFormat::utcNow()], ['id' => $parent_id]);
                }
 
                if ($dsprsig) {
@@ -1743,14 +1743,14 @@ class Item extends BaseObject
                                logger("Repaired double encoded signature from handle ".$dsprsig->signer, LOGGER_DEBUG);
                        }
 
-                       dba::insert('sign', ['iid' => $current_post, 'signed_text' => $dsprsig->signed_text,
+                       DBA::insert('sign', ['iid' => $current_post, 'signed_text' => $dsprsig->signed_text,
                                                'signature' => $dsprsig->signature, 'signer' => $dsprsig->signer]);
                }
 
                if (!empty($diaspora_signed_text)) {
                        // Formerly we stored the signed text, the signature and the author in different fields.
                        // We now store the raw data so that we are more flexible.
-                       dba::insert('sign', ['iid' => $current_post, 'signed_text' => $diaspora_signed_text]);
+                       DBA::insert('sign', ['iid' => $current_post, 'signed_text' => $diaspora_signed_text]);
                }
 
                $deleted = self::tagDeliver($item['uid'], $current_post);
@@ -1782,7 +1782,7 @@ class Item extends BaseObject
 
                self::insertDeliveryData($delivery_data);
 
-               dba::commit();
+               DBA::commit();
 
                /*
                 * Due to deadlock issues with the "term" table we are doing these steps after the commit.
@@ -1824,7 +1824,7 @@ class Item extends BaseObject
                        return;
                }
 
-               dba::insert('item-delivery-data', $delivery_data);
+               DBA::insert('item-delivery-data', $delivery_data);
        }
 
        /**
@@ -1839,7 +1839,7 @@ class Item extends BaseObject
                        return;
                }
 
-               dba::update('item-delivery-data', $delivery_data, ['iid' => $id], true);
+               DBA::update('item-delivery-data', $delivery_data, ['iid' => $id], true);
        }
 
        /**
@@ -1870,12 +1870,12 @@ class Item extends BaseObject
                }
 
                // Do we already have this content?
-               $item_activity = dba::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]);
+               $item_activity = DBA::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]);
                if (DBM::is_result($item_activity)) {
                        $item['iaid'] = $item_activity['id'];
                        logger('Fetched activity for URI ' . $item['uri'] . ' (' . $item['iaid'] . ')');
-               } elseif (dba::insert('item-activity', $fields)) {
-                       $item['iaid'] = dba::lastInsertId();
+               } elseif (DBA::insert('item-activity', $fields)) {
+                       $item['iaid'] = DBA::lastInsertId();
                        logger('Inserted activity for URI ' . $item['uri'] . ' (' . $item['iaid'] . ')');
                } else {
                        // This shouldn't happen.
@@ -1911,12 +1911,12 @@ class Item extends BaseObject
                }
 
                // Do we already have this content?
-               $item_content = dba::selectFirst('item-content', ['id'], ['uri-plink-hash' => $item['uri-hash']]);
+               $item_content = DBA::selectFirst('item-content', ['id'], ['uri-plink-hash' => $item['uri-hash']]);
                if (DBM::is_result($item_content)) {
                        $item['icid'] = $item_content['id'];
                        logger('Fetched content for URI ' . $item['uri'] . ' (' . $item['icid'] . ')');
-               } elseif (dba::insert('item-content', $fields)) {
-                       $item['icid'] = dba::lastInsertId();
+               } elseif (DBA::insert('item-content', $fields)) {
+                       $item['icid'] = DBA::lastInsertId();
                        logger('Inserted content for URI ' . $item['uri'] . ' (' . $item['icid'] . ')');
                } else {
                        // This shouldn't happen.
@@ -1948,7 +1948,7 @@ class Item extends BaseObject
 
                logger('Update activity for ' . json_encode($condition));
 
-               dba::update('item-activity', $fields, $condition, true);
+               DBA::update('item-activity', $fields, $condition, true);
 
                return true;
        }
@@ -1977,7 +1977,7 @@ class Item extends BaseObject
 
                logger('Update content for ' . json_encode($condition));
 
-               dba::update('item-content', $fields, $condition, true);
+               DBA::update('item-content', $fields, $condition, true);
        }
 
        /**
@@ -2016,8 +2016,8 @@ class Item extends BaseObject
 
                $condition = ["`nurl` IN (SELECT `nurl` FROM `contact` WHERE `id` = ?) AND `uid` != 0 AND NOT `blocked` AND `rel` IN (?, ?)",
                        $parent['owner-id'], CONTACT_IS_SHARING,  CONTACT_IS_FRIEND];
-               $contacts = dba::select('contact', ['uid'], $condition);
-               while ($contact = dba::fetch($contacts)) {
+               $contacts = DBA::select('contact', ['uid'], $condition);
+               while ($contact = DBA::fetch($contacts)) {
                        $users[$contact['uid']] = $contact['uid'];
                }
 
@@ -2025,7 +2025,7 @@ class Item extends BaseObject
 
                if ($item['uri'] != $item['parent-uri']) {
                        $parents = self::select(['uid', 'origin'], ["`uri` = ? AND `uid` != 0", $item['parent-uri']]);
-                       while ($parent = dba::fetch($parents)) {
+                       while ($parent = DBA::fetch($parents)) {
                                $users[$parent['uid']] = $parent['uid'];
                                if ($parent['origin'] && !$origin) {
                                        $origin_uid = $parent['uid'];
@@ -2060,7 +2060,7 @@ class Item extends BaseObject
                }
 
                if (empty($item['contact-id'])) {
-                       $self = dba::selectFirst('contact', ['id'], ['self' => true, 'uid' => $uid]);
+                       $self = DBA::selectFirst('contact', ['id'], ['self' => true, 'uid' => $uid]);
                        if (!DBM::is_result($self)) {
                                return;
                        }
@@ -2071,7 +2071,7 @@ class Item extends BaseObject
 
                $notify = false;
                if ($item['uri'] == $item['parent-uri']) {
-                       $contact = dba::selectFirst('contact', [], ['id' => $item['contact-id'], 'self' => false]);
+                       $contact = DBA::selectFirst('contact', [], ['id' => $item['contact-id'], 'self' => false]);
                        if (DBM::is_result($contact)) {
                                $notify = self::isRemoteSelf($contact, $item);
                        }
@@ -2272,7 +2272,7 @@ class Item extends BaseObject
 
                $hostname = self::getApp()->get_hostname();
 
-               $user = dba::selectFirst('user', ['nickname'], ['uid' => $uid]);
+               $user = DBA::selectFirst('user', ['nickname'], ['uid' => $uid]);
 
                $uri = "urn:X-dfrn:" . $hostname . ':' . $user['nickname'] . ':' . $guid;
 
@@ -2291,13 +2291,13 @@ class Item extends BaseObject
        private static function updateContact($arr)
        {
                // Unarchive the author
-               $contact = dba::selectFirst('contact', [], ['id' => $arr["author-id"]]);
+               $contact = DBA::selectFirst('contact', [], ['id' => $arr["author-id"]]);
                if (DBM::is_result($contact)) {
                        Contact::unmarkForArchival($contact);
                }
 
                // Unarchive the contact if it's not our own contact
-               $contact = dba::selectFirst('contact', [], ['id' => $arr["contact-id"], 'self' => false]);
+               $contact = DBA::selectFirst('contact', [], ['id' => $arr["contact-id"], 'self' => false]);
                if (DBM::is_result($contact)) {
                        Contact::unmarkForArchival($contact);
                }
@@ -2306,22 +2306,22 @@ class Item extends BaseObject
 
                // Is it a forum? Then we don't care about the rules from above
                if (!$update && ($arr["network"] == NETWORK_DFRN) && ($arr["parent-uri"] === $arr["uri"])) {
-                       if (dba::exists('contact', ['id' => $arr['contact-id'], 'forum' => true])) {
+                       if (DBA::exists('contact', ['id' => $arr['contact-id'], 'forum' => true])) {
                                $update = true;
                        }
                }
 
                if ($update) {
-                       dba::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
+                       DBA::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
                                ['id' => $arr['contact-id']]);
                }
                // Now do the same for the system wide contacts with uid=0
                if (!$arr['private']) {
-                       dba::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
+                       DBA::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
                                ['id' => $arr['owner-id']]);
 
                        if ($arr['owner-id'] != $arr['author-id']) {
-                               dba::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
+                               DBA::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
                                        ['id' => $arr['author-id']]);
                        }
                }
@@ -2416,7 +2416,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::fetch_first("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);
@@ -2428,7 +2428,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::fetch_first("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`
@@ -2451,7 +2451,7 @@ class Item extends BaseObject
        {
                $mention = false;
 
-               $user = dba::selectFirst('user', [], ['uid' => $uid]);
+               $user = DBA::selectFirst('user', [], ['uid' => $uid]);
                if (!DBM::is_result($user)) {
                        return;
                }
@@ -2488,7 +2488,7 @@ class Item extends BaseObject
                                // mmh.. no mention.. community page or private group... no wall.. no origin.. top-post (not a comment)
                                // delete it!
                                logger("no-mention top-level post to community or private group. delete.");
-                               dba::delete('item', ['id' => $item_id]);
+                               DBA::delete('item', ['id' => $item_id]);
                                return true;
                        }
                        return;
@@ -2512,7 +2512,7 @@ class Item extends BaseObject
                }
 
                // now change this copy of the post to a forum head message and deliver to all the tgroup members
-               $self = dba::selectFirst('contact', ['id', 'name', 'url', 'thumb'], ['uid' => $uid, 'self' => true]);
+               $self = DBA::selectFirst('contact', ['id', 'name', 'url', 'thumb'], ['uid' => $uid, 'self' => true]);
                if (!DBM::is_result($self)) {
                        return;
                }
@@ -2528,7 +2528,7 @@ class Item extends BaseObject
                $fields = ['wall' => true, 'origin' => true, 'forum_mode' => $forum_mode, 'contact-id' => $self['id'],
                        'owner-id' => $owner_id, 'owner-link' => $self['url'], 'private' => $private, 'allow_cid' => $user['allow_cid'],
                        'allow_gid' => $user['allow_gid'], 'deny_cid' => $user['deny_cid'], 'deny_gid' => $user['deny_gid']];
-               dba::update('item', $fields, ['id' => $item_id]);
+               DBA::update('item', $fields, ['id' => $item_id]);
 
                self::updateThread($item_id);
 
@@ -2569,7 +2569,7 @@ class Item extends BaseObject
                $datarray2 = $datarray;
                logger('remote-self start - Contact '.$contact['url'].' - '.$contact['remote_self'].' Item '.print_r($datarray, true), LOGGER_DEBUG);
                if ($contact['remote_self'] == 2) {
-                       $self = dba::selectFirst('contact', ['id', 'name', 'url', 'thumb'],
+                       $self = DBA::selectFirst('contact', ['id', 'name', 'url', 'thumb'],
                                        ['uid' => $contact['uid'], 'self' => true]);
                        if (DBM::is_result($self)) {
                                $datarray['contact-id'] = $self["id"];
@@ -2664,7 +2664,7 @@ class Item extends BaseObject
                                        $res = substr($i, $x + 1);
                                        $i = substr($i, 0, $x);
                                        $fields = ['data', 'type', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
-                                       $photo = dba::selectFirst('photo', $fields, ['resource-id' => $i, 'scale' => $res, 'uid' => $uid]);
+                                       $photo = DBA::selectFirst('photo', $fields, ['resource-id' => $i, 'scale' => $res, 'uid' => $uid]);
                                        if (DBM::is_result($photo)) {
                                                /*
                                                 * Check to see if we should replace this photo link with an embedded image
@@ -2870,7 +2870,7 @@ class Item extends BaseObject
 
                        ++$expired;
                }
-               dba::close($items);
+               DBA::close($items);
                logger('User ' . $uid . ": expired $expired items; expire items: $expire_items, expire notes: $expire_notes, expire starred: $expire_starred, expire photos: $expire_photos");
        }
 
@@ -2878,7 +2878,7 @@ class Item extends BaseObject
        {
                $condition = ['uid' => $uid, 'wall' => $wall, 'deleted' => false, 'visible' => true, 'moderated' => false];
                $params = ['order' => ['created' => false]];
-               $thread = dba::selectFirst('thread', ['created'], $condition, $params);
+               $thread = DBA::selectFirst('thread', ['created'], $condition, $params);
                if (DBM::is_result($thread)) {
                        return substr(DateTimeFormat::local($thread['created']), 0, 10);
                }
@@ -2955,7 +2955,7 @@ class Item extends BaseObject
                }
 
                // Retrieves the local post owner
-               $owner_self_contact = dba::selectFirst('contact', [], ['uid' => $uid, 'self' => true]);
+               $owner_self_contact = DBA::selectFirst('contact', [], ['uid' => $uid, 'self' => true]);
                if (!DBM::is_result($owner_self_contact)) {
                        logger('like: unknown owner ' . $uid);
                        return false;
@@ -2964,7 +2964,7 @@ class Item extends BaseObject
                // Retrieve the current logged in user's public contact
                $author_id = public_contact();
 
-               $author_contact = dba::selectFirst('contact', ['url'], ['id' => $author_id]);
+               $author_contact = DBA::selectFirst('contact', ['url'], ['id' => $author_id]);
                if (!DBM::is_result($author_contact)) {
                        logger('like: unknown author ' . $author_id);
                        return false;
@@ -2976,7 +2976,7 @@ class Item extends BaseObject
                        $item_contact = $owner_self_contact;
                } else {
                        $item_contact_id = Contact::getIdForURL($author_contact['url'], $uid, true);
-                       $item_contact = dba::selectFirst('contact', [], ['id' => $item_contact_id]);
+                       $item_contact = DBA::selectFirst('contact', [], ['id' => $item_contact_id]);
                        if (!DBM::is_result($item_contact)) {
                                logger('like: unknown item contact ' . $item_contact_id);
                                return false;
@@ -3008,10 +3008,10 @@ class Item extends BaseObject
                        // Already voted, undo it
                        $fields = ['deleted' => true, 'unseen' => true, 'changed' => DateTimeFormat::utcNow()];
                        /// @todo Consider using self::update - but before doing so, check the side effects
-                       dba::update('item', $fields, ['id' => $like_item['id']]);
+                       DBA::update('item', $fields, ['id' => $like_item['id']]);
 
                        // Clean up the Diaspora signatures for this like
-                       dba::delete('sign', ['iid' => $like_item['id']]);
+                       DBA::delete('sign', ['iid' => $like_item['id']]);
 
                        Worker::add(PRIORITY_HIGH, "Notifier", "like", $like_item['id']);
 
@@ -3086,7 +3086,7 @@ class Item extends BaseObject
                $item['iid'] = $itemid;
 
                if (!$onlyshadow) {
-                       $result = dba::insert('thread', $item);
+                       $result = DBA::insert('thread', $item);
 
                        logger("Add thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG);
                }
@@ -3118,28 +3118,28 @@ class Item extends BaseObject
                        }
                }
 
-               $result = dba::update('thread', $fields, ['iid' => $itemid]);
+               $result = DBA::update('thread', $fields, ['iid' => $itemid]);
 
                logger("Update thread for item ".$itemid." - guid ".$item["guid"]." - ".(int)$result, LOGGER_DEBUG);
        }
 
        private static function deleteThread($itemid, $itemuri = "")
        {
-               $item = dba::selectFirst('thread', ['uid'], ['iid' => $itemid]);
+               $item = DBA::selectFirst('thread', ['uid'], ['iid' => $itemid]);
                if (!DBM::is_result($item)) {
                        logger('No thread found for id '.$itemid, LOGGER_DEBUG);
                        return;
                }
 
                // Using dba::delete at this time could delete the associated item entries
-               $result = dba::e("DELETE FROM `thread` WHERE `iid` = ?", $itemid);
+               $result = DBA::e("DELETE FROM `thread` WHERE `iid` = ?", $itemid);
 
                logger("deleteThread: Deleted thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG);
 
                if ($itemuri != "") {
                        $condition = ["`uri` = ? AND NOT `deleted` AND NOT (`uid` IN (?, 0))", $itemuri, $item["uid"]];
                        if (!self::exists($condition)) {
-                               dba::delete('item', ['uri' => $itemuri, 'uid' => 0]);
+                               DBA::delete('item', ['uri' => $itemuri, 'uid' => 0]);
                                logger("deleteThread: Deleted shadow for item ".$itemuri, LOGGER_DEBUG);
                        }
                }
index 1e5c8648721cf2a973a189d845a95aff955883c1..b56b65f72c2ae17630ba8efafc2b60213de68cce 100644 (file)
@@ -8,7 +8,7 @@ namespace Friendica\Model;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Network\Probe;
 use Friendica\Util\DateTimeFormat;
@@ -40,8 +40,8 @@ class Mail
                        $subject = L10n::t('[no subject]');
                }
 
-               $me = dba::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
-               $contact = dba::selectFirst('contact', [], ['id' => $recipient, 'uid' => local_user()]);
+               $me = DBA::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
+               $contact = DBA::selectFirst('contact', [], ['id' => $recipient, 'uid' => local_user()]);
 
                if (!(count($me) && (count($contact)))) {
                        return -2;
@@ -84,8 +84,8 @@ class Mail
                        $fields = ['uid' => local_user(), 'guid' => $conv_guid, 'creator' => $sender_handle,
                                'created' => DateTimeFormat::utcNow(), 'updated' => DateTimeFormat::utcNow(),
                                'subject' => $subject, 'recips' => $handles];
-                       if (dba::insert('conv', $fields)) {
-                               $convid = dba::lastInsertId();
+                       if (DBA::insert('conv', $fields)) {
+                               $convid = DBA::lastInsertId();
                        }
                }
 
@@ -99,7 +99,7 @@ class Mail
                }
 
                $post_id = null;
-               $success = dba::insert(
+               $success = DBA::insert(
                        'mail',
                        [
                                'uid' => local_user(),
@@ -121,7 +121,7 @@ class Mail
                );
 
                if ($success) {
-                       $post_id = dba::lastInsertId();
+                       $post_id = DBA::lastInsertId();
                }
 
                /**
@@ -145,7 +145,7 @@ class Mail
                                        }
                                        $image_uri = substr($image, strrpos($image, '/') + 1);
                                        $image_uri = substr($image_uri, 0, strpos($image_uri, '-'));
-                                       dba::update('photo', ['allow-cid' => '<' . $recipient . '>'], ['resource-id' => $image_uri, 'album' => 'Wall Photos', 'uid' => local_user()]);
+                                       DBA::update('photo', ['allow-cid' => '<' . $recipient . '>'], ['resource-id' => $image_uri, 'album' => 'Wall Photos', 'uid' => local_user()]);
                                }
                        }
                }
@@ -198,8 +198,8 @@ class Mail
                $fields = ['uid' => $recipient['uid'], 'guid' => $conv_guid, 'creator' => $sender_handle,
                        'created' => DateTimeFormat::utcNow(), 'updated' => DateTimeFormat::utcNow(),
                        'subject' => $subject, 'recips' => $handles];
-               if (dba::insert('conv', $fields)) {
-                       $convid = dba::lastInsertId();
+               if (DBA::insert('conv', $fields)) {
+                       $convid = DBA::lastInsertId();
                }
 
                if (!$convid) {
@@ -207,7 +207,7 @@ class Mail
                        return -4;
                }
 
-               dba::insert(
+               DBA::insert(
                        'mail',
                        [
                                'uid' => $recipient['uid'],
index 336f4ab0691d431fab1a896a6a225f0f2e526738..a4c798501b8c82aa4dc67d363d9a0b7cd8f77849 100644 (file)
@@ -5,7 +5,7 @@
  */
 namespace Friendica\Model;
 
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Util\DateTimeFormat;
 
@@ -33,7 +33,7 @@ class OpenWebAuthToken
                        "meta" => $meta,
                        "created" => DateTimeFormat::utcNow()
                ];
-               return dba::insert("openwebauth-token", $fields);
+               return DBA::insert("openwebauth-token", $fields);
        }
 
        /**
@@ -49,9 +49,9 @@ class OpenWebAuthToken
        {
                $condition = ["type" => $type, "uid" => $uid, "token" => $token];
 
-               $entry = dba::selectFirst("openwebauth-token", ["id", "meta"], $condition);
+               $entry = DBA::selectFirst("openwebauth-token", ["id", "meta"], $condition);
                if (DBM::is_result($entry)) {
-                       dba::delete("openwebauth-token", ["id" => $entry["id"]]);
+                       DBA::delete("openwebauth-token", ["id" => $entry["id"]]);
 
                        return $entry["meta"];
                }
@@ -67,7 +67,7 @@ class OpenWebAuthToken
        public static function purge($type, $interval)
        {
                $condition = ["`type` = ? AND `created` < ?", $type, DateTimeFormat::utcNow() . " - INTERVAL " . $interval];
-               dba::delete("openwebauth-token", $condition);
+               DBA::delete("openwebauth-token", $condition);
        }
 
 }
index 983261fd617643b12907eabea14ae6ae80df4ea5..cae3663b36cc16b1eecb005f80fa87e1499eba9f 100644 (file)
@@ -5,7 +5,7 @@
 namespace Friendica\Model;
 
 use Friendica\BaseObject;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 require_once 'include/dba.php';
@@ -29,12 +29,12 @@ class PermissionSet extends BaseObject
                        'deny_cid' => self::sortPermissions(defaults($postarray, 'deny_cid', '')),
                        'deny_gid' => self::sortPermissions(defaults($postarray, 'deny_gid', ''))];
 
-               $set = dba::selectFirst('permissionset', ['id'], $condition);
+               $set = DBA::selectFirst('permissionset', ['id'], $condition);
 
                if (!DBM::is_result($set)) {
-                       dba::insert('permissionset', $condition, true);
+                       DBA::insert('permissionset', $condition, true);
 
-                       $set = dba::selectFirst('permissionset', ['id'], $condition);
+                       $set = DBA::selectFirst('permissionset', ['id'], $condition);
                }
                return $set['id'];
        }
index 2d740c3933bab75b2d86dbd34741360d6456f21f..4c297bc4ed853f7b2b48f2670f7a27c40e9599a3 100644 (file)
@@ -10,7 +10,7 @@ use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Object\Image;
 use Friendica\Util\DateTimeFormat;
@@ -41,14 +41,14 @@ class Photo
         */
        public static function store(Image $Image, $uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '', $desc = '')
        {
-               $photo = dba::selectFirst('photo', ['guid'], ["`resource-id` = ? AND `guid` != ?", $rid, '']);
+               $photo = DBA::selectFirst('photo', ['guid'], ["`resource-id` = ? AND `guid` != ?", $rid, '']);
                if (DBM::is_result($photo)) {
                        $guid = $photo['guid'];
                } else {
                        $guid = System::createGUID();
                }
 
-               $existing_photo = dba::selectFirst('photo', ['id'], ['resource-id' => $rid, 'uid' => $uid, 'contact-id' => $cid, 'scale' => $scale]);
+               $existing_photo = DBA::selectFirst('photo', ['id'], ['resource-id' => $rid, 'uid' => $uid, 'contact-id' => $cid, 'scale' => $scale]);
 
                $fields = [
                        'uid' => $uid,
@@ -74,9 +74,9 @@ class Photo
                ];
 
                if (DBM::is_result($existing_photo)) {
-                       $r = dba::update('photo', $fields, ['id' => $existing_photo['id']]);
+                       $r = DBA::update('photo', $fields, ['id' => $existing_photo['id']]);
                } else {
-                       $r = dba::insert('photo', $fields);
+                       $r = DBA::insert('photo', $fields);
                }
 
                return $r;
@@ -94,7 +94,7 @@ class Photo
                $thumb = '';
                $micro = '';
 
-               $photo = dba::selectFirst(
+               $photo = DBA::selectFirst(
                        'photo', ['resource-id'], ['uid' => $uid, 'contact-id' => $cid, 'scale' => 4, 'album' => 'Contact Photos']
                );
                if (x($photo['resource-id'])) {
index d4595976513689fdf1d551d5fa3637187fa651b1..40f0c52bdb4e361b9a3ef8f5d8bd57e890cf9b8c 100644 (file)
@@ -5,7 +5,7 @@
 namespace Friendica\Model;
 
 use Friendica\BaseObject;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Util\DateTimeFormat;
 
 require_once 'include/dba.php';
@@ -30,13 +30,13 @@ class Process extends BaseObject
                        $pid = getmypid();
                }
 
-               dba::transaction();
+               DBA::transaction();
 
-               if (!dba::exists('process', ['pid' => $pid])) {
-                       $return = dba::insert('process', ['pid' => $pid, 'command' => $command, 'created' => DateTimeFormat::utcNow()]);
+               if (!DBA::exists('process', ['pid' => $pid])) {
+                       $return = DBA::insert('process', ['pid' => $pid, 'command' => $command, 'created' => DateTimeFormat::utcNow()]);
                }
 
-               dba::commit();
+               DBA::commit();
 
                return $return;
        }
@@ -53,7 +53,7 @@ class Process extends BaseObject
                        $pid = getmypid();
                }
 
-               return dba::delete('process', ['pid' => $pid]);
+               return DBA::delete('process', ['pid' => $pid]);
        }
 
        /**
@@ -61,15 +61,15 @@ class Process extends BaseObject
         */
        public static function deleteInactive()
        {
-               dba::transaction();
+               DBA::transaction();
 
-               $processes = dba::select('process', ['pid']);
-               while($process = dba::fetch($processes)) {
+               $processes = DBA::select('process', ['pid']);
+               while($process = DBA::fetch($processes)) {
                        if (!posix_kill($process['pid'], 0)) {
                                self::deleteByPid($process['pid']);
                        }
                }
 
-               dba::commit();
+               DBA::commit();
        }
 }
index 79f3262410fc2229edcc9011d2734e58204d9663..d975dbb3f46234e9849bb18090c659f01320878a 100644 (file)
@@ -15,7 +15,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Protocol\Diaspora;
 use Friendica\Util\DateTimeFormat;
@@ -89,7 +89,7 @@ class Profile
         */
        public static function load(App $a, $nickname, $profile = 0, array $profiledata = [], $show_connect = true)
        {
-               $user = dba::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
+               $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
 
                if (!DBM::is_result($user) && empty($profiledata)) {
                        logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
@@ -198,7 +198,7 @@ class Profile
                if (remote_user() && count($_SESSION['remote'])) {
                        foreach ($_SESSION['remote'] as $visitor) {
                                if ($visitor['uid'] == $uid) {
-                                       $contact = dba::selectFirst('contact', ['profile-id'], ['id' => $visitor['cid']]);
+                                       $contact = DBA::selectFirst('contact', ['profile-id'], ['id' => $visitor['cid']]);
                                        if (DBM::is_result($contact)) {
                                                $profile_id = $contact['profile-id'];
                                        }
@@ -210,7 +210,7 @@ class Profile
                $profile = null;
 
                if ($profile_id) {
-                       $profile = dba::fetch_first(
+                       $profile = DBA::fetch_first(
                                "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::fetch_first(
                                "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`.*,
@@ -312,7 +312,7 @@ class Profile
                                $profile_url = normalise_link(System::baseUrl() . '/profile/' . $profile['nickname']);
                        }
 
-                       if (dba::exists('contact', ['pending' => false, 'uid' => local_user(), 'nurl' => $profile_url])) {
+                       if (DBA::exists('contact', ['pending' => false, 'uid' => local_user(), 'nurl' => $profile_url])) {
                                $connect = false;
                        }
                }
@@ -547,7 +547,7 @@ class Profile
                $cachekey = 'get_birthdays:' . local_user();
                $r = Cache::get($cachekey);
                if (is_null($r)) {
-                       $s = dba::p(
+                       $s = DBA::p(
                                "SELECT `event`.*, `event`.`id` AS `eid`, `contact`.* FROM `event`
                                INNER JOIN `contact` ON `contact`.`id` = `event`.`cid`
                                WHERE `event`.`uid` = ? AND `type` = 'birthday' AND `start` < ? AND `finish` > ?
@@ -557,7 +557,7 @@ class Profile
                                DateTimeFormat::utcNow()
                        );
                        if (DBM::is_result($s)) {
-                               $r = dba::inArray($s);
+                               $r = DBA::inArray($s);
                                Cache::set($cachekey, $r, CACHE_HOUR);
                        }
                }
@@ -633,7 +633,7 @@ class Profile
                $bd_format = L10n::t('g A l F d'); // 8 AM Friday January 18
                $classtoday = '';
 
-               $s = dba::p(
+               $s = DBA::p(
                        "SELECT `event`.*
                        FROM `event`
                        INNER JOIN `item`
@@ -661,7 +661,7 @@ class Profile
                if (DBM::is_result($s)) {
                        $istoday = false;
 
-                       while ($rr = dba::fetch($s)) {
+                       while ($rr = DBA::fetch($s)) {
                                if (strlen($rr['name'])) {
                                        $total ++;
                                }
@@ -698,7 +698,7 @@ class Profile
 
                                $r[] = $rr;
                        }
-                       dba::close($s);
+                       DBA::close($s);
                        $classtoday = (($istoday) ? 'event-today' : '');
                }
                $tpl = get_markup_template('events_reminder.tpl');
@@ -1025,7 +1025,7 @@ class Profile
                                        return;
                                }
 
-                               $contact = dba::selectFirst('contact',['id', 'url'], ['id' => $cid]);
+                               $contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]);
 
                                if (DBM::is_result($contact) && remote_user() && remote_user() == $contact['id']) {
                                        // The visitor is already authenticated.
@@ -1081,7 +1081,7 @@ class Profile
                        return;
                }
 
-               $visitor = dba::selectFirst('contact', [], ['id' => $cid]);
+               $visitor = DBA::selectFirst('contact', [], ['id' => $cid]);
 
                // Authenticate the visitor.
                $_SESSION['authenticated'] = 1;
index fc08ca6cbb5c3788f950376b30eaf82a4de8f141..73bcb2a905ca36b4da27bdacff4554ed26b69220 100644 (file)
@@ -5,7 +5,7 @@
 namespace Friendica\Model;
 
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Util\DateTimeFormat;
 
@@ -22,7 +22,7 @@ class PushSubscriber
        public static function publishFeed($uid, $default_priority = PRIORITY_HIGH)
        {
                $condition = ['push' => 0, 'uid' => $uid];
-               dba::update('push_subscriber', ['push' => 1, 'next_try' => NULL_DATE], $condition);
+               DBA::update('push_subscriber', ['push' => 1, 'next_try' => NULL_DATE], $condition);
 
                self::requeue($default_priority);
        }
@@ -36,9 +36,9 @@ class PushSubscriber
        {
                // We'll push to each subscriber that has push > 0,
                // i.e. there has been an update (set in notifier.php).
-               $subscribers = dba::select('push_subscriber', ['id', 'push', 'callback_url', 'nickname'], ["`push` > 0 AND `next_try` < UTC_TIMESTAMP()"]);
+               $subscribers = DBA::select('push_subscriber', ['id', 'push', 'callback_url', 'nickname'], ["`push` > 0 AND `next_try` < UTC_TIMESTAMP()"]);
 
-               while ($subscriber = dba::fetch($subscribers)) {
+               while ($subscriber = DBA::fetch($subscribers)) {
                        // We always handle retries with low priority
                        if ($subscriber['push'] > 1) {
                                $priority = PRIORITY_LOW;
@@ -50,7 +50,7 @@ class PushSubscriber
                        Worker::add($priority, 'PubSubPublish', (int)$subscriber['id']);
                }
 
-               dba::close($subscribers);
+               DBA::close($subscribers);
        }
 
        /**
@@ -66,10 +66,10 @@ class PushSubscriber
        public static function renew($uid, $nick, $subscribe, $hub_callback, $hub_topic, $hub_secret)
        {
                // fetch the old subscription if it exists
-               $subscriber = dba::selectFirst('push_subscriber', ['last_update', 'push'], ['callback_url' => $hub_callback]);
+               $subscriber = DBA::selectFirst('push_subscriber', ['last_update', 'push'], ['callback_url' => $hub_callback]);
 
                // delete old subscription if it exists
-               dba::delete('push_subscriber', ['callback_url' => $hub_callback]);
+               DBA::delete('push_subscriber', ['callback_url' => $hub_callback]);
 
                if ($subscribe) {
                        // if we are just updating an old subscription, keep the
@@ -87,7 +87,7 @@ class PushSubscriber
                                'topic' => $hub_topic, 'nickname' => $nick, 'push' => $push_flag,
                                'last_update' => $last_update, 'renewed' => DateTimeFormat::utcNow(),
                                'secret' => $hub_secret];
-                       dba::insert('push_subscriber', $fields);
+                       DBA::insert('push_subscriber', $fields);
 
                        logger("Successfully subscribed [$hub_callback] for $nick");
                } else {
@@ -103,7 +103,7 @@ class PushSubscriber
         */
        public static function delay($id)
        {
-               $subscriber = dba::selectFirst('push_subscriber', ['push', 'callback_url', 'renewed', 'nickname'], ['id' => $id]);
+               $subscriber = DBA::selectFirst('push_subscriber', ['push', 'callback_url', 'renewed', 'nickname'], ['id' => $id]);
                if (!DBM::is_result($subscriber)) {
                        return;
                }
@@ -115,10 +115,10 @@ class PushSubscriber
                        $days = round((time() -  strtotime($subscriber['renewed'])) / (60 * 60 * 24));
 
                        if ($days > 60) {
-                               dba::update('push_subscriber', ['push' => -1, 'next_try' => NULL_DATE], ['id' => $id]);
+                               DBA::update('push_subscriber', ['push' => -1, 'next_try' => NULL_DATE], ['id' => $id]);
                                logger('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.', LOGGER_DEBUG);
                        } else {
-                               dba::update('push_subscriber', ['push' => 0, 'next_try' => NULL_DATE], ['id' => $id]);
+                               DBA::update('push_subscriber', ['push' => 0, 'next_try' => NULL_DATE], ['id' => $id]);
                                logger('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.', LOGGER_DEBUG);
                        }
                } else {
@@ -128,7 +128,7 @@ class PushSubscriber
 
                        $retrial = $retrial + 1;
 
-                       dba::update('push_subscriber', ['push' => $retrial, 'next_try' => $next], ['id' => $id]);
+                       DBA::update('push_subscriber', ['push' => $retrial, 'next_try' => $next], ['id' => $id]);
                        logger('Delivery error: Next try (' . $retrial . ') ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' at ' . $next, LOGGER_DEBUG);
                }
        }
@@ -141,14 +141,14 @@ class PushSubscriber
         */
        public static function reset($id, $last_update)
        {
-               $subscriber = dba::selectFirst('push_subscriber', ['callback_url', 'nickname'], ['id' => $id]);
+               $subscriber = DBA::selectFirst('push_subscriber', ['callback_url', 'nickname'], ['id' => $id]);
                if (!DBM::is_result($subscriber)) {
                        return;
                }
 
                // set last_update to the 'created' date of the last item, and reset push=0
                $fields = ['push' => 0, 'next_try' => NULL_DATE, 'last_update' => $last_update];
-               dba::update('push_subscriber', $fields, ['id' => $id]);
+               DBA::update('push_subscriber', $fields, ['id' => $id]);
                logger('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital', LOGGER_DEBUG);
        }
 }
index 8e9ed40d031003b550b324b052db9b4549b6b5a7..0ec365f7c4199227cbadafba4ba2dfac46f55886 100644 (file)
@@ -5,7 +5,7 @@
 namespace Friendica\Model;
 
 use Friendica\Core\Config;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Util\DateTimeFormat;
 
@@ -19,7 +19,7 @@ class Queue
        public static function updateTime($id)
        {
                logger('queue: requeue item ' . $id);
-               $queue = dba::selectFirst('queue', ['retrial'], ['id' => $id]);
+               $queue = DBA::selectFirst('queue', ['retrial'], ['id' => $id]);
                if (!DBM::is_result($queue)) {
                        return;
                }
@@ -34,7 +34,7 @@ class Queue
                $delay = (($retrial + 3) ** 4) + (rand(1, 30) * ($retrial + 1));
                $next = DateTimeFormat::utc('now + ' . $delay . ' seconds');
 
-               dba::update('queue', ['last' => DateTimeFormat::utcNow(), 'retrial' => $retrial + 1, 'next' => $next], ['id' => $id]);
+               DBA::update('queue', ['last' => DateTimeFormat::utcNow(), 'retrial' => $retrial + 1, 'next' => $next], ['id' => $id]);
        }
 
        /**
@@ -43,7 +43,7 @@ class Queue
        public static function removeItem($id)
        {
                logger('queue: remove queue item ' . $id);
-               dba::delete('queue', ['id' => $id]);
+               DBA::delete('queue', ['id' => $id]);
        }
 
        /**
@@ -109,7 +109,7 @@ class Queue
                        }
                }
 
-               dba::insert('queue', [
+               DBA::insert('queue', [
                        'cid'     => $cid,
                        'network' => $network,
                        'guid'     => $guid,
index 9f0b595014bdaf245ab6c8f4f86cdbad4b3338e9..a4bcfe5935af7c605cc3d065856b93e86e0758ff 100644 (file)
@@ -5,7 +5,7 @@
 namespace Friendica\Model;
 
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 require_once 'boot.php';
@@ -18,8 +18,8 @@ class Term
        {
                $tag_text = '';
                $condition = ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_HASHTAG, TERM_MENTION]];
-               $tags = dba::select('term', [], $condition);
-               while ($tag = dba::fetch($tags)) {
+               $tags = DBA::select('term', [], $condition);
+               while ($tag = DBA::fetch($tags)) {
                        if ($tag_text != '') {
                                $tag_text .= ',';
                        }
@@ -38,8 +38,8 @@ class Term
        {
                $file_text = '';
                $condition = ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_FILE, TERM_CATEGORY]];
-               $tags = dba::select('term', [], $condition);
-               while ($tag = dba::fetch($tags)) {
+               $tags = DBA::select('term', [], $condition);
+               while ($tag = DBA::fetch($tags)) {
                        if ($tag['type'] == TERM_CATEGORY) {
                                $file_text .= '<' . $tag['term'] . '>';
                        } else {
@@ -66,7 +66,7 @@ class Term
                $message['tag'] = $tags;
 
                // Clean up all tags
-               dba::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_HASHTAG, TERM_MENTION]]);
+               DBA::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_HASHTAG, TERM_MENTION]]);
 
                if ($message['deleted']) {
                        return;
@@ -128,12 +128,12 @@ class Term
 
                        if ($message['uid'] == 0) {
                                $global = true;
-                               dba::update('term', ['global' => true], ['otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
+                               DBA::update('term', ['global' => true], ['otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
                        } else {
-                               $global = dba::exists('term', ['uid' => 0, 'otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
+                               $global = DBA::exists('term', ['uid' => 0, 'otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
                        }
 
-                       dba::insert('term', [
+                       DBA::insert('term', [
                                'uid'      => $message['uid'],
                                'oid'      => $itemid,
                                'otype'    => TERM_OBJ_POST,
@@ -152,8 +152,8 @@ class Term
                                foreach ($users AS $user) {
                                        if ($user['uid'] == $message['uid']) {
                                                /// @todo This function is called frim Item::update - so we mustn't call that function here
-                                               dba::update('item', ['mention' => true], ['id' => $itemid]);
-                                               dba::update('thread', ['mention' => true], ['iid' => $message['parent']]);
+                                               DBA::update('item', ['mention' => true], ['id' => $itemid]);
+                                               DBA::update('thread', ['mention' => true], ['iid' => $message['parent']]);
                                        }
                                }
                        }
@@ -172,7 +172,7 @@ class Term
                }
 
                // Clean up all tags
-               dba::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_FILE, TERM_CATEGORY]]);
+               DBA::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_FILE, TERM_CATEGORY]]);
 
                if ($message["deleted"]) {
                        return;
@@ -182,7 +182,7 @@ class Term
 
                if (preg_match_all("/\[(.*?)\]/ism", $message["file"], $files)) {
                        foreach ($files[1] as $file) {
-                               dba::insert('term', [
+                               DBA::insert('term', [
                                        'uid' => $message["uid"],
                                        'oid' => $itemid,
                                        'otype' => TERM_OBJ_POST,
@@ -194,7 +194,7 @@ class Term
 
                if (preg_match_all("/\<(.*?)\>/ism", $message["file"], $files)) {
                        foreach ($files[1] as $file) {
-                               dba::insert('term', [
+                               DBA::insert('term', [
                                        'uid' => $message["uid"],
                                        'oid' => $itemid,
                                        'otype' => TERM_OBJ_POST,
@@ -222,14 +222,14 @@ class Term
 
                $searchpath = System::baseUrl() . "/search?tag=";
 
-               $taglist = dba::select(
+               $taglist = DBA::select(
                        'term',
                        ['type', 'term', 'url'],
                        ["`otype` = ? AND `oid` = ? AND `type` IN (?, ?)", TERM_OBJ_POST, $item['id'], TERM_HASHTAG, TERM_MENTION],
                        ['order' => ['tid']]
                );
 
-               while ($tag = dba::fetch($taglist)) {
+               while ($tag = DBA::fetch($taglist)) {
                        if ($tag["url"] == "") {
                                $tag["url"] = $searchpath . $tag["term"];
                        }
@@ -254,7 +254,7 @@ class Term
 
                        $return['tags'][] = $prefix . "<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
                }
-               dba::close($taglist);
+               DBA::close($taglist);
 
                return $return;
        }
index 4dca908b61fdf93cdac24878df78d6f6dcb92b69..125b722bcf57c0a39c20553bba36b4949df04558 100644 (file)
@@ -13,7 +13,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Object\Image;
 use Friendica\Util\Crypto;
@@ -38,7 +38,7 @@ class User
         * @return boolean|array
         */
        public static function getOwnerDataById($uid) {
-               $r = dba::fetch_first("SELECT
+               $r = DBA::fetch_first("SELECT
                        `contact`.*,
                        `user`.`prvkey` AS `uprvkey`,
                        `user`.`timezone`,
@@ -70,7 +70,7 @@ class User
         */
        public static function getOwnerDataByNick($nick)
        {
-               $user = dba::selectFirst('user', ['uid'], ['nickname' => $nick]);
+               $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nick]);
                if (!DBM::is_result($user)) {
                        return false;
                }
@@ -97,7 +97,7 @@ class User
                        return $default_group;
                }
 
-               $user = dba::selectFirst('user', ['def_gid'], ['uid' => $uid]);
+               $user = DBA::selectFirst('user', ['def_gid'], ['uid' => $uid]);
 
                if (DBM::is_result($user)) {
                        $default_group = $user["def_gid"];
@@ -198,7 +198,7 @@ class User
                        }
                } elseif (is_int($user_info) || is_string($user_info)) {
                        if (is_int($user_info)) {
-                               $user = dba::selectFirst('user', ['uid', 'password', 'legacy_password'],
+                               $user = DBA::selectFirst('user', ['uid', 'password', 'legacy_password'],
                                        [
                                                'uid' => $user_info,
                                                'blocked' => 0,
@@ -212,7 +212,7 @@ class User
                                $condition = ["(`email` = ? OR `username` = ? OR `nickname` = ?)
                                        AND NOT `blocked` AND NOT `account_expired` AND NOT `account_removed` AND `verified`",
                                        $user_info, $user_info, $user_info];
-                               $user = dba::selectFirst('user', $fields, $condition);
+                               $user = DBA::selectFirst('user', $fields, $condition);
                        }
 
                        if (!DBM::is_result($user)) {
@@ -298,7 +298,7 @@ class User
                        'pwdreset_time' => null,
                        'legacy_password' => false
                ];
-               return dba::update('user', $fields, ['uid' => $uid]);
+               return DBA::update('user', $fields, ['uid' => $uid]);
        }
 
        /**
@@ -379,7 +379,7 @@ class User
                                throw new Exception(L10n::t('An invitation is required.'));
                        }
 
-                       if (!dba::exists('register', ['hash' => $invite_id])) {
+                       if (!DBA::exists('register', ['hash' => $invite_id])) {
                                throw new Exception(L10n::t('Invitation could not be verified.'));
                        }
                }
@@ -445,7 +445,7 @@ class User
                        throw new Exception(L10n::t('The nickname was blocked from registration by the nodes admin.'));
                }
 
-               if (Config::get('system', 'block_extended_register', false) && dba::exists('user', ['email' => $email])) {
+               if (Config::get('system', 'block_extended_register', false) && DBA::exists('user', ['email' => $email])) {
                        throw new Exception(L10n::t('Cannot use that email.'));
                }
 
@@ -465,8 +465,8 @@ class User
                }
 
                // Check existing and deleted accounts for this nickname.
-               if (dba::exists('user', ['nickname' => $nickname])
-                       || dba::exists('userd', ['username' => $nickname])
+               if (DBA::exists('user', ['nickname' => $nickname])
+                       || DBA::exists('userd', ['username' => $nickname])
                ) {
                        throw new Exception(L10n::t('Nickname is already registered. Please choose another.'));
                }
@@ -489,7 +489,7 @@ class User
                $sprvkey = $sres['prvkey'];
                $spubkey = $sres['pubkey'];
 
-               $insert_result = dba::insert('user', [
+               $insert_result = DBA::insert('user', [
                        'guid'     => generate_user_guid(),
                        'username' => $username,
                        'password' => $new_password_encoded,
@@ -509,8 +509,8 @@ class User
                ]);
 
                if ($insert_result) {
-                       $uid = dba::lastInsertId();
-                       $user = dba::selectFirst('user', [], ['uid' => $uid]);
+                       $uid = DBA::lastInsertId();
+                       $user = DBA::selectFirst('user', [], ['uid' => $uid]);
                } else {
                        throw new Exception(L10n::t('An error occurred during registration. Please try again.'));
                }
@@ -521,14 +521,14 @@ class User
 
                // if somebody clicked submit twice very quickly, they could end up with two accounts
                // due to race condition. Remove this one.
-               $user_count = dba::count('user', ['nickname' => $nickname]);
+               $user_count = DBA::count('user', ['nickname' => $nickname]);
                if ($user_count > 1) {
-                       dba::delete('user', ['uid' => $uid]);
+                       DBA::delete('user', ['uid' => $uid]);
 
                        throw new Exception(L10n::t('Nickname is already registered. Please choose another.'));
                }
 
-               $insert_result = dba::insert('profile', [
+               $insert_result = DBA::insert('profile', [
                        'uid' => $uid,
                        'name' => $username,
                        'photo' => System::baseUrl() . "/photo/profile/{$uid}.jpg",
@@ -539,14 +539,14 @@ class User
                        'profile-name' => L10n::t('default')
                ]);
                if (!$insert_result) {
-                       dba::delete('user', ['uid' => $uid]);
+                       DBA::delete('user', ['uid' => $uid]);
 
                        throw new Exception(L10n::t('An error occurred creating your default profile. Please try again.'));
                }
 
                // Create the self contact
                if (!Contact::createSelfFromUserId($uid)) {
-                       dba::delete('user', ['uid' => $uid]);
+                       DBA::delete('user', ['uid' => $uid]);
 
                        throw new Exception(L10n::t('An error occurred creating your self contact. Please try again.'));
                }
@@ -555,7 +555,7 @@ class User
                // right away as a default group for new contacts.
                $def_gid = Group::create($uid, L10n::t('Friends'));
                if (!$def_gid) {
-                       dba::delete('user', ['uid' => $uid]);
+                       DBA::delete('user', ['uid' => $uid]);
 
                        throw new Exception(L10n::t('An error occurred creating your default contact group. Please try again.'));
                }
@@ -565,7 +565,7 @@ class User
                        $fields['allow_gid'] = '<' . $def_gid . '>';
                }
 
-               dba::update('user', $fields, ['uid' => $uid]);
+               DBA::update('user', $fields, ['uid' => $uid]);
 
                // if we have no OpenID photo try to look up an avatar
                if (!strlen($photo)) {
@@ -610,7 +610,7 @@ class User
                                }
 
                                if (!$photo_failure) {
-                                       dba::update('photo', ['profile' => 1], ['resource-id' => $hash]);
+                                       DBA::update('photo', ['profile' => 1], ['resource-id' => $hash]);
                                }
                        }
                }
@@ -714,16 +714,16 @@ class User
 
                logger('Removing user: ' . $uid);
 
-               $user = dba::selectFirst('user', [], ['uid' => $uid]);
+               $user = DBA::selectFirst('user', [], ['uid' => $uid]);
 
                Addon::callHooks('remove_user', $user);
 
                // save username (actually the nickname as it is guaranteed
                // unique), so it cannot be re-registered in the future.
-               dba::insert('userd', ['username' => $user['nickname']]);
+               DBA::insert('userd', ['username' => $user['nickname']]);
 
                // The user and related data will be deleted in "cron_expire_and_remove_users" (cronjobs.php)
-               dba::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utcNow()], ['uid' => $uid]);
+               DBA::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utcNow()], ['uid' => $uid]);
                Worker::add(PRIORITY_HIGH, "Notifier", "removeme", $uid);
 
                // Send an update to the directory
index a53585c28412f1aec644427fb3bd958afb7657d6..bfe1eee7de3eb79e1a7142564470af1d9249b17a 100644 (file)
@@ -6,7 +6,7 @@ namespace Friendica\Module;
 
 use Friendica\BaseModule;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 
 require_once 'include/dba.php';
 require_once 'include/text.php';
@@ -26,14 +26,14 @@ class Hashtag extends BaseModule
                        System::jsonExit($result);
                }
 
-               $taglist = dba::p("SELECT DISTINCT(`term`) FROM `term` WHERE `term` LIKE ? AND `type` = ? ORDER BY `term`",
+               $taglist = DBA::p("SELECT DISTINCT(`term`) FROM `term` WHERE `term` LIKE ? AND `type` = ? ORDER BY `term`",
                        $t . '%',
                        intval(TERM_HASHTAG)
                );
-               while ($tag = dba::fetch($taglist)) {
+               while ($tag = DBA::fetch($taglist)) {
                        $result[] = ['text' => $tag['term']];
                }
-               dba::close($taglist);
+               DBA::close($taglist);
 
                System::jsonExit($result);
        }
index fb7a60613d5b949dca4caf3d4e67905bd1bf8c09..fccf8b9d85f6e347ee044987ada3fc9fbf456708 100644 (file)
@@ -9,7 +9,7 @@ use Friendica\BaseModule;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\User;
 use Friendica\Util\DateTimeFormat;
@@ -135,7 +135,7 @@ class Login extends BaseModule
                                        throw new Exception(L10n::t('Login failed.'));
                                }
                        } else {
-                               $record = dba::selectFirst('user', [],
+                               $record = DBA::selectFirst('user', [],
                                        ['uid' => User::getIdFromPasswordAuthentication($username, $password)]
                                );
                        }
@@ -176,7 +176,7 @@ class Login extends BaseModule
                        $data = json_decode($_COOKIE["Friendica"]);
                        if (isset($data->uid)) {
 
-                               $user = dba::selectFirst('user', [],
+                               $user = DBA::selectFirst('user', [],
                                        [
                                                'uid'             => $data->uid,
                                                'blocked'         => false,
@@ -231,7 +231,7 @@ class Login extends BaseModule
                                        goaway(self::getApp()->get_baseurl());
                                }
 
-                               $user = dba::selectFirst('user', [],
+                               $user = DBA::selectFirst('user', [],
                                        [
                                                'uid'             => $_SESSION['uid'],
                                                'blocked'         => false,
index c1e2a7c9780f491df1847ed122d4c287b82f9d4c..cf77482e5a8eec13d719bade0afdf9ada4bc2064 100644 (file)
@@ -5,7 +5,7 @@
 namespace Friendica\Module;
 
 use Friendica\BaseModule;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Model\Contact;
 use Friendica\Util\HTTPSignature;
 use Friendica\Util\Network;
@@ -44,7 +44,7 @@ class Magic extends BaseModule
                        goaway($dest);
                }
 
-               $contact = dba::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]);
+               $contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]);
 
                // Redirect if the contact is already authenticated on this site.
                if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], normalise_link(self::getApp()->get_baseurl())) !== false) {
index 84f25024475eedeed06e41298987761d5b767312..ae3828fe31d8365276421329d6d4d2b684fd83d4 100644 (file)
@@ -6,7 +6,7 @@ namespace Friendica\Module;
 
 use Friendica\BaseModule;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\OpenWebAuthToken;
@@ -50,7 +50,7 @@ class Owa extends BaseModule
                                                $fields    = ['id', 'url', 'addr', 'pubkey'];
                                                $condition = ['id' => $cid];
 
-                                               $contact = dba::selectFirst('contact', $fields, $condition);
+                                               $contact = DBA::selectFirst('contact', $fields, $condition);
 
                                                if (DBM::is_result($contact)) {
                                                        // Try to verify the signed header with the public key of the contact record
index addaeae115087af3ec66a3cf0dada2c5888ddd83..b9d1a65396a31eeff75f488216dfa8436f27678d 100644 (file)
@@ -7,7 +7,7 @@ namespace Friendica\Network;
 use Friendica\Core\Addon;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Util\DateTimeFormat;
 use OAuthServer;
@@ -37,7 +37,7 @@ class FKOAuth1 extends OAuthServer
        {
                logger("FKOAuth1::loginUser $uid");
                $a = get_app();
-               $record = dba::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]);
+               $record = DBA::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]);
 
                if (!DBM::is_result($record)) {
                        logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
@@ -60,14 +60,14 @@ class FKOAuth1 extends OAuthServer
                        $a->timezone = $a->user['timezone'];
                }
 
-               $contact = dba::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => 1]);
+               $contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => 1]);
                if (DBM::is_result($contact)) {
                        $a->contact = $contact;
                        $a->cid = $contact['id'];
                        $_SESSION['cid'] = $a->cid;
                }
 
-               dba::update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $_SESSION['uid']]);
+               DBA::update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $_SESSION['uid']]);
 
                Addon::callHooks('logged_in', $a->user);
        }
index 154d63b72fbf1bc49324188b49eb8c76cb527dfd..6422afcf9cd22dd83f0ad020c0ed14b82f3413aa 100644 (file)
@@ -10,7 +10,7 @@
 namespace Friendica\Network;
 
 use Friendica\Core\Config;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use OAuthConsumer;
 use OAuthDataStore;
@@ -42,8 +42,8 @@ class FKOAuthDataStore extends OAuthDataStore
        {
                logger(__function__ . ":" . $consumer_key);
 
-               $s = dba::select('clients', ['client_id', 'pw', 'redirect_uri'], ['client_id' => $consumer_key]);
-               $r = dba::inArray($s);
+               $s = DBA::select('clients', ['client_id', 'pw', 'redirect_uri'], ['client_id' => $consumer_key]);
+               $r = DBA::inArray($s);
 
                if (DBM::is_result($r)) {
                        return new OAuthConsumer($r[0]['client_id'], $r[0]['pw'], $r[0]['redirect_uri']);
@@ -62,8 +62,8 @@ class FKOAuthDataStore extends OAuthDataStore
        {
                logger(__function__ . ":" . $consumer . ", " . $token_type . ", " . $token);
 
-               $s = dba::select('tokens', ['id', 'secret', 'scope', 'expires', 'uid'], ['client_id' => $consumer->key, 'scope' => $token_type, 'id' => $token]);
-               $r = dba::inArray($s);
+               $s = DBA::select('tokens', ['id', 'secret', 'scope', 'expires', 'uid'], ['client_id' => $consumer->key, 'scope' => $token_type, 'id' => $token]);
+               $r = DBA::inArray($s);
 
                if (DBM::is_result($r)) {
                        $ot = new OAuthToken($r[0]['id'], $r[0]['secret']);
@@ -85,7 +85,7 @@ class FKOAuthDataStore extends OAuthDataStore
         */
        public function lookup_nonce($consumer, $token, $nonce, $timestamp)
        {
-               $token = dba::selectFirst('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp]);
+               $token = DBA::selectFirst('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp]);
                if (DBM::is_result($token)) {
                        return new OAuthToken($token['id'], $token['secret']);
                }
@@ -110,7 +110,7 @@ class FKOAuthDataStore extends OAuthDataStore
                        $k = $consumer;
                }
 
-               $r = dba::insert(
+               $r = DBA::insert(
                        'tokens',
                        [
                                'id' => $key,
@@ -151,7 +151,7 @@ class FKOAuthDataStore extends OAuthDataStore
                if (is_null($verifier) || ($uverifier !== false)) {
                        $key = self::genToken();
                        $sec = self::genToken();
-                       $r = dba::insert(
+                       $r = DBA::insert(
                                'tokens',
                                [
                                        'id' => $key,
@@ -167,7 +167,7 @@ class FKOAuthDataStore extends OAuthDataStore
                        }
                }
 
-               dba::delete('tokens', ['id' => $token->key]);
+               DBA::delete('tokens', ['id' => $token->key]);
 
                if (!is_null($ret) && !is_null($uverifier)) {
                        Config::delete("oauth", $verifier);
index e0c645565b4018eecce84657b0f0afe8240023b7..48530ffeae1377f8f233eb1bfe44ff99d0fbe2f6 100644 (file)
@@ -13,7 +13,7 @@ use DOMDocument;
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Profile;
 use Friendica\Protocol\Email;
@@ -415,7 +415,7 @@ class Probe
 
                                $condition = ['nurl' => normalise_link($data["url"])];
 
-                               $old_fields = dba::selectFirst('gcontact', $fieldnames, $condition);
+                               $old_fields = DBA::selectFirst('gcontact', $fieldnames, $condition);
 
                                // When the gcontact doesn't exist, the value "true" will trigger an insert.
                                // In difference to the public contacts we want to have every contact
@@ -428,7 +428,7 @@ class Probe
                                        $fields['created'] = DateTimeFormat::utcNow();
                                }
 
-                               dba::update('gcontact', $fields, $condition, $old_fields);
+                               DBA::update('gcontact', $fields, $condition, $old_fields);
 
                                $fields = ['name' => $data['name'],
                                                'nick' => $data['nick'],
@@ -466,13 +466,13 @@ class Probe
                                // This won't trigger an insert. This is intended, since we only need
                                // public contacts for everyone we store items from.
                                // We don't need to store every contact on the planet.
-                               $old_fields = dba::selectFirst('contact', $fieldnames, $condition);
+                               $old_fields = DBA::selectFirst('contact', $fieldnames, $condition);
 
                                $fields['name-date'] = DateTimeFormat::utcNow();
                                $fields['uri-date'] = DateTimeFormat::utcNow();
                                $fields['success_update'] = DateTimeFormat::utcNow();
 
-                               dba::update('contact', $fields, $condition, $old_fields);
+                               DBA::update('contact', $fields, $condition, $old_fields);
                        }
                }
 
index 71431b10db969dc7fdc9a7689331aaa4a4289b78..4299b6ff4532b06c219b523eb1ba12ca50439970 100644 (file)
@@ -11,7 +11,7 @@ use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
@@ -264,7 +264,7 @@ class Post extends BaseObject
                                        'starred'   => L10n::t('starred'),
                                ];
 
-                               $thread = dba::selectFirst('thread', ['ignored'], ['uid' => $item['uid'], 'iid' => $item['id']]);
+                               $thread = DBA::selectFirst('thread', ['ignored'], ['uid' => $item['uid'], 'iid' => $item['id']]);
                                if (DBM::is_result($thread)) {
                                        $ignore = [
                                                'do'        => L10n::t("ignore thread"),
index 0769d3b1d949067a05c417b11859dfddd20ff01e..b5e1b6c573b29c4be031cecfc86db93ba0d251c0 100644 (file)
@@ -18,7 +18,7 @@ use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Event;
@@ -952,7 +952,7 @@ class DFRN
                $conversation_uri = $conversation_href;
 
                if (isset($parent_item)) {
-                       $conversation = dba::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $item['parent-uri']]);
+                       $conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $item['parent-uri']]);
                        if (DBM::is_result($conversation)) {
                                if ($conversation['conversation-uri'] != '') {
                                        $conversation_uri = $conversation['conversation-uri'];
@@ -1401,7 +1401,7 @@ class DFRN
                        if (empty($contact['addr'])) {
                                logger('Empty contact handle for ' . $contact['id'] . ' - ' . $contact['url'] . ' - trying to update it.');
                                if (Contact::updateFromProbe($contact['id'])) {
-                                       $new_contact = dba::selectFirst('contact', ['addr'], ['id' => $contact['id']]);
+                                       $new_contact = DBA::selectFirst('contact', ['addr'], ['id' => $contact['id']]);
                                        $contact['addr'] = $new_contact['addr'];
                                }
 
@@ -1543,7 +1543,7 @@ class DFRN
                        'name', 'nick', 'about', 'location', 'keywords', 'xmpp', 'bdyear', 'bd', 'hidden', 'contact-type'];
                $condition = ["`uid` = ? AND `nurl` = ? AND `network` != ?",
                        $importer["importer_uid"], normalise_link($author["link"]), NETWORK_STATUSNET];
-               $contact_old = dba::selectFirst('contact', $fields, $condition);
+               $contact_old = DBA::selectFirst('contact', $fields, $condition);
 
                if (DBM::is_result($contact_old)) {
                        $author["contact-id"] = $contact_old["id"];
@@ -1855,7 +1855,7 @@ class DFRN
                $msg["seen"] = 0;
                $msg["replied"] = 0;
 
-               dba::insert('mail', $msg);
+               DBA::insert('mail', $msg);
 
                // send notifications.
                /// @TODO Arange this mess
@@ -2074,7 +2074,7 @@ class DFRN
                        'url' => $relocate["url"], 'nurl' => normalise_link($relocate["url"]),
                        'addr' => $relocate["addr"], 'connect' => $relocate["addr"],
                        'notify' => $relocate["notify"], 'server_url' => $relocate["server_url"]];
-               dba::update('gcontact', $fields, ['nurl' => normalise_link($old["url"])]);
+               DBA::update('gcontact', $fields, ['nurl' => normalise_link($old["url"])]);
 
                // Update the contact table. We try to find every entry.
                $fields = ['name' => $relocate["name"], 'avatar' => $relocate["avatar"],
@@ -2084,7 +2084,7 @@ class DFRN
                        'poll' => $relocate["poll"], 'site-pubkey' => $relocate["sitepubkey"]];
                $condition = ["(`id` = ?) OR (`nurl` = ?)", $importer["id"], normalise_link($old["url"])];
 
-               dba::update('contact', $fields, $condition);
+               DBA::update('contact', $fields, $condition);
 
                Contact::updateAvatar($relocate["avatar"], $importer["importer_uid"], $importer["id"], true);
 
@@ -2228,7 +2228,7 @@ class DFRN
                        }
 
                        if ($Blink && link_compare($Blink, System::baseUrl() . "/profile/" . $importer["nickname"])) {
-                               $author = dba::selectFirst('contact', ['name', 'thumb', 'url'], ['id' => $item['author-id']]);
+                               $author = DBA::selectFirst('contact', ['name', 'thumb', 'url'], ['id' => $item['author-id']]);
 
                                // send a notification
                                notification(
@@ -2851,16 +2851,16 @@ class DFRN
                        $accounttype = intval(XML::getFirstNodeValue($xpath, "/atom:feed/dfrn:account_type/text()"));
 
                        if ($accounttype != $importer["contact-type"]) {
-                               dba::update('contact', ['contact-type' => $accounttype], ['id' => $importer["id"]]);
+                               DBA::update('contact', ['contact-type' => $accounttype], ['id' => $importer["id"]]);
                        }
                        // A forum contact can either have set "forum" or "prv" - but not both
                        if (($accounttype == ACCOUNT_TYPE_COMMUNITY) && (($forum != $importer["forum"]) || ($forum == $importer["prv"]))) {
                                $condition = ['(`forum` != ? OR `prv` != ?) AND `id` = ?', $forum, !$forum, $importer["id"]];
-                               dba::update('contact', ['forum' => $forum, 'prv' => !$forum], $condition);
+                               DBA::update('contact', ['forum' => $forum, 'prv' => !$forum], $condition);
                        }
                } elseif ($forum != $importer["forum"]) { // Deprecated since 3.5.1
                        $condition = ['`forum` != ? AND `id` = ?', $forum, $importer["id"]];
-                       dba::update('contact', ['forum' => $forum], $condition);
+                       DBA::update('contact', ['forum' => $forum], $condition);
                }
 
 
@@ -2988,7 +2988,7 @@ class DFRN
 
                        $sec = random_string();
 
-                       dba::insert('profile_check', ['uid' => local_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id, 'sec' => $sec, 'expire' => time() + 45]);
+                       DBA::insert('profile_check', ['uid' => local_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id, 'sec' => $sec, 'expire' => time() + 45]);
 
                        $url = curPageURL();
 
index c792a86e048cea831bd6dd73c63ad3f04aceeab9..9ad90869be8043a72b7708e660c462df376faa55 100644 (file)
@@ -18,7 +18,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
@@ -76,32 +76,32 @@ class Diaspora
                        }
 
                        // Servers that want to get all content
-                       $servers = dba::select('gserver', ['url'], ['relay-subscribe' => true, 'relay-scope' => 'all']);
-                       while ($server = dba::fetch($servers)) {
+                       $servers = DBA::select('gserver', ['url'], ['relay-subscribe' => true, 'relay-scope' => 'all']);
+                       while ($server = DBA::fetch($servers)) {
                                $serverlist[$server['url']] = $server['url'];
                        }
 
                        // All tags of the current post
                        $condition = ['otype' => TERM_OBJ_POST, 'type' => TERM_HASHTAG, 'oid' => $parent['parent']];
-                       $tags = dba::select('term', ['term'], $condition);
+                       $tags = DBA::select('term', ['term'], $condition);
                        $taglist = [];
-                       while ($tag = dba::fetch($tags)) {
+                       while ($tag = DBA::fetch($tags)) {
                                $taglist[] = $tag['term'];
                        }
 
                        // All servers who wants content with this tag
                        $tagserverlist = [];
                        if (!empty($taglist)) {
-                               $tagserver = dba::select('gserver-tag', ['gserver-id'], ['tag' => $taglist]);
-                               while ($server = dba::fetch($tagserver)) {
+                               $tagserver = DBA::select('gserver-tag', ['gserver-id'], ['tag' => $taglist]);
+                               while ($server = DBA::fetch($tagserver)) {
                                        $tagserverlist[] = $server['gserver-id'];
                                }
                        }
 
                        // All adresses with the given id
                        if (!empty($tagserverlist)) {
-                               $servers = dba::select('gserver', ['url'], ['relay-subscribe' => true, 'relay-scope' => 'tags', 'id' => $tagserverlist]);
-                               while ($server = dba::fetch($servers)) {
+                               $servers = DBA::select('gserver', ['url'], ['relay-subscribe' => true, 'relay-scope' => 'tags', 'id' => $tagserverlist]);
+                               while ($server = DBA::fetch($servers)) {
                                        $serverlist[$server['url']] = $server['url'];
                                }
                        }
@@ -146,7 +146,7 @@ class Diaspora
                // Fetch the relay contact
                $condition = ['uid' => 0, 'nurl' => normalise_link($server_url),
                        'contact-type' => ACCOUNT_TYPE_RELAY];
-               $contact = dba::selectFirst('contact', $fields, $condition);
+               $contact = DBA::selectFirst('contact', $fields, $condition);
 
                if (DBM::is_result($contact)) {
                        if ($contact['archive'] || $contact['blocked']) {
@@ -156,7 +156,7 @@ class Diaspora
                } else {
                        self::setRelayContact($server_url);
 
-                       $contact = dba::selectFirst('contact', $fields, $condition);
+                       $contact = DBA::selectFirst('contact', $fields, $condition);
                        if (DBM::is_result($contact)) {
                                return $contact;
                        }
@@ -186,11 +186,11 @@ class Diaspora
                $condition = ['uid' => 0, 'nurl' => normalise_link($server_url),
                        'contact-type' => ACCOUNT_TYPE_RELAY];
 
-               if (dba::exists('contact', $condition)) {
+               if (DBA::exists('contact', $condition)) {
                        unset($fields['created']);
                }
 
-               dba::update('contact', $fields, $condition, true);
+               DBA::update('contact', $fields, $condition, true);
        }
 
        /**
@@ -207,13 +207,13 @@ class Diaspora
         */
        public static function participantsForThread($thread, array $contacts)
        {
-               $r = dba::p("SELECT `contact`.`batch`, `contact`.`id`, `contact`.`name`, `contact`.`network`,
+               $r = DBA::p("SELECT `contact`.`batch`, `contact`.`id`, `contact`.`name`, `contact`.`network`,
                                `fcontact`.`batch` AS `fbatch`, `fcontact`.`network` AS `fnetwork` FROM `participation`
                                INNER JOIN `contact` ON `contact`.`id` = `participation`.`cid`
                                INNER JOIN `fcontact` ON `fcontact`.`id` = `participation`.`fid`
                                WHERE `participation`.`iid` = ?", $thread);
 
-               while ($contact = dba::fetch($r)) {
+               while ($contact = DBA::fetch($r)) {
                        if (!empty($contact['fnetwork'])) {
                                $contact['network'] = $contact['fnetwork'];
                        }
@@ -235,7 +235,7 @@ class Diaspora
                                $contacts[] = $contact;
                        }
                }
-               dba::close($r);
+               DBA::close($r);
 
                return $contacts;
        }
@@ -899,7 +899,7 @@ class Diaspora
        {
                $update = false;
 
-               $person = dba::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
+               $person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
                if (DBM::is_result($person)) {
                        logger("In cache " . print_r($person, true), LOGGER_DEBUG);
 
@@ -924,7 +924,7 @@ class Diaspora
                                self::updateFContact($r);
 
                                // Fetch the updated or added contact
-                               $person = dba::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
+                               $person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
                                if (!DBM::is_result($person)) {
                                        $person = $r;
                                }
@@ -951,7 +951,7 @@ class Diaspora
 
                $condition = ['url' => $arr["url"], 'network' => $arr["network"]];
 
-               dba::update('fcontact', $fields, $condition, true);
+               DBA::update('fcontact', $fields, $condition, true);
        }
 
        /**
@@ -1425,7 +1425,7 @@ class Diaspora
        private static function authorContactByUrl($def_contact, $person, $uid)
        {
                $condition = ['nurl' => normalise_link($person["url"]), 'uid' => $uid];
-               $contact = dba::selectFirst('contact', ['id', 'network'], $condition);
+               $contact = DBA::selectFirst('contact', ['id', 'network'], $condition);
                if (DBM::is_result($contact)) {
                        $cid = $contact["id"];
                        $network = $contact["network"];
@@ -1532,7 +1532,7 @@ class Diaspora
                                'notify' => $data['notify'], 'poll' => $data['poll'],
                                'network' => $data['network']];
 
-               dba::update('contact', $fields, ['addr' => $old_handle]);
+               DBA::update('contact', $fields, ['addr' => $old_handle]);
 
                $fields = ['url' => $data['url'], 'nurl' => normalise_link($data['url']),
                                'name' => $data['name'], 'nick' => $data['nick'],
@@ -1540,7 +1540,7 @@ class Diaspora
                                'notify' => $data['notify'], 'photo' => $data['photo'],
                                'server_url' => $data['baseurl'], 'network' => $data['network']];
 
-               dba::update('gcontact', $fields, ['addr' => $old_handle]);
+               DBA::update('gcontact', $fields, ['addr' => $old_handle]);
 
                logger('Contacts are updated.');
 
@@ -1558,12 +1558,12 @@ class Diaspora
        {
                $author = notags(unxmlify($data->author));
 
-               $contacts = dba::select('contact', ['id'], ['addr' => $author]);
-               while ($contact = dba::fetch($contacts)) {
+               $contacts = DBA::select('contact', ['id'], ['addr' => $author]);
+               while ($contact = DBA::fetch($contacts)) {
                        Contact::remove($contact["id"]);
                }
 
-               dba::delete('gcontact', ['addr' => $author]);
+               DBA::delete('gcontact', ['addr' => $author]);
 
                logger('Removed contacts for ' . $author);
 
@@ -1631,7 +1631,7 @@ class Diaspora
                $item = Item::selectFirst(['uid'], ['origin' => true, 'guid' => $guid]);
                if (DBM::is_result($item)) {
                        logger("Found user ".$item['uid']." as owner of item ".$guid, LOGGER_DEBUG);
-                       $contact = dba::selectFirst('contact', [], ['self' => true, 'uid' => $item['uid']]);
+                       $contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $item['uid']]);
                        if (DBM::is_result($contact)) {
                                return $contact;
                        }
@@ -1797,7 +1797,7 @@ class Diaspora
 
                $person = self::personByHandle($msg_author);
 
-               dba::lock('mail');
+               DBA::lock('mail');
 
                $r = q(
                        "SELECT `id` FROM `mail` WHERE `guid` = '%s' AND `uid` = %d LIMIT 1",
@@ -1828,9 +1828,9 @@ class Diaspora
                        dbesc($msg_created_at)
                );
 
-               dba::unlock();
+               DBA::unlock();
 
-               dba::update('conv', ['updated' => DateTimeFormat::utcNow()], ['id' => $conversation["id"]]);
+               DBA::update('conv', ['updated' => DateTimeFormat::utcNow()], ['id' => $conversation["id"]]);
 
                notification(
                        [
@@ -2084,7 +2084,7 @@ class Diaspora
 
                $body = self::replacePeopleGuid($body, $person["url"]);
 
-               dba::lock('mail');
+               DBA::lock('mail');
 
                $r = q(
                        "SELECT `id` FROM `mail` WHERE `guid` = '%s' AND `uid` = %d LIMIT 1",
@@ -2115,9 +2115,9 @@ class Diaspora
                        dbesc($created_at)
                );
 
-               dba::unlock();
+               DBA::unlock();
 
-               dba::update('conv', ['updated' => DateTimeFormat::utcNow()], ['id' => $conversation["id"]]);
+               DBA::update('conv', ['updated' => DateTimeFormat::utcNow()], ['id' => $conversation["id"]]);
                return true;
        }
 
@@ -2162,8 +2162,8 @@ class Diaspora
 
                logger('Received participation for ID: '.$item['id'].' - Contact: '.$contact_id.' - Server: '.$server, LOGGER_DEBUG);
 
-               if (!dba::exists('participation', ['iid' => $item['id'], 'server' => $server])) {
-                       dba::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]);
+               if (!DBA::exists('participation', ['iid' => $item['id'], 'server' => $server])) {
+                       DBA::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]);
                }
 
                // Send all existing comments and likes to the requesting server
@@ -2180,7 +2180,7 @@ class Diaspora
                        logger("Send ".$cmd." for item ".$comment['id']." to contact ".$contact_id, LOGGER_DEBUG);
                        Worker::add(PRIORITY_HIGH, 'Delivery', $cmd, $comment['id'], $contact_id);
                }
-               dba::close($comments);
+               DBA::close($comments);
 
                return true;
        }
@@ -2291,7 +2291,7 @@ class Diaspora
                        $fields['bd'] = $birthday;
                }
 
-               dba::update('contact', $fields, ['id' => $contact['id']]);
+               DBA::update('contact', $fields, ['id' => $contact['id']]);
 
                $gcontact = ["url" => $contact["url"], "network" => NETWORK_DIASPORA, "generation" => 2,
                                        "photo" => $image_url, "name" => $name, "location" => $location,
@@ -2320,7 +2320,7 @@ class Diaspora
                $a = get_app();
 
                if ($contact["rel"] == CONTACT_IS_SHARING) {
-                       dba::update(
+                       DBA::update(
                                'contact',
                                ['rel' => CONTACT_IS_FRIEND, 'writable' => true],
                                ['id' => $contact["id"], 'uid' => $importer["uid"]]
@@ -3213,7 +3213,7 @@ class Diaspora
                // If the item belongs to a user, we take this user id.
                if ($item['uid'] == 0) {
                        $condition = ['verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false];
-                       $first_user = dba::selectFirst('user', ['uid'], $condition);
+                       $first_user = DBA::selectFirst('user', ['uid'], $condition);
                        $owner = User::getOwnerDataById($first_user['uid']);
                } else {
                        $owner = User::getOwnerDataById($item['uid']);
@@ -4200,7 +4200,7 @@ class Diaspora
                 * Now store the signature more flexible to dynamically support new fields.
                 * This will break Diaspora compatibility with Friendica versions prior to 3.5.
                 */
-               dba::insert('sign', ['iid' => $post_id, 'signed_text' => json_encode($message)]);
+               DBA::insert('sign', ['iid' => $post_id, 'signed_text' => json_encode($message)]);
 
                logger('Stored diaspora like signature');
                return true;
@@ -4236,7 +4236,7 @@ class Diaspora
                 * Now store the signature more flexible to dynamically support new fields.
                 * This will break Diaspora compatibility with Friendica versions prior to 3.5.
                 */
-               dba::insert('sign', ['iid' => $message_id, 'signed_text' => json_encode($message)]);
+               DBA::insert('sign', ['iid' => $message_id, 'signed_text' => json_encode($message)]);
 
                logger('Stored diaspora comment signature');
                return true;
index bd0defa32a0397585c0d9670bcb3bfdd3a96c751..8661c3e17b86bf6f1cf11716205453be064feb9a 100644 (file)
@@ -13,7 +13,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\Lock;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Conversation;
@@ -78,7 +78,7 @@ class OStatus
                        $condition = ["`uid` = ? AND `alias` = ? AND `network` != ? AND `rel` IN (?, ?)",
                                        $importer["uid"], $aliaslink, NETWORK_STATUSNET,
                                        CONTACT_IS_SHARING, CONTACT_IS_FRIEND];
-                       $contact = dba::selectFirst('contact', [], $condition);
+                       $contact = DBA::selectFirst('contact', [], $condition);
                }
 
                if (!DBM::is_result($contact) && $author["author-link"] != '') {
@@ -89,14 +89,14 @@ class OStatus
                        $condition = ["`uid` = ? AND `nurl` IN (?, ?) AND `network` != ? AND `rel` IN (?, ?)",
                                        $importer["uid"], normalise_link($author["author-link"]), normalise_link($aliaslink),
                                        NETWORK_STATUSNET, CONTACT_IS_SHARING, CONTACT_IS_FRIEND];
-                       $contact = dba::selectFirst('contact', [], $condition);
+                       $contact = DBA::selectFirst('contact', [], $condition);
                }
 
                if (!DBM::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);
+                       $contact = DBA::selectFirst('contact', [], $condition);
                }
 
                if (DBM::is_result($contact)) {
@@ -182,7 +182,7 @@ class OStatus
 
                        $contact['name-date'] = DateTimeFormat::utcNow();
 
-                       dba::update('contact', $contact, ['id' => $contact["id"]], $current);
+                       DBA::update('contact', $contact, ['id' => $contact["id"]], $current);
 
                        if (!empty($author["author-avatar"]) && ($author["author-avatar"] != $current['avatar'])) {
                                logger("Update profile picture for contact ".$contact["id"], LOGGER_DEBUG);
@@ -194,7 +194,7 @@ class OStatus
 
                        if ($cid) {
                                $fields = ['url', 'nurl', 'name', 'nick', 'alias', 'about', 'location'];
-                               $old_contact = dba::selectFirst('contact', $fields, ['id' => $cid]);
+                               $old_contact = DBA::selectFirst('contact', $fields, ['id' => $cid]);
 
                                // Update it with the current values
                                $fields = ['url' => $author["author-link"], 'name' => $contact["name"],
@@ -203,7 +203,7 @@ class OStatus
                                                'about' => $contact["about"], 'location' => $contact["location"],
                                                'success_update' => DateTimeFormat::utcNow(), 'last-update' => DateTimeFormat::utcNow()];
 
-                               dba::update('contact', $fields, ['id' => $cid], $old_contact);
+                               DBA::update('contact', $fields, ['id' => $cid], $old_contact);
 
                                // Update the avatar
                                if (!empty($author["author-avatar"])) {
@@ -834,9 +834,9 @@ class OStatus
                        $conv_data['source'] = $doc2->saveXML();
 
                        $condition = ['item-uri' => $conv_data['uri'],'protocol' => PROTOCOL_OSTATUS_FEED];
-                       if (dba::exists('conversation', $condition)) {
+                       if (DBA::exists('conversation', $condition)) {
                                logger('Delete deprecated entry for URI '.$conv_data['uri'], LOGGER_DEBUG);
-                               dba::delete('conversation', ['item-uri' => $conv_data['uri']]);
+                               DBA::delete('conversation', ['item-uri' => $conv_data['uri']]);
                        }
 
                        logger('Store conversation data for uri '.$conv_data['uri'], LOGGER_DEBUG);
@@ -858,7 +858,7 @@ class OStatus
        private static function fetchSelf($self, &$item)
        {
                $condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $self, PROTOCOL_DFRN, PROTOCOL_OSTATUS_SALMON];
-               if (dba::exists('conversation', $condition)) {
+               if (DBA::exists('conversation', $condition)) {
                        logger('Conversation '.$item['uri'].' is already stored.', LOGGER_DEBUG);
                        return;
                }
@@ -893,7 +893,7 @@ class OStatus
        private static function fetchRelated($related, $related_uri, $importer)
        {
                $condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $related_uri, PROTOCOL_DFRN, PROTOCOL_OSTATUS_SALMON];
-               $conversation = dba::selectFirst('conversation', ['source', 'protocol'], $condition);
+               $conversation = DBA::selectFirst('conversation', ['source', 'protocol'], $condition);
                if (DBM::is_result($conversation)) {
                        $stored = true;
                        $xml = $conversation['source'];
@@ -903,7 +903,7 @@ class OStatus
                        }
                        if ($conversation['protocol'] == PROTOCOL_OSTATUS_SALMON) {
                                logger('Delete invalid cached XML for URI '.$related_uri, LOGGER_DEBUG);
-                               dba::delete('conversation', ['item-uri' => $related_uri]);
+                               DBA::delete('conversation', ['item-uri' => $related_uri]);
                        }
                }
 
@@ -973,7 +973,7 @@ class OStatus
                // Finally we take the data that we fetched from "ostatus:conversation"
                if ($xml == '') {
                        $condition = ['item-uri' => $related_uri, 'protocol' => PROTOCOL_SPLITTED_CONV];
-                       $conversation = dba::selectFirst('conversation', ['source'], $condition);
+                       $conversation = DBA::selectFirst('conversation', ['source'], $condition);
                        if (DBM::is_result($conversation)) {
                                $stored = true;
                                logger('Got cached XML from conversation for URI '.$related_uri, LOGGER_DEBUG);
@@ -1300,7 +1300,7 @@ class OStatus
                if ($owner['account-type'] == ACCOUNT_TYPE_COMMUNITY) {
                        $condition = ['uid' => $owner['uid'], 'self' => false, 'pending' => false,
                                        'archive' => false, 'hidden' => false, 'blocked' => false];
-                       $members = dba::count('contact', $condition);
+                       $members = DBA::count('contact', $condition);
                        XML::addElement($doc, $root, "statusnet:group_info", "", ["member_count" => $members]);
                }
 
@@ -1401,7 +1401,7 @@ class OStatus
         */
        private static function addAuthor($doc, $owner, $show_profile = true)
        {
-               $profile = dba::selectFirst('profile', ['homepage', 'publish'], ['uid' => $owner['uid'], 'is-default' => true]);
+               $profile = DBA::selectFirst('profile', ['homepage', 'publish'], ['uid' => $owner['uid'], 'is-default' => true]);
                $author = $doc->createElement("author");
                XML::addElement($doc, $author, "id", $owner["url"]);
                if ($owner['account-type'] == ACCOUNT_TYPE_COMMUNITY) {
@@ -1981,7 +1981,7 @@ class OStatus
                        $conversation_uri = $conversation_href;
 
                        if (isset($parent_item)) {
-                               $conversation = dba::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $parent_item]);
+                               $conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $parent_item]);
                                if (DBM::is_result($conversation)) {
                                        if ($conversation['conversation-uri'] != '') {
                                                $conversation_uri = $conversation['conversation-uri'];
@@ -2022,7 +2022,7 @@ class OStatus
 
                foreach ($mentioned as $mention) {
                        $condition = ['uid' => $owner['uid'], 'nurl' => normalise_link($mention)];
-                       $contact = dba::selectFirst('contact', ['forum', 'prv', 'self', 'contact-type'], $condition);
+                       $contact = DBA::selectFirst('contact', ['forum', 'prv', 'self', 'contact-type'], $condition);
                        if ($contact["forum"] || $contact["prv"] || ($owner['contact-type'] == ACCOUNT_TYPE_COMMUNITY) ||
                                ($contact['self'] && ($owner['account-type'] == ACCOUNT_TYPE_COMMUNITY))) {
                                XML::addElement($doc, $entry, "link", "",
index 848662538b93717c98c840117bfa09fee45fe2df..f45b65e611f00b768f921d94645985a34b2eef68 100644 (file)
@@ -15,7 +15,7 @@ use Exception;
 use Friendica\Content\Text\HTML;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\GContact;
 use Friendica\Model\Profile;
@@ -67,7 +67,7 @@ class PortableContact
 
                if ($cid) {
                        if (!$url || !$uid) {
-                               $contact = dba::selectFirst('contact', ['poco', 'uid'], ['id' => $cid]);
+                               $contact = DBA::selectFirst('contact', ['poco', 'uid'], ['id' => $cid]);
                                if (DBM::is_result($contact)) {
                                        $url = $contact['poco'];
                                        $uid = $contact['uid'];
@@ -204,7 +204,7 @@ class PortableContact
                logger("load: loaded $total entries", LOGGER_DEBUG);
 
                $condition = ["`cid` = ? AND `uid` = ? AND `zcid` = ? AND `updated` < UTC_TIMESTAMP - INTERVAL 2 DAY", $cid, $uid, $zcid];
-               dba::delete('glink', $condition);
+               DBA::delete('glink', $condition);
        }
 
        public static function reachable($profile, $server = "", $network = "", $force = false)
@@ -342,7 +342,7 @@ class PortableContact
                        if (!self::checkServer($server_url, $gcontacts[0]["network"], $force)) {
                                if ($force) {
                                        $fields = ['last_failure' => DateTimeFormat::utcNow()];
-                                       dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
+                                       DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
                                }
 
                                logger("Profile ".$profile.": Server ".$server_url." wasn't reachable.", LOGGER_DEBUG);
@@ -423,7 +423,7 @@ class PortableContact
 
                                                if (!empty($noscrape["updated"])) {
                                                        $fields = ['last_contact' => DateTimeFormat::utcNow()];
-                                                       dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
+                                                       DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
 
                                                        logger("Profile ".$profile." was last updated at ".$noscrape["updated"]." (noscrape)", LOGGER_DEBUG);
 
@@ -451,7 +451,7 @@ class PortableContact
                        && (normalise_link($profile) != normalise_link($data["url"]))
                ) {
                        // Delete the old entry
-                       dba::delete('gcontact', ['nurl' => normalise_link($profile)]);
+                       DBA::delete('gcontact', ['nurl' => normalise_link($profile)]);
 
                        $gcontact = array_merge($gcontacts[0], $data);
 
@@ -472,7 +472,7 @@ class PortableContact
 
                if (($data["poll"] == "") || (in_array($data["network"], [NETWORK_FEED, NETWORK_PHANTOM]))) {
                        $fields = ['last_failure' => DateTimeFormat::utcNow()];
-                       dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
+                       DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
 
                        logger("Profile ".$profile." wasn't reachable (profile)", LOGGER_DEBUG);
                        return false;
@@ -488,7 +488,7 @@ class PortableContact
 
                if (!$feedret["success"]) {
                        $fields = ['last_failure' => DateTimeFormat::utcNow()];
-                       dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
+                       DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
 
                        logger("Profile ".$profile." wasn't reachable (no feed)", LOGGER_DEBUG);
                        return false;
@@ -530,11 +530,11 @@ class PortableContact
                        $fields['updated'] = $last_updated;
                }
 
-               dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
+               DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
 
                if (($gcontacts[0]["generation"] == 0)) {
                        $fields = ['generation' => 9];
-                       dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
+                       DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
                }
 
                logger("Profile ".$profile." was last updated at ".$last_updated, LOGGER_DEBUG);
@@ -930,12 +930,12 @@ class PortableContact
                        return false;
                }
 
-               $gserver = dba::selectFirst('gserver', [], ['nurl' => normalise_link($server_url)]);
+               $gserver = DBA::selectFirst('gserver', [], ['nurl' => normalise_link($server_url)]);
                if (DBM::is_result($gserver)) {
                        if ($gserver["created"] <= NULL_DATE) {
                                $fields = ['created' => DateTimeFormat::utcNow()];
                                $condition = ['nurl' => normalise_link($server_url)];
-                               dba::update('gserver', $fields, $condition);
+                               DBA::update('gserver', $fields, $condition);
                        }
                        $poco = $gserver["poco"];
                        $noscrape = $gserver["noscrape"];
@@ -989,7 +989,7 @@ class PortableContact
                // Mastodon uses the "@" for user profiles.
                // But this can be misunderstood.
                if (parse_url($server_url, PHP_URL_USER) != '') {
-                       dba::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
+                       DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
                        return false;
                }
 
@@ -1005,7 +1005,7 @@ class PortableContact
                if (DBM::is_result($gserver) && ($orig_server_url == $server_url) &&
                        (!$serverret["success"] && ($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)]);
+                       DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
                        return false;
                }
 
@@ -1020,7 +1020,7 @@ class PortableContact
                        // Quit if there is a timeout
                        if (!$serverret["success"] && ($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)]);
+                               DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
                                return false;
                        }
 
@@ -1046,7 +1046,7 @@ class PortableContact
 
                if (!$failure) {
                        // This will be too low, but better than no value at all.
-                       $registered_users = dba::count('gcontact', ['server_url' => normalise_link($server_url)]);
+                       $registered_users = DBA::count('gcontact', ['server_url' => normalise_link($server_url)]);
                }
 
                // Look for poco
@@ -1365,7 +1365,7 @@ class PortableContact
                }
 
                // Check again if the server exists
-               $found = dba::exists('gserver', ['nurl' => normalise_link($server_url)]);
+               $found = DBA::exists('gserver', ['nurl' => normalise_link($server_url)]);
 
                $version = strip_tags($version);
                $site_name = strip_tags($site_name);
@@ -1379,11 +1379,11 @@ class PortableContact
                                'last_contact' => $last_contact, 'last_failure' => $last_failure];
 
                if ($found) {
-                       dba::update('gserver', $fields, ['nurl' => normalise_link($server_url)]);
+                       DBA::update('gserver', $fields, ['nurl' => normalise_link($server_url)]);
                } elseif (!$failure) {
                        $fields['nurl'] = normalise_link($server_url);
                        $fields['created'] = DateTimeFormat::utcNow();
-                       dba::insert('gserver', $fields);
+                       DBA::insert('gserver', $fields);
                }
 
                if (!$failure && in_array($fields['network'], [NETWORK_DFRN, NETWORK_DIASPORA])) {
@@ -1414,17 +1414,17 @@ class PortableContact
                        return;
                }
 
-               $gserver = dba::selectFirst('gserver', ['id', 'relay-subscribe', 'relay-scope'], ['nurl' => normalise_link($server_url)]);
+               $gserver = DBA::selectFirst('gserver', ['id', 'relay-subscribe', 'relay-scope'], ['nurl' => normalise_link($server_url)]);
                if (!DBM::is_result($gserver)) {
                        return;
                }
 
                if (($gserver['relay-subscribe'] != $data->subscribe) || ($gserver['relay-scope'] != $data->scope)) {
                        $fields = ['relay-subscribe' => $data->subscribe, 'relay-scope' => $data->scope];
-                       dba::update('gserver', $fields, ['id' => $gserver['id']]);
+                       DBA::update('gserver', $fields, ['id' => $gserver['id']]);
                }
 
-               dba::delete('gserver-tag', ['gserver-id' => $gserver['id']]);
+               DBA::delete('gserver-tag', ['gserver-id' => $gserver['id']]);
                if ($data->scope == 'tags') {
                        // Avoid duplicates
                        $tags = [];
@@ -1434,7 +1434,7 @@ class PortableContact
                        }
 
                        foreach ($tags as $tag) {
-                               dba::insert('gserver-tag', ['gserver-id' => $gserver['id'], 'tag' => $tag], true);
+                               DBA::insert('gserver-tag', ['gserver-id' => $gserver['id'], 'tag' => $tag], true);
                        }
                }
 
@@ -1620,7 +1620,7 @@ class PortableContact
                        }
 
                        $fields = ['last_poco_query' => DateTimeFormat::utcNow()];
-                       dba::update('gserver', $fields, ['nurl' => $server["nurl"]]);
+                       DBA::update('gserver', $fields, ['nurl' => $server["nurl"]]);
 
                        return true;
                } else {
@@ -1629,7 +1629,7 @@ class PortableContact
 
                        // If we couldn't reach the server, we will try it some time later
                        $fields = ['last_poco_query' => DateTimeFormat::utcNow()];
-                       dba::update('gserver', $fields, ['nurl' => $server["nurl"]]);
+                       DBA::update('gserver', $fields, ['nurl' => $server["nurl"]]);
 
                        return false;
                }
@@ -1655,7 +1655,7 @@ class PortableContact
                                if (!self::checkServer($server["url"], $server["network"])) {
                                        // The server is not reachable? Okay, then we will try it later
                                        $fields = ['last_poco_query' => DateTimeFormat::utcNow()];
-                                       dba::update('gserver', $fields, ['nurl' => $server["nurl"]]);
+                                       DBA::update('gserver', $fields, ['nurl' => $server["nurl"]]);
                                        continue;
                                }
 
index a01a7c721e0ccf8947d9da62f046640eacecb7ba..1ab5341a816efb86cf2f5bef01066d5080a0695d 100644 (file)
@@ -36,7 +36,7 @@ namespace Friendica\Util;
 
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\User;
 
@@ -71,7 +71,7 @@ class ExAuth
        {
                while (!feof(STDIN)) {
                        // Quit if the database connection went down
-                       if (!dba::connected()) {
+                       if (!DBA::connected()) {
                                $this->writeLog(LOG_ERR, 'the database connection went down');
                                return;
                        }
@@ -144,7 +144,7 @@ class ExAuth
                // Does the hostname match? So we try directly
                if ($a->get_hostname() == $aCommand[2]) {
                        $this->writeLog(LOG_INFO, 'internal user check for ' . $sUser . '@' . $aCommand[2]);
-                       $found = dba::exists('user', ['nickname' => $sUser]);
+                       $found = DBA::exists('user', ['nickname' => $sUser]);
                } else {
                        $found = false;
                }
@@ -225,7 +225,7 @@ class ExAuth
                if ($a->get_hostname() == $aCommand[2]) {
                        $this->writeLog(LOG_INFO, 'internal auth for ' . $sUser . '@' . $aCommand[2]);
 
-                       $aUser = dba::selectFirst('user', ['uid', 'password', 'legacy_password'], ['nickname' => $sUser]);
+                       $aUser = DBA::selectFirst('user', ['uid', 'password', 'legacy_password'], ['nickname' => $sUser]);
                        if (DBM::is_result($aUser)) {
                                $uid = $aUser['uid'];
                                $success = User::authenticate($aUser, $aCommand[3]);
index c3a45205c37bd9326ada56d9955e8494df79312f..94358077042df345de42b3cf63d664e01adeb6b7 100644 (file)
@@ -6,7 +6,7 @@
 namespace Friendica\Util;
 
 use Friendica\Core\Config;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 
 /**
@@ -179,9 +179,9 @@ class HTTPSignature
        private static function getActivitypubKey($id)
        {
                if (strpos($id, 'acct:') === 0) {
-                       $contact = dba::selectFirst('contact', ['pubkey'], ['uid' => 0, 'addr' => str_replace('acct:', '', $id)]);
+                       $contact = DBA::selectFirst('contact', ['pubkey'], ['uid' => 0, 'addr' => str_replace('acct:', '', $id)]);
                } else {
-                       $contact = dba::selectFirst('contact', ['pubkey'], ['id' => $id, 'network' => 'activitypub']);
+                       $contact = DBA::selectFirst('contact', ['pubkey'], ['id' => $id, 'network' => 'activitypub']);
                }
 
                if (DBM::is_result($contact)) {
index 80761032e909ee2c1160d5a766ec5a278bc4e933..3be372767bd7b3fc1e53023dcb0011c064be20e6 100644 (file)
@@ -9,7 +9,7 @@ use DOMDocument;
 use DOMXPath;
 use Friendica\Content\OEmbed;
 use Friendica\Core\Addon;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Object\Image;
 
 require_once 'include/dba.php';
@@ -47,7 +47,7 @@ class ParseUrl
                        return false;
                }
 
-               $parsed_url = dba::selectFirst('parsed_url', ['content'],
+               $parsed_url = DBA::selectFirst('parsed_url', ['content'],
                        ['url' => normalise_link($url), 'guessing' => !$no_guessing, 'oembed' => $do_oembed]
                );
                if (!empty($parsed_url['content'])) {
@@ -57,7 +57,7 @@ class ParseUrl
 
                $data = self::getSiteinfo($url, $no_guessing, $do_oembed);
 
-               dba::insert(
+               DBA::insert(
                        'parsed_url',
                        [
                                'url' => normalise_link($url), 'guessing' => !$no_guessing,
index df7a18a1790e52e469e6fe2dc0d477005f138563..644ef6b9d4e9f1c922fbc018c54a8a0cb2502964 100644 (file)
@@ -8,7 +8,7 @@ use Friendica\BaseObject;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Util\DateTimeFormat;
 
@@ -102,11 +102,11 @@ class Cron
                if (Config::get('system', 'last_cron_hourly', 0) + 3600 < time()) {
 
                        // Delete all done workerqueue entries
-                       dba::delete('workerqueue', ['`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 1 HOUR']);
+                       DBA::delete('workerqueue', ['`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 1 HOUR']);
 
                        // Optimizing this table only last seconds
                        if (Config::get('system', 'optimize_workerqueue', false)) {
-                               dba::e("OPTIMIZE TABLE `workerqueue`");
+                               DBA::e("OPTIMIZE TABLE `workerqueue`");
                        }
 
                        Config::set('system', 'last_cron_hourly', time());
index 6454be3e5861055eff9a93c561d5b8af993f7e1b..b2d70d9a8018442d4dafe739d9ec748f8c225f91 100644 (file)
@@ -8,7 +8,7 @@ use Friendica\App;
 use Friendica\BaseObject;
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Database\PostUpdate;
 use Friendica\Model\Contact;
@@ -109,18 +109,18 @@ class CronJobs
        {
                // expire any expired regular accounts. Don't expire forums.
                $condition = ["NOT `account_expired` AND `account_expires_on` > ? AND `account_expires_on` < UTC_TIMESTAMP() AND `page-flags` = 0", NULL_DATE];
-               dba::update('user', ['account_expired' => true], $condition);
+               DBA::update('user', ['account_expired' => true], $condition);
 
                // Remove any freshly expired account
-               $users = dba::select('user', ['uid'], ['account_expired' => true, 'account_removed' => false]);
-               while ($user = dba::fetch($users)) {
+               $users = DBA::select('user', ['uid'], ['account_expired' => true, 'account_removed' => false]);
+               while ($user = DBA::fetch($users)) {
                        User::remove($user['uid']);
                }
 
                // delete user records for recently removed accounts
-               $users = dba::select('user', ['uid'], ["`account_removed` AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY"]);
-               while ($user = dba::fetch($users)) {
-                       dba::delete('user', ['uid' => $user['uid']]);
+               $users = DBA::select('user', ['uid'], ["`account_removed` AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY"]);
+               while ($user = DBA::fetch($users)) {
+                       DBA::delete('user', ['uid' => $user['uid']]);
                }
        }
 
@@ -165,14 +165,14 @@ class CronJobs
                                $cachetime = PROXY_DEFAULT_TIME;
                        }
                        $condition = ['`uid` = 0 AND `resource-id` LIKE "pic:%" AND `created` < NOW() - INTERVAL ? SECOND', $cachetime];
-                       dba::delete('photo', $condition);
+                       DBA::delete('photo', $condition);
                }
 
                // Delete the cached OEmbed entries that are older than three month
-               dba::delete('oembed', ["`created` < NOW() - INTERVAL 3 MONTH"]);
+               DBA::delete('oembed', ["`created` < NOW() - INTERVAL 3 MONTH"]);
 
                // Delete the cached "parse_url" entries that are older than three month
-               dba::delete('parsed_url', ["`created` < NOW() - INTERVAL 3 MONTH"]);
+               DBA::delete('parsed_url', ["`created` < NOW() - INTERVAL 3 MONTH"]);
 
                // Maximum table size in megabyte
                $max_tablesize = intval(Config::get('system', 'optimize_max_tablesize')) * 1000000;
index 05955167f3e5f8a0adecf4eaef217865029338e7..7b4e0f3acff08ff3103e6851b59df95261829156 100644 (file)
@@ -8,7 +8,7 @@ namespace Friendica\Worker;
 
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 
 require_once 'include/dba.php';
 
@@ -81,22 +81,22 @@ class DBClean {
                        $last_id = Config::get('system', 'dbclean-last-id-1', 0);
 
                        logger("Deleting old global item entries from item table without user copy. Last ID: ".$last_id);
-                       $r = dba::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
+                       $r = DBA::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
                                                NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
                                                `received` < UTC_TIMESTAMP() - INTERVAL ? DAY AND `id` >= ?
                                        ORDER BY `id` LIMIT ".intval($limit), $days_unclaimed, $last_id);
-                       $count = dba::num_rows($r);
+                       $count = DBA::num_rows($r);
                        if ($count > 0) {
                                logger("found global item orphans: ".$count);
-                               while ($orphan = dba::fetch($r)) {
+                               while ($orphan = DBA::fetch($r)) {
                                        $last_id = $orphan["id"];
-                                       dba::delete('item', ['id' => $orphan["id"]]);
+                                       DBA::delete('item', ['id' => $orphan["id"]]);
                                }
                                Worker::add(PRIORITY_MEDIUM, 'DBClean', 1, $last_id);
                        } else {
                                logger("No global item orphans found");
                        }
-                       dba::close($r);
+                       DBA::close($r);
                        logger("Done deleting ".$count." old global item entries from item table without user copy. Last ID: ".$last_id);
 
                        Config::set('system', 'dbclean-last-id-1', $last_id);
@@ -104,21 +104,21 @@ class DBClean {
                        $last_id = Config::get('system', 'dbclean-last-id-2', 0);
 
                        logger("Deleting items without parents. Last ID: ".$last_id);
-                       $r = dba::p("SELECT `id` FROM `item`
+                       $r = DBA::p("SELECT `id` FROM `item`
                                        WHERE NOT EXISTS (SELECT `id` FROM `item` AS `i` WHERE `item`.`parent` = `i`.`id`)
                                        AND `id` >= ? ORDER BY `id` LIMIT ".intval($limit), $last_id);
-                       $count = dba::num_rows($r);
+                       $count = DBA::num_rows($r);
                        if ($count > 0) {
                                logger("found item orphans without parents: ".$count);
-                               while ($orphan = dba::fetch($r)) {
+                               while ($orphan = DBA::fetch($r)) {
                                        $last_id = $orphan["id"];
-                                       dba::delete('item', ['id' => $orphan["id"]]);
+                                       DBA::delete('item', ['id' => $orphan["id"]]);
                                }
                                Worker::add(PRIORITY_MEDIUM, 'DBClean', 2, $last_id);
                        } else {
                                logger("No item orphans without parents found");
                        }
-                       dba::close($r);
+                       DBA::close($r);
                        logger("Done deleting ".$count." items without parents. Last ID: ".$last_id);
 
                        Config::set('system', 'dbclean-last-id-2', $last_id);
@@ -130,21 +130,21 @@ class DBClean {
                        $last_id = Config::get('system', 'dbclean-last-id-3', 0);
 
                        logger("Deleting orphaned data from thread table. Last ID: ".$last_id);
-                       $r = dba::p("SELECT `iid` FROM `thread`
+                       $r = DBA::p("SELECT `iid` FROM `thread`
                                        WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `thread`.`iid`) AND `iid` >= ?
                                        ORDER BY `iid` LIMIT ".intval($limit), $last_id);
-                       $count = dba::num_rows($r);
+                       $count = DBA::num_rows($r);
                        if ($count > 0) {
                                logger("found thread orphans: ".$count);
-                               while ($orphan = dba::fetch($r)) {
+                               while ($orphan = DBA::fetch($r)) {
                                        $last_id = $orphan["iid"];
-                                       dba::delete('thread', ['iid' => $orphan["iid"]]);
+                                       DBA::delete('thread', ['iid' => $orphan["iid"]]);
                                }
                                Worker::add(PRIORITY_MEDIUM, 'DBClean', 3, $last_id);
                        } else {
                                logger("No thread orphans found");
                        }
-                       dba::close($r);
+                       DBA::close($r);
                        logger("Done deleting ".$count." orphaned data from thread table. Last ID: ".$last_id);
 
                        Config::set('system', 'dbclean-last-id-3', $last_id);
@@ -156,21 +156,21 @@ class DBClean {
                        $last_id = Config::get('system', 'dbclean-last-id-4', 0);
 
                        logger("Deleting orphaned data from notify table. Last ID: ".$last_id);
-                       $r = dba::p("SELECT `iid`, `id` FROM `notify`
+                       $r = DBA::p("SELECT `iid`, `id` FROM `notify`
                                        WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `notify`.`iid`) AND `id` >= ?
                                        ORDER BY `id` LIMIT ".intval($limit), $last_id);
-                       $count = dba::num_rows($r);
+                       $count = DBA::num_rows($r);
                        if ($count > 0) {
                                logger("found notify orphans: ".$count);
-                               while ($orphan = dba::fetch($r)) {
+                               while ($orphan = DBA::fetch($r)) {
                                        $last_id = $orphan["id"];
-                                       dba::delete('notify', ['iid' => $orphan["iid"]]);
+                                       DBA::delete('notify', ['iid' => $orphan["iid"]]);
                                }
                                Worker::add(PRIORITY_MEDIUM, 'DBClean', 4, $last_id);
                        } else {
                                logger("No notify orphans found");
                        }
-                       dba::close($r);
+                       DBA::close($r);
                        logger("Done deleting ".$count." orphaned data from notify table. Last ID: ".$last_id);
 
                        Config::set('system', 'dbclean-last-id-4', $last_id);
@@ -182,21 +182,21 @@ class DBClean {
                        $last_id = Config::get('system', 'dbclean-last-id-5', 0);
 
                        logger("Deleting orphaned data from notify-threads table. Last ID: ".$last_id);
-                       $r = dba::p("SELECT `id` FROM `notify-threads`
+                       $r = DBA::p("SELECT `id` FROM `notify-threads`
                                        WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `notify-threads`.`master-parent-item`) AND `id` >= ?
                                        ORDER BY `id` LIMIT ".intval($limit), $last_id);
-                       $count = dba::num_rows($r);
+                       $count = DBA::num_rows($r);
                        if ($count > 0) {
                                logger("found notify-threads orphans: ".$count);
-                               while ($orphan = dba::fetch($r)) {
+                               while ($orphan = DBA::fetch($r)) {
                                        $last_id = $orphan["id"];
-                                       dba::delete('notify-threads', ['id' => $orphan["id"]]);
+                                       DBA::delete('notify-threads', ['id' => $orphan["id"]]);
                                }
                                Worker::add(PRIORITY_MEDIUM, 'DBClean', 5, $last_id);
                        } else {
                                logger("No notify-threads orphans found");
                        }
-                       dba::close($r);
+                       DBA::close($r);
                        logger("Done deleting ".$count." orphaned data from notify-threads table. Last ID: ".$last_id);
 
                        Config::set('system', 'dbclean-last-id-5', $last_id);
@@ -208,21 +208,21 @@ class DBClean {
                        $last_id = Config::get('system', 'dbclean-last-id-6', 0);
 
                        logger("Deleting orphaned data from sign table. Last ID: ".$last_id);
-                       $r = dba::p("SELECT `iid`, `id` FROM `sign`
+                       $r = DBA::p("SELECT `iid`, `id` FROM `sign`
                                        WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `sign`.`iid`) AND `id` >= ?
                                        ORDER BY `id` LIMIT ".intval($limit), $last_id);
-                       $count = dba::num_rows($r);
+                       $count = DBA::num_rows($r);
                        if ($count > 0) {
                                logger("found sign orphans: ".$count);
-                               while ($orphan = dba::fetch($r)) {
+                               while ($orphan = DBA::fetch($r)) {
                                        $last_id = $orphan["id"];
-                                       dba::delete('sign', ['iid' => $orphan["iid"]]);
+                                       DBA::delete('sign', ['iid' => $orphan["iid"]]);
                                }
                                Worker::add(PRIORITY_MEDIUM, 'DBClean', 6, $last_id);
                        } else {
                                logger("No sign orphans found");
                        }
-                       dba::close($r);
+                       DBA::close($r);
                        logger("Done deleting ".$count." orphaned data from sign table. Last ID: ".$last_id);
 
                        Config::set('system', 'dbclean-last-id-6', $last_id);
@@ -234,21 +234,21 @@ class DBClean {
                        $last_id = Config::get('system', 'dbclean-last-id-7', 0);
 
                        logger("Deleting orphaned data from term table. Last ID: ".$last_id);
-                       $r = dba::p("SELECT `oid`, `tid` FROM `term`
+                       $r = DBA::p("SELECT `oid`, `tid` FROM `term`
                                        WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `term`.`oid`) AND `tid` >= ?
                                        ORDER BY `tid` LIMIT ".intval($limit), $last_id);
-                       $count = dba::num_rows($r);
+                       $count = DBA::num_rows($r);
                        if ($count > 0) {
                                logger("found term orphans: ".$count);
-                               while ($orphan = dba::fetch($r)) {
+                               while ($orphan = DBA::fetch($r)) {
                                        $last_id = $orphan["tid"];
-                                       dba::delete('term', ['oid' => $orphan["oid"]]);
+                                       DBA::delete('term', ['oid' => $orphan["oid"]]);
                                }
                                Worker::add(PRIORITY_MEDIUM, 'DBClean', 7, $last_id);
                        } else {
                                logger("No term orphans found");
                        }
-                       dba::close($r);
+                       DBA::close($r);
                        logger("Done deleting ".$count." orphaned data from term table. Last ID: ".$last_id);
 
                        Config::set('system', 'dbclean-last-id-7', $last_id);
@@ -264,7 +264,7 @@ class DBClean {
                        $last_id = Config::get('system', 'dbclean-last-id-8', 0);
 
                        logger("Deleting expired threads. Last ID: ".$last_id);
-                       $r = dba::p("SELECT `thread`.`iid` FROM `thread`
+                       $r = DBA::p("SELECT `thread`.`iid` FROM `thread`
                                        INNER JOIN `contact` ON `thread`.`contact-id` = `contact`.`id` AND NOT `notify_new_posts`
                                        WHERE `thread`.`received` < UTC_TIMESTAMP() - INTERVAL ? DAY
                                                AND NOT `thread`.`mention` AND NOT `thread`.`starred`
@@ -276,18 +276,18 @@ class DBClean {
                                                                        OR (`item`.`attach` != '') OR `item`.`wall` OR `item`.`origin`)
                                                                        AND `item`.`parent` = `thread`.`iid`)
                                        ORDER BY `thread`.`iid` LIMIT 1000", $days, $last_id);
-                       $count = dba::num_rows($r);
+                       $count = DBA::num_rows($r);
                        if ($count > 0) {
                                logger("found expired threads: ".$count);
-                               while ($thread = dba::fetch($r)) {
+                               while ($thread = DBA::fetch($r)) {
                                        $last_id = $thread["iid"];
-                                       dba::delete('thread', ['iid' => $thread["iid"]]);
+                                       DBA::delete('thread', ['iid' => $thread["iid"]]);
                                }
                                Worker::add(PRIORITY_MEDIUM, 'DBClean', 8, $last_id);
                        } else {
                                logger("No expired threads found");
                        }
-                       dba::close($r);
+                       DBA::close($r);
                        logger("Done deleting ".$count." expired threads. Last ID: ".$last_id);
 
                        Config::set('system', 'dbclean-last-id-8', $last_id);
@@ -300,22 +300,22 @@ class DBClean {
                        $till_id = Config::get('system', 'dbclean-last-id-8', 0);
 
                        logger("Deleting old global item entries from expired threads from ID ".$last_id." to ID ".$till_id);
-                       $r = dba::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
+                       $r = DBA::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
                                                NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
                                                `received` < UTC_TIMESTAMP() - INTERVAL 90 DAY AND `id` >= ? AND `id` <= ?
                                        ORDER BY `id` LIMIT ".intval($limit), $last_id, $till_id);
-                       $count = dba::num_rows($r);
+                       $count = DBA::num_rows($r);
                        if ($count > 0) {
                                logger("found global item entries from expired threads: ".$count);
-                               while ($orphan = dba::fetch($r)) {
+                               while ($orphan = DBA::fetch($r)) {
                                        $last_id = $orphan["id"];
-                                       dba::delete('item', ['id' => $orphan["id"]]);
+                                       DBA::delete('item', ['id' => $orphan["id"]]);
                                }
                                Worker::add(PRIORITY_MEDIUM, 'DBClean', 9, $last_id);
                        } else {
                                logger("No global item entries from expired threads");
                        }
-                       dba::close($r);
+                       DBA::close($r);
                        logger("Done deleting ".$count." old global item entries from expired threads. Last ID: ".$last_id);
 
                        Config::set('system', 'dbclean-last-id-9', $last_id);
@@ -324,21 +324,21 @@ class DBClean {
                        $days = intval(Config::get('system', 'dbclean_expire_conversation', 90));
 
                        logger("Deleting old conversations. Last created: ".$last_id);
-                       $r = dba::p("SELECT `received`, `item-uri` FROM `conversation`
+                       $r = DBA::p("SELECT `received`, `item-uri` FROM `conversation`
                                        WHERE `received` < UTC_TIMESTAMP() - INTERVAL ? DAY
                                        ORDER BY `received` LIMIT ".intval($limit), $days);
-                       $count = dba::num_rows($r);
+                       $count = DBA::num_rows($r);
                        if ($count > 0) {
                                logger("found old conversations: ".$count);
-                               while ($orphan = dba::fetch($r)) {
+                               while ($orphan = DBA::fetch($r)) {
                                        $last_id = $orphan["received"];
-                                       dba::delete('conversation', ['item-uri' => $orphan["item-uri"]]);
+                                       DBA::delete('conversation', ['item-uri' => $orphan["item-uri"]]);
                                }
                                Worker::add(PRIORITY_MEDIUM, 'DBClean', 10, $last_id);
                        } else {
                                logger("No old conversations found");
                        }
-                       dba::close($r);
+                       DBA::close($r);
                        logger("Done deleting ".$count." conversations. Last created: ".$last_id);
 
                        Config::set('system', 'dbclean-last-id-10', $last_id);
index 13ecc3ad449d7601806cf8303add82fe52bb86f1..28658e5cdbb382002d3df6b4de6804882ede2321 100644 (file)
@@ -8,7 +8,7 @@ use Friendica\BaseObject;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
@@ -39,14 +39,14 @@ class Delivery extends BaseObject
                $public_message = false;
 
                if ($cmd == self::MAIL) {
-                       $target_item = dba::selectFirst('mail', [], ['id' => $item_id]);
+                       $target_item = DBA::selectFirst('mail', [], ['id' => $item_id]);
                        if (!DBM::is_result($target_item)) {
                                return;
                        }
                        $uid = $target_item['uid'];
                        $items = [];
                } elseif ($cmd == self::SUGGESTION) {
-                       $target_item = dba::selectFirst('fsuggest', [], ['id' => $item_id]);
+                       $target_item = DBA::selectFirst('fsuggest', [], ['id' => $item_id]);
                        if (!DBM::is_result($target_item)) {
                                return;
                        }
@@ -74,7 +74,7 @@ class Delivery extends BaseObject
                                }
                                $items[] = $item;
                        }
-                       dba::close($itemdata);
+                       DBA::close($itemdata);
 
                        $uid = $target_item['contact-uid'];
 
@@ -138,7 +138,7 @@ class Delivery extends BaseObject
                }
 
                // We don't deliver our items to blocked or pending contacts, and not to ourselves either
-               $contact = dba::selectFirst('contact', [],
+               $contact = DBA::selectFirst('contact', [],
                        ['id' => $contact_id, 'blocked' => false, 'pending' => false, 'self' => false]
                );
                if (!DBM::is_result($contact)) {
@@ -210,7 +210,7 @@ class Delivery extends BaseObject
                } elseif ($cmd == self::SUGGESTION) {
                        $item = $target_item;
                        $atom = DFRN::fsuggest($item, $owner);
-                       dba::delete('fsuggest', ['id' => $item['id']]);
+                       DBA::delete('fsuggest', ['id' => $item['id']]);
                } elseif ($cmd == self::RELOCATION) {
                        $atom = DFRN::relocate($owner, $owner['uid']);
                } elseif ($followup) {
@@ -237,7 +237,7 @@ class Delivery extends BaseObject
 
                if (link_compare($basepath, System::baseUrl())) {
                        $condition = ['nurl' => normalise_link($contact['url']), 'self' => true];
-                       $target_self = dba::selectFirst('contact', ['uid'], $condition);
+                       $target_self = DBA::selectFirst('contact', ['uid'], $condition);
                        if (!DBM::is_result($target_self)) {
                                return;
                        }
@@ -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::fetch_first("SELECT *, `name` as `senderName`
                                                        FROM `contact`
                                                        WHERE NOT `blocked` AND `id` = ? LIMIT 1",
                                                        $cid);
@@ -264,7 +264,7 @@ class Delivery extends BaseObject
                                return;
                        }
 
-                       $user = dba::selectFirst('user', [], ['uid' => $target_uid]);
+                       $user = DBA::selectFirst('user', [], ['uid' => $target_uid]);
 
                        $target_importer = array_merge($target_importer, $user);
 
@@ -404,7 +404,7 @@ class Delivery extends BaseObject
                        return;
                }
 
-               $local_user = dba::selectFirst('user', [], ['uid' => $owner['uid']]);
+               $local_user = DBA::selectFirst('user', [], ['uid' => $owner['uid']]);
                if (!DBM::is_result($local_user)) {
                        return;
                }
@@ -412,7 +412,7 @@ class Delivery extends BaseObject
                logger('Deliver ' . $target_item["guid"] . ' via mail to ' . $contact['addr']);
 
                $reply_to = '';
-               $mailacct = dba::selectFirst('mailacct', ['reply_to'], ['uid' => $owner['uid']]);
+               $mailacct = DBA::selectFirst('mailacct', ['reply_to'], ['uid' => $owner['uid']]);
                if (DBM::is_result($mailacct) && !empty($mailacct['reply_to'])) {
                        $reply_to = $mailacct['reply_to'];
                }
index 2e36ab514d54d7df499051643e528ea8bc8f67a3..5baab5f4b173d6659c8b287c9838727516a3efdc 100644 (file)
@@ -7,7 +7,7 @@ namespace Friendica\Worker;
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\GContact;
 use Friendica\Network\Probe;
@@ -160,7 +160,7 @@ class DiscoverPoCo
 
                        $urlparts = parse_url($user["url"]);
                        if (!isset($urlparts["scheme"])) {
-                               dba::update('gcontact', ['network' => NETWORK_PHANTOM],
+                               DBA::update('gcontact', ['network' => NETWORK_PHANTOM],
                                        ['nurl' => normalise_link($user["url"])]);
                                continue;
                         }
@@ -173,7 +173,7 @@ class DiscoverPoCo
                                                "identi.ca" => NETWORK_PUMPIO,
                                                "alpha.app.net" => NETWORK_APPNET];
 
-                               dba::update('gcontact', ['network' => $networks[$urlparts["host"]]],
+                               DBA::update('gcontact', ['network' => $networks[$urlparts["host"]]],
                                        ['nurl' => normalise_link($user["url"])]);
                                continue;
                        }
@@ -196,7 +196,7 @@ class DiscoverPoCo
                                        return;
                                }
                        } else {
-                               dba::update('gcontact', ['last_failure' => DateTimeFormat::utcNow()],
+                               DBA::update('gcontact', ['last_failure' => DateTimeFormat::utcNow()],
                                        ['nurl' => normalise_link($user["url"])]);
                        }
 
index 1d4efb29cd14cf7fdcf7b08742cfac29eb02dfa1..7dd5a9b5a79581922b1265494f84b9a6a32c0db2 100644 (file)
@@ -10,7 +10,7 @@ use Friendica\BaseObject;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Item;
 
@@ -30,44 +30,44 @@ class Expire
                        logger('Delete expired items', LOGGER_DEBUG);
                        // physically remove anything that has been deleted for more than two months
                        $condition = ["`deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY"];
-                       $rows = dba::select('item', ['id', 'iaid', 'icid', 'psid'],  $condition);
-                       while ($row = dba::fetch($rows)) {
-                               dba::delete('item', ['id' => $row['id']]);
-                               if (!empty($row['iaid']) && !dba::exists('item', ['iaid' => $row['iaid']])) {
-                                       dba::delete('item-activity', ['id' => $row['iaid']]);
+                       $rows = DBA::select('item', ['id', 'iaid', 'icid', 'psid'],  $condition);
+                       while ($row = DBA::fetch($rows)) {
+                               DBA::delete('item', ['id' => $row['id']]);
+                               if (!empty($row['iaid']) && !DBA::exists('item', ['iaid' => $row['iaid']])) {
+                                       DBA::delete('item-activity', ['id' => $row['iaid']]);
                                }
-                               if (!empty($row['icid']) && !dba::exists('item', ['icid' => $row['icid']])) {
-                                       dba::delete('item-content', ['id' => $row['icid']]);
+                               if (!empty($row['icid']) && !DBA::exists('item', ['icid' => $row['icid']])) {
+                                       DBA::delete('item-content', ['id' => $row['icid']]);
                                }
                                // When the permission set will be used in photo and events as well.
                                // this query here needs to be extended.
-                               if (!empty($row['psid']) && !dba::exists('item', ['psid' => $row['psid']])) {
-                                       dba::delete('permissionset', ['id' => $row['psid']]);
+                               if (!empty($row['psid']) && !DBA::exists('item', ['psid' => $row['psid']])) {
+                                       DBA::delete('permissionset', ['id' => $row['psid']]);
                                }
                        }
-                       dba::close($rows);
+                       DBA::close($rows);
 
                        // Normally we shouldn't have orphaned data at all.
                        // If we do have some, then we have to check why.
                        logger('Deleting orphaned item activities - start', LOGGER_DEBUG);
                        $condition = ["NOT EXISTS (SELECT `iaid` FROM `item` WHERE `item`.`iaid` = `item-activity`.`id`)"];
-                       dba::delete('item-activity', $condition);
-                       logger('Orphaned item activities deleted: ' . dba::affected_rows(), LOGGER_DEBUG);
+                       DBA::delete('item-activity', $condition);
+                       logger('Orphaned item activities deleted: ' . DBA::affected_rows(), LOGGER_DEBUG);
 
                        logger('Deleting orphaned item content - start', LOGGER_DEBUG);
                        $condition = ["NOT EXISTS (SELECT `icid` FROM `item` WHERE `item`.`icid` = `item-content`.`id`)"];
-                       dba::delete('item-content', $condition);
-                       logger('Orphaned item content deleted: ' . dba::affected_rows(), LOGGER_DEBUG);
+                       DBA::delete('item-content', $condition);
+                       logger('Orphaned item content deleted: ' . DBA::affected_rows(), LOGGER_DEBUG);
 
                        // make this optional as it could have a performance impact on large sites
                        if (intval(Config::get('system', 'optimize_items'))) {
-                               dba::e("OPTIMIZE TABLE `item`");
+                               DBA::e("OPTIMIZE TABLE `item`");
                        }
 
                        logger('Delete expired items - done', LOGGER_DEBUG);
                        return;
                } elseif (intval($param) > 0) {
-                       $user = dba::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
+                       $user = DBA::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
                        if (DBM::is_result($user)) {
                                logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG);
                                Item::expire($user['uid'], $user['expire']);
@@ -89,13 +89,13 @@ class Expire
                Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
                                'Expire', 'delete');
 
-               $r = dba::p("SELECT `uid`, `username` FROM `user` WHERE `expire` != 0");
-               while ($row = dba::fetch($r)) {
+               $r = DBA::p("SELECT `uid`, `username` FROM `user` WHERE `expire` != 0");
+               while ($row = DBA::fetch($r)) {
                        logger('Calling expiry for user '.$row['uid'].' ('.$row['username'].')', LOGGER_DEBUG);
                        Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
                                        'Expire', (int)$row['uid']);
                }
-               dba::close($r);
+               DBA::close($r);
 
                logger('expire: calling hooks');
 
index 986ade27bfa0487fca27d5d6b5e536d887cb31ed..efdccb6b1f4c2fded64d47a588bb0c7497fa8364 100644 (file)
@@ -8,7 +8,7 @@ use Friendica\BaseObject;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
@@ -65,7 +65,7 @@ class Notifier
 
                if ($cmd == Delivery::MAIL) {
                        $normal_mode = false;
-                       $message = dba::selectFirst('mail', ['uid', 'contact-id'], ['id' => $item_id]);
+                       $message = DBA::selectFirst('mail', ['uid', 'contact-id'], ['id' => $item_id]);
                        if (!DBM::is_result($message)) {
                                return;
                        }
@@ -73,7 +73,7 @@ class Notifier
                        $recipients[] = $message['contact-id'];
                } elseif ($cmd == Delivery::SUGGESTION) {
                        $normal_mode = false;
-                       $suggest = dba::selectFirst('fsuggest', ['uid', 'cid'], ['id' => $item_id]);
+                       $suggest = DBA::selectFirst('fsuggest', ['uid', 'cid'], ['id' => $item_id]);
                        if (!DBM::is_result($suggest)) {
                                return;
                        }
@@ -223,7 +223,7 @@ class Notifier
 
                                $fields = ['forum', 'prv'];
                                $condition = ['id' => $target_item['contact-id']];
-                               $contact = dba::selectFirst('contact', $fields, $condition);
+                               $contact = DBA::selectFirst('contact', $fields, $condition);
                                if (!DBM::is_result($contact)) {
                                        // Should never happen
                                        return false;
@@ -343,14 +343,14 @@ class Notifier
                                logger('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent['author-id']." - Owner: ".$thr_parent['owner-id'], LOGGER_DEBUG);
 
                                // Send a salmon to the parent author
-                               $probed_contact = dba::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
+                               $probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
                                if (DBM::is_result($probed_contact) && !empty($probed_contact["notify"])) {
                                        logger('Notify parent author '.$probed_contact["url"].': '.$probed_contact["notify"]);
                                        $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
                                }
 
                                // Send a salmon to the parent owner
-                               $probed_contact = dba::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]);
+                               $probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]);
                                if (DBM::is_result($probed_contact) && !empty($probed_contact["notify"])) {
                                        logger('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]);
                                        $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
@@ -407,8 +407,8 @@ class Notifier
                        if (!empty($networks)) {
                                $condition['network'] = $networks;
                        }
-                       $contacts = dba::select('contact', ['id', 'url', 'network'], $condition);
-                       $r = dba::inArray($contacts);
+                       $contacts = DBA::select('contact', ['id', 'url', 'network'], $condition);
+                       $r = DBA::inArray($contacts);
                }
 
                // delivery loop
@@ -458,7 +458,7 @@ class Notifier
 
                        $condition = ['network' => NETWORK_DFRN, 'uid' => $owner['uid'], 'blocked' => false,
                                'pending' => false, 'archive' => false, 'rel' => [CONTACT_IS_FOLLOWER, CONTACT_IS_FRIEND]];
-                       $r2 = dba::inArray(dba::select('contact', ['id', 'name', 'network'], $condition));
+                       $r2 = DBA::inArray(DBA::select('contact', ['id', 'name', 'network'], $condition));
 
                        $r = array_merge($r2, $r1);
 
index 8d2e6f2b0b1b5b43ca2c880bbb7b78ada342aa0e..e586ca005a90dd23fa37a376af48d6cb75f4c7dd 100644 (file)
@@ -8,7 +8,7 @@ use Friendica\BaseObject;
 use Friendica\Content\Text\BBCode;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
@@ -47,7 +47,7 @@ class OnePoll
 
                $d = DateTimeFormat::utcNow();
 
-               $contact = dba::selectFirst('contact', [], ['id' => $contact_id]);
+               $contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
                if (!DBM::is_result($contact)) {
                        logger('Contact not found or cannot be used.');
                        return;
@@ -118,7 +118,7 @@ class OnePoll
                                logger("Skipping probably dead contact ".$contact['url']);
 
                                // set the last-update so we don't keep polling
-                               dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
+                               DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                                return;
                        }
 
@@ -127,7 +127,7 @@ class OnePoll
                                logger('Contact is marked dead');
 
                                // set the last-update so we don't keep polling
-                               dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
+                               DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                                return;
                        } else {
                                Contact::unmarkForArchival($contact);
@@ -138,7 +138,7 @@ class OnePoll
                        logger('Ignore public contacts');
 
                        // set the last-update so we don't keep polling
-                       dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
+                       DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                        return;
                }
 
@@ -150,7 +150,7 @@ class OnePoll
                        logger('No self contact for user '.$importer_uid);
 
                        // set the last-update so we don't keep polling
-                       dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
+                       DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                        return;
                }
 
@@ -175,7 +175,7 @@ class OnePoll
 
                        if (!intval($contact['writable'])) {
                                $fields = ['writable' => true];
-                               dba::update('contact', $fields, ['id' => $contact['id']]);
+                               DBA::update('contact', $fields, ['id' => $contact['id']]);
                        }
 
                        $url = $contact['poll'] . '?dfrn_id=' . $idtosend
@@ -187,7 +187,7 @@ class OnePoll
 
                        if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
                                // set the last-update so we don't keep polling
-                               dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
+                               DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                                Contact::markForArchival($contact);
                                return;
                        }
@@ -243,13 +243,13 @@ class OnePoll
 
                        if ((intval($res->status) != 0) || !strlen($res->challenge) || !strlen($res->dfrn_id)) {
                                // set the last-update so we don't keep polling
-                               dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
+                               DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                                return;
                        }
 
                        if (((float)$res->dfrn_version > 2.21) && ($contact['poco'] == '')) {
                                $fields = ['poco' => str_replace('/profile/', '/poco/', $contact['url'])];
-                               dba::update('contact', $fields, ['id' => $contact['id']]);
+                               DBA::update('contact', $fields, ['id' => $contact['id']]);
                        }
 
                        $postvars = [];
@@ -278,7 +278,7 @@ class OnePoll
                                logger('ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id);
 
                                // set the last-update so we don't keep polling
-                               dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
+                               DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                                Contact::markForArchival($contact);
                                return;
                        }
@@ -306,14 +306,14 @@ class OnePoll
 
                        if ($stat_writeable != $contact['writable']) {
                                $fields = ['writable' => $stat_writeable];
-                               dba::update('contact', $fields, ['id' => $contact['id']]);
+                               DBA::update('contact', $fields, ['id' => $contact['id']]);
                        }
 
                        // Are we allowed to import from this person?
 
                        if ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked']) {
                                // set the last-update so we don't keep polling
-                               dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
+                               DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                                return;
                        }
 
@@ -323,7 +323,7 @@ class OnePoll
 
                        if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
                                // set the last-update so we don't keep polling
-                               dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
+                               DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                                Contact::markForArchival($contact);
                                return;
                        }
@@ -337,7 +337,7 @@ class OnePoll
                        $mail_disabled = ((function_exists('imap_open') && (! Config::get('system', 'imap_disabled'))) ? 0 : 1);
                        if ($mail_disabled) {
                                // set the last-update so we don't keep polling
-                               dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
+                               DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                                Contact::markForArchival($contact);
                                return;
                        }
@@ -345,10 +345,10 @@ class OnePoll
                        logger("Mail: Enabled", LOGGER_DEBUG);
 
                        $mbox = null;
-                       $user = dba::selectFirst('user', ['prvkey'], ['uid' => $importer_uid]);
+                       $user = DBA::selectFirst('user', ['prvkey'], ['uid' => $importer_uid]);
 
                        $condition = ["`server` != '' AND `uid` = ?", $importer_uid];
-                       $mailconf = dba::selectFirst('mailacct', [], $condition);
+                       $mailconf = DBA::selectFirst('mailacct', [], $condition);
                        if (DBM::is_result($user) && DBM::is_result($mailconf)) {
                                $mailbox = Email::constructMailboxName($mailconf);
                                $password = '';
@@ -358,7 +358,7 @@ class OnePoll
                                logger("Mail: Connect to " . $mailconf['user']);
                                if ($mbox) {
                                        $fields = ['last_check' => DateTimeFormat::utcNow()];
-                                       dba::update('mailacct', $fields, ['id' => $mailconf['id']]);
+                                       DBA::update('mailacct', $fields, ['id' => $mailconf['id']]);
                                        logger("Mail: Connected to " . $mailconf['user']);
                                } else {
                                        logger("Mail: Connection error ".$mailconf['user']." ".print_r(imap_errors(), true));
@@ -620,17 +620,17 @@ class OnePoll
                        $updated = DateTimeFormat::utcNow();
 
                        self::updateContact($contact, ['last-update' => $updated, 'success_update' => $updated]);
-                       dba::update('gcontact', ['last_contact' => $updated], ['nurl' => $contact['nurl']]);
+                       DBA::update('gcontact', ['last_contact' => $updated], ['nurl' => $contact['nurl']]);
                        Contact::unmarkForArchival($contact);
                } elseif (in_array($contact["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_FEED])) {
                        $updated = DateTimeFormat::utcNow();
 
                        self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]);
-                       dba::update('gcontact', ['last_failure' => $updated], ['nurl' => $contact['nurl']]);
+                       DBA::update('gcontact', ['last_failure' => $updated], ['nurl' => $contact['nurl']]);
                        Contact::markForArchival($contact);
                } else {
                        $updated = DateTimeFormat::utcNow();
-                       dba::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
+                       DBA::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
                }
 
                return;
@@ -653,7 +653,7 @@ class OnePoll
         */
        private static function updateContact($contact, $fields)
        {
-               dba::update('contact', $fields, ['id' => $contact['id']]);
-               dba::update('contact', $fields, ['uid' => 0, 'nurl' => $contact['nurl']]);
+               DBA::update('contact', $fields, ['id' => $contact['id']]);
+               DBA::update('contact', $fields, ['uid' => 0, 'nurl' => $contact['nurl']]);
        }
 }
index 50f01e294e2311374bb2fede2270639f014456da..4709708ae1c6f710b3800071bb1646a4d0152915 100644 (file)
@@ -7,7 +7,7 @@ namespace Friendica\Worker;
 
 use Friendica\BaseObject;
 use Friendica\Core\System;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\PushSubscriber;
 use Friendica\Protocol\OStatus;
@@ -30,7 +30,7 @@ class PubSubPublish
        {
                $a = BaseObject::getApp();
 
-               $subscriber = dba::selectFirst('push_subscriber', [], ['id' => $id]);
+               $subscriber = DBA::selectFirst('push_subscriber', [], ['id' => $id]);
                if (!DBM::is_result($subscriber)) {
                        return;
                }
index 53d93ba910db71ce6fefbb7fc51851d81c914bce..25c963fabcb4fa7a55d4108add1e2a289cf0dd3a 100644 (file)
@@ -8,7 +8,7 @@ use Friendica\Core\Addon;
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\PushSubscriber;
 use Friendica\Model\Queue as QueueModel;
@@ -36,7 +36,7 @@ class Queue
                        // Handling the pubsubhubbub requests
                        PushSubscriber::requeue();
 
-                       $r = dba::inArray(dba::p("SELECT `id` FROM `queue` WHERE `next` < UTC_TIMESTAMP() ORDER BY `batch`, `cid`"));
+                       $r = DBA::inArray(DBA::p("SELECT `id` FROM `queue` WHERE `next` < UTC_TIMESTAMP() ORDER BY `batch`, `cid`"));
 
                        Addon::callHooks('queue_predeliver', $r);
 
@@ -52,12 +52,12 @@ class Queue
 
 
                // delivering
-               $q_item = dba::selectFirst('queue', [], ['id' => $queue_id]);
+               $q_item = DBA::selectFirst('queue', [], ['id' => $queue_id]);
                if (!DBM::is_result($q_item)) {
                        return;
                }
 
-               $contact = dba::selectFirst('contact', [], ['id' => $q_item['cid']]);
+               $contact = DBA::selectFirst('contact', [], ['id' => $q_item['cid']]);
                if (!DBM::is_result($contact)) {
                        QueueModel::removeItem($q_item['id']);
                        return;
@@ -97,7 +97,7 @@ class Queue
                        }
                }
 
-               $user = dba::selectFirst('user', [], ['uid' => $contact['uid']]);
+               $user = DBA::selectFirst('user', [], ['uid' => $contact['uid']]);
                if (!DBM::is_result($user)) {
                        QueueModel::removeItem($q_item['id']);
                        return;
index aa2325d5492e4bd67073b4fdcc1b2bfc80a47847..40ac937f100ed4656a3ff251eecceea7aeb4bfbe 100644 (file)
@@ -5,7 +5,7 @@
  */
 namespace Friendica\Worker;
 
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 
 require_once 'include/dba.php';
 
@@ -13,12 +13,12 @@ class RemoveContact {
        public static function execute($id) {
 
                // Only delete if the contact doesn't exist (anymore)
-               $r = dba::exists('contact', ['id' => $id]);
+               $r = DBA::exists('contact', ['id' => $id]);
                if ($r) {
                        return;
                }
 
                // Now we delete all the depending table entries
-               dba::delete('contact', ['id' => $id]);
+               DBA::delete('contact', ['id' => $id]);
        }
 }
index 6db06380c8515c876ab7f6884db516c94f38f383..bfef31e3fbc50d8e3bba75135c3e2e500e7775e5 100644 (file)
@@ -2,38 +2,38 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 
 class TagUpdate
 {
        public static function execute()
        {
-               $messages = dba::p("SELECT `oid`,`item`.`guid`, `item`.`created`, `item`.`received` FROM `term` INNER JOIN `item` ON `item`.`id`=`term`.`oid` WHERE `term`.`otype` = 1 AND `term`.`guid` = ''");
+               $messages = DBA::p("SELECT `oid`,`item`.`guid`, `item`.`created`, `item`.`received` FROM `term` INNER JOIN `item` ON `item`.`id`=`term`.`oid` WHERE `term`.`otype` = 1 AND `term`.`guid` = ''");
 
-               logger('fetched messages: ' . dba::num_rows($messages));
-               while ($message = dba::fetch($messages)) {
+               logger('fetched messages: ' . DBA::num_rows($messages));
+               while ($message = DBA::fetch($messages)) {
                        if ($message['uid'] == 0) {
                                $global = true;
 
-                               dba::update('term', ['global' => true], ['otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
+                               DBA::update('term', ['global' => true], ['otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
                        } else {
-                               $global = (dba::count('term', ['uid' => 0, 'otype' => TERM_OBJ_POST, 'guid' => $message['guid']]) > 0);
+                               $global = (DBA::count('term', ['uid' => 0, 'otype' => TERM_OBJ_POST, 'guid' => $message['guid']]) > 0);
                        }
 
                        $fields = ['guid' => $message['guid'], 'created' => $message['created'],
                                'received' => $message['received'], 'global' => $global];
-                       dba::update('term', $fields, ['otype' => TERM_OBJ_POST, 'oid' => $message['oid']]);
+                       DBA::update('term', $fields, ['otype' => TERM_OBJ_POST, 'oid' => $message['oid']]);
                }
 
-               dba::close($messages);
+               DBA::close($messages);
 
-               $messages = dba::select('item', ['guid'], ['uid' => 0]);
+               $messages = DBA::select('item', ['guid'], ['uid' => 0]);
 
-               logger('fetched messages: ' . dba::num_rows($messages));
-               while ($message = dba::fetch(messages)) {
-                       dba::update('item', ['global' => true], ['guid' => $message['guid']]);
+               logger('fetched messages: ' . DBA::num_rows($messages));
+               while ($message = DBA::fetch(messages)) {
+                       DBA::update('item', ['global' => true], ['guid' => $message['guid']]);
                }
 
-               dba::close($messages);
+               DBA::close($messages);
        }
 }
index 9f0990a72d5e0e420a3f97c93d67ba4df9977a71..eb9399ab808a76f5c0b6366f3c2c0b71057bb2b4 100644 (file)
@@ -5,7 +5,7 @@
 
 namespace Friendica\Test;
 
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use PHPUnit\DbUnit\DataSet\YamlDataSet;
 use PHPUnit\DbUnit\TestCaseTrait;
 use PHPUnit\Framework\TestCase;
@@ -32,11 +32,11 @@ abstract class DatabaseTest extends TestCase
         */
        protected function getConnection()
        {
-               if (!dba::connected()) {
+               if (!DBA::connected()) {
                        $this->markTestSkipped('Could not connect to the database.');
                }
 
-               return $this->createDefaultDBConnection(dba::get_db(), getenv('MYSQL_DATABASE'));
+               return $this->createDefaultDBConnection(DBA::get_db(), getenv('MYSQL_DATABASE'));
        }
 
        /**
index 1fd728888e962d17c9cd54aa261985a8f8bdf9b3..270d2007913d53ff4fc9943d240f223496ff9dd4 100644 (file)
@@ -3,7 +3,7 @@
 namespace Friendica\Test\src\Core\Lock;
 
 use Friendica\Core\Lock\DatabaseLockDriver;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 
 class DatabaseLockDriverTest extends LockTest
 {
@@ -14,7 +14,7 @@ class DatabaseLockDriverTest extends LockTest
 
        public function tearDown()
        {
-               dba::delete('locks', [ 'id > 0']);
+               DBA::delete('locks', [ 'id > 0']);
                parent::tearDown();
        }
 }
index 47055852ca10deb6b04f2bd32e6fc55de3c0711e..4fcb9d94e4a3ea26cb8742a875ff3725a069eb52 100644 (file)
@@ -5,7 +5,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\Worker;
-use Friendica\Database\dba;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
@@ -152,16 +152,16 @@ function update_1203() {
 
 function update_1244() {
        // Sets legacy_password for all legacy hashes
-       dba::update('user', ['legacy_password' => true], ['SUBSTR(password, 1, 4) != "$2y$"']);
+       DBA::update('user', ['legacy_password' => true], ['SUBSTR(password, 1, 4) != "$2y$"']);
 
        // All legacy hashes are re-hashed using the new secure hashing function
-       $stmt = dba::select('user', ['uid', 'password'], ['legacy_password' => true]);
-       while($user = dba::fetch($stmt)) {
-               dba::update('user', ['password' => User::hashPassword($user['password'])], ['uid' => $user['uid']]);
+       $stmt = DBA::select('user', ['uid', 'password'], ['legacy_password' => true]);
+       while($user = DBA::fetch($stmt)) {
+               DBA::update('user', ['password' => User::hashPassword($user['password'])], ['uid' => $user['uid']]);
        }
 
        // Logged in users are forcibly logged out
-       dba::delete('session', ['1 = 1']);
+       DBA::delete('session', ['1 = 1']);
 
        return UPDATE_SUCCESS;
 }
@@ -180,7 +180,7 @@ function update_1245() {
 
 function update_1247() {
        // Removing hooks with the old name
-       dba::e("DELETE FROM `hook`
+       DBA::e("DELETE FROM `hook`
 WHERE `hook` LIKE 'plugin_%'");
 
        // Make sure we install the new renamed ones
@@ -191,9 +191,9 @@ function update_1260() {
        Config::set('system', 'maintenance', 1);
        Config::set('system', 'maintenance_reason', L10n::t('%s: Updating author-id and owner-id in item and thread table. ', DBM::date().' '.date('e')));
 
-       $items = dba::p("SELECT `id`, `owner-link`, `owner-name`, `owner-avatar`, `network` FROM `item`
+       $items = DBA::p("SELECT `id`, `owner-link`, `owner-name`, `owner-avatar`, `network` FROM `item`
                WHERE `owner-id` = 0 AND `owner-link` != ''");
-       while ($item = dba::fetch($items)) {
+       while ($item = DBA::fetch($items)) {
                $contact = ['url' => $item['owner-link'], 'name' => $item['owner-name'],
                        'photo' => $item['owner-avatar'], 'network' => $item['network']];
                $cid = Contact::getIdForURL($item['owner-link'], 0, false, $contact);
@@ -202,14 +202,14 @@ function update_1260() {
                }
                Item::update(['owner-id' => $cid], ['id' => $item['id']]);
        }
-       dba::close($items);
+       DBA::close($items);
 
-       dba::e("UPDATE `thread` INNER JOIN `item` ON `thread`.`iid` = `item`.`id`
+       DBA::e("UPDATE `thread` INNER JOIN `item` ON `thread`.`iid` = `item`.`id`
                SET `thread`.`owner-id` = `item`.`owner-id` WHERE `thread`.`owner-id` = 0");
 
-       $items = dba::p("SELECT `id`, `author-link`, `author-name`, `author-avatar`, `network` FROM `item`
+       $items = DBA::p("SELECT `id`, `author-link`, `author-name`, `author-avatar`, `network` FROM `item`
                WHERE `author-id` = 0 AND `author-link` != ''");
-       while ($item = dba::fetch($items)) {
+       while ($item = DBA::fetch($items)) {
                $contact = ['url' => $item['author-link'], 'name' => $item['author-name'],
                        'photo' => $item['author-avatar'], 'network' => $item['network']];
                $cid = Contact::getIdForURL($item['author-link'], 0, false, $contact);
@@ -218,9 +218,9 @@ function update_1260() {
                }
                Item::update(['author-id' => $cid], ['id' => $item['id']]);
        }
-       dba::close($items);
+       DBA::close($items);
 
-       dba::e("UPDATE `thread` INNER JOIN `item` ON `thread`.`iid` = `item`.`id`
+       DBA::e("UPDATE `thread` INNER JOIN `item` ON `thread`.`iid` = `item`.`id`
                SET `thread`.`author-id` = `item`.`author-id` WHERE `thread`.`author-id` = 0");
 
        Config::set('system', 'maintenance', 0);
@@ -229,7 +229,7 @@ function update_1260() {
 
 function update_1261() {
        // This fixes the results of an issue in the develop branch of 2018-05.
-       dba::update('contact', ['blocked' => false, 'pending' => false], ['uid' => 0, 'blocked' => true, 'pending' => true]);
+       DBA::update('contact', ['blocked' => false, 'pending' => false], ['uid' => 0, 'blocked' => true, 'pending' => true]);
        return UPDATE_SUCCESS;
 }