no need to manually (un)serialize vfs_fstab and detect old php serialize and new json_encoded values

This commit is contained in:
Ralf Becker 2014-06-27 07:48:44 +00:00
parent b612f5ad62
commit 7666292284
3 changed files with 9 additions and 10 deletions

View File

@ -1262,8 +1262,7 @@ class vfs_stream_wrapper implements iface_stream_wrapper
{
stream_register_wrapper(self::SCHEME,__CLASS__);
if (($fstab = $GLOBALS['egw_info']['server']['vfs_fstab']) &&
(is_array($fstab) || is_array($fstab = unserialize($fstab))) && count($fstab))
if (($fstab = $GLOBALS['egw_info']['server']['vfs_fstab']) && is_array($fstab) && count($fstab))
{
self::$fstab = $fstab;
}

View File

@ -18,17 +18,17 @@
*/
function vfs_storage_mode_options($config)
{
if (!isset($config['vfs_fstab']) || $config['vfs_fstab'] == serialize(array(
if (!isset($config['vfs_fstab']) || $config['vfs_fstab'] == json_encode($default=array(
'/' => 'sqlfs://$host/',
'/apps' => 'links://$host/apps',
)))
)) || $config['vfs_fstab'] == serialize($default)) // detect old serialized value too
{
$config['vfs_storage_mode'] = 'fs';
}
elseif($config['vfs_fstab'] == serialize(array(
elseif($config['vfs_fstab'] == json_encode($default_db=array(
'/' => 'sqlfs://$host/?storage=db',
'/apps' => 'links://$host/apps?storage=db',
)))
)) || $config['vfs_fstab'] == serialize($default_db)) // detect old serialized value too
{
$config['vfs_storage_mode'] = 'db';
}
@ -89,12 +89,12 @@ function encryptalgo($config)
if(!$found)
{
/* Something is wrong with their mcrypt install or php.ini */
$out = '<option value="">' . lang('no algorithms available') . '</option>' . "\n";;
$out = '<option value="">' . lang('no algorithms available') . '</option>' . "\n";
}
}
else
{
$out = '<option value="tripledes">TRIPLEDES</option>' . "\n";;
$out = '<option value="tripledes">TRIPLEDES</option>' . "\n";
}
return $out;
}

View File

@ -57,10 +57,10 @@ function vfs_storage_mode($settings)
config::save_value('vfs_fstab','','phpgwapi');
break;
case 'db':
config::save_value('vfs_fstab',serialize(array(
config::save_value('vfs_fstab', array(
'/' => 'sqlfs://$host/?storage=db',
'/apps' => 'links://$host/apps?storage=db',
)),'phpgwapi');
),'phpgwapi');
break;
}
}