X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FCronJobs.php;h=ab4c4c62111a4af105aab95c7dc97ae856132814;hb=27d94023eef0263a3ce9750f79a73ac941a25304;hp=e83347055b78f260fe39e9ef5ec940d8f5e87204;hpb=390d5706f46ce58cbed24b292d5c1f1b9789a8a8;p=friendica.git diff --git a/src/Worker/CronJobs.php b/src/Worker/CronJobs.php index e83347055b..ab4c4c6211 100644 --- a/src/Worker/CronJobs.php +++ b/src/Worker/CronJobs.php @@ -1,24 +1,23 @@ '%s' - AND `account_expires_on` < UTC_TIMESTAMP()", dbesc(NULL_DATE)); + // 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); + + // Remove any freshly expired account + $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 - $r = q("SELECT * FROM `user` WHERE `account_removed` AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY"); - if (DBM::is_result($r)) { - foreach ($r as $user) { - dba::delete('user', array('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']]); } } @@ -164,15 +164,15 @@ class CronJobs if (!$cachetime) { $cachetime = PROXY_DEFAULT_TIME; } - $condition = array('`uid` = 0 AND `resource-id` LIKE "pic:%" AND `created` < NOW() - INTERVAL ? SECOND', $cachetime); + $condition = ['`uid` = 0 AND `resource-id` LIKE "pic:%" AND `created` < NOW() - INTERVAL ? SECOND', $cachetime]; dba::delete('photo', $condition); } // Delete the cached OEmbed entries that are older than three month - dba::delete('oembed', array("`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', array("`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;