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