wp/wp-content/plugins/blog-copier/blog-copier.php
changeset 5 5e2f62d02dcd
parent 4 346c88efed21
--- a/wp/wp-content/plugins/blog-copier/blog-copier.php	Mon Jun 08 16:11:51 2015 +0000
+++ b/wp/wp-content/plugins/blog-copier/blog-copier.php	Tue Jun 09 03:35:32 2015 +0200
@@ -3,12 +3,12 @@
 Plugin Name: Blog Copier
 Plugin URI: http://wordpress.org/extend/plugins/blog-copier/
 Description: Enables superusers to copy existing sub blogs to new sub blogs.
-Version: 1.0.5
+Version: 1.0.7
 Author: Modern Tribe, Inc.
 Network: true
 Author URI: http://tri.be
 
-Copyright: (C) 2012 Modern Tribe derived from (C) 2010 Ron Rennick, All rights reserved.
+Copyright: (C) 2014 Modern Tribe derived from (C) 2010 Ron Rennick, All rights reserved.
 
 See http://wpebooks.com/replicator/ for original code.
 
@@ -251,6 +251,7 @@
 					}
 					$msg = sprintf(__( 'Copied: %s in %s seconds', $this->_domain ),'<a href="http://'.$newdomain.'" target="_blank">'.$title.'</a>', number_format_i18n(timer_stop()));
 					do_action( 'log', __( 'Copy Complete!', $this->_domain ), $this->_domain, $msg );
+					do_action( 'copy_blog_complete', $from_blog_id, $to_blog_id );
 				}
 			} else {
 				$msg = $to_blog_id->get_error_message();
@@ -311,8 +312,13 @@
 					$wpdb->get_results($query);
 				}
 
-				// apply key opptions from new blog.
 				switch_to_blog( $to_blog_id );
+
+				// caches will be incorrect after direct DB copies
+				wp_cache_delete( 'notoptions', 'options' );
+				wp_cache_delete( 'alloptions', 'options' );
+
+				// apply key options from new blog.
 				foreach( $saved_options as $option_name => $option_value ) {
 					update_option( $option_name, $option_value );
 				}
@@ -326,7 +332,10 @@
 						$raw_option_name = substr($option->option_name,$from_blog_prefix_length);
 						$wpdb->update( $wpdb->options, array( 'option_name' => $to_blog_prefix . $raw_option_name ), array( 'option_id' => $option->option_id ) );
 					}
-					wp_cache_flush();
+
+					// caches will be incorrect after direct DB copies
+					wp_cache_delete( 'notoptions', 'options' );
+					wp_cache_delete( 'alloptions', 'options' );
 				}
 
 				// Fix GUIDs on copied posts