The WP Remote WordPress Plugin - Version 2.8.4.3

Version Description

Download this release

Release Info

Developer jeramynirodha
Plugin Icon 128x128 The WP Remote WordPress Plugin
Version 2.8.4.3
Comparing to
See all releases

Code changes from version 2.8.4.2 to 2.8.4.3

Files changed (5) hide show
  1. plugin.php +1 -1
  2. readme.txt +6 -1
  3. wprp.api.php +1 -1
  4. wprp.plugins.php +39 -0
  5. wprp.themes.php +23 -13
plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: WP Remote
5
  Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>.
6
- Version: 2.8.4.2
7
  Author: maekit
8
  Author URI: https://maek.it/
9
  */
3
  /*
4
  Plugin Name: WP Remote
5
  Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>.
6
+ Version: 2.8.4.3
7
  Author: maekit
8
  Author URI: https://maek.it/
9
  */
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: jeramynirodha, bmett, humanmade, willmot, joehoyle, danielbachhube
3
  Tags: wpremote, remote administration, multiple wordpress
4
  Requires at least: 3.0
5
  Tested up to: 4.9
6
- Stable tag: 2.8.4.2
7
 
8
  WP Remote is a free web app that enables you to easily manage all of your WordPress powered sites from one place.
9
 
@@ -69,6 +69,11 @@ You can email us at support@wpremote.com for support.
69
 
70
  == Changelog ==
71
 
 
 
 
 
 
72
  #### 2.8.4.2 (9 January 2019)
73
 
74
  * Backport WPEngine bug fix from v3.0.a
3
  Tags: wpremote, remote administration, multiple wordpress
4
  Requires at least: 3.0
5
  Tested up to: 4.9
6
+ Stable tag: 2.8.4.3
7
 
8
  WP Remote is a free web app that enables you to easily manage all of your WordPress powered sites from one place.
9
 
69
 
70
  == Changelog ==
71
 
72
+ #### 2.8.4.3 (11 January 2019)
73
+
74
+ * Backport bug fix for theme updates from v3.0.a
75
+ * Plugins will now be re-installed if they vanish and add in user_abort prevention.
76
+
77
  #### 2.8.4.2 (9 January 2019)
78
 
79
  * Backport WPEngine bug fix from v3.0.a
wprp.api.php CHANGED
@@ -183,7 +183,7 @@ foreach( WPR_API_Request::get_actions() as $action ) {
183
  $api_args = array(
184
  'zip_url' => esc_url_raw( WPR_API_Request::get_arg( 'zip_url' ) ),
185
  );
186
- $actions[$action] = _wprp_update_plugin( sanitize_text_field( WPR_API_Request::get_arg( 'plugin' ) ), $api_args );
187
 
188
  break;
189
 
183
  $api_args = array(
184
  'zip_url' => esc_url_raw( WPR_API_Request::get_arg( 'zip_url' ) ),
185
  );
186
+ $actions[$action] = _wprp_update_plugin_wrap( sanitize_text_field( WPR_API_Request::get_arg( 'plugin' ) ), $api_args );
187
 
188
  break;
189
 
wprp.plugins.php CHANGED
@@ -75,6 +75,45 @@ function _wprp_get_plugins() {
75
  return $plugins;
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  /**
79
  * Update a plugin
80
  *
75
  return $plugins;
76
  }
77
 
78
+ /**
79
+ * Wrap the Update Plugin function with a failsafe fallback
80
+ *
81
+ * @param $plugin_file
82
+ * @param $args
83
+ * @return array|bool|WP_Error
84
+ */
85
+ function _wprp_update_plugin_wrap( $plugin_file, $args )
86
+ {
87
+ @ignore_user_abort( true );
88
+
89
+ $response = false;
90
+ $is_active = is_plugin_active( $plugin_file );
91
+ $is_active_network = is_plugin_active_for_network( $plugin_file );
92
+
93
+ try {
94
+ $response = _wprp_update_plugin($plugin_file, $args);
95
+ } catch (\Exception $exception) {}
96
+
97
+ // FALLBACK for when the plugin is deleted. Just re-install.
98
+ if ( ! file_exists(WP_PLUGIN_DIR . '/' . $plugin_file) ){
99
+ $plugin_slug = rtrim(plugin_dir_path($plugin_file), '/');
100
+
101
+ _wprp_install_plugin($plugin_slug);
102
+
103
+ if ($is_active) {
104
+ activate_plugin($plugin_file, '', $is_active_network, true);
105
+ }
106
+
107
+ $response = new WP_Error('rollback','Plugin update failed. Plugin has been re-installed.');
108
+ }
109
+
110
+ if ($response === false) {
111
+ return new WP_Error('update-failed', 'No message was set.');
112
+ }
113
+
114
+ return $response;
115
+ }
116
+
117
  /**
118
  * Update a plugin
119
  *
wprp.themes.php CHANGED
@@ -156,7 +156,7 @@ function _wprp_activate_theme( $theme ) {
156
  * Update a theme
157
  *
158
  * @param mixed $theme
159
- * @return array
160
  */
161
  function _wprp_update_theme( $theme ) {
162
 
@@ -166,31 +166,41 @@ function _wprp_update_theme( $theme ) {
166
  include_once ( ABSPATH . 'wp-admin/includes/admin.php' );
167
  require_once ( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
168
  require_once WPRP_PLUGIN_PATH . 'inc/class-wprp-theme-upgrader-skin.php';
 
169
 
170
- // check for filesystem access
171
  if ( ! _wpr_check_filesystem_access() )
172
  return new WP_Error( 'filesystem-not-writable', __( 'The filesystem is not writable with the supplied credentials', 'wpremote' ) );
173
 
174
  $skin = new WPRP_Theme_Upgrader_Skin();
175
  $upgrader = new Theme_Upgrader( $skin );
176
 
 
 
177
  // Do the upgrade
178
  ob_start();
179
  $result = $upgrader->upgrade( $theme );
180
  $data = ob_get_contents();
181
  ob_clean();
182
 
183
- if ( ! empty( $skin->error ) )
184
-
185
- return new WP_Error( 'theme-upgrader-skin', $upgrader->strings[$skin->error] );
186
-
187
- else if ( is_wp_error( $result ) )
188
-
189
- return $result;
190
-
191
- else if ( ( ! $result && ! is_null( $result ) ) || $data )
192
-
193
- return new WP_Error( 'theme-update', __( 'Unknown error updating theme.', 'wpremote' ) );
 
 
 
 
 
 
 
194
 
195
  return array( 'status' => 'success' );
196
 
156
  * Update a theme
157
  *
158
  * @param mixed $theme
159
+ * @return array|WP_Error
160
  */
161
  function _wprp_update_theme( $theme ) {
162
 
166
  include_once ( ABSPATH . 'wp-admin/includes/admin.php' );
167
  require_once ( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
168
  require_once WPRP_PLUGIN_PATH . 'inc/class-wprp-theme-upgrader-skin.php';
169
+ require_once WPRP_PLUGIN_PATH . 'inc/class-wprp-automatic-upgrader-skin.php';
170
 
171
+ // check for filesystem access
172
  if ( ! _wpr_check_filesystem_access() )
173
  return new WP_Error( 'filesystem-not-writable', __( 'The filesystem is not writable with the supplied credentials', 'wpremote' ) );
174
 
175
  $skin = new WPRP_Theme_Upgrader_Skin();
176
  $upgrader = new Theme_Upgrader( $skin );
177
 
178
+ remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
179
+
180
  // Do the upgrade
181
  ob_start();
182
  $result = $upgrader->upgrade( $theme );
183
  $data = ob_get_contents();
184
  ob_clean();
185
 
186
+ // Run the language upgrader
187
+ try {
188
+ ob_start();
189
+ $skin2 = new WPRP_Automatic_Upgrader_Skin();
190
+ $lang_upgrader = new Language_Pack_Upgrader($skin2);
191
+ $result2 = $lang_upgrader->upgrade($upgrader);
192
+ if ($data2 = ob_get_contents()) {
193
+ ob_end_clean();
194
+ }
195
+ } catch (\Exception $e) {} // Fail silently
196
+
197
+ if ( ! empty( $skin->error ) ){
198
+ return new WP_Error( 'theme-upgrader-skin', $upgrader->strings[$skin->error] );
199
+ } elseif ( is_wp_error( $result ) ) {
200
+ return $result;
201
+ } elseif ( ( ! $result && ! is_null( $result ) ) || $data ) {
202
+ return new WP_Error('theme-update', __('Unknown error updating theme.', 'wpremote'));
203
+ }
204
 
205
  return array( 'status' => 'success' );
206