Exemplo n.º 1
0
 /**
  * Clean up tasks that should be done hourly. This task cannot be relied on
  * to run every hour, consistently.
  */
 public static function runHourlyCleanUp()
 {
     // delete unassociated attachments
     $unassociatedAttachCutOff = XenForo_Application::$time - 86400;
     $attachmentModel = XenForo_Model::create('XenForo_Model_Attachment');
     $attachmentModel->deleteUnassociatedAttachments($unassociatedAttachCutOff);
     $attachmentModel->deleteUnusedAttachmentData();
     // delete expired sessions
     $session = new XenForo_Session();
     $session->deleteExpiredSessions();
     // delete expired admin sessions
     $session = new XenForo_Session(array('admin' => true));
     $session->deleteExpiredSessions();
     // delete expired session activities
     $sessionModel = XenForo_Model::create('XenForo_Model_Session');
     $sessionCleanUpCutOff = XenForo_Application::$time - 3600;
     $sessionModel->updateUserLastActivityFromSessions();
     $sessionModel->deleteSessionActivityOlderThanCutOff($sessionCleanUpCutOff);
     // delete expired thread redirects
     $threadRedirectModel = XenForo_Model::create('XenForo_Model_ThreadRedirect');
     $redirects = $threadRedirectModel->getExpiredThreadRedirects(XenForo_Application::$time);
     $threadRedirectModel->deleteThreadRedirects(array_keys($redirects));
     XenForo_Model::create('XenForo_Model_Alert')->deleteOldReadAlerts();
     XenForo_Model::create('XenForo_Model_Alert')->deleteOldUnreadAlerts();
     XenForo_Model::create('XenForo_Model_NewsFeed')->deleteOldNewsFeedItems();
     XenForo_Model::create('XenForo_Model_Login')->cleanUpLoginAttempts();
     XenForo_Model::create('XenForo_Model_CaptchaQuestion')->deleteOldCaptchas();
 }