* All apps: default preferences wont save because merge-print template directory does not exist

creating /templates/$app now via update-script, if it does not already exist, it was already created for new installation and for EPL
This commit is contained in:
Ralf Becker 2016-08-25 18:15:33 +02:00
parent 25416167d9
commit 6b7d046564
2 changed files with 34 additions and 1 deletions

View File

@ -12,7 +12,7 @@
/* Basic information about this app */ /* Basic information about this app */
$setup_info['api']['name'] = 'api'; $setup_info['api']['name'] = 'api';
$setup_info['api']['title'] = 'EGroupware API'; $setup_info['api']['title'] = 'EGroupware API';
$setup_info['api']['version'] = '16.1.002'; $setup_info['api']['version'] = '16.1.003';
$setup_info['api']['versions']['current_header'] = '1.29'; $setup_info['api']['versions']['current_header'] = '1.29';
$setup_info['api']['enable'] = 3; $setup_info['api']['enable'] = 3;
$setup_info['api']['app_order'] = 1; $setup_info['api']['app_order'] = 1;

View File

@ -84,3 +84,36 @@ function api_upgrade16_1_001()
} }
return $GLOBALS['setup_info']['api']['currentver'] = '16.1.002'; return $GLOBALS['setup_info']['api']['currentver'] = '16.1.002';
} }
use EGroupware\Api\Vfs;
/**
* Create /templates and subdirectories, if they dont exist
*
* They are create as part of the installation for new installations and allways exist in EPL.
* If they dont exist, you can not save the preferences of the concerned applications, unless
* you either manually create the directory or remove the path from the default preferences.
*
* @return string
*/
function api_upgrade16_1_002()
{
$admins = $GLOBALS['egw_setup']->add_account('Admins','Admin','Group',False,False);
Vfs::$is_root = true;
foreach(array('','addressbook', 'calendar', 'infolog', 'tracker', 'timesheet', 'projectmanager', 'filemanager') as $app)
{
if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) continue;
// create directory and set permissions: Admins writable and other readable
$dir = '/templates'.($app ? '/'.$app : '');
if (Vfs::file_exists($dir)) continue;
Vfs::mkdir($dir, 075, STREAM_MKDIR_RECURSIVE);
Vfs::chgrp($dir, abs($admins));
Vfs::chmod($dir, 075);
}
Vfs::$is_root = false;
return $GLOBALS['setup_info']['api']['currentver'] = '16.1.003';
}