ThemeFuse / Unyson

A WordPress framework that facilitates the development of WP themes
http://unyson.io
922 stars 218 forks source link

Archive Zip: The execution failed. Please check error.log (Solved) #4388

Open ahrana opened 3 days ago

ahrana commented 3 days ago

if you can't take backup using backups and demo extension, then use my below modified code, it will work and you can take backup.

screencapture-dev-cxrana-pantheonsite-io-wp-admin-tools-php-2024-10-22-23_12_35

File Name : class-fw-ext-backups-task-type-zip.php

Go to the file /code/wp-content/plugins/unyson/framework/extensions/backups/includes/module/tasks/type/class-fw-ext-backups-task-type-zip.php. Look at line 120, where ZipArchive->setCompressionName() is called.

You can fix the issue in the FW_Ext_Backups_Task_Type_Zip class by adding a validation check to ensure the compression name is not empty when calling the setCompressionName() method

below is my full modified file, just replace the file:

`<?php if (!defined('FW')) die('Forbidden');

/**

ahrana commented 3 days ago

### Look at line 120, where ZipArchive->setCompressionName() is called

In the line where setCompressionName() is called, I've added a check to ensure that both the file path and compression method are not empty before attempting to set the compression

Modified Line: 120 no line

 if ( $set_compression_is_available ) {
                // Ensure compression name is not empty before setting
                $compression_method = apply_filters( 'fw_backup_compression_method', ZipArchive::CM_DEFAULT );
                if (!empty($file_zip_path) && $compression_method !== false) {
                    $zip->setCompressionName( $file_zip_path, $compression_method );
                }
            }
        }

        // Zip archive will be created only after closing the object
ahrana commented 2 days ago

if your extensions not Installing or activating

copy my code and paste to your themes functions.php

/**
 * Remove Unyson's default GitHub API URL filter.
 *
 * This allows us to use our own custom GitHub API URL, 
 * which is important for [reason - e.g., security, custom domain, etc.].
 *
 * Developed by Rana / Learn With Rana 
 */
function remove_unyson_github_filter() {
    remove_filter('fw_github_api_url', '_fw_filter_github_api_url');
}

add_action('after_setup_theme', 'remove_unyson_github_filter');