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

Version Description

  • New: Tested up to WP 4.6
  • New: Create a poll and ask what feature is most required
Download this release

Release Info

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

Code changes from version 1.0.9 to 1.1.0

includes/admin/admin-notices.php CHANGED
@@ -21,9 +21,15 @@ if ( ! defined( 'ABSPATH' ) ) exit;
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 Folder 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>';
@@ -89,7 +95,7 @@ function wpstg_admin_messages() {
89
  async: !0,
90
  success: function(e) {
91
  if (e=="success") {
92
- jQuery(\'.wpstg_fivestar\').slideUp(\'slow\');
93
  }
94
  }
95
  });
@@ -104,7 +110,7 @@ function wpstg_admin_messages() {
104
  async: !0,
105
  success: function(e) {
106
  if (e=="success") {
107
- jQuery(\'.wpstg_beta_notice\').slideUp(\'slow\');
108
  }
109
  }
110
  });
@@ -116,6 +122,69 @@ function wpstg_admin_messages() {
116
  }
117
  add_action( 'admin_notices', 'wpstg_admin_messages' );
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
  /**
121
  * Show a message when pro or free plugin become disabled
21
  */
22
  function wpstg_admin_messages() {
23
  global $wpstg_options;
24
+
25
+ // show admin notices only to admins
26
+ if( !current_user_can( 'update_plugins' ) ) {
27
+ return;
28
+ }
29
+
30
+ wpstg_start_poll();
31
+
32
+ if ( wpstg_is_admin_page() && !wp_is_writable( wpstg_get_upload_dir() ) ){
33
  echo '<div class="error">';
34
  echo '<p><strong>WP Staging Folder 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>';
35
  echo '</div>';
95
  async: !0,
96
  success: function(e) {
97
  if (e=="success") {
98
+ jQuery(\'.wpstg_fivestar\').slideUp(\'fast\');
99
  }
100
  }
101
  });
110
  async: !0,
111
  success: function(e) {
112
  if (e=="success") {
113
+ jQuery(\'.wpstg_beta_notice\').slideUp(\'fast\');
114
  }
115
  }
116
  });
122
  }
123
  add_action( 'admin_notices', 'wpstg_admin_messages' );
124
 
125
+ /**
126
+ * Ask for a doing a poll
127
+ */
128
+ function wpstg_start_poll(){
129
+
130
+ $install_date = get_option('wpstg_installDate');
131
+ $display_date = date('Y-m-d h:i:s');
132
+ $datetime1 = new DateTime($install_date);
133
+ $datetime2 = new DateTime($display_date);
134
+ $diff_intrval = round(($datetime2->format('U') - $datetime1->format('U')) / (60*60*24));
135
+
136
+ if($diff_intrval >= 10 && get_option('wpstg_start_poll') !== 'no')
137
+ {
138
+ echo '<div class="wpstg_poll update-nag" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
139
+ <p>Great, You are using <strong>WP Staging</strong> for a while. Hope you are happy with it.<br><br>Are you interested in copying changes from WPStaging staging site back to your live site?
140
+ <br><br>Click on the <a href="" target="_blank"><i>Yes, i am interested</i></a> Button and fill out the poll!<br>It only takes one (1) minute of your time - I promise!
141
+ <br><br>Cheers,<br>René
142
+ <ul>
143
+ <li class="float:left"><a href="https://docs.google.com/forms/d/e/1FAIpQLScZ-dO5WffV3xObn16LwG05tr1HrADD_8L4wbTxPHqoPssVcg/viewform?c=0&w=1&usp=mail_form_link" class="thankyou button button-primary" target="_new" title=Yes, i am interested" style="color: #ffffff;font-weight: normal;margin-right:10px;float:left;">Yes, i am interested</a></li>
144
+ <li><a href="javascript:void(0);" class="wpstg_hide_poll" title="Close It" style="vertical-align:middle;">Do Not Ask Again</a></li>
145
+ </ul>
146
+ </div>
147
+ <script>
148
+ jQuery( document ).ready(function( $ ) {
149
+ jQuery(\'.wpstg_hide_poll\').click(function(){
150
+ var data={\'action\':\'wpstg_hide_poll\'}
151
+ jQuery.ajax({
152
+ url: "'.admin_url( 'admin-ajax.php' ).'",
153
+ type: "post",
154
+ data: data,
155
+ dataType: "json",
156
+ async: !0,
157
+ success: function(e) {
158
+ if (e=="success") {
159
+ jQuery(\'.wpstg_poll\').slideUp(\'fast\');
160
+ }
161
+ }
162
+ });
163
+ })
164
+ });
165
+ </script>
166
+ ';
167
+ }
168
+ }
169
+
170
+
171
+ /* Hide the poll notice
172
+ *
173
+ * @subpackage Admin/Notices
174
+ * @copyright Copyright (c) 2016, René Hermenau
175
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
176
+ * @since 1.1.0
177
+ *
178
+ * @return json string
179
+ *
180
+ */
181
+
182
+ function wpstg_hide_poll(){
183
+ update_option('wpstg_start_poll','no');
184
+ echo json_encode(array("success")); exit;
185
+ }
186
+ add_action('wp_ajax_wpstg_hide_poll','wpstg_hide_poll');
187
+
188
 
189
  /**
190
  * Show a message when pro or free plugin become disabled
includes/install.php CHANGED
@@ -57,44 +57,43 @@ if ( ! defined( 'ABSPATH' ) ) exit;
57
 
58
 
59
  function wpstg_install() {
60
- global $wpdb, $wpstg_options, $wp_version;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
- // Add Upgraded from Option
63
- $current_version = get_option( 'wpstg_version' );
64
- if ( $current_version ) {
65
- update_option( 'wpstg_version_upgraded_from', $current_version );
66
- }
67
 
68
- // Update the current version
69
- update_option( 'wpstg_version', WPSTG_VERSION );
70
- // Add plugin installation date and variable for rating div
71
- add_option('wpstg_installDate',date('Y-m-d h:i:s'));
72
- add_option('wpstg_RatingDiv','no');
73
- // Add First-time variables
74
- add_option('wpstg_firsttime','true');
75
- add_option('wpstg_is_staging_site','false');
76
- // Show beta notice
77
- add_option('wpstg_hide_beta','no');
78
-
79
- // Create empty config files in /wp-content/uploads/wp-staging
80
- wpstg_create_remaining_files();
81
- wpstg_create_clonedetails_files();
82
-
83
-
84
-
85
  /* Setup some default options
86
  * Store our initial social networks in separate option row.
87
  * For easier modification and to prevent some trouble
88
  */
89
-
90
  // Bail if activating from network, or bulk
91
- if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
92
- return;
93
- }
94
-
95
- // Add the transient to redirect / not for multisites
96
- set_transient( '_wpstg_activation_redirect', true, 30 );
97
 
 
 
98
  }
99
 
100
  /**
57
 
58
 
59
  function wpstg_install() {
60
+ global $wpdb, $wpstg_options;
61
+
62
+ // Add Upgraded from Option
63
+ $current_version = get_option( 'wpstg_version' );
64
+ if( $current_version ) {
65
+ update_option( 'wpstg_version_upgraded_from', $current_version );
66
+ }
67
+
68
+ // Update the current version
69
+ update_option( 'wpstg_version', WPSTG_VERSION );
70
+ // Add plugin installation date and variable for rating div
71
+ add_option( 'wpstg_installDate', date( 'Y-m-d h:i:s' ) );
72
+ add_option( 'wpstg_RatingDiv', 'no' );
73
+ // Add First-time variables
74
+ add_option( 'wpstg_firsttime', 'true' );
75
+ add_option( 'wpstg_is_staging_site', 'false' );
76
+ // Show beta notice
77
+ add_option( 'wpstg_hide_beta', 'no' );
78
+
79
+ // Create empty config files in /wp-content/uploads/wp-staging
80
+ wpstg_create_remaining_files();
81
+ wpstg_create_clonedetails_files();
82
+
83
 
 
 
 
 
 
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  /* Setup some default options
86
  * Store our initial social networks in separate option row.
87
  * For easier modification and to prevent some trouble
88
  */
89
+
90
  // Bail if activating from network, or bulk
91
+ if( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
92
+ return;
93
+ }
 
 
 
94
 
95
+ // Add the transient to redirect / not for multisites
96
+ set_transient( '_wpstg_activation_redirect', true, 30 );
97
  }
98
 
99
  /**
readme.txt CHANGED
@@ -8,8 +8,8 @@ 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.5.2
12
- Stable tag: 1.0.9
13
 
14
  A duplicator plugin! Clone, duplicate and migrate live sites to independent staging and development sites that are available only to administrators.
15
 
@@ -19,7 +19,9 @@ A duplicator plugin! Clone, duplicate and migrate live sites to independent stag
19
  If you find a bug please open a ticket in the [support request](https://wordpress.org/support/plugin/wp-staging/ "support forum"). Every issue will be fixed asap!
20
  </strong>
21
  <br /><br />
22
- <strong>Note: </strong> This plugin is not able to push back your changes to the live site at the moment! This is a feature i am already working on.
 
 
23
  <br /> <br />
24
 
25
 
@@ -141,6 +143,10 @@ After installation goto the settings page 'Staging' and do your adjustments ther
141
 
142
  == Changelog ==
143
 
 
 
 
 
144
  = 1.0.9 =
145
  * Fix: Undefined WPSTG() warning
146
  * Fix: Change compatibility version to wp 4.5.3
@@ -238,5 +244,5 @@ After installation goto the settings page 'Staging' and do your adjustments ther
238
 
239
  == Upgrade Notice ==
240
 
241
- = 1.0.3 =
242
- 1.0.3 <strong>Compatible up to WP 4.4.2</strong>
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.6
12
+ Stable tag: 1.1.0
13
 
14
  A duplicator plugin! Clone, duplicate and migrate live sites to independent staging and development sites that are available only to administrators.
15
 
19
  If you find a bug please open a ticket in the [support request](https://wordpress.org/support/plugin/wp-staging/ "support forum"). Every issue will be fixed asap!
20
  </strong>
21
  <br /><br />
22
+ <strong>Note: </strong> This plugin is not able to push back your changes to the live site at the moment!
23
+ Please let us know your most requested feature and use our quick poll. It only takes one minute of your time:
24
+ [Start the Poll](https://docs.google.com/forms/d/e/1FAIpQLScZ-dO5WffV3xObn16LwG05tr1HrADD_8L4wbTxPHqoPssVcg/viewform?c=0&w=1&usp=mail_form_link "wp staging poll")
25
  <br /> <br />
26
 
27
 
143
 
144
  == Changelog ==
145
 
146
+ = 1.1.0 =
147
+ * New: Tested up to WP 4.6
148
+ * New: Create a poll and ask what feature is most required
149
+
150
  = 1.0.9 =
151
  * Fix: Undefined WPSTG() warning
152
  * Fix: Change compatibility version to wp 4.5.3
244
 
245
  == Upgrade Notice ==
246
 
247
+ = 1.1.0 =
248
+ 1.1.0 <strong>Compatible up to WP 4.6</strong>
uninstall.php CHANGED
@@ -32,5 +32,6 @@ if( isset( $wpstg_options['uninstall_on_delete'] ) ) {
32
  delete_option( 'wpstg_hide_beta' );
33
  delete_option( 'wpstg_settings' );
34
  delete_option( 'wpstg_existing_clones' );
 
35
  }
36
 
32
  delete_option( 'wpstg_hide_beta' );
33
  delete_option( 'wpstg_settings' );
34
  delete_option( 'wpstg_existing_clones' );
35
+ delete_option( 'wpstg_start_poll' );
36
  }
37
 
wp-staging.php CHANGED
@@ -6,7 +6,7 @@
6
  * Description: Create a staging clone site for testing & developing
7
  * Author: WP-Staging, René Hermenau
8
  * Author URI: https://wordpress.org/plugins/wp-staging
9
- * Version: 1.0.9
10
  * Text Domain: wpstg
11
  * Domain Path: languages
12
 
@@ -34,11 +34,11 @@ if( !defined( 'ABSPATH' ) )
34
 
35
  // Plugin version
36
  if( !defined( 'WPSTG_VERSION' ) ) {
37
- define( 'WPSTG_VERSION', '1.0.9' );
38
  }
39
  // Is compatible up to WordPress version
40
  if( !defined( 'WPSTG_WP_COMPATIBLE' ) ) {
41
- define( 'WPSTG_WP_COMPATIBLE', '4.5.3' );
42
  }
43
 
44
  // Plugin Folder Path
@@ -58,25 +58,25 @@ if( !class_exists( 'WPSTG_Utils' ) ) {
58
 
59
  // Installation & activation
60
  register_activation_hook( __FILE__, 'wpstg_activation' );
61
- function wpstg_activation($networkwide){
62
- require_once WPSTG_PLUGIN_DIR . '/includes/install.php';
63
 
64
- if (function_exists('is_multisite') && is_multisite()) {
65
  // check if it is a network activation - if so, run the activation function for each blog id
66
- if ($networkwide) {
67
  $old_blog = $wpdb->blogid;
68
  // Get all blog ids
69
- $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
70
- foreach ($blogids as $blog_id) {
71
- switch_to_blog($blog_id);
72
  wpstg_install();
73
  }
74
- switch_to_blog($old_blog);
75
  return;
76
- }
77
- }
78
 
79
- wpstg_install();
80
  }
81
 
82
  /*
6
  * Description: Create a staging clone site for testing & developing
7
  * Author: WP-Staging, René Hermenau
8
  * Author URI: https://wordpress.org/plugins/wp-staging
9
+ * Version: 1.1.0
10
  * Text Domain: wpstg
11
  * Domain Path: languages
12
 
34
 
35
  // Plugin version
36
  if( !defined( 'WPSTG_VERSION' ) ) {
37
+ define( 'WPSTG_VERSION', '1.1.0' );
38
  }
39
  // Is compatible up to WordPress version
40
  if( !defined( 'WPSTG_WP_COMPATIBLE' ) ) {
41
+ define( 'WPSTG_WP_COMPATIBLE', '4.6' );
42
  }
43
 
44
  // Plugin Folder Path
58
 
59
  // Installation & activation
60
  register_activation_hook( __FILE__, 'wpstg_activation' );
61
+ function wpstg_activation( $networkwide ) {
62
+ require_once WPSTG_PLUGIN_DIR . '/includes/install.php';
63
 
64
+ if( function_exists( 'is_multisite' ) && is_multisite() ) {
65
  // check if it is a network activation - if so, run the activation function for each blog id
66
+ if( $networkwide ) {
67
  $old_blog = $wpdb->blogid;
68
  // Get all blog ids
69
+ $blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
70
+ foreach ( $blogids as $blog_id ) {
71
+ switch_to_blog( $blog_id );
72
  wpstg_install();
73
  }
74
+ switch_to_blog( $old_blog );
75
  return;
76
+ }
77
+ }
78
 
79
+ wpstg_install();
80
  }
81
 
82
  /*