Giter Club home page Giter Club logo

Comments (15)

 avatar commented on July 18, 2024

The restore happens here, if you know how to make it skip already existing resizes, please create pull request or give us the solution and we will make the changes.

from unyson-backups-extension.

 avatar commented on July 18, 2024

I can add a filter here and here so you will be able to add_filter() and disable those tasks.

Will this solution fit your needs?

from unyson-backups-extension.

pear1 avatar pear1 commented on July 18, 2024

Yes, if we can trigger this filter for specific demos.
For example trigger this filter when specific demo is installing.

from unyson-backups-extension.

 avatar commented on July 18, 2024

In the filter you will have access to demo details (like ID)

from unyson-backups-extension.

pear1 avatar pear1 commented on July 18, 2024

That would be awesome.

from unyson-backups-extension.

 avatar commented on July 18, 2024
function _filter_theme_fw_backups_do_image_sizes_restore(
    $do,
    FW_Ext_Backups_Task_Collection $collection
) {
    if (
        $collection->get_id() === 'demo-content-install'
        &&
        ($task = $collection->get_task('demo:demo-download'))
        &&
        ($task_args = $task->get_args())
        &&
        isset($task_args['demo_id'])
        &&
        in_array($task_args['demo_id'], array('DEMO_ID_1', 'DEMO_ID_2'))
    ) {
        $do = false;
    }

    return $do;
}
add_filter(
    'fw:ext:backups:add-restore-task:image-sizes-restore', 
    '_filter_theme_fw_backups_do_image_sizes_restore'.
    10, 2
);

from unyson-backups-extension.

 avatar commented on July 18, 2024

Download latest Backups extension from Github and test the filter. Let us know it works and it will be included in the next release.

from unyson-backups-extension.

pear1 avatar pear1 commented on July 18, 2024

When we add this filter, then no demo has Image Sizes Restore task.
How can we get the demo ID? We tried local folder names, but that didn't work.

from unyson-backups-extension.

 avatar commented on July 18, 2024

#15 (comment)

$task_args['demo_id']

from unyson-backups-extension.

pear1 avatar pear1 commented on July 18, 2024

Tried this, but all our demos skip Image Sizes Restore task.

function _filter_theme_fw_backups_do_image_sizes_restore(
    $do,
    FW_Ext_Backups_Task_Collection $collection
) {
    if (
        $collection->get_id() === 'demo-content-install'
        &&
        ($task = $collection->get_task('demo:demo-download'))
        &&
        ($task_args = $task->get_args())
        &&
        isset($task_args['demo_id'])
        &&
        in_array($task_args['demo_id'], array('demo-local-643e272z588b54db5abf0af67f730345'))
    ) {
        $do = false;
    }

    return $do;
}
add_filter(
    'fw:ext:backups:add-restore-task:image-sizes-restore', 
    '_filter_theme_fw_backups_do_image_sizes_restore',
    10, 2
);

from unyson-backups-extension.

 avatar commented on July 18, 2024

Debug that code and check why it always enters in if.

from unyson-backups-extension.

pear1 avatar pear1 commented on July 18, 2024

The issue was dot instead of comma:

'_filter_theme_fw_backups_do_image_sizes_restore'. <--------------
10, 2

Now everything works fine, but the demo id is generated different in every new installation. For example I have Classic and Explore demos, I need to disable image resize for Classic demo for every client WordPress installation.

from unyson-backups-extension.

pear1 avatar pear1 commented on July 18, 2024

One way to fix it could be by using demo content folder name instead?

from unyson-backups-extension.

 avatar commented on July 18, 2024

Yes. The id must be always the same. You are generating random md5 as id?

from unyson-backups-extension.

pear1 avatar pear1 commented on July 18, 2024

For one of demos I was using value what was given by $task_args['demo_id'], but then I realize that it was dynamically generated.

from unyson-backups-extension.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.