From 3c14bd7f590436666064a8c8208cf2ee95c76de0 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 7 Jun 2011 15:29:50 +0000 Subject: [PATCH] import i/e defintions on update --- importexport/setup/tables_update.inc.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/importexport/setup/tables_update.inc.php b/importexport/setup/tables_update.inc.php index d32dfea6b9..cbbf626b27 100755 --- a/importexport/setup/tables_update.inc.php +++ b/importexport/setup/tables_update.inc.php @@ -67,6 +67,30 @@ function importexport_upgrade1_9_002() $GLOBALS['egw_setup']->db->concat("','", 'allowed_users', "','"); $GLOBALS['egw_setup']->oProc->query($sql, __LINE__, __FILE__); + // import i/e defintions + if (extension_loaded('dom')) + { + require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.importexport_definitions_bo.inc.php'); + + // This sets up $GLOBALS['egw']->accounts and $GLOBALS['egw']->db + $GLOBALS['egw_setup']->setup_account_object(); + + // step through every source code intstalled app + $egwdir = dir(EGW_INCLUDE_ROOT); + while (false !== ($appdir = $egwdir->read())) { + $defdir = EGW_INCLUDE_ROOT. "/$appdir/setup/"; + if ( !is_dir( $defdir ) ) continue; + + // step through each file in defdir of app + $d = dir($defdir); + while (false !== ($entry = $d->read())) { + $file = $defdir. '/'. $entry; + list( $filename, $extension) = explode('.',$entry); + if ( $extension != 'xml' ) continue; + importexport_definitions_bo::import( $file ); + } + } + } // give Default and Admins group rights for ImportExport foreach(array('Default' => 'Default','Admins' => 'Admin') as $account_lid => $name) {