/** * Run this task * * @access public * @return void */ public function runTask() { /* Run it */ $itemsRemoved = IPSContentCache::prune(); $this->class->appendTaskLog($this->task, "Cleaned up content cache - " . $itemsRemoved . " items removed"); $this->class->unlockTask($this->task); }
/** * Run this task * * @access public * @return void */ public function runTask() { $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); $mids = array(); $vids = array(); $emails = array(); // If enabled, remove validating new_reg members & entries from members table if (intval($this->settings['validate_day_prune']) > 0) { $less_than = time() - $this->settings['validate_day_prune'] * 86400; $this->DB->build(array('select' => 'v.vid, v.member_id', 'from' => array('validating' => 'v'), 'where' => 'v.new_reg=1 AND v.coppa_user<>1 AND v.entry_date < ' . $less_than . ' AND v.lost_pass<>1', 'add_join' => array(0 => array('select' => 'm.posts, m.member_group_id, m.email', 'from' => array('members' => 'm'), 'where' => 'm.member_id=v.member_id', 'type' => 'left')))); $outer = $this->DB->execute(); while ($i = $this->DB->fetch($outer)) { if ($i['member_group_id'] != $this->settings['auth_group']) { // No longer validating? $this->DB->delete('validating', "vid='{$i['vid']}'"); continue; } if (intval($i['posts']) < 1) { $mids[] = $i['member_id']; } } // Remove non-posted validating members if (count($mids) > 0) { IPSMember::remove($mids); } //----------------------------------------- // Log to log table - modify but dont delete //----------------------------------------- $this->class->appendTaskLog($this->task, sprintf($this->lang->words['task_removevalidating'], count($mids))); } //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->unlockTask($this->task); }
/** * Run this task * * @access public * @return void */ public function runTask() { $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); //----------------------------------------- // Delete old subscriptions //----------------------------------------- $deleted = 0; $trids = array(); if ($this->settings['subs_autoprune'] > 0) { $time = time() - $this->settings['subs_autoprune'] * 86400; $this->DB->build(array('select' => 'tr.trid', 'from' => array('tracker' => 'tr'), 'where' => 't.last_post < ' . $time, 'add_join' => array(array('from' => array('topics' => 't'), 'where' => 't.tid=tr.topic_id', 'type' => 'left')))); $this->DB->execute(); while ($r = $this->DB->fetch()) { $trids[] = $r['trid']; } if (count($trids) > 0) { $this->DB->delete('tracker', "trid IN (" . implode(",", $trids) . ")"); } $deleted = intval(count($trids)); } //----------------------------------------- // Delete old unattached uploads //----------------------------------------- $time_cutoff = time() - 7200; $deadid = array(); $this->DB->build(array("select" => '*', 'from' => 'attachments', 'where' => "attach_rel_id=0 AND attach_date < {$time_cutoff}")); $this->DB->execute(); while ($killmeh = $this->DB->fetch()) { if ($killmeh['attach_location']) { @unlink($this->settings['upload_dir'] . "/" . $killmeh['attach_location']); } if ($killmeh['attach_thumb_location']) { @unlink($this->settings['upload_dir'] . "/" . $killmeh['attach_thumb_location']); } $deadid[] = $killmeh['attach_id']; } $_attach_count = count($deadid); if ($_attach_count) { $this->DB->delete('attachments', "attach_id IN(" . implode(",", $deadid) . ")"); } //----------------------------------------- // Remove old XML-RPC logs... //----------------------------------------- if ($this->settings['xmlrpc_log_expire'] > 0) { $time = time() - $this->settings['xmlrpc_log_expire'] * 86400; $this->DB->delete('api_log', "api_log_date < {$time}"); $xmlrpc_logs_deleted = $this->DB->getAffectedRows(); } //----------------------------------------- // Log to log table - modify but dont delete //----------------------------------------- $this->class->appendTaskLog($this->task, sprintf($this->lang->words['task_dailycleanout'], $xmlrpc_logs_deleted, $_attach_count, $deleted)); //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->unlockTask($this->task); }
/** * Run this task * * @access public * @return void */ public function runTask() { $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); //----------------------------------------- // This is mysql only //----------------------------------------- if (strtolower($this->settings['sql_driver']) != 'mysql') { $this->class->unlockTask($this->task); return; } //----------------------------------------- // Clean out openid caches older than 24 hours // For whatever reason the OpenID libraries // seem to have an issue where caches can start // to accumulate. On boards heavily using // OpenID, it's possible to eventually fill up // the cache directories, which causes all subsequent // logins to fail. This task just clears out those // caches once every 24 hours to keep that from happening. //----------------------------------------- try { if (is_dir(DOC_IPS_ROOT_PATH . 'cache/openid')) { if (is_dir(DOC_IPS_ROOT_PATH . 'cache/openid/associations')) { foreach (new DirectoryIterator(DOC_IPS_ROOT_PATH . 'cache/openid/associations') as $cache) { if ($cache->getMTime() < time() - 60 * 60 * 24) { @unlink($cache->getPathname()); } } } if (is_dir(DOC_IPS_ROOT_PATH . 'cache/openid/nonces')) { foreach (new DirectoryIterator(DOC_IPS_ROOT_PATH . 'cache/openid/nonces') as $cache) { if ($cache->getMTime() < time() - 60 * 60 * 24) { @unlink($cache->getPathname()); } } } if (is_dir(DOC_IPS_ROOT_PATH . 'cache/openid/temp')) { foreach (new DirectoryIterator(DOC_IPS_ROOT_PATH . 'cache/openid/temp') as $cache) { if ($cache->getMTime() < time() - 60 * 60 * 24) { @unlink($cache->getPathname()); } } } } } catch (Exception $e) { } //----------------------------------------- // Log to log table - modify but dont delete //----------------------------------------- $this->class->appendTaskLog($this->task, $this->lang->words['task_openidcleanup']); //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->unlockTask($this->task); }
/** * Run this task * * @access public * @return void */ public function runTask() { $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); $count = 0; $canUnlock = array(); if ($this->settings['ipb_bruteforce_attempts'] and $this->settings['ipb_bruteforce_unlock']) { $this->DB->build(array('select' => 'member_id, failed_logins, failed_login_count', 'from' => 'members', 'where' => 'failed_login_count > 0 AND failed_logins ' . $this->DB->buildIsNull(false))); $outer = $this->DB->execute(); while ($r = $this->DB->fetch($outer)) { $used_ips = array(); $this_attempt = array(); $oldest = 0; $newest = 0; if ($r['failed_logins']) { $failed_logins = explode(",", IPSText::cleanPermString($r['failed_logins'])); if (is_array($failed_logins) and count($failed_logins)) { sort($failed_logins); foreach ($failed_logins as $attempt) { $this_attempt = explode("-", $attempt); if (isset($used_ips[$this_attempt[1]]) and $this_attempt[0] > $used_ips[$this_attempt[1]]) { $used_ips[$this_attempt[1]] = $this_attempt[0]; } } $totalLocked = count($used_ips); $totalToUnlock = 0; if (count($used_ips)) { foreach ($used_ips as $ip => $timestamp) { if ($timestamp < time() - $this->settings['ipb_bruteforce_period'] * 60) { $totalToUnlock++; } } } if ($totalToUnlock == $totalLocked) { $canUnlock[] = $r['member_id']; } } else { $canUnlock[] = $r['member_id']; } } else { $canUnlock[] = $r['member_id']; } } if (count($canUnlock)) { $this->DB->update('members', array('failed_logins' => null, 'failed_login_count' => 0), 'member_id IN(' . implode(',', $canUnlock) . ')'); } //----------------------------------------- // Log to log table - modify but dont delete //----------------------------------------- $this->class->appendTaskLog($this->task, sprintf($this->lang->words['task_removelocked'], count($canUnlock))); } //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->unlockTask($this->task); }
/** * Run this task * * @access public * @return void */ public function runTask() { /* INIT */ if (!$this->registry->isClassLoaded('classItemMarking')) { require_once IPS_ROOT_PATH . 'sources/classes/itemmarking/classItemMarking.php'; $this->registry->setClass('classItemMarking', new classItemMarking($this->registry)); } $itemsRemoved = $this->registry->getClass('classItemMarking')->manualCleanUp(100); $this->class->appendTaskLog($this->task, "Cleaned up " . $itemsRemoved . " markers"); $this->class->unlockTask($this->task); }
/** * Run this task * * @access public * @return void */ public function runTask() { $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); //----------------------------------------- // Enabled? //----------------------------------------- if (!$this->settings['update_topic_views_immediately']) { //----------------------------------------- // Attempt to prevent timeout... //----------------------------------------- $timeStart = time(); $ids = array(); $complete = true; //----------------------------------------- // Get SQL query //----------------------------------------- $this->DB->build(array('select' => 'views_tid, COUNT(*) as topicviews', 'from' => 'topic_views', 'group' => 'views_tid')); $o = $this->DB->execute(); while ($r = $this->DB->fetch($o)) { //----------------------------------------- // Update... //----------------------------------------- $this->DB->update('topics', 'views=views+' . intval($r['topicviews']), "tid=" . intval($r['views_tid']), false, true); $ids[] = $r['views_tid']; //----------------------------------------- // Running longer than 30 seconds? //----------------------------------------- if (time() - $timeStart > 30) { $complete = false; break; } } //----------------------------------------- // Delete from table //----------------------------------------- if (!$complete) { if (count($ids)) { $this->DB->delete('topic_views', 'views_tid IN(' . implode(',', $ids) . ')'); } } else { $this->DB->delete('topic_views'); } //----------------------------------------- // Log to log table - modify but dont delete //----------------------------------------- $this->class->appendTaskLog($this->task, $this->lang->words['task_updateviews']); } //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->unlockTask($this->task); }
/** * Run this task * * @access public * @return void */ public function runTask() { $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); //----------------------------------------- // INIT //----------------------------------------- $feeds_to_update = array(); $time = time(); $t_minus_30 = time() - 30 * 60; //----------------------------------------- // Got any to update? // 30 mins is RSS friendly. //----------------------------------------- $this->DB->build(array('select' => '*', 'from' => 'rss_import', 'where' => 'rss_import_enabled=1 AND rss_import_last_import <= ' . $t_minus_30, 'order' => 'rss_import_last_import ASC', 'limit' => array($this->limit))); $rss_main_query = $this->DB->execute(); if ($this->DB->getTotalRows($rss_main_query)) { define('IN_ACP', 1); require_once IPSLib::getAppDir('forums') . '/modules_admin/rss/import.php'; $rss = new admin_forums_rss_import(); $rss->makeRegistryShortcuts($this->registry); while ($rss_feed = $this->DB->fetch($rss_main_query)) { $this_check = time() - $rss_feed['rss_import_time'] * 60; if ($rss_feed['rss_import_last_import'] <= $this_check) { //----------------------------------------- // Set the feeds we need to update... //----------------------------------------- $feeds_to_update[] = $rss_feed['rss_import_id']; } } $timeStart = time(); //----------------------------------------- // Do the update now... //----------------------------------------- if (count($feeds_to_update)) { $rss->rssImportRebuildCache(implode(",", $feeds_to_update), 0, 1); //----------------------------------------- // Running longer than 30 seconds? //----------------------------------------- if (time() - $timeStart > 30) { break; } } } //----------------------------------------- // Log to log table - modify but dont delete //----------------------------------------- $this->class->appendTaskLog($this->task, sprintf($this->lang->words['task_rssimport'], count($feeds_to_update))); //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->unlockTask($this->task); }
/** * Run this task * * @access public * @return void */ public function runTask() { $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); //----------------------------------------- // Rebuild stats cache //----------------------------------------- $this->cache->rebuildCache('stats', 'global'); //----------------------------------------- // Log to log table - modify but dont delete //----------------------------------------- $this->class->appendTaskLog($this->task, $this->lang->words['task_statsrebuilt']); //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->unlockTask($this->task); }
/** * Run this task * * @access public * @return void */ public function runTask() { $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); //----------------------------------------- // Deactivate expired announcements //----------------------------------------- require IPSLib::getAppDir('forums') . '/modules_public/forums/announcements.php'; $announcements = new public_forums_forums_announcements(); $announcements->makeRegistryShortcuts($this->registry); $announcements->announceRetireExpired(); //----------------------------------------- // Log to log table - modify but dont delete //----------------------------------------- $this->class->appendTaskLog($this->task, $this->lang->words['task_announcements']); //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->unlockTask($this->task); }
/** * Run this task * 1235503784 * @access public * @return void */ public function runTask() { $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); //----------------------------------------- // Delete reg_anti_spam //----------------------------------------- $this->DB->delete('captcha', 'captcha_date < ' . (time() - 60 * 60 * 6)); //----------------------------------------- // Delete sessions //----------------------------------------- $this->DB->delete('sessions', 'running_time < ' . (IPS_UNIX_TIME_NOW - $this->settings['session_expiration'])); //----------------------------------------- // Log to log table - modify but dont delete //----------------------------------------- $this->class->appendTaskLog($this->task, $this->lang->words['task_cleanout']); //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->unlockTask($this->task); }
/** * Run this task * * @access public * @return void */ public function runTask() { $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); //----------------------------------------- // Send daily digests... //----------------------------------------- require IPSLib::getAppDir('forums') . '/sources/classes/digest.php'; $digest = new digestLibrary($this->registry); $digest->digest_time = 'daily'; $digest->digest_type = 'topic'; $digest->runDigest(); $digest->digest_time = 'daily'; $digest->digest_type = 'forum'; $digest->runDigest(); //----------------------------------------- // Log to log table - modify but dont delete //----------------------------------------- $this->class->appendTaskLog($this->task, $this->lang->words['task_dailydigest']); //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->unlockTask($this->task); }
/** * Run this task * * @access public * @return void */ public function runTask() { $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); //----------------------------------------- // This is mysql only //----------------------------------------- if (strtolower($this->settings['sql_driver']) != 'mysql') { $this->class->unlockTask($this->task); return; } //----------------------------------------- // Clean out sleeping mysql processes //----------------------------------------- $this->DB->return_die = true; $resource = $this->DB->query("SHOW PROCESSLIST", true); while ($r = $this->DB->fetch($resource)) { //----------------------------------------- // Make sure we're only killing stuff on our db //----------------------------------------- if ($r['db'] == $this->settings['sql_database'] and $r['Command'] == 'Sleep' and $r['Time'] > 60) { $this->DB->return_die = true; $this->DB->query("KILL {$r['Id']}"); /* Log */ IPSDebug::addLogMessage('Task - MySQL Clean Up Performed. Killed id ' . $r['Id'], 'mysqlCleanUp', $r); } } $this->DB->return_die = false; //----------------------------------------- // Log to log table - modify but dont delete //----------------------------------------- $this->class->appendTaskLog($this->task, $this->lang->words['task_mysqlcleanup']); //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->unlockTask($this->task); }
/** * Run this task * * @access public * @return void */ public function runTask() { $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); $this->DB->build(array('select' => 'views_member_id, COUNT(*) as profile_views', 'from' => 'profile_portal_views', 'group' => 'views_member_id')); $o = $this->DB->execute(); while ($r = $this->DB->fetch($o)) { //----------------------------------------- // Update... //----------------------------------------- $this->DB->update('members', 'members_profile_views=members_profile_views+' . intval($r['profile_views']), "member_id=" . intval($r['views_member_id']), false, true); } //----------------------------------------- // Delete from table //----------------------------------------- $this->DB->delete('profile_portal_views'); //----------------------------------------- // Log to log table - modify but dont delete //----------------------------------------- $this->class->appendTaskLog($this->task, $this->lang->words['task_profileviews']); //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->unlockTask($this->task); }
/** * Run this task * * @access public * @return void */ public function runTask() { $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); //----------------------------------------- // Spider Logs //----------------------------------------- if ($this->settings['ipb_prune_spider']) { $this->DB->delete("spider_logs", "entry_date < " . (time() - 60 * 60 * 24 * 30)); } //----------------------------------------- // Admin Login Logs //----------------------------------------- if ($this->settings['prune_admin_login_logs']) { $this->DB->delete("admin_login_logs", "admin_time < " . (time() - 60 * 60 * 24 * 30)); } //----------------------------------------- // Task Logs //----------------------------------------- if ($this->settings['ipb_prune_task']) { $this->DB->delete("task_logs", "log_date < " . (time() - 60 * 60 * 24 * 30)); } //----------------------------------------- // Admin Logs //----------------------------------------- if ($this->settings['ipb_prune_admin']) { $this->DB->delete("admin_logs", "ctime < " . (time() - 60 * 60 * 24 * 30)); } //----------------------------------------- // Mod Logs //----------------------------------------- if ($this->settings['ipb_prune_mod']) { $this->DB->delete("moderator_logs", "ctime < " . (time() - 60 * 60 * 24 * 30)); } //----------------------------------------- // Email Logs //----------------------------------------- if ($this->settings['ipb_prune_email']) { $this->DB->delete("email_logs", "email_date < " . (time() - 60 * 60 * 24 * 30)); } //----------------------------------------- // Email Error Logs //----------------------------------------- if ($this->settings['ipb_prune_emailerror']) { $this->DB->delete("mail_error_logs", "mlog_date < " . (time() - 60 * 60 * 24 * 30)); } //----------------------------------------- // Error Logs //----------------------------------------- if ($this->settings['prune_error_logs']) { $this->DB->delete("error_logs", "log_date < " . (time() - 60 * 60 * 24 * 30)); } //----------------------------------------- // SQL Error Logs // --Only prune older than 30 days //----------------------------------------- if ($this->settings['ipb_prune_sql']) { try { foreach (new DirectoryIterator(DOC_IPS_ROOT_PATH . 'cache') as $file) { if ($file->isDot() or !$file->isFile()) { continue; } if (preg_match("#^sql_error_log_(\\d+)_(\\d+)_(\\d+).cgi\$#", $file->getFilename(), $matches)) { if ($file->getMTime() < time() - 60 * 60 * 24 * 30) { @unlink($file->getPathname()); } } } } catch (Exception $e) { } } //----------------------------------------- // Log to log table - modify but dont delete //----------------------------------------- $this->class->appendTaskLog($this->task, $this->lang->words['task_logprune']); //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->unlockTask($this->task); }