*/
namespace Friendica\Worker;
+use Friendica\BaseObject;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
+use Friendica\Database\dba;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\XML;
-use dba;
require_once 'include/dba.php';
class OnePoll
{
- public static function execute($contact_id = 0, $command = '') {
- global $a;
+ public static function execute($contact_id = 0, $command = '')
+ {
+ $a = BaseObject::getApp();
require_once 'include/items.php';
$ret = Network::curl($url);
- if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
+ 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']]);
Contact::markForArchival($contact);
$ret = Network::curl($contact['poll'], false, $redirects, ['cookiejar' => $cookiejar]);
unlink($cookiejar);
- if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
+ 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']]);
Contact::markForArchival($contact);
return;
}
- private static function RemoveReply($subject) {
+ private static function RemoveReply($subject)
+ {
while (in_array(strtolower(substr($subject, 0, 3)), ["re:", "aw:"])) {
$subject = trim(substr($subject, 4));
}
* @param array $contact The personal contact entry
* @param array $fields The fields that are updated
*/
- private static function updateContact($contact, $fields) {
+ private static function updateContact($contact, $fields)
+ {
dba::update('contact', $fields, ['id' => $contact['id']]);
dba::update('contact', $fields, ['uid' => 0, 'nurl' => $contact['nurl']]);
}