From 6b7d0465642178fdb0bc0e08984bf60050ad4ce8 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 25 Aug 2016 18:15:33 +0200 Subject: [PATCH] * 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 --- api/setup/setup.inc.php | 2 +- api/setup/tables_update.inc.php | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/api/setup/setup.inc.php b/api/setup/setup.inc.php index c6cfcc6f37..fdf3b78961 100755 --- a/api/setup/setup.inc.php +++ b/api/setup/setup.inc.php @@ -12,7 +12,7 @@ /* Basic information about this app */ $setup_info['api']['name'] = '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']['enable'] = 3; $setup_info['api']['app_order'] = 1; diff --git a/api/setup/tables_update.inc.php b/api/setup/tables_update.inc.php index 4f2d72cbdb..c236848760 100644 --- a/api/setup/tables_update.inc.php +++ b/api/setup/tables_update.inc.php @@ -84,3 +84,36 @@ function api_upgrade16_1_001() } 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'; +}