Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions admin/class-boldgrid-backup-admin-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -2600,14 +2600,16 @@ public function restore_archive_file( $dryrun = false, array $args = [] ) {
do_action( 'boldgrid_backup_pre_restore', $info );

/*
* Attempt to fix any permissions related issues before the restoration begins. If we're
* unable to, the restoration may not continue.
* Attempt to fix any permissions related issues before the restoration begins.
*
* Historically, we'd abort the restoration if we couldn't set writable permissions. Now, we'll
* add a line to the logs and try anyways. A bug was encountered where we couldn't set writable
* permissions and yet the restore completed. Voodoo.
*/
if ( class_exists( 'ZipArchive' ) ) {
if ( ! $this->restore_helper->set_writable_permissions( $info['filepath'] ) ) {
$error_message = $this->restore_helper->get_last_error();
$this->logger->add( $error_message );
return [ 'error' => $error_message ];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Permission prep stops after first failure

Medium Severity

set_writable_permissions still returns on the first chmod failure, so later archive paths are never prepared. Restore now continues into unzip_file anyway, which can then fail on files that would have been writable if permission prep had finished.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 69c3568. Configure here.

}
} else {
$this->logger->add( 'ZipArchive not available. Unable to set_writable_permissions. Trying restore anyways...' );
Expand Down