Giter Club home page Giter Club logo

Comments (37)

 avatar commented on July 18, 2024 2

ZipArchive also has this, of course we will test it on some hosting servers, and you will test it when we will create the approval.

from unyson-backups-extension.

 avatar commented on July 18, 2024 1

http://www.phpconcept.net/pclzip/ Contains too much "noise", defined global constants. http://www.phpclasses.org/browse/file/10410.html is just a class, I will inspect it and figure out if it can be used to unzip in steps.

from unyson-backups-extension.

 avatar commented on July 18, 2024 1

I didn't know about zip_*() functions. I just did a test and it woks and the code is simple. Thank you very much! I will try to integrate them in unzip process.

from unyson-backups-extension.

 avatar commented on July 18, 2024 1

I haven't noticed that the download task had it's own unzip script, now I changed it to use the partial unzip 19e5348

from unyson-backups-extension.

 avatar commented on July 18, 2024 1

Code snippets soon...

from unyson-backups-extension.

 avatar commented on July 18, 2024 1

This possibility was already there #15

How to disable image sizes remove on Content Backup

Important! Use this code only while developing, to export a demo install with image sizes included. Do not include this code in theme in production, because all Content Backups created by user will be with image sizes.

  1. Add the filter in {theme}/functions.php

    add_filter(
        'fw:ext:backups:add-backup-task:image-sizes-remove',
        '_filter_theme_fw_ext_backups_disable_image_sizes_remove',
        10, 2
    );
    function _filter_theme_fw_ext_backups_disable_image_sizes_remove(
        $do, FW_Ext_Backups_Task_Collection $collection
    ) {
        $do = false;
        return $do;
    }
  2. Do Content Backup

  3. Remove the filter from 1.

How to disable image sizes restore for specific demo

add_filter(
    'fw:ext:backups:add-restore-task:image-sizes-restore', 
    '_filter_theme_fw_backups_disable_image_sizes_restore'.
    10, 2
);
function _filter_theme_fw_backups_disable_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;
}

from unyson-backups-extension.

 avatar commented on July 18, 2024 1

How content backup works:

  1. db is exported to a txt file
  2. uploads/ is copied
  3. image sizes are deleted from the copied uploads/ (only original images are left)
  4. everything is ziped

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

yes , this would be useful to eliminate the long resizing images process

from unyson-backups-extension.

 avatar commented on July 18, 2024

What about this?

On sizes restore start do:

  1. Get first attachment file name hello.jpg, find its sizes by file name hello-...x....jpg and remember the list
  2. Regenerate sizes for that first image and load again the files list
  3. If the initial file list is identical to the one after regenerate, this mean that the zip contains all image sizes and there is no point to regenerate all images

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

sounds doable, but what if user has switched themes in lets say last 3 months , and theme he uses now has different image sizes , the check would not be reliable.

from unyson-backups-extension.

 avatar commented on July 18, 2024

Do you mean a demo install designed for one theme will be used for completely different theme?

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

no I dont mean that ,

you make theme ,
I make theme

both based on Unyson

user uses yours , than uses mine ,

than decides to make demo

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

here we have to think that demo functionality is available to all of us, users and developers

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

in ref to that unzip function , I just checked our unzip code and we ended up uzing this lib
http://www.phpclasses.org/browse/file/10410.html in combo with dZip

instead of that function. It was more reliable and gave us option to restrict up/down per user.
but this one is also widely used http://www.phpconcept.net/pclzip/
and does not require any additional php.ini settings

from unyson-backups-extension.

 avatar commented on July 18, 2024

I am concerned about compatibility with different zip archives created with different zip clients. For example here is a comment from that file:

    Function _loadFileListByEOF(&$fh, $stopOnFile=false){
        // Check if there's a valid Central Dir signature.
        // Let's consider a file comment smaller than 1024 characters...
        // Actually, it length can be 65536.. But we're not going to support it.

        for($x = 0; $x < 1024; $x++){

I hope everything will be fine.

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

this guy did it with zipacrchive , http://stackoverflow.com/questions/3263129/unzipping-larger-files-with-php ,

but see this comment http://stackoverflow.com/a/3263293/594423

looks like this does it in chunks already

$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
 fwrite($fp,"$buf");

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

before you dig in check this please , http://prntscr.com/cqzq6z

I am not sure if it requires PECL zip , or is also available for it .
If it does requires it note that many servers dont have it by default

from unyson-backups-extension.

 avatar commented on July 18, 2024

I remember that previously I made zip and unzip in steps, but when I added/extracted one file from zip, the entire zip was loaded and processed in background (in FTP I saw a big temp file) and the process was way slower that doing everything at once. I hope with zip_*() functions that will not happen.

from unyson-backups-extension.

 avatar commented on July 18, 2024

I edited a Content Backup zip and added 45k files in it (Unyson svn respository). The archive is ~215Mb, my php memory limit is 40Mb. The backup restore worked fine, the unzip process was made in 2 requests/steps (also I decreased manually unzip timeout and it was made in multiple steps).

error_log(memory_get_peak_usage().':'.memory_get_peak_usage(true));

showed 18791320:2097152 which is 17.9MB:2MB. If it will work on slow servers it will be awesome.

from unyson-backups-extension.

 avatar commented on July 18, 2024

59e33f4

Please test

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

on it

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

Im getting this

[07-Oct-2016 17:42:55 UTC] PHP Warning:  copy(T:/wamp64/www/Development/DemosTest/wordpress/wp-content/themes/theme_name/demo-content/clean\f\plugins\unyson\framework\extensions\learning\extensions\learning-quiz\includes\option-types\quiz-builder\items\gap-fill\class-fw-option-type-quiz-builder-item-gap-fill.php): failed to open stream: Invalid argument in T:\wamp64\www\Development\DemosTest\wordpress\wp-content\plugins\unyson\framework\extensions\backups\helpers.php on line 147

using local theme install , demo is located in

theme/demo-content

from unyson-backups-extension.

 avatar commented on July 18, 2024

I think it's Windows path length limit

> 'T:/wamp64/www/Development/DemosTest/wordpress/wp-content/themes/theme_name/demo-content/clean/f/plugins/unyson/framework/extensions/learning/extensions/learning-quiz/includes/option-types/quiz-builder/items/gap-fill/class-fw-option-type-quiz-builder-item-gap-fill.php'.length
267

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

me to , doing new backup ,

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

well seems like same process if done from demo-content folder , will do next test on demo download

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

this will take looong http://prntscr.com/cr1y7h

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

tell me , is the process interrupted if I get out of demo install page ?

from unyson-backups-extension.

 avatar commented on July 18, 2024
  1. This change 59e33f4 contains only unzip improvements
  2. Image Sizes process wasn't touched
  3. Demo Install has nothing to do with plugins and themes

from unyson-backups-extension.

 avatar commented on July 18, 2024

Yes

from unyson-backups-extension.

 avatar commented on July 18, 2024

Your theme should require the plugins with TGM

from unyson-backups-extension.

 avatar commented on July 18, 2024

That is a another issue.

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

k deleted, will test this more

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

Im lost.

Use this code only while developing, to export a demo install with image sizes included

I thought we will have off switch for image sizes restore.
What is image sizes remove?

Sorry but I dont understand the usage at all.

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

I add filters
Export demo
Remove filters from theme

Demo installs without image sizes restore

Right?

from unyson-backups-extension.

 avatar commented on July 18, 2024

I add filters
Export demo
Remove filters from theme

Yes, this is for first filter.

Demo installs without image sizes restore

This is for the second filter. (note the DEMO_ID_X in array)

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

ok but What is image sizes remove? http://prntscr.com/csnd9b

from unyson-backups-extension.

danyj avatar danyj commented on July 18, 2024

@moldcraft ,

does the second filter , fw:ext:backups:add-restore-task:image-sizes-restore

also need to be removed? Not right?

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.