[multiple] Rename Friendica\Database\dba to Friendica\Database\DBA

pull/652/head
Hypolite Petovan 2018-07-20 08:20:48 -04:00
parent 9463696159
commit 57505bdf82
13 changed files with 72 additions and 72 deletions

View File

@ -39,7 +39,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Cache; use Friendica\Core\Cache;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\dba; use Friendica\Database\DBA;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Database\DBStructure; use Friendica\Database\DBStructure;
use Friendica\Model\Item; use Friendica\Model\Item;
@ -119,7 +119,7 @@ function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data)
$rules = Cache::get('rules_' . local_user()); $rules = Cache::get('rules_' . local_user());
if (!isset($rules)) { if (!isset($rules)) {
$rules = dba::inArray(dba::select( $rules = DBA::inArray(DBA::select(
'advancedcontentfilter_rules', 'advancedcontentfilter_rules',
['name', 'expression', 'serialized'], ['name', 'expression', 'serialized'],
['uid' => local_user(), 'active' => true] ['uid' => local_user(), 'active' => true]
@ -300,7 +300,7 @@ function advancedcontentfilter_get_rules()
throw new HTTPException\UnauthorizedException(L10n::t('You must be logged in to use this method')); throw new HTTPException\UnauthorizedException(L10n::t('You must be logged in to use this method'));
} }
$rules = dba::inArray(dba::select('advancedcontentfilter_rules', [], ['uid' => local_user()])); $rules = DBA::inArray(DBA::select('advancedcontentfilter_rules', [], ['uid' => local_user()]));
return json_encode($rules); return json_encode($rules);
} }
@ -311,7 +311,7 @@ function advancedcontentfilter_get_rules_id(ServerRequestInterface $request, Res
throw new HTTPException\UnauthorizedException(L10n::t('You must be logged in to use this method')); throw new HTTPException\UnauthorizedException(L10n::t('You must be logged in to use this method'));
} }
$rule = dba::selectFirst('advancedcontentfilter_rules', [], ['id' => $args['id'], 'uid' => local_user()]); $rule = DBA::selectFirst('advancedcontentfilter_rules', [], ['id' => $args['id'], 'uid' => local_user()]);
return json_encode($rule); return json_encode($rule);
} }
@ -341,11 +341,11 @@ function advancedcontentfilter_post_rules(ServerRequestInterface $request)
$fields['uid'] = local_user(); $fields['uid'] = local_user();
$fields['created'] = DateTimeFormat::utcNow(); $fields['created'] = DateTimeFormat::utcNow();
if (!dba::insert('advancedcontentfilter_rules', $fields)) { if (!DBA::insert('advancedcontentfilter_rules', $fields)) {
throw new HTTPException\ServiceUnavaiableException(dba::errorMessage()); throw new HTTPException\ServiceUnavaiableException(DBA::errorMessage());
} }
$rule = dba::selectFirst('advancedcontentfilter_rules', [], ['id' => dba::lastInsertId()]); $rule = DBA::selectFirst('advancedcontentfilter_rules', [], ['id' => DBA::lastInsertId()]);
return json_encode(['message' => L10n::t('Rule successfully added'), 'rule' => $rule]); return json_encode(['message' => L10n::t('Rule successfully added'), 'rule' => $rule]);
} }
@ -360,7 +360,7 @@ function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, Res
throw new HTTPException\BadRequestException(L10n::t('Invalid form security token, please refresh the page.')); throw new HTTPException\BadRequestException(L10n::t('Invalid form security token, please refresh the page.'));
} }
if (!dba::exists('advancedcontentfilter_rules', ['id' => $args['id'], 'uid' => local_user()])) { if (!DBA::exists('advancedcontentfilter_rules', ['id' => $args['id'], 'uid' => local_user()])) {
throw new HTTPException\NotFoundException(L10n::t('Rule doesn\'t exist or doesn\'t belong to you.')); throw new HTTPException\NotFoundException(L10n::t('Rule doesn\'t exist or doesn\'t belong to you.'));
} }
@ -372,8 +372,8 @@ function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, Res
throw new HTTPException\BadRequestException($e->getMessage(), 0, $e); throw new HTTPException\BadRequestException($e->getMessage(), 0, $e);
} }
if (!dba::update('advancedcontentfilter_rules', $fields, ['id' => $args['id']])) { if (!DBA::update('advancedcontentfilter_rules', $fields, ['id' => $args['id']])) {
throw new HTTPException\ServiceUnavaiableException(dba::errorMessage()); throw new HTTPException\ServiceUnavaiableException(DBA::errorMessage());
} }
return json_encode(['message' => L10n::t('Rule successfully updated')]); return json_encode(['message' => L10n::t('Rule successfully updated')]);
@ -389,12 +389,12 @@ function advancedcontentfilter_delete_rules_id(ServerRequestInterface $request,
throw new HTTPException\BadRequestException(L10n::t('Invalid form security token, please refresh the page.')); throw new HTTPException\BadRequestException(L10n::t('Invalid form security token, please refresh the page.'));
} }
if (!dba::exists('advancedcontentfilter_rules', ['id' => $args['id'], 'uid' => local_user()])) { if (!DBA::exists('advancedcontentfilter_rules', ['id' => $args['id'], 'uid' => local_user()])) {
throw new HTTPException\NotFoundException(L10n::t('Rule doesn\'t exist or doesn\'t belong to you.')); throw new HTTPException\NotFoundException(L10n::t('Rule doesn\'t exist or doesn\'t belong to you.'));
} }
if (!dba::delete('advancedcontentfilter_rules', ['id' => $args['id']])) { if (!DBA::delete('advancedcontentfilter_rules', ['id' => $args['id']])) {
throw new HTTPException\ServiceUnavaiableException(dba::errorMessage()); throw new HTTPException\ServiceUnavaiableException(DBA::errorMessage());
} }
return json_encode(['message' => L10n::t('Rule successfully deleted')]); return json_encode(['message' => L10n::t('Rule successfully deleted')]);

View File

@ -13,7 +13,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\dba; use Friendica\Database\DBA;
use Friendica\Model\ItemContent; use Friendica\Model\ItemContent;
function buffer_install() { function buffer_install() {
@ -260,7 +260,7 @@ function buffer_send(App $a, &$b)
// Dont't post if the post doesn't belong to us. // Dont't post if the post doesn't belong to us.
// This is a check for forum postings // This is a check for forum postings
$self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]); $self = DBA::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
if ($b['contact-id'] != $self['id']) { if ($b['contact-id'] != $self['id']) {
return; return;
} }

View File

@ -12,7 +12,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\dba; use Friendica\Database\DBA;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Photo; use Friendica\Model\Photo;
@ -78,14 +78,14 @@ function catavatar_addon_settings_post(App $a, &$s)
// delete the current cached cat avatar // delete the current cached cat avatar
$condition = ['uid' => local_user(), 'blocked' => false, $condition = ['uid' => local_user(), 'blocked' => false,
'account_expired' => false, 'account_removed' => false]; 'account_expired' => false, 'account_removed' => false];
$user = dba::selectFirst('user', ['email'], $condition); $user = DBA::selectFirst('user', ['email'], $condition);
$seed = PConfig::get(local_user(), 'catavatar', 'seed', md5(trim(strtolower($user['email'])))); $seed = PConfig::get(local_user(), 'catavatar', 'seed', md5(trim(strtolower($user['email']))));
if (!empty($_POST['catavatar-usecat'])) { if (!empty($_POST['catavatar-usecat'])) {
$url = $a->get_baseurl() . '/catavatar/' . local_user() . '?ts=' . time(); $url = $a->get_baseurl() . '/catavatar/' . local_user() . '?ts=' . time();
$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)) { if (!DBM::is_result($self)) {
notice(L10n::t("The cat hadn't found itself.")); notice(L10n::t("The cat hadn't found itself."));
return; return;
@ -94,16 +94,16 @@ function catavatar_addon_settings_post(App $a, &$s)
Photo::importProfilePhoto($url, local_user(), $self['id']); Photo::importProfilePhoto($url, local_user(), $self['id']);
$condition = ['uid' => local_user(), 'contact-id' => $self['id']]; $condition = ['uid' => local_user(), 'contact-id' => $self['id']];
$photo = dba::selectFirst('photo', ['resource-id'], $condition); $photo = DBA::selectFirst('photo', ['resource-id'], $condition);
if (!DBM::is_result($photo)) { if (!DBM::is_result($photo)) {
notice(L10n::t('There was an error, the cat ran away.')); notice(L10n::t('There was an error, the cat ran away.'));
return; return;
} }
dba::update('photo', ['profile' => false], ['profile' => true, 'uid' => local_user()]); DBA::update('photo', ['profile' => false], ['profile' => true, 'uid' => local_user()]);
$fields = ['profile' => true, 'album' => L10n::t('Profile Photos'), 'contact-id' => 0]; $fields = ['profile' => true, 'album' => L10n::t('Profile Photos'), 'contact-id' => 0];
dba::update('photo', $fields, ['uid' => local_user(), 'resource-id' => $photo['resource-id']]); DBA::update('photo', $fields, ['uid' => local_user(), 'resource-id' => $photo['resource-id']]);
Photo::importProfilePhoto($url, local_user(), $self['id']); Photo::importProfilePhoto($url, local_user(), $self['id']);
@ -138,7 +138,7 @@ function catavatar_addon_settings_post(App $a, &$s)
*/ */
function catavatar_lookup(App $a, &$b) function catavatar_lookup(App $a, &$b)
{ {
$user = dba::selectFirst('user', ['uid'], ['email' => $b['email']]); $user = DBA::selectFirst('user', ['uid'], ['email' => $b['email']]);
$url = $a->get_baseurl() . '/catavatar/' . $user['uid']; $url = $a->get_baseurl() . '/catavatar/' . $user['uid'];
switch($b['size']) { switch($b['size']) {
@ -174,7 +174,7 @@ function catavatar_content(App $a)
$condition = ['uid' => $uid, 'blocked' => false, $condition = ['uid' => $uid, 'blocked' => false,
'account_expired' => false, 'account_removed' => false]; 'account_expired' => false, 'account_removed' => false];
$user = dba::selectFirst('user', ['email'], $condition); $user = DBA::selectFirst('user', ['email'], $condition);
if ($user === false) { if ($user === false) {
throw new NotFoundException(); throw new NotFoundException();

View File

@ -13,7 +13,7 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\dba; use Friendica\Database\DBA;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Queue; use Friendica\Model\Queue;
@ -293,7 +293,7 @@ function diaspora_send(&$a,&$b) {
// Dont't post if the post doesn't belong to us. // Dont't post if the post doesn't belong to us.
// This is a check for forum postings // This is a check for forum postings
$self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]); $self = DBA::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
if ($b['contact-id'] != $self['id']) { if ($b['contact-id'] != $self['id']) {
return; return;
} }

View File

@ -14,7 +14,7 @@ use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\dba; use Friendica\Database\DBA;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Item; use Friendica\Model\Item;
@ -101,7 +101,7 @@ function ifttt_post(App $a)
$nickname = $a->argv[1]; $nickname = $a->argv[1];
$user = dba::selectFirst('user', ['uid'], ['nickname' => $nickname]); $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname]);
if (!DBM::is_result($user)) { if (!DBM::is_result($user)) {
logger('User ' . $nickname . ' not found.', LOGGER_DEBUG); logger('User ' . $nickname . ' not found.', LOGGER_DEBUG);
return; return;

View File

@ -10,7 +10,7 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\dba; use Friendica\Database\DBA;
use Friendica\Util\Network; use Friendica\Util\Network;
function libertree_install() { function libertree_install() {
@ -173,7 +173,7 @@ function libertree_send(&$a,&$b) {
// Dont't post if the post doesn't belong to us. // Dont't post if the post doesn't belong to us.
// This is a check for forum postings // This is a check for forum postings
$self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]); $self = DBA::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
if ($b['contact-id'] != $self['id']) { if ($b['contact-id'] != $self['id']) {
return; return;
} }

View File

@ -9,7 +9,7 @@
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Database\dba; use Friendica\Database\DBA;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
@ -47,7 +47,7 @@ function public_server_register_account($a, $b)
} }
$fields = ['account_expires_on' => DateTimeFormat::utc('now +' . $days . ' days'), 'expire' => $days_posts]; $fields = ['account_expires_on' => DateTimeFormat::utc('now +' . $days . ' days'), 'expire' => $days_posts];
dba::update('user', $fields, ['uid' => $uid]); DBA::update('user', $fields, ['uid' => $uid]);
} }
function public_server_cron($a, $b) function public_server_cron($a, $b)
@ -75,7 +75,7 @@ function public_server_cron($a, $b)
]); ]);
$fields = ['expire_notification_sent' => DateTimeFormat::utcNow()]; $fields = ['expire_notification_sent' => DateTimeFormat::utcNow()];
dba::update('user', $fields, ['uid' => $rr['uid']]); DBA::update('user', $fields, ['uid' => $rr['uid']]);
} }
} }
@ -86,7 +86,7 @@ function public_server_cron($a, $b)
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
foreach ($r as $rr) { foreach ($r as $rr) {
$fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')]; $fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')];
dba::update('user', $fields, ['uid' => $rr['uid']]); DBA::update('user', $fields, ['uid' => $rr['uid']]);
} }
} }
} }
@ -98,7 +98,7 @@ function public_server_cron($a, $b)
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
foreach ($r as $rr) { foreach ($r as $rr) {
$fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')]; $fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')];
dba::update('user', $fields, ['uid' => $rr['uid']]); DBA::update('user', $fields, ['uid' => $rr['uid']]);
} }
} }
} }
@ -110,7 +110,7 @@ function public_server_cron($a, $b)
intval($flagposts), dbesc(NULL_DATE)); intval($flagposts), dbesc(NULL_DATE));
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
foreach ($r as $rr) { foreach ($r as $rr) {
dba::update('user', ['expire' => $flagpostsexpire], ['uid' => $rr['uid']]); DBA::update('user', ['expire' => $flagpostsexpire], ['uid' => $rr['uid']]);
} }
} }
} }
@ -138,7 +138,7 @@ function public_server_login($a, $b)
$fields = ['account_expires_on' => DateTimeFormat::utc('now +' . $days . ' days')]; $fields = ['account_expires_on' => DateTimeFormat::utc('now +' . $days . ' days')];
$condition = ["`uid` = ? AND `account_expires_on` > ?", local_user(), NULL_DATE]; $condition = ["`uid` = ? AND `account_expires_on` > ?", local_user(), NULL_DATE];
dba::update('user', $fields, $condition); DBA::update('user', $fields, $condition);
} }
function public_server_addon_admin_post(&$a) function public_server_addon_admin_post(&$a)

View File

@ -13,7 +13,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\dba; use Friendica\Database\DBA;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\GContact; use Friendica\Model\GContact;
@ -439,7 +439,7 @@ function pumpio_send(&$a, &$b)
// Dont't post if the post doesn't belong to us. // Dont't post if the post doesn't belong to us.
// This is a check for forum postings // This is a check for forum postings
$self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]); $self = DBA::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
if ($b['contact-id'] != $self['id']) { if ($b['contact-id'] != $self['id']) {
return; return;
} }
@ -952,7 +952,7 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru
} }
$condition = ['verb' => ACTIVITY_LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]; $condition = ['verb' => ACTIVITY_LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']];
if (dba::exists('item', $condition)) { if (DBA::exists('item', $condition)) {
logger("pumpio_dolike: found existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']); logger("pumpio_dolike: found existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
return; return;
} }
@ -1079,13 +1079,13 @@ function pumpio_dodelete(&$a, $uid, $self, $post, $own_id)
{ {
// Two queries for speed issues // Two queries for speed issues
$condition = ['uri' => $post->object->id, 'uid' => $uid]; $condition = ['uri' => $post->object->id, 'uid' => $uid];
if (dba::exists('item', $condition)) { if (DBA::exists('item', $condition)) {
Item::delete($condition); Item::delete($condition);
return true; return true;
} }
$condition = ['extid' => $post->object->id, 'uid' => $uid]; $condition = ['extid' => $post->object->id, 'uid' => $uid];
if (dba::exists('item', $condition)) { if (DBA::exists('item', $condition)) {
Item::delete($condition); Item::delete($condition);
return true; return true;
} }
@ -1110,10 +1110,10 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
if ($post->verb != "update") { if ($post->verb != "update") {
// Two queries for speed issues // Two queries for speed issues
if (dba::exists('item', ['uri' => $post->object->id, 'uid' => $uid])) { if (DBA::exists('item', ['uri' => $post->object->id, 'uid' => $uid])) {
return false; return false;
} }
if (dba::exists('item', ['extid' => $post->object->id, 'uid' => $uid])) { if (DBA::exists('item', ['extid' => $post->object->id, 'uid' => $uid])) {
return false; return false;
} }
} }
@ -1639,11 +1639,11 @@ function pumpio_fetchallcomments(&$a, $uid, $id)
} }
// Checking if the comment already exists - Two queries for speed issues // Checking if the comment already exists - Two queries for speed issues
if (dba::exists('item', ['uri' => $item->id, 'uid' => $uid])) { if (DBA::exists('item', ['uri' => $item->id, 'uid' => $uid])) {
continue; continue;
} }
if (dba::exists('item', ['extid' => $item->id, 'uid' => $uid])) { if (DBA::exists('item', ['extid' => $item->id, 'uid' => $uid])) {
continue; continue;
} }

View File

@ -47,7 +47,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\dba; use Friendica\Database\DBA;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\GContact; use Friendica\Model\GContact;
use Friendica\Model\Group; use Friendica\Model\Group;
@ -492,7 +492,7 @@ function statusnet_post_hook(App $a, &$b)
// Dont't post if the post doesn't belong to us. // Dont't post if the post doesn't belong to us.
// This is a check for forum postings // This is a check for forum postings
$self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]); $self = DBA::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
if ($b['contact-id'] != $self['id']) { if ($b['contact-id'] != $self['id']) {
return; return;
} }
@ -1074,7 +1074,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
$postarray['uri'] = $hostname . "::" . $content->id; $postarray['uri'] = $hostname . "::" . $content->id;
if (dba::exists('item', ['extid' => $postarray['uri'], 'uid' => $uid])) { if (DBA::exists('item', ['extid' => $postarray['uri'], 'uid' => $uid])) {
return []; return [];
} }

View File

@ -14,7 +14,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\dba; use Friendica\Database\DBA;
function tumblr_install() { function tumblr_install() {
Addon::registerHook('post_local', 'addon/tumblr/tumblr.php', 'tumblr_post_local'); Addon::registerHook('post_local', 'addon/tumblr/tumblr.php', 'tumblr_post_local');
@ -332,7 +332,7 @@ function tumblr_send(&$a,&$b) {
// Dont't post if the post doesn't belong to us. // Dont't post if the post doesn't belong to us.
// This is a check for forum postings // This is a check for forum postings
$self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]); $self = DBA::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
if ($b['contact-id'] != $self['id']) { if ($b['contact-id'] != $self['id']) {
return; return;
} }

View File

@ -71,7 +71,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\dba; use Friendica\Database\DBA;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\GContact; use Friendica\Model\GContact;
@ -495,7 +495,7 @@ function twitter_post_hook(App $a, &$b)
// Dont't post if the post doesn't belong to us. // Dont't post if the post doesn't belong to us.
// This is a check for forum postings // This is a check for forum postings
$self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]); $self = DBA::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
if ($b['contact-id'] != $self['id']) { if ($b['contact-id'] != $self['id']) {
return; return;
} }
@ -734,17 +734,17 @@ function twitter_expire(App $a, $b)
return; return;
} }
$r = dba::select('item', ['id', 'iaid', 'icid'], ['deleted' => true, 'network' => NETWORK_TWITTER]); $r = DBA::select('item', ['id', 'iaid', 'icid'], ['deleted' => true, 'network' => NETWORK_TWITTER]);
while ($row = dba::fetch($r)) { while ($row = DBA::fetch($r)) {
dba::delete('item', ['id' => $row['id']]); DBA::delete('item', ['id' => $row['id']]);
if (!empty($row['iaid']) && !dba::exists('item', ['iaid' => $row['iaid']])) { if (!empty($row['iaid']) && !DBA::exists('item', ['iaid' => $row['iaid']])) {
dba::delete('item-activity', ['id' => $row['iaid']]); DBA::delete('item-activity', ['id' => $row['iaid']]);
} }
if (!empty($row['icid']) && !dba::exists('item', ['icid' => $row['icid']])) { if (!empty($row['icid']) && !DBA::exists('item', ['icid' => $row['icid']])) {
dba::delete('item-content', ['id' => $row['icid']]); DBA::delete('item-content', ['id' => $row['icid']]);
} }
} }
dba::close($r); DBA::close($r);
require_once "include/items.php"; require_once "include/items.php";
@ -1014,11 +1014,11 @@ function twitter_fetch_contact($uid, $data, $create_user)
$cid = Contact::getIdForURL($url, 0, true, $fields); $cid = Contact::getIdForURL($url, 0, true, $fields);
if (!empty($cid)) { if (!empty($cid)) {
dba::update('contact', $fields, ['id' => $cid]); DBA::update('contact', $fields, ['id' => $cid]);
Contact::updateAvatar($avatar, 0, $cid); Contact::updateAvatar($avatar, 0, $cid);
} }
$contact = dba::selectFirst('contact', [], ['uid' => $uid, 'alias' => "twitter::" . $data->id_str]); $contact = DBA::selectFirst('contact', [], ['uid' => $uid, 'alias' => "twitter::" . $data->id_str]);
if (!DBM::is_result($contact) && !$create_user) { if (!DBM::is_result($contact) && !$create_user) {
return 0; return 0;
} }
@ -1037,11 +1037,11 @@ function twitter_fetch_contact($uid, $data, $create_user)
$fields['readonly'] = false; $fields['readonly'] = false;
$fields['pending'] = false; $fields['pending'] = false;
if (!dba::insert('contact', $fields)) { if (!DBA::insert('contact', $fields)) {
return false; return false;
} }
$contact_id = dba::lastInsertId(); $contact_id = DBA::lastInsertId();
Group::addMember(User::getDefaultGroup($uid), $contact_id); Group::addMember(User::getDefaultGroup($uid), $contact_id);
@ -1066,7 +1066,7 @@ function twitter_fetch_contact($uid, $data, $create_user)
$fields['name-date'] = DateTimeFormat::utcNow(); $fields['name-date'] = DateTimeFormat::utcNow();
$fields['uri-date'] = DateTimeFormat::utcNow(); $fields['uri-date'] = DateTimeFormat::utcNow();
dba::update('contact', $fields, ['id' => $contact['id']]); DBA::update('contact', $fields, ['id' => $contact['id']]);
} }
} }
@ -1342,7 +1342,7 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
// $postarray['object'] = json_encode($post); // Activate for debugging // $postarray['object'] = json_encode($post); // Activate for debugging
// Don't import our own comments // Don't import our own comments
if (dba::exists('item', ['extid' => $postarray['uri'], 'uid' => $uid])) { if (DBA::exists('item', ['extid' => $postarray['uri'], 'uid' => $uid])) {
logger("Item with extid " . $postarray['uri'] . " found.", LOGGER_DEBUG); logger("Item with extid " . $postarray['uri'] . " found.", LOGGER_DEBUG);
return []; return [];
} }
@ -1515,7 +1515,7 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection,
break; break;
} }
if (dba::exists('item', ['uri' => 'twitter::' . $post->id_str, 'uid' => $uid])) { if (DBA::exists('item', ['uri' => 'twitter::' . $post->id_str, 'uid' => $uid])) {
break; break;
} }
@ -1660,7 +1660,7 @@ function twitter_fetchhometimeline(App $a, $uid)
$notify = false; $notify = false;
if ($postarray['uri'] == $postarray['parent-uri']) { if ($postarray['uri'] == $postarray['parent-uri']) {
$contact = dba::selectFirst('contact', [], ['id' => $postarray['contact-id'], 'self' => false]); $contact = DBA::selectFirst('contact', [], ['id' => $postarray['contact-id'], 'self' => false]);
if (DBM::is_result($contact)) { if (DBM::is_result($contact)) {
$notify = Item::isRemoteSelf($contact, $postarray); $notify = Item::isRemoteSelf($contact, $postarray);
} }

View File

@ -32,7 +32,7 @@ use Friendica\Content\Text\HTML;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\dba; use Friendica\Database\DBA;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\User; use Friendica\Model\User;
@ -463,7 +463,7 @@ function windowsphonepush_login(App $a)
$user_id = User::authenticate($_SERVER['PHP_AUTH_USER'], trim($_SERVER['PHP_AUTH_PW'])); $user_id = User::authenticate($_SERVER['PHP_AUTH_USER'], trim($_SERVER['PHP_AUTH_PW']));
if ($user_id) { if ($user_id) {
$record = dba::selectFirst('user', [], ['uid' => $user_id]); $record = DBA::selectFirst('user', [], ['uid' => $user_id]);
} else { } else {
logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG); logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"'); header('WWW-Authenticate: Basic realm="Friendica"');

View File

@ -11,7 +11,7 @@ use Friendica\Content\Text\HTML;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\dba; use Friendica\Database\DBA;
use Friendica\Util\Network; use Friendica\Util\Network;
function wppost_install() { function wppost_install() {
@ -210,7 +210,7 @@ function wppost_send(&$a,&$b) {
// Dont't post if the post doesn't belong to us. // Dont't post if the post doesn't belong to us.
// This is a check for forum postings // This is a check for forum postings
$self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]); $self = DBA::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
if ($b['contact-id'] != $self['id']) { if ($b['contact-id'] != $self['id']) {
return; return;
} }