Old database functions had been replaced in the workers
This commit is contained in:
parent
66bcbe210a
commit
08abf65f7b
|
@ -208,7 +208,7 @@ class Delivery {
|
||||||
$atom = DFRN::mail($item, $owner);
|
$atom = DFRN::mail($item, $owner);
|
||||||
} elseif ($fsuggest) {
|
} elseif ($fsuggest) {
|
||||||
$atom = DFRN::fsuggest($item, $owner);
|
$atom = DFRN::fsuggest($item, $owner);
|
||||||
q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1", intval($item['id']));
|
dba::delete('fsuggest', ['id' => $item['id']]);
|
||||||
} elseif ($relocate) {
|
} elseif ($relocate) {
|
||||||
$atom = DFRN::relocate($owner, $uid);
|
$atom = DFRN::relocate($owner, $uid);
|
||||||
} elseif ($followup) {
|
} elseif ($followup) {
|
||||||
|
@ -290,9 +290,7 @@ class Delivery {
|
||||||
if ($x && count($x)) {
|
if ($x && count($x)) {
|
||||||
$write_flag = ((($x[0]['rel']) && ($x[0]['rel'] != CONTACT_IS_SHARING)) ? true : false);
|
$write_flag = ((($x[0]['rel']) && ($x[0]['rel'] != CONTACT_IS_SHARING)) ? true : false);
|
||||||
if ((($owner['page-flags'] == PAGE_COMMUNITY) || $write_flag) && !$x[0]['writable']) {
|
if ((($owner['page-flags'] == PAGE_COMMUNITY) || $write_flag) && !$x[0]['writable']) {
|
||||||
q("UPDATE `contact` SET `writable` = 1 WHERE `id` = %d",
|
dba::update('contact', ['writable' => true], ['id' => $x[0]['id']]);
|
||||||
intval($x[0]['id'])
|
|
||||||
);
|
|
||||||
$x[0]['writable'] = 1;
|
$x[0]['writable'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Network\Probe;
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use dba;
|
||||||
|
|
||||||
class DiscoverPoCo {
|
class DiscoverPoCo {
|
||||||
/// @todo Clean up this mess of a parameter hell and split it in several classes
|
/// @todo Clean up this mess of a parameter hell and split it in several classes
|
||||||
|
@ -158,8 +159,8 @@ class DiscoverPoCo {
|
||||||
|
|
||||||
$urlparts = parse_url($user["url"]);
|
$urlparts = parse_url($user["url"]);
|
||||||
if (!isset($urlparts["scheme"])) {
|
if (!isset($urlparts["scheme"])) {
|
||||||
q("UPDATE `gcontact` SET `network` = '%s' WHERE `nurl` = '%s'",
|
dba::update('gcontact', ['network' => NETWORK_PHANTOM],
|
||||||
dbesc(NETWORK_PHANTOM), dbesc(normalise_link($user["url"])));
|
['nurl' => normalise_link($user["url"])]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,8 +172,8 @@ class DiscoverPoCo {
|
||||||
"identi.ca" => NETWORK_PUMPIO,
|
"identi.ca" => NETWORK_PUMPIO,
|
||||||
"alpha.app.net" => NETWORK_APPNET];
|
"alpha.app.net" => NETWORK_APPNET];
|
||||||
|
|
||||||
q("UPDATE `gcontact` SET `network` = '%s' WHERE `nurl` = '%s'",
|
dba::update('gcontact', ['network' => $networks[$urlparts["host"]]],
|
||||||
dbesc($networks[$urlparts["host"]]), dbesc(normalise_link($user["url"])));
|
['nurl' => normalise_link($user["url"])]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,8 +195,8 @@ class DiscoverPoCo {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
q("UPDATE `gcontact` SET `last_failure` = '%s' WHERE `nurl` = '%s'",
|
dba::update('gcontact', ['last_failure' => DateTimeFormat::utcNow()],
|
||||||
dbesc(DateTimeFormat::utcNow()), dbesc(normalise_link($user["url"])));
|
['nurl' => normalise_link($user["url"])]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quit the loop after 3 minutes
|
// Quit the loop after 3 minutes
|
||||||
|
|
|
@ -541,8 +541,8 @@ class Notifier {
|
||||||
if ($push_notify) {
|
if ($push_notify) {
|
||||||
// Set push flag for PuSH subscribers to this topic,
|
// Set push flag for PuSH subscribers to this topic,
|
||||||
// they will be notified in queue.php
|
// they will be notified in queue.php
|
||||||
q("UPDATE `push_subscriber` SET `push` = 1 ".
|
$condition = ['push' => false, 'nickname' => $owner['nickname']];
|
||||||
"WHERE `nickname` = '%s' AND `push` = 0", dbesc($owner['nickname']));
|
dba::update('push_subscriber', ['push' => true], $condition);
|
||||||
|
|
||||||
logger('Activating internal PuSH for item '.$item_id, LOGGER_DEBUG);
|
logger('Activating internal PuSH for item '.$item_id, LOGGER_DEBUG);
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use dba;
|
||||||
|
|
||||||
require_once 'include/items.php';
|
require_once 'include/items.php';
|
||||||
|
|
||||||
|
@ -76,9 +77,8 @@ class PubSubPublish {
|
||||||
logger('successfully pushed to '.$rr['callback_url']);
|
logger('successfully pushed to '.$rr['callback_url']);
|
||||||
|
|
||||||
// set last_update to the "created" date of the last item, and reset push=0
|
// set last_update to the "created" date of the last item, and reset push=0
|
||||||
q("UPDATE `push_subscriber` SET `push` = 0, last_update = '%s' WHERE id = %d",
|
$fields = ['push' => 0, 'last_update' => $last_update];
|
||||||
dbesc($last_update),
|
dba::update('push_subscriber', $fields, ['id' => $rr['id']]);
|
||||||
intval($rr['id']));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
logger('error when pushing to '.$rr['callback_url'].' HTTP: '.$ret);
|
logger('error when pushing to '.$rr['callback_url'].' HTTP: '.$ret);
|
||||||
|
@ -90,9 +90,7 @@ class PubSubPublish {
|
||||||
if ($new_push > 30) // OK, let's give up
|
if ($new_push > 30) // OK, let's give up
|
||||||
$new_push = 0;
|
$new_push = 0;
|
||||||
|
|
||||||
q("UPDATE `push_subscriber` SET `push` = %d WHERE id = %d",
|
dba::update('push_subscriber', ['push' => $new_push], ['id' => $rr['id']]);
|
||||||
$new_push,
|
|
||||||
intval($rr['id']));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Queue
|
||||||
// Handling the pubsubhubbub requests
|
// Handling the pubsubhubbub requests
|
||||||
Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], 'PubSubPublish');
|
Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], 'PubSubPublish');
|
||||||
|
|
||||||
$r = dba::inArray(dba::p("SELECT `id` FROM `queue` WHERE `next` < UTC_TIMESTAMP()"));
|
$r = dba::inArray(dba::p("SELECT `id` FROM `queue` WHERE `next` < UTC_TIMESTAMP() ORDER BY `batch`, `cid`"));
|
||||||
|
|
||||||
Addon::callHooks('queue_predeliver', $r);
|
Addon::callHooks('queue_predeliver', $r);
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace Friendica\Worker;
|
namespace Friendica\Worker;
|
||||||
|
|
||||||
|
use dba;
|
||||||
|
|
||||||
class TagUpdate
|
class TagUpdate
|
||||||
{
|
{
|
||||||
public static function execute()
|
public static function execute()
|
||||||
|
@ -13,18 +15,14 @@ class TagUpdate
|
||||||
if ($message['uid'] == 0) {
|
if ($message['uid'] == 0) {
|
||||||
$global = true;
|
$global = true;
|
||||||
|
|
||||||
q("UPDATE `term` SET `global` = 1 WHERE `otype` = %d AND `guid` = '%s'",
|
dba::update('term', ['global' => true], ['otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
|
||||||
intval(TERM_OBJ_POST), dbesc($message['guid']));
|
|
||||||
} else {
|
} else {
|
||||||
$isglobal = q("SELECT `global` FROM `term` WHERE `uid` = 0 AND `otype` = %d AND `guid` = '%s'",
|
$global = (dba::count('term', ['uid' => 0, 'otype' => TERM_OBJ_POST, 'guid' => $message['guid']]) > 0);
|
||||||
intval(TERM_OBJ_POST), dbesc($message['guid']));
|
|
||||||
|
|
||||||
$global = (count($isglobal) > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
q("UPDATE `term` SET `guid` = '%s', `created` = '%s', `received` = '%s', `global` = %d WHERE `otype` = %d AND `oid` = %d",
|
$fields = ['guid' => $message['guid'], 'created' => $message['created'],
|
||||||
dbesc($message['guid']), dbesc($message['created']), dbesc($message['received']),
|
'received' => $message['received'], 'global' => $global];
|
||||||
intval($global), intval(TERM_OBJ_POST), intval($message['oid']));
|
dba::update('term', $fields, ['otype' => TERM_OBJ_POST, 'oid' => $message['oid']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
dba::close($messages);
|
dba::close($messages);
|
||||||
|
@ -33,7 +31,7 @@ class TagUpdate
|
||||||
|
|
||||||
logger('fetched messages: ' . dba::num_rows($messages));
|
logger('fetched messages: ' . dba::num_rows($messages));
|
||||||
while ($message = dba::fetch(messages)) {
|
while ($message = dba::fetch(messages)) {
|
||||||
q("UPDATE `item` SET `global` = 1 WHERE `guid` = '%s'", dbesc($message['guid']));
|
dba::update('item', ['global' => true], ['guid' => $message['guid']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
dba::close($messages);
|
dba::close($messages);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user