mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Prevent new categories from being created during dry-run
This commit is contained in:
parent
ae77723140
commit
34f8f7db08
@ -21,6 +21,11 @@ class importexport_helper_functions {
|
||||
*/
|
||||
const CACHE_EXPIRATION = 3600;
|
||||
|
||||
/**
|
||||
* Make no changes (automatic category creation)
|
||||
*/
|
||||
public static $dry_run = false;
|
||||
|
||||
/**
|
||||
* Files known to cause problems, and will be skipped in a plugin scan
|
||||
* If you put appname => true, the whole app will be skipped.
|
||||
@ -187,7 +192,7 @@ class importexport_helper_functions {
|
||||
foreach ( $cat_names as $cat_name ) {
|
||||
$cat_name = trim($cat_name);
|
||||
if ( $cat_name == '' ) continue;
|
||||
if ( ( $cat_id = $cats->name2id( $cat_name ) ) == 0 ) {
|
||||
if ( ( $cat_id = $cats->name2id( $cat_name ) ) == 0 && !self::$dry_run) {
|
||||
$cat_id = $cats->add( array(
|
||||
'name' => $cat_name,
|
||||
'parent' => $parent,
|
||||
|
@ -97,6 +97,7 @@
|
||||
{
|
||||
// Set this so plugin doesn't do any data changes
|
||||
$content['dry-run'] = true;
|
||||
importexport_helper_functions::$dry_run = true;
|
||||
$this->message .= '<b>' . lang('Import aborted').":</b><br />\n";
|
||||
$definition_obj->plugin_options = (array)$definition_obj->plugin_options + array('dry_run' => true);
|
||||
}
|
||||
@ -105,6 +106,10 @@
|
||||
{
|
||||
echo $this->preview($plugin, $file, $definition_obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
importexport_helper_functions::$dry_run = false;
|
||||
}
|
||||
$count = $plugin->import($file, $definition_obj);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user