WP Staging – DB & File Duplicator & Migration - Version 1.0.3

Version Description

  • Fix: Missing const MASHFS_VERSION
  • Fix: Remove error "table XY has been created, BUT inserting rows failed."
  • Fix: Not tested up to 4.4.2 message shown although it's tested up to WP 4.4.2
  • New: Disable either free or pro version and does not allow to have both version enabled at the same time
Download this release

Release Info

Developer ReneHermi
Plugin Icon 128x128 WP Staging – DB & File Duplicator & Migration
Version 1.0.3
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.3

includes/admin/admin-notices.php CHANGED
@@ -21,8 +21,9 @@ if ( ! defined( 'ABSPATH' ) ) exit;
21
  */
22
  function wpstg_admin_messages() {
23
  global $wpstg_options;
 
24
 
25
- if ( wpstg_is_admin_page() && !wp_is_writable( wpstg_get_upload_dir() ) ){
26
  echo '<div class="error">';
27
  echo '<p><strong>WP Staging File Permission error: </strong>' . wpstg_get_upload_dir() . ' is not write and/or readable. <br> Check if the folder <strong>'.wpstg_get_upload_dir().'</strong> exists! File permissions should be chmod 755 or 777.</p>';
28
  echo '</div>';
@@ -57,6 +58,7 @@ function wpstg_admin_messages() {
57
  }
58
 
59
  echo wpstg_show_beta_message();
 
60
 
61
  $install_date = get_option('wpstg_installDate');
62
  $display_date = date('Y-m-d h:i:s');
@@ -114,6 +116,27 @@ function wpstg_admin_messages() {
114
  }
115
  add_action( 'admin_notices', 'wpstg_admin_messages' );
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  /* Hide the rating div
118
  *
119
  * @subpackage Admin/Notices
21
  */
22
  function wpstg_admin_messages() {
23
  global $wpstg_options;
24
+
25
 
26
+ if ( wpstg_is_admin_page() && !wp_is_writable( wpstg_get_upload_dir() ) ){
27
  echo '<div class="error">';
28
  echo '<p><strong>WP Staging File Permission error: </strong>' . wpstg_get_upload_dir() . ' is not write and/or readable. <br> Check if the folder <strong>'.wpstg_get_upload_dir().'</strong> exists! File permissions should be chmod 755 or 777.</p>';
29
  echo '</div>';
58
  }
59
 
60
  echo wpstg_show_beta_message();
61
+ wpstg_plugin_deactivated_notice();
62
 
63
  $install_date = get_option('wpstg_installDate');
64
  $display_date = date('Y-m-d h:i:s');
116
  }
117
  add_action( 'admin_notices', 'wpstg_admin_messages' );
118
 
119
+
120
+ /**
121
+ * Show a message when pro or free plugin become disabled
122
+ *
123
+ * @return void
124
+ */
125
+ function wpstg_plugin_deactivated_notice() {
126
+ if (false !== ( $deactivated_notice_id = get_transient('wp_staging_deactivated_notice_id') )) {
127
+ if ('1' === $deactivated_notice_id) {
128
+ $message = __("WP Staging and WP Staging Pro cannot both be active. We've automatically deactivated WP Staging.", 'wpstg');
129
+ } else {
130
+ $message = __("WP Staging and WP Staging Pro cannot both be active. We've automatically deactivated WP Staging Pro.", 'wpstg');
131
+ }
132
+ ?>
133
+ <div class="updated notice is-dismissible" style="border-left: 4px solid #ffba00;">
134
+ <p><?php echo esc_html($message); ?></p>
135
+ </div> <?php
136
+ delete_transient('wp_staging_deactivated_notice_id');
137
+ }
138
+ }
139
+
140
  /* Hide the rating div
141
  *
142
  * @subpackage Admin/Notices
includes/admin/settings/register-settings.php CHANGED
@@ -200,7 +200,7 @@ function wpstg_get_registered_settings() {
200
  'uninstall_on_delete' => array(
201
  'id' => 'uninstall_on_delete',
202
  'name' => __( 'Remove Data on Uninstall?', 'mashsb' ),
203
- 'desc' => __( 'Check this box if you like WP Staging to completely remove all of its data when the plugin is deleted.', 'mashsb' ),
204
  'type' => 'checkbox'
205
  ),
206
 
200
  'uninstall_on_delete' => array(
201
  'id' => 'uninstall_on_delete',
202
  'name' => __( 'Remove Data on Uninstall?', 'mashsb' ),
203
+ 'desc' => __( 'Check this box if you like WP Staging to completely remove all of its data when the plugin is deleted. This will not remove staging sites files or database tables.', 'mashsb' ),
204
  'type' => 'checkbox'
205
  ),
206
 
includes/scripts.php CHANGED
@@ -74,7 +74,7 @@ function wpstg_load_staging_styles() {
74
  $url = $css_dir . 'wpstg-admin-bar' . $suffix . '.css';
75
 
76
  if(wpstg_is_staging_site()) { // Load it on all pages
77
- wp_register_style( 'wpstg-admin-bar', $url, array(), MASHFS_VERSION, 'all' );
78
  wp_enqueue_style( 'wpstg-admin-bar' );
79
  }
80
  }
74
  $url = $css_dir . 'wpstg-admin-bar' . $suffix . '.css';
75
 
76
  if(wpstg_is_staging_site()) { // Load it on all pages
77
+ wp_register_style( 'wpstg-admin-bar', $url, array(), WPSTG_VERSION, 'all' );
78
  wp_enqueue_style( 'wpstg-admin-bar' );
79
  }
80
  }
includes/template-functions.php CHANGED
@@ -707,10 +707,9 @@ function wpstg_clone_db_internal() {
707
  wpstg_return_json('wpstg_clone_db_internal', 'success', wpstg_get_log_data($progress) . $log_data, $wpstg_clone_details['db_progress'], wpstg_get_runtime());
708
  }
709
  } else {
710
- WPSTG()->logger->info('Table ' . $new_table . ' has been created, BUT inserting rows failed. This happens sometimes when a table had been updated during staging process. Exclude this table from copying and try again. Offset: ' . $offset . '');
711
  wpstg_save_options();
712
- wpstg_return_json('wpstg_clone_db_internal', 'fail', 'Table ' . $new_table . ' has been created, BUT inserting rows failed. This happens sometimes when a table had been updated during staging process. Exclude this table from copying and try again. Offset: ' . $offset, $wpstg_clone_details['db_progress'] . ' ', wpstg_get_runtime());
713
-
714
  }
715
  } else {
716
  WPSTG()->logger->info('Creating table ' . $table . ' has been failed.');
707
  wpstg_return_json('wpstg_clone_db_internal', 'success', wpstg_get_log_data($progress) . $log_data, $wpstg_clone_details['db_progress'], wpstg_get_runtime());
708
  }
709
  } else {
710
+ WPSTG()->logger->info('Table ' . $new_table . ' has been created, but inserting rows failed! Rows will be skipped. Offset: ' . $offset . '');
711
  wpstg_save_options();
712
+ //wpstg_return_json('wpstg_clone_db_internal', 'fail', 'Table ' . $new_table . ' has been created, BUT inserting rows failed. This happens sometimes when a table had been updated during staging process. Exclude this table from copying and try again. Offset: ' . $offset, $wpstg_clone_details['db_progress'] . ' ', wpstg_get_runtime());
 
713
  }
714
  } else {
715
  WPSTG()->logger->info('Creating table ' . $table . ' has been failed.');
includes/wpstg-utils.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPSTG_Utils {
4
+
5
+
6
+ /**
7
+ * Checks if another version of WPSTG (Pro) is active and deactivates it.
8
+ * To be hooked on `activated_plugin` so other plugin is deactivated when current plugin is activated.
9
+ *
10
+ * @param string $plugin
11
+ *
12
+ */
13
+ public static function deactivate_other_instances( $plugin ) {
14
+ if ( ! in_array( basename( $plugin ), array( 'wp-staging-pro.php', 'wp-staging.php' ) ) ) {
15
+ return;
16
+ }
17
+
18
+ $plugin_to_deactivate = 'wp-staging.php';
19
+ $deactivated_notice_id = '1';
20
+ if ( basename( $plugin ) == $plugin_to_deactivate ) {
21
+ $plugin_to_deactivate = 'wp-staging-pro.php';
22
+ $deactivated_notice_id = '2';
23
+ }
24
+
25
+ if ( is_multisite() ) {
26
+ $active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
27
+ $active_plugins = array_keys( $active_plugins );
28
+ } else {
29
+ $active_plugins = (array) get_option( 'active_plugins', array() );
30
+ }
31
+
32
+ foreach ( $active_plugins as $basename ) {
33
+ if ( false !== strpos( $basename, $plugin_to_deactivate ) ) {
34
+ set_transient( 'wp_staging_deactivated_notice_id', $deactivated_notice_id, 1 * HOUR_IN_SECONDS );
35
+ deactivate_plugins( $basename );
36
+
37
+ return;
38
+ }
39
+ }
40
+ }
41
+
42
+ }
readme.txt CHANGED
@@ -6,10 +6,10 @@ Contributors: ReneHermi, WP-Staging
6
  Donate link: https://wordpress.org/plugins/wp-staging
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
- Tags: staging, migration, wordpress migration, wordpress staging, development, migrate, cloning, clone, database export, database find replace, database serialization, duplication, duplicator, duplicate, site duplicate, duplicate posts, db backup, file backup, backup, db migration, db restore, website backup, website staging, website deploy, staging, admin, page, content, plugin, media, backup, test, test site, testing, sandbox, widget, post, plugin, admin, posts, sidebar, shortcode, google, administration, ajax, api, authentication, blog, code, comments, contact, dashboard, multisite, theme
10
  Requires at least: 3.6+
11
- Tested up to: 4.4.1
12
- Stable tag: 1.0.1
13
 
14
  A duplicator plugin! Clone, duplicate and migrate live sites to independent staging and development sites that are available only to administrators.
15
 
@@ -141,6 +141,16 @@ After installation goto the settings page 'Staging' and do your adjustments ther
141
 
142
  == Changelog ==
143
 
 
 
 
 
 
 
 
 
 
 
144
  = 1.0.1 =
145
  * New: Orange colored admin bar on staging site for better visualization and comparision between production live site and staging site
146
  * Tweak: Remove contact link on multisite notification
@@ -203,5 +213,5 @@ After installation goto the settings page 'Staging' and do your adjustments ther
203
 
204
  == Upgrade Notice ==
205
 
206
- = 0.9.7 =
207
- 0.9.7 <strong> * New: Tested up to wp 4.3.1</strong>
6
  Donate link: https://wordpress.org/plugins/wp-staging
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
+ Tags: staging, duplication, cloning, clone, migration, sandbox, test site, testing, backup, post, admin, administration, duplicate posts
10
  Requires at least: 3.6+
11
+ Tested up to: 4.4.2
12
+ Stable tag: 1.0.3
13
 
14
  A duplicator plugin! Clone, duplicate and migrate live sites to independent staging and development sites that are available only to administrators.
15
 
141
 
142
  == Changelog ==
143
 
144
+ = 1.0.3 =
145
+ * Fix: Missing const MASHFS_VERSION
146
+ * Fix: Remove error "table XY has been created, BUT inserting rows failed."
147
+ * Fix: Not tested up to 4.4.2 message shown although it's tested up to WP 4.4.2
148
+ * New: Disable either free or pro version and does not allow to have both version enabled at the same time
149
+
150
+ = 1.0.2 =
151
+ * Tweak: Change setting description of uninstall option
152
+ * Tweak: Lower tags in readme.txt
153
+
154
  = 1.0.1 =
155
  * New: Orange colored admin bar on staging site for better visualization and comparision between production live site and staging site
156
  * Tweak: Remove contact link on multisite notification
213
 
214
  == Upgrade Notice ==
215
 
216
+ = 1.0.3 =
217
+ 1.0.3 <strong>Compatible up to WP 4.4.2</strong>
wp-staging.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: WP-Staging - Create a staging clone site for testing & developing
6
  * Author: WP-Staging, René Hermenau
7
  * Author URI: https://wordpress.org/plugins/wp-staging
8
- * Version: 1.0.1
9
  * Text Domain: wpstg
10
  * Domain Path: languages
11
 
@@ -26,7 +26,6 @@
26
  * @package WPSTG
27
  * @category Core
28
  * @author René Hermenau
29
- * @version 0.9.1
30
  */
31
  // Exit if accessed directly
32
  if (!defined('ABSPATH'))
@@ -34,11 +33,11 @@ if (!defined('ABSPATH'))
34
 
35
  // Plugin version
36
  if (!defined('WPSTG_VERSION')) {
37
- define('WPSTG_VERSION', '1.0.1');
38
  }
39
  // Plugin version
40
  if (!defined('WPSTG_WP_COMPATIBLE')) {
41
- define('WPSTG_WP_COMPATIBLE', '4.4.1');
42
  }
43
 
44
  if (!class_exists('wpstaging')) :
@@ -245,4 +244,11 @@ function WPSTG() {
245
  }
246
 
247
  // Get WPSTG Running
248
- WPSTG();
 
 
 
 
 
 
 
5
  * Description: WP-Staging - Create a staging clone site for testing & developing
6
  * Author: WP-Staging, René Hermenau
7
  * Author URI: https://wordpress.org/plugins/wp-staging
8
+ * Version: 1.0.3
9
  * Text Domain: wpstg
10
  * Domain Path: languages
11
 
26
  * @package WPSTG
27
  * @category Core
28
  * @author René Hermenau
 
29
  */
30
  // Exit if accessed directly
31
  if (!defined('ABSPATH'))
33
 
34
  // Plugin version
35
  if (!defined('WPSTG_VERSION')) {
36
+ define('WPSTG_VERSION', '1.0.3');
37
  }
38
  // Plugin version
39
  if (!defined('WPSTG_WP_COMPATIBLE')) {
40
+ define('WPSTG_WP_COMPATIBLE', '4.4.2');
41
  }
42
 
43
  if (!class_exists('wpstaging')) :
244
  }
245
 
246
  // Get WPSTG Running
247
+ WPSTG();
248
+
249
+ if ( ! class_exists( 'WPSTG_Utils' ) ) {
250
+ require dirname( __FILE__ ) . '/includes/wpstg-utils.php';
251
+ }
252
+
253
+ // Deactivate WPSTG (Pro)
254
+ add_action( 'activated_plugin', array( 'WPSTG_Utils', 'deactivate_other_instances' ) );