/usr/share/horde/whups/lib/LoginTasks/SystemTask/Upgrade.php is in php-horde-whups 3.0.0~beta1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | <?php
/**
* Login system task for automated upgrade tasks.
*
* Copyright 2010-2013 Horde LLC (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (BSD). If you
* did not receive this file, see http://www.horde.org/licenses/bsdl.php.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/bsdl.php BSDL
* @package Whups
*/
class Whups_LoginTasks_SystemTask_Upgrade extends Horde_Core_LoginTasks_SystemTask_Upgrade
{
/**
*/
protected $_app = 'whups';
/**
*/
protected $_versions = array(
'2.0'
);
/**
*/
protected function _upgrade($version)
{
switch ($version) {
case '2.0':
$this->_upgradeAbookPrefs();
$this->_upgradeLayout();
break;
}
}
/**
* Upgrade to the new addressbook preferences.
*/
protected function _upgradeAbookPrefs()
{
global $prefs;
if (!$prefs->isDefault('search_sources')) {
$src = $prefs->getValue('search_sources');
if (!is_array(json_decode($src))) {
$prefs->setValue('search_sources', json_encode(explode("\t", $src)));
}
}
if (!$prefs->isDefault('search_fields')) {
$val = $prefs->getValue('search_fields');
if (!is_array(json_decode($val, true))) {
$fields = array();
foreach (explode("\n", $val) as $field) {
$field = trim($field);
if (!empty($field)) {
$tmp = explode("\t", $field);
if (count($tmp) > 1) {
$source = array_splice($tmp, 0, 1);
$fields[$source[0]] = $tmp;
}
}
}
$prefs->setValue('search_fields', $fields);
}
}
}
/**
* Upgrade mybugs_layout preference.
*/
protected function _upgradeLayout()
{
$bu = new Horde_Core_Block_Upgrade();
$bu->upgrade('mybugs_layout');
}
}
|