You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -65,6 +72,7 @@ public function backup( $args, $assoc_args = [] ) {
65
72
66
73
// Handle --list flag to display available backups
67
74
if ( $list_backups ) {
75
+
$this->check_rclone_available();
68
76
$this->list_remote_backups();
69
77
70
78
return; // Exit after listing backups
@@ -263,6 +271,12 @@ public function restore( $args, $assoc_args = [] ) {
263
271
264
272
if ( $backup_id ) {
265
273
274
+
// verify_backup_id() lists remote backups (rclone lsf) before the
275
+
// pre_restore_check() preflight below, so check rclone here too --
276
+
// otherwise a missing rclone surfaces as a misleading "Invalid backup
277
+
// ID" instead of the friendly "rclone is not installed" message.
278
+
$this->check_rclone_available();
279
+
266
280
if ( ! $this->verify_backup_id( $backup_id ) ) {
267
281
EE::error( "Invalid backup ID provided.\nPlease provide a valid ID from the list using 'ee site backup --list " . $this->site_data['site_url'] . "'." );
268
282
}
@@ -865,7 +879,14 @@ private function restore_wp( $backup_dir ) {
865
879
EE::run_command( $args, $assoc_args, $options );
866
880
}
867
881
868
-
privatefunctionpre_backup_restore_checks() {
882
+
/**
883
+
* Verify rclone is installed and the configured backend exists.
884
+
*
885
+
* Extracted from pre_backup_restore_checks() so read-only paths (e.g.
886
+
* `ee site backup --list`) can run it before invoking rclone and surface a
887
+
* friendly message instead of a raw "sh: 1: rclone: not found".
888
+
*/
889
+
privatefunctioncheck_rclone_available() {
869
890
$command = 'rclone --version';
870
891
$return_code = EE::exec( $command );
871
892
@@ -893,6 +914,10 @@ private function pre_backup_restore_checks() {
893
914
);
894
915
EE::error( sprintf( 'rclone backend "%s" does not exist. Please create it using `rclone config`', $rclone_backend ) );
895
916
}
917
+
}
918
+
919
+
privatefunctionpre_backup_restore_checks() {
920
+
$this->check_rclone_available();
896
921
897
922
$this->check_and_install( 'zip', 'zip' );
898
923
$this->check_and_install( '7z', 'p7zip-full' );
@@ -1286,6 +1311,20 @@ private function get_available_ram_mb() {
1286
1311
returnintval( EE::launch( $command )->stdout );
1287
1312
}
1288
1313
1314
+
/**
1315
+
* Installed rclone version as a dotted string (e.g. "1.66.0"), or '' if it
1316
+
* cannot be determined. Used to gate download flags that older rclone lacks.
1317
+
*
1318
+
* @return string
1319
+
*/
1320
+
privatefunctionget_rclone_version() {
1321
+
// `rclone version` prints e.g. "rclone v1.66.0" on its first line.
1322
+
$output = EE::launch( "rclone version | head -n1 | awk '{print $2}'" )->stdout;
0 commit comments