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

Version Description

  • Fix: Settings are not deleted when plugin is removed
  • Fix: Staging site is available for non administrators
Download this release

Release Info

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

Code changes from version 1.1.1 to 1.1.2

includes/{class-wpstg-license-handler.php → admin/class-wpstg-license-handler.php} RENAMED
File without changes
includes/{error-handling.php → admin/error-handling.php} RENAMED
File without changes
includes/{template-functions.php → admin/template-functions.php} RENAMED
File without changes
includes/admin/upgrades/upgrade-functions.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Upgrade Functions
5
+ *
6
+ * @package WPSTG
7
+ * @subpackage Admin/Upgrades
8
+ * @copyright Copyright (c) 2016, Ren´é Hermenau
9
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
10
+ * @since 1.1.2
11
+ */
12
+ // Exit if accessed directly
13
+ if( !defined( 'ABSPATH' ) )
14
+ exit;
15
+
16
+ /**
17
+ * Perform automatic upgrades when necessary
18
+ *
19
+ * @since 1.2.3
20
+ * @return void
21
+ */
22
+ function wpstg_do_automatic_upgrades() {
23
+
24
+ $did_upgrade = false;
25
+ $wpstg_version = preg_replace( '/[^0-9.].*/', '', get_option( 'wpstg_version' ) );
26
+
27
+ if( version_compare( $wpstg_version, '1.1.2', '<' ) ) {
28
+ wpstg_update_v1();
29
+ }
30
+
31
+ // Check if version number in DB is lower than version number in current plugin
32
+ if( version_compare( $wpstg_version, WPSTG_VERSION, '<' ) ) {
33
+ // Let us know that an upgrade has happened
34
+ $did_upgrade = true;
35
+ }
36
+
37
+ // Update Version number
38
+ if( $did_upgrade ) {
39
+ update_option( 'wpstg_version', preg_replace( '/[^0-9.].*/', '', WPSTG_VERSION ) );
40
+
41
+ }
42
+ }
43
+
44
+ add_action( 'admin_init', 'wpstg_do_automatic_upgrades' );
45
+
46
+ /**
47
+ * Store default settings which were not stored properly in version earlier than 1.1.2
48
+ */
49
+ function wpstg_update_v1() {
50
+ // Add plugin installation date and variable for rating div
51
+ add_option( 'wpstg_installDate', date( 'Y-m-d h:i:s' ) );
52
+ add_option( 'wpstg_RatingDiv', 'no' );
53
+
54
+ // Add First-time variables
55
+ add_option( 'wpstg_firsttime', 'true' );
56
+ add_option( 'wpstg_is_staging_site', 'false' );
57
+
58
+ // Show beta notice
59
+ add_option( 'wpstg_hide_beta', 'no' );
60
+
61
+ // Create empty config files in /wp-content/uploads/wp-staging
62
+ wpstg_create_remaining_files();
63
+ wpstg_create_clonedetails_files();
64
+ }
65
+
66
+ /**
67
+ *
68
+ * @return mixed string | bool false name of the theme if theme is a known commercial theme
69
+ */
70
+ function wpstg_is_commercial_theme() {
71
+
72
+ // Get current theme name
73
+ $my_theme = wp_get_theme();
74
+
75
+ // Known commercial themes which are using WP QUADS
76
+ $themes = array('Bunchy', 'Bimber', 'boombox', 'Boombox');
77
+
78
+ if( is_object( $my_theme ) && in_array( $my_theme->get( 'Name' ), $themes ) ) {
79
+ return $my_theme->get( 'Name' );
80
+ }
81
+
82
+ return false;
83
+ }
includes/{wpstg-sanitize.php → admin/wpstg-sanitize.php} RENAMED
File without changes
includes/install.php CHANGED
@@ -18,10 +18,9 @@ if ( ! defined( 'ABSPATH' ) ) exit;
18
  *
19
  */
20
 
21
- //register_activation_hook( WPSTG_PLUGIN_FILE, 'wpstg_install_multisite' );
22
- /*function wpstg_install_multisite($networkwide) {
23
  global $wpdb;
24
- wp_die('fire');
25
 
26
  if (function_exists('is_multisite') && is_multisite()) {
27
  // check if it is a network activation - if so, run the activation function for each blog id
@@ -38,7 +37,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
38
  }
39
  }
40
  wpstg_install();
41
- }*/
42
 
43
  /**
44
  * Install
@@ -49,7 +48,6 @@ if ( ! defined( 'ABSPATH' ) ) exit;
49
  *
50
  * @since 0.9.0
51
  * @global $wpdb
52
- * @global $wpstg_options
53
  * @global $wp_version
54
  * @return void
55
  */
@@ -57,8 +55,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
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 ) {
@@ -67,12 +64,15 @@ function wpstg_install() {
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
 
18
  *
19
  */
20
 
21
+
22
+ function wpstg_install_multisite($networkwide) {
23
  global $wpdb;
 
24
 
25
  if (function_exists('is_multisite') && is_multisite()) {
26
  // check if it is a network activation - if so, run the activation function for each blog id
37
  }
38
  }
39
  wpstg_install();
40
+ }
41
 
42
  /**
43
  * Install
48
  *
49
  * @since 0.9.0
50
  * @global $wpdb
 
51
  * @global $wp_version
52
  * @return void
53
  */
55
 
56
 
57
  function wpstg_install() {
58
+
 
59
  // Add Upgraded from Option
60
  $current_version = get_option( 'wpstg_version' );
61
  if( $current_version ) {
64
 
65
  // Update the current version
66
  update_option( 'wpstg_version', WPSTG_VERSION );
67
+
68
  // Add plugin installation date and variable for rating div
69
  add_option( 'wpstg_installDate', date( 'Y-m-d h:i:s' ) );
70
  add_option( 'wpstg_RatingDiv', 'no' );
71
+
72
  // Add First-time variables
73
  add_option( 'wpstg_firsttime', 'true' );
74
  add_option( 'wpstg_is_staging_site', 'false' );
75
+
76
  // Show beta notice
77
  add_option( 'wpstg_hide_beta', 'no' );
78
 
languages/Gruntfile.js DELETED
@@ -1,105 +0,0 @@
1
- /* local path for wp-staging git repository
2
- cd "s:\github\wp-staging"
3
- *
4
- */
5
- module.exports = function(grunt) {
6
-
7
- // Project configuration.
8
- grunt.initConfig({
9
-
10
- pkg: grunt.file.readJSON( 'package.json' ),
11
- paths : {
12
- // Base destination dir
13
- base : '../../wordpress-svn/staging/tags/<%= pkg.version %>',
14
- basetrunk : '../../wordpress-svn/staging/svn/trunk/',
15
- basezip: '../../wordpress-svn/staging/'
16
- },
17
-
18
- // Tasks here
19
- // Bump version numbers
20
- version: {
21
- css: {
22
- options: {
23
- prefix: 'Version\\:\\s'
24
- },
25
- src: [ 'style.css' ]
26
- },
27
- php: {
28
- options: {
29
- prefix: '\@version\\s+'
30
- },
31
- src: [ 'functions.php', '<%= pkg.name %>.php' ]
32
- }
33
- },
34
- // minify js
35
- uglify: {
36
- build: {
37
- files:[
38
- {'assets/js/wpstg-admin.min.js' : 'assets/js/wpstg-admin.js'},
39
- {'assets/js/wpstg.min.js' : 'assets/js/wpstg.js'},
40
- ]
41
- }
42
- },
43
- // Copy to build folder
44
- copy: {
45
- build: {
46
- files: [
47
- {expand: true, src: ['**', '!node_modules/**', '!Gruntfile.js', '!package.json', '!nbproject/**', '!grunt/**'],
48
- dest: '<%= paths.base %>'},
49
-
50
- {expand: true, src: ['**', '!node_modules/**', '!Gruntfile.js', '!package.json', '!nbproject/**', '!grunt/**'],
51
- dest: '<%= paths.basetrunk %>'},
52
- ]
53
- },
54
- },
55
-
56
- // Clean the build folder
57
- clean: {
58
- options: {
59
- force: true
60
- },
61
- build: {
62
- files:[
63
- {src: ['<%= paths.base %>']},
64
- {src: ['<%= paths.basetrunk %>']},
65
- ]
66
-
67
- }
68
- },
69
- // Minify CSS files into NAME-OF-FILE.min.css
70
- cssmin: {
71
- build: {
72
- files:[
73
- {'assets/css/wpstg-admin.min.css' : 'assets/css/wpstg-admin.css'},
74
- {'templates/wpstg.min.css' : 'templates/wpstg.min.css'},
75
- ]
76
- }
77
- },
78
- // Compress the build folder into an upload-ready zip file
79
- compress: {
80
- build: {
81
- options: {
82
- archive: '<%= paths.basezip %>/<%= pkg.name %>.zip'
83
- },
84
- cwd: '<%= paths.base %>',
85
- src: ['**/*']
86
- //dest: '../../',
87
- //expand: true
88
- }
89
- }
90
-
91
-
92
- });
93
-
94
- // Load all grunt plugins here
95
- // [...]
96
- //require('load-grunt-config')(grunt);
97
- require('load-grunt-tasks')(grunt);
98
-
99
- // Display task timing
100
- require('time-grunt')(grunt);
101
-
102
- // Build task
103
- //grunt.registerTask( 'build', [ 'compress:build' ]);
104
- grunt.registerTask( 'build', [ 'clean:build', 'uglify:build', 'cssmin:build', 'copy:build', 'compress:build' ]);
105
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -9,7 +9,7 @@ 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.7
12
- Stable tag: 1.1.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
 
@@ -143,6 +143,10 @@ After installation goto the settings page 'Staging' and do your adjustments ther
143
 
144
  == Changelog ==
145
 
 
 
 
 
146
  = 1.1.1 =
147
  * Fix: Change rating url
148
  * New: Tested up to WP 4.7
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.7
12
+ Stable tag: 1.1.2
13
 
14
  A duplicator plugin! Clone, duplicate and migrate live sites to independent staging and development sites that are available only to administrators.
15
 
143
 
144
  == Changelog ==
145
 
146
+ = 1.1.2 =
147
+ * Fix: Settings are not deleted when plugin is removed
148
+ * Fix: Staging site is available for non administrators
149
+
150
  = 1.1.1 =
151
  * Fix: Change rating url
152
  * New: Tested up to WP 4.7
uninstall.php CHANGED
@@ -13,10 +13,7 @@
13
  if( !defined( 'WP_UNINSTALL_PLUGIN' ) )
14
  exit;
15
 
16
- // Load WPSTG file
17
- include_once( 'wp-staging.php' );
18
-
19
- global $wpstg_options;
20
 
21
  /**
22
  * Delete all the Plugin Options
13
  if( !defined( 'WP_UNINSTALL_PLUGIN' ) )
14
  exit;
15
 
16
+ $wpstg_options = get_option ('wpstg_settings');
 
 
 
17
 
18
  /**
19
  * Delete all the Plugin Options
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.1.1
10
  * Text Domain: wpstg
11
  * Domain Path: languages
12
 
@@ -34,7 +34,7 @@ if ( !defined('ABSPATH') )
34
 
35
  // Plugin version
36
  if ( !defined('WPSTG_VERSION') ) {
37
- define('WPSTG_VERSION', '1.1.1');
38
  }
39
  // Is compatible up to WordPress version
40
  if ( !defined('WPSTG_WP_COMPATIBLE') ) {
@@ -84,7 +84,6 @@ if ( !class_exists('wpstaging') ) :
84
  * @return void
85
  */
86
  private function setup_constants() {
87
- //global $wpdb;
88
 
89
  // Plugin Folder Path
90
  if ( !defined('WPSTG_PLUGIN_DIR') ) {
@@ -119,10 +118,13 @@ if ( !class_exists('wpstaging') ) :
119
  */
120
  private function includes() {
121
  global $wpstg_options;
 
122
  require_once WPSTG_PLUGIN_DIR . 'includes/logger.php';
123
  require_once WPSTG_PLUGIN_DIR . 'includes/scripts.php';
124
  require_once WPSTG_PLUGIN_DIR . 'includes/staging-functions.php';
 
125
  if ( is_admin() || ( defined('WP_CLI') && WP_CLI ) ) {
 
126
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/settings/register-settings.php';
127
  $wpstg_options = wpstg_get_settings(); // Load it on top of all
128
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/admin-actions.php';
@@ -133,15 +135,16 @@ if ( !class_exists('wpstaging') ) :
133
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/welcome.php';
134
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/settings/display-settings.php';
135
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/settings/contextual-help.php';
136
- require_once WPSTG_PLUGIN_DIR . 'includes/install.php';
137
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/tools.php';
138
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/upload-functions.php';
139
- require_once WPSTG_PLUGIN_DIR . 'includes/class-wpstg-license-handler.php';
140
  require_once WPSTG_PLUGIN_DIR . 'includes/debug/classes/wpstgDebug.interface.php';
141
  require_once WPSTG_PLUGIN_DIR . 'includes/debug/classes/wpstgDebug.class.php';
142
- require_once WPSTG_PLUGIN_DIR . 'includes/wpstg-sanitize.php';
143
- require_once WPSTG_PLUGIN_DIR . 'includes/template-functions.php';
144
- require_once WPSTG_PLUGIN_DIR . 'includes/error-handling.php';
 
 
145
  }
146
  }
147
 
@@ -198,19 +201,11 @@ function wp_staging_loaded() {
198
  return $wpstg;
199
  //WPSTG();
200
  }
201
-
202
  add_action('plugins_loaded', 'wp_staging_loaded');
203
 
204
- /* function WPSTG() {
205
- global $wpstg;
206
-
207
- if ( !is_null($wpstg) ) {
208
- return $wpstg;
209
- }
210
-
211
- $wpstg = new wpstaging();
212
- return $wpstg;
213
- } */
214
-
215
  // Deactivate WPSTG (Pro)
216
  add_action('activated_plugin', array('WPSTG_Utils', 'deactivate_other_instances'));
 
 
 
 
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.2
10
  * Text Domain: wpstg
11
  * Domain Path: languages
12
 
34
 
35
  // Plugin version
36
  if ( !defined('WPSTG_VERSION') ) {
37
+ define('WPSTG_VERSION', '1.1.2');
38
  }
39
  // Is compatible up to WordPress version
40
  if ( !defined('WPSTG_WP_COMPATIBLE') ) {
84
  * @return void
85
  */
86
  private function setup_constants() {
 
87
 
88
  // Plugin Folder Path
89
  if ( !defined('WPSTG_PLUGIN_DIR') ) {
118
  */
119
  private function includes() {
120
  global $wpstg_options;
121
+
122
  require_once WPSTG_PLUGIN_DIR . 'includes/logger.php';
123
  require_once WPSTG_PLUGIN_DIR . 'includes/scripts.php';
124
  require_once WPSTG_PLUGIN_DIR . 'includes/staging-functions.php';
125
+
126
  if ( is_admin() || ( defined('WP_CLI') && WP_CLI ) ) {
127
+
128
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/settings/register-settings.php';
129
  $wpstg_options = wpstg_get_settings(); // Load it on top of all
130
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/admin-actions.php';
135
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/welcome.php';
136
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/settings/display-settings.php';
137
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/settings/contextual-help.php';
 
138
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/tools.php';
139
  require_once WPSTG_PLUGIN_DIR . 'includes/admin/upload-functions.php';
140
+ require_once WPSTG_PLUGIN_DIR . 'includes/admin/class-wpstg-license-handler.php';
141
  require_once WPSTG_PLUGIN_DIR . 'includes/debug/classes/wpstgDebug.interface.php';
142
  require_once WPSTG_PLUGIN_DIR . 'includes/debug/classes/wpstgDebug.class.php';
143
+ require_once WPSTG_PLUGIN_DIR . 'includes/admin/wpstg-sanitize.php';
144
+ require_once WPSTG_PLUGIN_DIR . 'includes/admin/template-functions.php';
145
+ require_once WPSTG_PLUGIN_DIR . 'includes/admin/error-handling.php';
146
+ require_once WPSTG_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
147
+
148
  }
149
  }
150
 
201
  return $wpstg;
202
  //WPSTG();
203
  }
 
204
  add_action('plugins_loaded', 'wp_staging_loaded');
205
 
 
 
 
 
 
 
 
 
 
 
 
206
  // Deactivate WPSTG (Pro)
207
  add_action('activated_plugin', array('WPSTG_Utils', 'deactivate_other_instances'));
208
+
209
+ // Run activation hook. Must be called from outside of the singleton
210
+ require_once WPSTG_PLUGIN_DIR . 'includes/install.php';
211
+ register_activation_hook( __FILE__, 'wpstg_install_multisite' );