+ // make this optional as it could have a performance impact on large sites
+ if (intval(Config::get('system', 'optimize_items'))) {
+ q("OPTIMIZE TABLE `item`");
+ }
+ return;
+ } elseif (($argc == 2) && (intval($argv[1]) > 0)) {
+ $user = dba::select('user', array('uid', 'username', 'expire'), array('uid' => $argv[1]), array('limit' => 1));
+ if (DBM::is_result($user)) {
+ logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG);
+ item_expire($user['uid'], $user['expire']);
+ logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - done ', LOGGER_DEBUG);
+ }
+ return;
+ } elseif (($argc == 3) && ($argv[1] == 'hook') && is_array($a->hooks) && array_key_exists("expire", $a->hooks)) {
+ foreach ($a->hooks["expire"] as $hook) {
+ if ($hook[1] == $argv[2]) {
+ logger("Calling expire hook '" . $hook[1] . "'", LOGGER_DEBUG);
+ call_single_hook($a, $name, $hook, $data);
+ }
+ }
+ return;
+ }