2006-11-10 16:30:01 +01:00
|
|
|
<?php
|
2007-06-08 00:08:38 +02:00
|
|
|
/**
|
|
|
|
* eGroupWare - importexport
|
|
|
|
*
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @package importexport
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @author Cornelius Weiss <nelius@cwtech.de>
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
2006-11-10 16:30:01 +01:00
|
|
|
|
2008-10-14 10:42:09 +02:00
|
|
|
if (!extension_loaded('dom'))
|
|
|
|
{
|
|
|
|
echo "<p>Required PHP DOM extension missing, installation of ImportExport definitions aborted.</p>\n";
|
|
|
|
return; // otherwise we mess up the whole eGroupware install process
|
|
|
|
}
|
2010-03-29 15:10:01 +02:00
|
|
|
require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.importexport_definitions_bo.inc.php');
|
2007-06-21 17:09:51 +02:00
|
|
|
|
2007-06-22 00:03:50 +02:00
|
|
|
// This sets up $GLOBALS['egw']->accounts and $GLOBALS['egw']->db
|
|
|
|
$GLOBALS['egw_setup']->setup_account_object();
|
2007-06-08 00:08:38 +02:00
|
|
|
|
2007-06-22 00:03:50 +02:00
|
|
|
// step through every source code intstalled app
|
|
|
|
$egwdir = dir(EGW_INCLUDE_ROOT);
|
|
|
|
while (false !== ($appdir = $egwdir->read())) {
|
2011-01-26 01:28:14 +01:00
|
|
|
$defdir = EGW_INCLUDE_ROOT. "/$appdir/setup/";
|
2007-06-22 00:03:50 +02:00
|
|
|
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;
|
2010-03-29 15:10:01 +02:00
|
|
|
importexport_definitions_bo::import( $file );
|
2007-06-22 00:03:50 +02:00
|
|
|
}
|
2011-03-16 18:07:32 +01:00
|
|
|
|
|
|
|
// Set as default definition for the app, if there is no site default yet
|
|
|
|
if(!$GLOBALS['egw']->preferences->default[$appdir]['nextmatch-export-definition']) {
|
|
|
|
$bo = new importexport_definitions_bo(array('name' => "export-$appdir"));
|
|
|
|
$definitions = $bo->get_definitions();
|
|
|
|
if($definitions[0]) {
|
|
|
|
$definition = $definition[0];
|
|
|
|
$GLOBALS['egw']->preferences->add($appdir, 'nextmatch-export-definition', "export-$appdir", 'default');
|
|
|
|
$GLOBALS['egw']->preferences->save_repository(true, 'default');
|
|
|
|
}
|
|
|
|
}
|
2007-06-08 00:08:38 +02:00
|
|
|
}
|