* @author Andrew Coleman <mercury@appisolutions.net>
* @package Horde_Maintenance
*/
-class Maintenance_Task_delete_attachments_monthly extends Maintenance_Task {
-
+class Maintenance_Task_delete_attachments_monthly extends Maintenance_Task
+{
/**
* Purges the old linked attachment folders.
*
*/
function doMaintenance()
{
- global $conf, $prefs;
-
- require_once IMP_BASE . '/lib/Compose.php';
- require_once 'Horde/Auth.php';
require_once 'VFS.php';
/* Find the UNIX timestamp of the last second that we will not
* purge. */
- $del_time = gmmktime(0, 0, 0, date('n') - $prefs->getValue('delete_attachments_monthly_keep'), 1, date('Y'));
+ $del_time = gmmktime(0, 0, 0, date('n') - $GLOBALS['prefs']->getValue('delete_attachments_monthly_keep'), 1, date('Y'));
- $vfs = &VFS::singleton($conf['vfs']['type'], Horde::getDriverConfig('vfs', $conf['vfs']['type']));
+ $vfs = &VFS::singleton($GLOBALS['conf']['vfs']['type'], Horde::getDriverConfig('vfs', $GLOBALS['conf']['vfs']['type']));
$path = IMP_Compose::VFS_LINK_ATTACH_PATH . '/' . Auth::getAuth();
/* Make sure cleaning is done recursively. */
* @author Michael Slusarz <slusarz@horde.org>
* @package Horde_Maintenance
*/
-class Maintenance_Task_delete_sentmail_monthly extends Maintenance_Task {
-
+class Maintenance_Task_delete_sentmail_monthly extends Maintenance_Task
+{
/**
* Purge the old sent-mail folders.
*
old sent-mail folders. Then sort this array according to
the date. */
include_once 'Horde/Identity.php';
- include_once IMP_BASE . '/lib/Folder.php';
$identity = &Identity::singleton(array('imp', 'imp'));
$imp_folder = &IMP_Folder::singleton();
*/
function describeMaintenance()
{
- global $prefs;
-
- return sprintf(_("All old sent-mail folders more than %s months old will be deleted."), $prefs->getValue('delete_sentmail_monthly_keep'));
+ return sprintf(_("All old sent-mail folders more than %s months old will be deleted."), $GLOBALS['prefs']->getValue('delete_sentmail_monthly_keep'));
}
}
* @author Michael Slusarz <slusarz@horde.org>
* @package Horde_Maintenance
*/
-class Maintenance_Task_fetchmail_login extends Maintenance_Task {
-
+class Maintenance_Task_fetchmail_login extends Maintenance_Task
+{
/**
* The style of the maintenance page output.
*
* @author Jan Schneider <jan@horde.org>
* @package Horde_Maintenance
*/
-class Maintenance_Task_purge_sentmail extends Maintenance_Task {
-
+class Maintenance_Task_purge_sentmail extends Maintenance_Task
+{
/**
* Purge old messages in the sent-mail folder.
*
{
global $prefs, $notification;
- require_once IMP_BASE . '/lib/Folder.php';
- require_once IMP_BASE . '/lib/Message.php';
$imp_folder = &IMP_Folder::singleton();
- $imp_imap = &IMP_IMAP::singleton();
$imp_message = &IMP_Message::singleton();
- $folder_list = Maintenance_Task_purge_sentmail::_getFolders();
+ $mbox_list = Maintenance_Task_purge_sentmail::_getFolders();
/* Get the current UNIX timestamp minus the number of days specified
* in 'purge_sentmail_keep'. If a message has a timestamp prior to
* this value, it will be deleted. */
- $del_time = date('r', time() - ($prefs->getValue('purge_sentmail_keep') * 86400));
+ $del_time = new DateTime(time() - ($prefs->getValue('purge_sentmail_keep') * 86400));
+ $month = $del_time->format('n');
+ $day = $del_time->format('j');
+ $year = $del_time->format('Y');
- foreach ($folder_list as $sentmail_folder) {
- /* Make sure the sent-mail folder exists. */
- if (!$imp_folder->exists($sentmail_folder)) {
+ foreach ($mbox_list as $mbox) {
+ /* Make sure the sent-mail mailbox exists. */
+ if (!$imp_folder->exists($mbox)) {
continue;
}
/* Open the sent-mail mailbox and get the list of messages older
* than 'purge_sentmail_keep' days. */
- $imp_imap->changeMbox($sentmail_folder, IMP_IMAP_AUTO);
- $msg_ids = @imap_search($imp_imap->stream(), "BEFORE \"$del_time\"", SE_UID);
+ $query = new Horde_Imap_Client_Search_Query();
+ $query->dateSearch($month, $day, $year, Horde_Imap_Client_Search_Query::DATE_BEFORE);
+ $msg_ids = $GLOBALS['imp_search']->runSearchQuery($query, $mbox);
if (empty($msg_ids)) {
continue;
}
/* Go through the message list and delete the messages. */
- $indices = array($sentmail_folder => $msg_ids);
- if ($imp_message->delete($indices, true)) {
+ if ($imp_message->delete(array($mbox => $msg_ids), true)) {
$msgcount = count($msg_ids);
if ($msgcount == 1) {
- $notification->push(sprintf(_("Purging 1 message from sent-mail folder %s."), IMP::displayFolder($sentmail_folder)), 'horde.message');
+ $notification->push(sprintf(_("Purging 1 message from sent-mail folder %s."), IMP::displayFolder($mbox)), 'horde.message');
} else {
- $notification->push(sprintf(_("Purging %d messages from sent-mail folder."), $msgcount, IMP::displayFolder($sentmail_folder)), 'horde.message');
+ $notification->push(sprintf(_("Purging %d messages from sent-mail folder."), $msgcount, IMP::displayFolder($mbox)), 'horde.message');
}
}
}
*/
function describeMaintenance()
{
- $folder_list = array_map(array('IMP', 'displayFolder'),
- Maintenance_Task_purge_sentmail::_getFolders());
+ $mbox_list = array_map(array('IMP', 'displayFolder'), Maintenance_Task_purge_sentmail::_getFolders());
return sprintf(_("All messages in the folder(s) \"%s\" older than %s days will be permanently deleted."),
- implode(', ', $folder_list),
+ implode(', ', $mbox_list),
$GLOBALS['prefs']->getValue('purge_sentmail_keep'));
}
* @author Matt Selsky <selsky@columbia.edu>
* @package Horde_Maintenance
*/
-class Maintenance_Task_purge_spam extends Maintenance_Task {
-
+class Maintenance_Task_purge_spam extends Maintenance_Task
+{
/**
* Purge old messages in the Spam folder.
*
}
/* Make sure the Spam folder exists. */
- require_once IMP_BASE . '/lib/Folder.php';
$imp_folder = &IMP_Folder::singleton();
if (!$imp_folder->exists($spam_folder)) {
return false;
/* Get the current UNIX timestamp minus the number of days
specified in 'purge_spam_keep'. If a message has a
timestamp prior to this value, it will be deleted. */
- $del_time = date("r", time() - ($prefs->getValue('purge_spam_keep') * 86400));
+ $del_time = new DateTime(time() - ($prefs->getValue('purge_spam_keep') * 86400));
+ $month = $del_time->format('n');
+ $day = $del_time->format('j');
+ $year = $del_time->format('Y');
- /* Open the Spam mailbox and get the list of messages older
- than 'purge_spam_keep' days. */
- require_once IMP_BASE . '/lib/Message.php';
- $imp_imap = &IMP_IMAP::singleton();
- $imp_message = &IMP_Message::singleton();
- $imp_imap->changeMbox($spam_folder, IMP_IMAP_AUTO);
- $msg_ids = @imap_search($imp_imap->stream(), "BEFORE \"$del_time\"", SE_UID);
+ /* Get the list of messages older than 'purge_spam_keep' days. */
+ $query = new Horde_Imap_Client_Search_Query();
+ $query->dateSearch($month, $day, $year, Horde_Imap_Client_Search_Query::DATE_BEFORE);
+ $msg_ids = $GLOBALS['imp_search']->runSearchQuery($query, $mbox);
if (empty($msg_ids)) {
return false;
}
/* Go through the message list and delete the messages. */
- $indices = array($spam_folder => $msg_ids);
- if ($imp_message->delete($indices, true)) {
+ $imp_message = &IMP_Message::singleton();
+ if ($imp_message->delete(array($spam_folder => $msg_ids), true)) {
$msgcount = count($msg_ids);
if ($msgcount == 1) {
$notification->push(_("Purging 1 message from Spam folder."), 'horde.message');
* @author Michael Slusarz <slusarz@horde.org>
* @package Horde_Maintenance
*/
-class Maintenance_Task_purge_trash extends Maintenance_Task {
-
+class Maintenance_Task_purge_trash extends Maintenance_Task
+{
/**
* Purge old messages in the Trash folder.
*
}
/* Make sure the Trash folder exists. */
- require_once IMP_BASE . '/lib/Folder.php';
$imp_folder = &IMP_Folder::singleton();
if (!$imp_folder->exists($trash_folder)) {
return false;
/* Get the current UNIX timestamp minus the number of days
specified in 'purge_trash_keep'. If a message has a
timestamp prior to this value, it will be deleted. */
- $del_time = date("r", time() - ($prefs->getValue('purge_trash_keep') * 86400));
+ $del_time = new DateTime(time() - ($prefs->getValue('purge_trash_keep') * 86400));
+ $month = $del_time->format('n');
+ $day = $del_time->format('j');
+ $year = $del_time->format('Y');
- /* Open the Trash mailbox and get the list of messages older
- than 'purge_trash_keep' days. */
- require_once IMP_BASE . '/lib/Message.php';
- $imp_imap = &IMP_IMAP::singleton();
- $imp_message = &IMP_Message::singleton();
- $imp_imap->changeMbox($trash_folder, IMP_IMAP_AUTO);
- $msg_ids = @imap_search($imp_imap->stream(), "BEFORE \"$del_time\"", SE_UID);
+ /* Get the list of messages older than 'purge_trash_keep' days. */
+ $query = new Horde_Imap_Client_Search_Query();
+ $query->dateSearch($month, $day, $year, Horde_Imap_Client_Search_Query::DATE_BEFORE);
+ $msg_ids = $GLOBALS['imp_search']->runSearchQuery($query, $mbox);
if (empty($msg_ids)) {
return false;
}
/* Go through the message list and delete the messages. */
- $indices = array($trash_folder => $msg_ids);
- if ($imp_message->delete($indices, true)) {
+ $imp_message = &IMP_Message::singleton();
+ if ($imp_message->delete(array($trash_folder => $msg_ids), true)) {
$msgcount = count($msg_ids);
if ($msgcount == 1) {
$notification->push(_("Purging 1 message from Trash folder."), 'horde.message');
* @author Michael Slusarz <slusarz@horde.org>
* @package Horde_Maintenance
*/
-class Maintenance_Task_rename_sentmail_monthly extends Maintenance_Task {
-
+class Maintenance_Task_rename_sentmail_monthly extends Maintenance_Task
+{
/**
* Renames the old sent-mail folders.
*
$success = true;
include_once 'Horde/Identity.php';
- include_once IMP_BASE . '/lib/Folder.php';
$identity = &Identity::singleton(array('imp', 'imp'));
$imp_folder = &IMP_Folder::singleton();
* @author Michael Slusarz <slusarz@horde.org>
* @package Horde_Maintenance
*/
-class Maintenance_Task_tos_agreement extends Maintenance_Task {
-
+class Maintenance_Task_tos_agreement extends Maintenance_Task
+{
/**
* The style of the maintenance page output.
*
<?php
require_once 'Horde/Maintenance.php';
-require_once $GLOBALS['registry']->get('fileroot', 'imp') . '/lib/base.php';
+require_once dirname(__FILE__) . '/../base.php';
/**
* The Maintenance_IMP class defines the maintenance operations run upon