1: <?php
2: /**
3: * Login system task for automated upgrade tasks.
4: * These tasks REQUIRE IMP authentication.
5: *
6: * Copyright 2009-2012 Horde LLC (http://www.horde.org/)
7: *
8: * See the enclosed file COPYING for license information (GPL). If you
9: * did not receive this file, see http://www.horde.org/licenses/gpl.
10: *
11: * @author Michael Slusarz <slusarz@horde.org>
12: * @category Horde
13: * @license http://www.horde.org/licenses/gpl GPL
14: * @package IMP
15: */
16: class IMP_LoginTasks_SystemTask_UpgradeAuth extends Horde_Core_LoginTasks_SystemTask_Upgrade
17: {
18: /**
19: */
20: protected $_app = 'imp';
21:
22: /**
23: */
24: protected $_auth = true;
25:
26: /**
27: */
28: protected $_versions = array(
29: '5.0'
30: );
31:
32: /**
33: */
34: protected function _upgrade($version)
35: {
36: switch ($version) {
37: case '5.0':
38: $this->_upgradeExpireImapCache();
39: break;
40: }
41: }
42:
43: /**
44: * Expire existing IMAP cache.
45: */
46: protected function _upgradeExpireImapCache()
47: {
48: try {
49: $ob = $GLOBALS['injector']->getInstance('IMP_Factory_Imap')->create()->ob;
50:
51: if ($cache = $ob->getCache()) {
52: $ob->login();
53:
54: $mboxes = $ob->listMailboxes('*', Horde_Imap_Client::MBOX_ALL, array('flat' => true));
55:
56: foreach ($mboxes as $val) {
57: $ob->cache->deleteMailbox($val);
58: }
59: }
60: } catch (Exception $e) {}
61: }
62:
63: }
64: