The WP Remote WordPress Plugin - Version 2.7.2

Version Description

Download this release

Release Info

Developer danielbachhuber
Plugin Icon 128x128 The WP Remote WordPress Plugin
Version 2.7.2
Comparing to
See all releases

Code changes from version 2.7.1 to 2.7.2

Files changed (5) hide show
  1. plugin.php +1 -1
  2. readme.txt +7 -2
  3. wprp.admin.php +1 -1
  4. wprp.backups.php +28 -17
  5. wprp.hm.backup.php +8 -8
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>. <strong>Deactivate to clear your API Key.</strong>
6
- Version: 2.7.1
7
  Author: Human Made Limited
8
  Author URI: http://hmn.md/
9
  */
3
  /*
4
  Plugin Name: WP Remote
5
  Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>. <strong>Deactivate to clear your API Key.</strong>
6
+ Version: 2.7.2
7
  Author: Human Made Limited
8
  Author URI: http://hmn.md/
9
  */
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: humanmade, willmot, joehoyle, danielbachhuber, mattheu, pauldewouters, cuvelier, tcrsavage
3
  Tags: wpremote, remote administration, multiple wordpress
4
  Requires at least: 3.0
5
- Tested up to: 3.8
6
- Stable tag: 2.7.1
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
 
@@ -37,6 +37,11 @@ You can email us at support@wpremote.com for support.
37
 
38
  == Changelog ==
39
 
 
 
 
 
 
40
  #### 2.7.1 (23 December 2013)
41
 
42
  * Bug fix: Restore plugin and theme installation mechanism.
2
  Contributors: humanmade, willmot, joehoyle, danielbachhuber, mattheu, pauldewouters, cuvelier, tcrsavage
3
  Tags: wpremote, remote administration, multiple wordpress
4
  Requires at least: 3.0
5
+ Tested up to: 3.8.1
6
+ Stable tag: 2.7.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
 
37
 
38
  == Changelog ==
39
 
40
+ #### 2.7.2 (22 January 2014)
41
+
42
+ * Misc improvements to the accuracy of the backup restart mechanism.
43
+ * Inline styles to insure the API key prompt always appears, even if a theme or plugin may hide admin notices.
44
+
45
  #### 2.7.1 (23 December 2013)
46
 
47
  * Bug fix: Restore plugin and theme installation mechanism.
wprp.admin.php CHANGED
@@ -20,7 +20,7 @@ add_action( 'admin_menu', 'wprp_setup_admin' );
20
  */
21
  function wprp_add_api_key_admin_notice() { ?>
22
 
23
- <div id="wprp-message" class="updated">
24
 
25
  <form method="post" action="options.php">
26
 
20
  */
21
  function wprp_add_api_key_admin_notice() { ?>
22
 
23
+ <div id="wprp-message" class="updated" style="display:block !important;">
24
 
25
  <form method="post" action="options.php">
26
 
wprp.backups.php CHANGED
@@ -39,6 +39,8 @@ class WPRP_Backups extends WPRP_HM_Backup {
39
  */
40
  public function __construct() {
41
 
 
 
42
  // Set the backup path
43
  $this->set_path( $this->path() );
44
 
@@ -353,14 +355,14 @@ class WPRP_Backups extends WPRP_HM_Backup {
353
  */
354
  private function path_default() {
355
 
356
- if ( empty( $path ) )
357
- $path = parent::conform_dir( trailingslashit( WP_CONTENT_DIR ) . substr( $this->key(), 0, 10 ) . '-backups' );
358
 
359
  $upload_dir = wp_upload_dir();
360
 
361
  // If the backups dir can't be created in WP_CONTENT_DIR then fallback to uploads
362
  if ( ( ( ! is_dir( $path ) && ! is_writable( dirname( $path ) ) ) || ( is_dir( $path ) && ! is_writable( $path ) ) ) && strpos( $path, $upload_dir['basedir'] ) === false )
363
- $path = parent::conform_dir( trailingslashit( $upload_dir['basedir'] ) . substr( $this->key(), 0, 10 ) . '-backups' );
364
 
365
  return $path;
366
  }
@@ -524,7 +526,7 @@ class WPRP_Backups extends WPRP_HM_Backup {
524
  *
525
  * @access private
526
  */
527
- private function is_backup_still_running() {
528
 
529
  // Check whether there's supposed to be a backup in progress
530
  if ( false === ( $process_id = $this->get_backup_process_id() ) )
@@ -536,28 +538,37 @@ class WPRP_Backups extends WPRP_HM_Backup {
536
  else
537
  $time_to_wait = 90;
538
 
 
 
 
 
539
  // If the heartbeat has been modified in the last 90 seconds, we might not be dead
540
  if ( ( time() - $this->get_heartbeat_timestamp() ) < $time_to_wait )
541
  return true;
542
 
543
- // Check if the database archive was modified recently
544
- $database = $this->get_database_dump_filepath();
545
- if ( file_exists( $database ) && ( ( time() - filemtime( $database ) ) < $time_to_wait ) )
546
- return true;
 
 
 
 
 
547
 
548
- // Check if there's a ZipArchive file being modified.
549
- $ziparchive_files = glob( $this->get_path() . '/*.zip.*' );
550
- $ziparchive_mtimes = array();
551
- foreach( $ziparchive_files as $ziparchive_file ) {
552
- $ziparchive_mtimes[] = filemtime( $ziparchive_file );
553
  }
554
- if ( ! empty( $ziparchive_mtimes ) ) {
555
- $latest_ziparchive_mtime = max( $ziparchive_mtimes );
556
- if ( ( time() - $latest_ziparchive_mtime ) < $time_to_wait )
557
  return true;
558
  }
 
559
 
560
  return false;
 
561
  }
562
 
563
  /**
@@ -580,7 +591,7 @@ class WPRP_Backups extends WPRP_HM_Backup {
580
  return false;
581
 
582
  // Check whether there's supposed to be a backup in progress
583
- if ( $this->get_backup_process_id() && $this->is_backup_still_running() )
584
  return false;
585
 
586
  // Uh oh, needs to be restarted
39
  */
40
  public function __construct() {
41
 
42
+ parent::__construct();
43
+
44
  // Set the backup path
45
  $this->set_path( $this->path() );
46
 
355
  */
356
  private function path_default() {
357
 
358
+ $dirname = substr( $this->key(), 0, 10 ) . '-wprbackups';
359
+ $path = parent::conform_dir( trailingslashit( WP_CONTENT_DIR ) . $dirname );
360
 
361
  $upload_dir = wp_upload_dir();
362
 
363
  // If the backups dir can't be created in WP_CONTENT_DIR then fallback to uploads
364
  if ( ( ( ! is_dir( $path ) && ! is_writable( dirname( $path ) ) ) || ( is_dir( $path ) && ! is_writable( $path ) ) ) && strpos( $path, $upload_dir['basedir'] ) === false )
365
+ $path = parent::conform_dir( trailingslashit( $upload_dir['basedir'] ) . $dirname );
366
 
367
  return $path;
368
  }
526
  *
527
  * @access private
528
  */
529
+ private function is_backup_still_running( $context = 'get_backup' ) {
530
 
531
  // Check whether there's supposed to be a backup in progress
532
  if ( false === ( $process_id = $this->get_backup_process_id() ) )
538
  else
539
  $time_to_wait = 90;
540
 
541
+ // Give heartbeat requests a little bit of time to restart
542
+ if ( 'get_backup' == $context )
543
+ $time_to_wait += 15;
544
+
545
  // If the heartbeat has been modified in the last 90 seconds, we might not be dead
546
  if ( ( time() - $this->get_heartbeat_timestamp() ) < $time_to_wait )
547
  return true;
548
 
549
+ // Check if there's any file being modified.
550
+ $backup_file_dirs = array( $this->get_path() );
551
+
552
+ if ( $this->is_using_file_manifest() ) {
553
+ $backup_file_dirs[] = $this->get_file_manifest_dirpath();
554
+ }
555
+
556
+ foreach ( $backup_file_dirs as $backup_file_dir ) {
557
+ $backup_files = glob( $backup_file_dir . '/*' );
558
 
559
+ $file_mtimes = array();
560
+ foreach( $backup_files as $backup_file ) {
561
+ $file_mtimes[] = filemtime( $backup_file );
 
 
562
  }
563
+ if ( ! empty( $file_mtimes ) ) {
564
+ $latest_file_mtime = max( $file_mtimes );
565
+ if ( ( time() - $latest_file_mtime ) < $time_to_wait )
566
  return true;
567
  }
568
+ }
569
 
570
  return false;
571
+
572
  }
573
 
574
  /**
591
  return false;
592
 
593
  // Check whether there's supposed to be a backup in progress
594
+ if ( $this->get_backup_process_id() && $this->is_backup_still_running( 'backup_heartbeat' ) )
595
  return false;
596
 
597
  // Uh oh, needs to be restarted
wprp.hm.backup.php CHANGED
@@ -1067,8 +1067,14 @@ class WPRP_HM_Backup {
1067
 
1068
  $this->do_action( 'hmbkp_archive_started' );
1069
 
1070
- // ZipArchive is the fastest for chunked backups
1071
- if ( class_exists( 'ZipArchive' ) && empty( $this->skip_zip_archive ) ) {
 
 
 
 
 
 
1072
  $this->archive_method = 'zip_archive_files';
1073
 
1074
  $ret = $this->zip_archive_files( $next_files );
@@ -1078,12 +1084,6 @@ class WPRP_HM_Backup {
1078
  }
1079
  }
1080
 
1081
- // Fall back to `zip` if ZipArchive doesn't exist
1082
- else if ( $this->get_zip_command_path() ) {
1083
- $this->archive_method = 'zip_files';
1084
- $error = $this->zip_files( $next_files );
1085
- }
1086
-
1087
  // Last opportunity
1088
  else {
1089
  $this->archive_method = 'pcl_zip_files';
1067
 
1068
  $this->do_action( 'hmbkp_archive_started' );
1069
 
1070
+ // `zip` is the most performant archive method
1071
+ if ( $this->get_zip_command_path() ) {
1072
+ $this->archive_method = 'zip_files';
1073
+ $error = $this->zip_files( $next_files );
1074
+ }
1075
+
1076
+ // ZipArchive is also pretty fast for chunked backups
1077
+ else if ( class_exists( 'ZipArchive' ) && empty( $this->skip_zip_archive ) ) {
1078
  $this->archive_method = 'zip_archive_files';
1079
 
1080
  $ret = $this->zip_archive_files( $next_files );
1084
  }
1085
  }
1086
 
 
 
 
 
 
 
1087
  // Last opportunity
1088
  else {
1089
  $this->archive_method = 'pcl_zip_files';