mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 04:45:16 +02:00
Replace old database queries with the new ones
This commit is contained in:
parent
8f9757aba5
commit
4ad655ab80
12 changed files with 42 additions and 181 deletions
|
@ -1106,9 +1106,7 @@ function admin_page_site_post(App $a)
|
|||
Config::set('system', 'touch_icon', $touch_icon);
|
||||
|
||||
if ($banner == "") {
|
||||
// don't know why, but del_config doesn't work...
|
||||
q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1", dbesc("system"), dbesc("banner")
|
||||
);
|
||||
Config::delete('system', 'banner');
|
||||
} else {
|
||||
Config::set('system', 'banner', $banner);
|
||||
}
|
||||
|
|
|
@ -283,12 +283,9 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
notice(L10n::t('Remote site reported: ') . $message . EOL);
|
||||
}
|
||||
|
||||
if (($status == 0) && ($intro_id)) {
|
||||
if (($status == 0) && $intro_id) {
|
||||
// Success. Delete the notification.
|
||||
q("DELETE FROM `intro` WHERE `id` = %d AND `uid` = %d",
|
||||
intval($intro_id),
|
||||
intval($uid)
|
||||
);
|
||||
dba::delete('intro', ['id' => $intro_id]);
|
||||
}
|
||||
|
||||
if ($status != 0) {
|
||||
|
@ -360,10 +357,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
}
|
||||
}
|
||||
|
||||
q("DELETE FROM `intro` WHERE `id` = %d AND `uid` = %d",
|
||||
intval($intro_id),
|
||||
intval($uid)
|
||||
);
|
||||
dba::delete('intro', ['id' => $intro_id]);
|
||||
|
||||
$r = q("UPDATE `contact` SET `name-date` = '%s',
|
||||
`uri-date` = '%s',
|
||||
|
|
|
@ -140,7 +140,7 @@ function dfrn_poll_init(App $a)
|
|||
|
||||
if ($type === 'profile-check' && $dfrn_version < 2.2) {
|
||||
if ((strlen($challenge)) && (strlen($sec))) {
|
||||
q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
|
||||
dba::delete('profile_check', ["`expire` < ?", time()]);
|
||||
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
|
||||
dbesc($sec)
|
||||
);
|
||||
|
@ -205,7 +205,7 @@ function dfrn_poll_init(App $a)
|
|||
break;
|
||||
}
|
||||
|
||||
q("DELETE FROM `profile_check` WHERE `expire` < " . intval(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)) {
|
||||
|
@ -232,7 +232,7 @@ function dfrn_poll_post(App $a)
|
|||
if (strlen($challenge) && strlen($sec)) {
|
||||
logger('dfrn_poll: POST: profile-check');
|
||||
|
||||
q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
|
||||
dba::delete('profile_check', ["`expire` < ?", time()]);
|
||||
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
|
||||
dbesc($sec)
|
||||
);
|
||||
|
@ -305,11 +305,7 @@ function dfrn_poll_post(App $a)
|
|||
$type = $r[0]['type'];
|
||||
$last_update = $r[0]['last_update'];
|
||||
|
||||
$r = q("DELETE FROM `challenge` WHERE `dfrn-id` = '%s' AND `challenge` = '%s'",
|
||||
dbesc($dfrn_id),
|
||||
dbesc($challenge)
|
||||
);
|
||||
|
||||
dba::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
|
||||
|
||||
$sql_extra = '';
|
||||
switch ($direction) {
|
||||
|
@ -414,7 +410,7 @@ function dfrn_poll_content(App $a)
|
|||
|
||||
$status = 0;
|
||||
|
||||
$r = q("DELETE FROM `challenge` WHERE `expire` < " . intval(time()));
|
||||
dba::delete('challenge', ["`expire` < ?", time()]);
|
||||
|
||||
if ($type !== 'profile') {
|
||||
$r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` , `type`, `last_update` )
|
||||
|
|
|
@ -263,13 +263,9 @@ function dfrn_request_post(App $a)
|
|||
if (DBM::is_result($r)) {
|
||||
foreach ($r as $rr) {
|
||||
if (!$rr['rel']) {
|
||||
q("DELETE FROM `contact` WHERE `id` = %d AND NOT `self`",
|
||||
intval($rr['cid'])
|
||||
);
|
||||
dba::delete('contact', ['id' => $rr['cid'], 'self' => false]);
|
||||
}
|
||||
q("DELETE FROM `intro` WHERE `id` = %d",
|
||||
intval($rr['iid'])
|
||||
);
|
||||
dba::delete('intro', ['id' => $rr['iid']]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -148,11 +148,7 @@ function message_content(App $a)
|
|||
|
||||
$cmd = $a->argv[1];
|
||||
if ($cmd === 'drop') {
|
||||
$r = q("DELETE FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($a->argv[2]),
|
||||
intval(local_user())
|
||||
);
|
||||
if ($r) {
|
||||
if (dba::delete('mail', ['id' => $a->argv[2]])) {
|
||||
info(L10n::t('Message deleted.') . EOL);
|
||||
}
|
||||
//goaway(System::baseUrl(true) . '/message' );
|
||||
|
@ -166,22 +162,7 @@ function message_content(App $a)
|
|||
$parent = $r[0]['parent-uri'];
|
||||
$convid = $r[0]['convid'];
|
||||
|
||||
$r = q("DELETE FROM `mail` WHERE `parent-uri` = '%s' AND `uid` = %d ",
|
||||
dbesc($parent),
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
// remove diaspora conversation pointer
|
||||
// Actually if we do this, we can never receive another reply to that conversation,
|
||||
// as we will never again have the info we need to re-create it.
|
||||
// We'll just have to orphan it.
|
||||
//if ($convid) {
|
||||
// q("delete from conv where id = %d limit 1",
|
||||
// intval($convid)
|
||||
// );
|
||||
//}
|
||||
|
||||
if ($r) {
|
||||
if (dba::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
|
||||
info(L10n::t('Conversation removed.') . EOL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,8 +135,7 @@ function pubsubhubbub_init(App $a) {
|
|||
dbesc($hub_callback));
|
||||
|
||||
// delete old subscription if it exists
|
||||
q("DELETE FROM `push_subscriber` WHERE `callback_url` = '%s'",
|
||||
dbesc($hub_callback));
|
||||
dba::delete('push_subscriber', ['callback_url' => $hub_callback]);
|
||||
|
||||
if ($subscribe) {
|
||||
$last_update = DateTimeFormat::utcNow();
|
||||
|
|
|
@ -149,9 +149,7 @@ function settings_post(App $a)
|
|||
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
|
||||
|
||||
$key = $_POST['remove'];
|
||||
q("DELETE FROM tokens WHERE id='%s' AND uid=%d",
|
||||
dbesc($key),
|
||||
local_user());
|
||||
dba::delete('tokens', ['id' => $key]);
|
||||
goaway(System::baseUrl(true)."/settings/oauth/");
|
||||
return;
|
||||
}
|
||||
|
@ -714,9 +712,7 @@ function settings_content(App $a)
|
|||
if (($a->argc > 3) && ($a->argv[2] === 'delete')) {
|
||||
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't');
|
||||
|
||||
q("DELETE FROM clients WHERE client_id='%s' AND uid=%d",
|
||||
dbesc($a->argv[3]),
|
||||
local_user());
|
||||
dba::delete('clients', ['client_id' => $a->argv[3], 'uid' => local_user()]);
|
||||
goaway(System::baseUrl(true)."/settings/oauth/");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue