BackUpWordPress - Version 3.2.1

Version Description

  • Important bug fixes. Please upgrade to this version to avoid incomplete or broken backups.
Download this release

Release Info

Developer pauldewouters
Plugin Icon 128x128 BackUpWordPress
Version 3.2.1
Comparing to
See all releases

Code changes from version 3.2.0 to 3.2.1

admin/actions.php CHANGED
@@ -284,7 +284,7 @@ function hmbkp_edit_schedule_submit() {
284
 
285
  }
286
 
287
- if ( isset( $_POST['hmbkp_schedule_recurrence']['hmbkp_schedule_start_day_of_month'] ) ) {
288
 
289
  $day_of_month = absint( $_POST['hmbkp_schedule_recurrence']['hmbkp_schedule_start_day_of_month'] );
290
 
284
 
285
  }
286
 
287
+ if ( ( 'hmbkp_monthly' === $schedule_recurrence_type ) && isset( $_POST['hmbkp_schedule_recurrence']['hmbkp_schedule_start_day_of_month'] ) ) {
288
 
289
  $day_of_month = absint( $_POST['hmbkp_schedule_recurrence']['hmbkp_schedule_start_day_of_month'] );
290
 
backupwordpress.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Plugin Name: BackUpWordPress
4
  Plugin URI: http://bwp.hmn.md/
5
  Description: Simple automated backups of your WordPress powered website. Once activated you'll find me under <strong>Tools &rarr; Backups</strong>. On multisite, you'll find me under the Network Settings menu.
6
- Version: 3.2.0
7
  Author: Human Made Limited
8
  Author URI: http://hmn.md/
9
  License: GPL-2.0+
1
  <?php
2
  /*
3
+ Plugin Name: BackUpWordPress Backup Plugin
4
  Plugin URI: http://bwp.hmn.md/
5
  Description: Simple automated backups of your WordPress powered website. Once activated you'll find me under <strong>Tools &rarr; Backups</strong>. On multisite, you'll find me under the Network Settings menu.
6
+ Version: 3.2.1
7
  Author: Human Made Limited
8
  Author URI: http://hmn.md/
9
  License: GPL-2.0+
changelog.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ * Check if shell_exec is available before running command
2
+ * Only validate day of month if this is the schedule type
3
+ * Make FS optional and fix the DB connect method
4
+ * (issue-770) Exclude the folder, not the wildcard
5
+ * (issue-751) Rename plugin
classes/class-backup.php CHANGED
@@ -169,7 +169,7 @@ namespace HM\BackUpWordPress {
169
  'backupbuddy_backups',
170
  'pb_backupbuddy',
171
  'backup-db',
172
- 'cache',
173
  'Envato-backups',
174
  'managewp',
175
  );
@@ -773,7 +773,7 @@ namespace HM\BackUpWordPress {
773
  public function dump_database() {
774
 
775
  // If we cannot run mysqldump via CLI, fallback to PHP
776
- if ( is_wp_error( $this->user_can_connect() ) ) {
777
  $this->mysqldump_fallback();
778
  } else {
779
  // Attempt mysqldump command
@@ -953,17 +953,17 @@ namespace HM\BackUpWordPress {
953
  public function archive() {
954
 
955
  // Do we have the path to the zip command
956
- if ( $this->get_zip_command_path() ) {
957
  $this->zip();
958
  }
959
 
960
  // If not or if the shell zip failed then use ZipArchive
961
- if ( empty( $this->archive_verified ) && class_exists( 'ZipArchive' ) && empty( $this->skip_zip_archive ) ) {
962
  $this->zip_archive();
963
  }
964
 
965
  // If ZipArchive is unavailable or one of the above failed
966
- if ( empty( $this->archive_verified ) ) {
967
  $this->pcl_zip();
968
  }
969
 
@@ -999,9 +999,13 @@ namespace HM\BackUpWordPress {
999
  // Run the zip command with the recursive and quiet flags
1000
  $command .= ' && ' . escapeshellcmd( $this->get_zip_command_path() ) . ' -rq ';
1001
 
1002
- // If the destination zip file already exists then let's just add changed files to save time
1003
- if ( file_exists( $this->get_archive_filepath() ) && $this->get_existing_archive_filepath() ) {
1004
- $command .= ' -FS ';
 
 
 
 
1005
  }
1006
 
1007
  // Save the zip file to the correct path
@@ -1476,7 +1480,6 @@ namespace HM\BackUpWordPress {
1476
  $rule = '^' . $rule;
1477
  }
1478
 
1479
-
1480
  }
1481
 
1482
  // Escape shell args for zip command
@@ -1843,15 +1846,65 @@ namespace HM\BackUpWordPress {
1843
 
1844
  // mysql --host=localhost --user=myname --password=mypass mydb
1845
 
1846
- $user = escapeshellarg( DB_USER );
 
1847
 
1848
- $pwd = escapeshellarg( DB_PASSWORD );
1849
 
1850
- $host = escapeshellarg( DB_HOST );
1851
 
1852
- $db = escapeshellarg( DB_NAME );
 
 
 
 
 
 
1853
 
1854
- $cmd = "mysql --host={$host} --user={$user} --password={$pwd} {$db}";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1855
 
1856
  // Pipe STDERR to STDOUT
1857
  $cmd .= ' 2>&1';
@@ -1865,9 +1918,8 @@ namespace HM\BackUpWordPress {
1865
  }
1866
 
1867
  if ( $stderr ) {
1868
- return new \WP_Error( 'connection-error', $stderr );
1869
  }
1870
-
1871
  }
1872
 
1873
  }
169
  'backupbuddy_backups',
170
  'pb_backupbuddy',
171
  'backup-db',
172
+ 'cache/',
173
  'Envato-backups',
174
  'managewp',
175
  );
773
  public function dump_database() {
774
 
775
  // If we cannot run mysqldump via CLI, fallback to PHP
776
+ if ( ! ( self::is_shell_exec_available() ) || is_wp_error( $this->user_can_connect() ) ) {
777
  $this->mysqldump_fallback();
778
  } else {
779
  // Attempt mysqldump command
953
  public function archive() {
954
 
955
  // Do we have the path to the zip command
956
+ if ( ( defined( 'HMBKP_FORCE_ZIP_METHOD' ) && ( 'zip' === HMBKP_FORCE_ZIP_METHOD ) ) || $this->get_zip_command_path() ) {
957
  $this->zip();
958
  }
959
 
960
  // If not or if the shell zip failed then use ZipArchive
961
+ if ( ( defined( 'HMBKP_FORCE_ZIP_METHOD' ) && ( 'ziparchive' === HMBKP_FORCE_ZIP_METHOD ) ) || ( empty( $this->archive_verified ) && class_exists( 'ZipArchive' ) && empty( $this->skip_zip_archive ) ) ) {
962
  $this->zip_archive();
963
  }
964
 
965
  // If ZipArchive is unavailable or one of the above failed
966
+ if ( ( defined( 'HMBKP_FORCE_ZIP_METHOD' ) && ( 'pclzip' === HMBKP_FORCE_ZIP_METHOD ) ) || empty( $this->archive_verified ) ) {
967
  $this->pcl_zip();
968
  }
969
 
999
  // Run the zip command with the recursive and quiet flags
1000
  $command .= ' && ' . escapeshellcmd( $this->get_zip_command_path() ) . ' -rq ';
1001
 
1002
+ if ( defined( 'HMBKP_ENABLE_SYNC' ) && HMBKP_ENABLE_SYNC ) {
1003
+
1004
+ // If the destination zip file already exists then let's just add changed files to save time
1005
+ if ( file_exists( $this->get_archive_filepath() ) && $this->get_existing_archive_filepath() ) {
1006
+ $command .= ' -FS ';
1007
+ }
1008
+
1009
  }
1010
 
1011
  // Save the zip file to the correct path
1480
  $rule = '^' . $rule;
1481
  }
1482
 
 
1483
  }
1484
 
1485
  // Escape shell args for zip command
1846
 
1847
  // mysql --host=localhost --user=myname --password=mypass mydb
1848
 
1849
+ // Guess port or socket connection type
1850
+ $port_or_socket = strstr( DB_HOST, ':' );
1851
 
1852
+ $host = DB_HOST;
1853
 
1854
+ if ( ! empty( $port_or_socket ) ) {
1855
 
1856
+ $host = substr( DB_HOST, 0, strpos( DB_HOST, ':' ) );
1857
+
1858
+ $port_or_socket = substr( $port_or_socket, 1 );
1859
+
1860
+ if ( 0 !== strpos( $port_or_socket, '/' ) ) {
1861
+
1862
+ $port = intval( $port_or_socket );
1863
 
1864
+ $maybe_socket = strstr( $port_or_socket, ':' );
1865
+
1866
+ if ( ! empty( $maybe_socket ) ) {
1867
+
1868
+ $socket = substr( $maybe_socket, 1 );
1869
+
1870
+ }
1871
+
1872
+ } else {
1873
+
1874
+ $socket = $port_or_socket;
1875
+
1876
+ }
1877
+ }
1878
+
1879
+ // Path to the mysqldump executable
1880
+ $cmd = 'mysql ';
1881
+
1882
+ // Username
1883
+ $cmd .= ' -u ' . escapeshellarg( DB_USER );
1884
+
1885
+ // Don't pass the password if it's blank
1886
+ if ( DB_PASSWORD ) {
1887
+ $cmd .= ' -p' . escapeshellarg( DB_PASSWORD );
1888
+ }
1889
+
1890
+ // Set the host
1891
+ $cmd .= ' -h ' . escapeshellarg( $host );
1892
+
1893
+ // Set the port if it was set
1894
+ if ( ! empty( $port ) && is_numeric( $port ) ) {
1895
+ $cmd .= ' -P ' . $port;
1896
+ }
1897
+
1898
+ // Set the socket path
1899
+ if ( ! empty( $socket ) && ! is_numeric( $socket ) ) {
1900
+ $cmd .= ' --protocol=socket -S ' . $socket;
1901
+ }
1902
+
1903
+ // The database we're dumping
1904
+ $cmd .= ' ' . escapeshellarg( DB_NAME );
1905
+
1906
+ // Quit immediately
1907
+ $cmd .= ' --execute="quit"';
1908
 
1909
  // Pipe STDERR to STDOUT
1910
  $cmd .= ' 2>&1';
1918
  }
1919
 
1920
  if ( $stderr ) {
1921
+ return new \WP_Error( 'mysql-cli-connect-error', __( 'Could not connect to mysql', 'backupwordpress' ) );
1922
  }
 
1923
  }
1924
 
1925
  }
languages/backupwordpress.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: BackUpWordPress 3.2.0\n"
6
  "Report-Msgid-Bugs-To: support@humanmade.co.uk\n"
7
- "POT-Creation-Date: 2015-03-16 08:25:27+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -720,6 +720,10 @@ msgid ""
720
  "or complete"
721
  msgstr ""
722
 
 
 
 
 
723
  #: classes/class-backupwordpress-wp-cli-command.php:50
724
  msgid "Backup: Dumping database..."
725
  msgstr ""
@@ -942,7 +946,7 @@ msgstr ""
942
  msgid "Argument 1 for %s must be a valid class"
943
  msgstr ""
944
 
945
- #. Plugin Name of the plugin/theme
946
  msgid "BackUpWordPress"
947
  msgstr ""
948
 
@@ -1170,6 +1174,10 @@ msgstr ""
1170
  msgid "Database Manually"
1171
  msgstr ""
1172
 
 
 
 
 
1173
  #. Plugin URI of the plugin/theme
1174
  msgid "http://bwp.hmn.md/"
1175
  msgstr ""
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: BackUpWordPress Backup Plugin 3.2.1\n"
6
  "Report-Msgid-Bugs-To: support@humanmade.co.uk\n"
7
+ "POT-Creation-Date: 2015-03-25 16:55:34+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
720
  "or complete"
721
  msgstr ""
722
 
723
+ #: classes/class-backup.php:1921
724
+ msgid "Could not connect to mysql"
725
+ msgstr ""
726
+
727
  #: classes/class-backupwordpress-wp-cli-command.php:50
728
  msgid "Backup: Dumping database..."
729
  msgstr ""
946
  msgid "Argument 1 for %s must be a valid class"
947
  msgstr ""
948
 
949
+ #: classes/class-setup.php:34
950
  msgid "BackUpWordPress"
951
  msgstr ""
952
 
1174
  msgid "Database Manually"
1175
  msgstr ""
1176
 
1177
+ #. Plugin Name of the plugin/theme
1178
+ msgid "BackUpWordPress Backup Plugin"
1179
+ msgstr ""
1180
+
1181
  #. Plugin URI of the plugin/theme
1182
  msgid "http://bwp.hmn.md/"
1183
  msgstr ""
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: humanmade, willmot, pauldewouters, joehoyle, mattheu, tcrsavage, cuvelier
3
  Tags: back up, backup, backups, database, zip, db, files, archive, wp-cli, humanmade
4
  Requires at least: 3.9
5
- Tested up to: 4.2-alpha
6
- Stable tag: 3.2.0
7
 
8
  Simple automated backups of your WordPress powered website.
9
 
@@ -118,6 +118,10 @@ You can also tweet <a href="http://twitter.com/humanmadeltd">@humanmadeltd</a> o
118
 
119
  == Upgrade Notice ==
120
 
 
 
 
 
121
  = 3.1.3 =
122
 
123
  * Fixes backwards compatibility for add-ons and avoids a Fatal Error. Please upgrade straight to this version before upgrading your add-ons.
@@ -136,6 +140,14 @@ You can also tweet <a href="http://twitter.com/humanmadeltd">@humanmadeltd</a> o
136
 
137
  == Changelog ==
138
 
 
 
 
 
 
 
 
 
139
  ### 3.2 / 2015-03-16
140
 
141
  * (issue-698) skip mySql bug
2
  Contributors: humanmade, willmot, pauldewouters, joehoyle, mattheu, tcrsavage, cuvelier
3
  Tags: back up, backup, backups, database, zip, db, files, archive, wp-cli, humanmade
4
  Requires at least: 3.9
5
+ Tested up to: 4.2-beta
6
+ Stable tag: 3.2.1
7
 
8
  Simple automated backups of your WordPress powered website.
9
 
118
 
119
  == Upgrade Notice ==
120
 
121
+ = 3.2.1 =
122
+
123
+ * Important bug fixes. Please upgrade to this version to avoid incomplete or broken backups.
124
+
125
  = 3.1.3 =
126
 
127
  * Fixes backwards compatibility for add-ons and avoids a Fatal Error. Please upgrade straight to this version before upgrading your add-ons.
140
 
141
  == Changelog ==
142
 
143
+ ### 3.2.1 / 2015-03-25
144
+
145
+ * Check if shell_exec is available before running command
146
+ * Only validate day of month if this is the schedule type
147
+ * Make FS optional and fix the DB connect method
148
+ * (issue-770) Exclude the folder, not the wildcard
149
+ * (issue-751) Rename plugin
150
+
151
  ### 3.2 / 2015-03-16
152
 
153
  * (issue-698) skip mySql bug