From caae2ceeae02c033e9bb41171c0a7fde82ef89ec Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 22 Oct 2012 14:25:43 +0000 Subject: [PATCH] Prevent new categories from being created during dry-run --- .../inc/class.importexport_helper_functions.inc.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/importexport/inc/class.importexport_helper_functions.inc.php b/importexport/inc/class.importexport_helper_functions.inc.php index 089fabeff8..cb411f4852 100755 --- a/importexport/inc/class.importexport_helper_functions.inc.php +++ b/importexport/inc/class.importexport_helper_functions.inc.php @@ -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,12 +192,7 @@ class importexport_helper_functions { foreach ( $cat_names as $cat_name ) { $cat_name = trim($cat_name); if ( $cat_name == '' ) continue; - // Handle any IDs that slip in - if ( is_numeric($cat_name) && categories::id2name((int)$cat_name)) { - $cat_ids[] = (int)$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,