Jump to content
flydev

Duplicator: Backup and move sites

Recommended Posts

So, after multiple tries to code a function which could zip a folder and could lead to be extracted on both platforms (win/unix) failed. The function I built (which I think can work on both platforms) lead to a ZipArchive error: NO ERROR on Windows and thus the zip file is not finalized 😤😤

it irks me, if someone has a function which work on both platform please post it here ✌️

 

Share this post


Link to post
Share on other sites
50 minutes ago, flydev said:

So, after multiple tries to code a function which could zip a folder and could lead to be extracted on both platforms (win/unix) failed. The function I built (which I think can work on both platforms) lead to a ZipArchive error: NO ERROR on Windows and thus the zip file is not finalized 😤😤

it irks me, if someone has a function which work on both platform please post it here ✌️

 

I haven't been following the zip conversation closely but don't ProcessWire's inbuilt functions not work? wireZipFile() has never failed me and more lately $files->zip(). I've just tried the following (example from the Docs) on my local Windows machine (EDIT: not  a Windows Server though!) and remote linux machine and $files->zip() worked without errors (nested folders; PW 3.x):

 

// Create zip of all files in directory $dir to file $zip
$dir = $config->paths->cache . "my-files/";
$zip = $config->paths->cache . "my-file.zip";
$result = $files->zip($zip, $dir);

echo "<h3>These files were added to the ZIP:</h3>";
foreach($result['files'] as $file) {
  echo "<li>" . $sanitizer->entities($file) . "</li>";
}

if(count($result['errors'])) {
  echo "<h3>There were errors:</h3>";
  foreach($result['errors'] as $error) {
    echo "<li>" . $sanitizer->entities($error) . "</li>";
  }
}

 

Edited by kongondo
windows not windows server!
  • Like 1

Share this post


Link to post
Share on other sites

Thanks @kongondo,

from what I remember, the main reason I didn't used this function is because it doesn't work with the exclude feature.

Maybe I am wrong, I will look more closer at the function's code.

Share this post


Link to post
Share on other sites

yes,

and I know I can exclude files directly in WireZipFile() but I can't apply a filter on the iterator. Now, writing this post, I have an idea which could work.

Share this post


Link to post
Share on other sites

Yes, but there is a feature to exclude files by extension - not tested a wildcard in the core function - which can't work "as is" with this function.

 

Maybe I should return an array of all files (from an extension provided) and passing this array to the function. This should work.

Share this post


Link to post
Share on other sites
3 minutes ago, flydev said:

Maybe I should return an array of all files (from an extension provided) and passing this array to the function. This should work.

I think it would work. $files->($zip, array|string $files)

  • Like 2

Share this post


Link to post
Share on other sites

Okay, thanks @kongondo, you put me on the right track. The zip file can be extracted on Windows and Unix, but the "extension feature" doesn't work.  Will find a workaround.  Thanks again :)

  • Like 1

Share this post


Link to post
Share on other sites
26 minutes ago, flydev said:

Okay, thanks @kongondo, you put me on the right track. The zip file can be extracted on Windows and Unix :)

Glad that part work.

27 minutes ago, flydev said:

....but the "extension feature" doesn't work.  Will find a workaround.

Hmm. Doesn't work on both OS?

Share this post


Link to post
Share on other sites

hi @flydev

I didn't follow the whole thread. Maybe you want to have a look at https://doc.nette.org/en/2.4/finder and https://doc.nette.org/en/2.4/filesystem; Maybe this makes things easier :)

You could also have a look at Soma's online installer: https://raw.githubusercontent.com/somatonic/PWOnlineInstaller/master/grabpw.php (this is in use for a long time and should be tested on all systems).

 

  • Like 1

Share this post


Link to post
Share on other sites

I'm getting the error below

Quote

Warning: filesize(): stat failed for /home/floriann/public_html/site/assets/logs/duplicator.txt in /home/floriann/public_html/wire/core/FileLog.php on line 225

Warning: filesize(): stat failed for /home/floriann/public_html/site/assets/logs/duplicator.txt in /home/floriann/public_html/wire/core/FileLog.php on line 225

Warning: filesize(): stat failed for /home/floriann/public_html/site/assets/logs/duplicator.txt in /home/floriann/public_html/wire/core/FileLog.php on line 237

Warning: file(/home/floriann/public_html/site/assets/logs/duplicator.txt): failed to open stream: No such file or directory in /home/floriann/public_html/wire/core/FileLog.php on line 238

The mention of filesize is odd because this site is a 1 page holding page with 4 medium images. Other than that it's the usual 3.0.96 files.

This is on a server which I don't have complete control over. Otherwise I'd get you better server info.

  • Like 1

Share this post


Link to post
Share on other sites

@Peter Knight   this issue is known and fixed in the next version.

The cause is that the ProcessModule try to load the log file but the file does not exist (the file is created on the first backup).

  • Like 3

Share this post


Link to post
Share on other sites

Hello,

the module got updated, please upgrade it to version 1.1.9.

This version contain some small fixes, the major fix is that packages can be built/extracted on Windows and/or Unix platforms and the exclusion feature still work as expected.

Apart from that, I am working on the GoogleDrive feature; It look like that the AmazonS3 feature need an update. Dropbox v2 planned for soon.

 

@adrian I found (another or maybe this is what you was talking about ?) confusing thing with GoogleDrive. Duplicator can store 10 packages in GoogleDrive and delete the older keeping the newer but without differencing packages built on distinct websites. In the current state of the module, when he get files from Google Drive, all packages are threated as "one (1) website".

 

Edited by flydev
Amazon still working
  • Like 2

Share this post


Link to post
Share on other sites
20 minutes ago, flydev said:

@adrian I found (another or maybe this is what you was talking about ?) confusing thing with GoogleDrive. Duplicator can store 10 packages in GoogleDrive and delete the older keeping the newer but without differencing packages built on distinct websites. In the current state of the module, when he get files from Google Drive, all packages are threated as "one (1) website".

Sorry @flydev - I don't quite follow what you are saying there, but to clarify what I am seeing - once it hit's 10 packages for one site, none are deleted, so no more are uploaded unless I manually delete some.

  • Like 1

Share this post


Link to post
Share on other sites

For people interested, Dropbox support is back. It needs to be tested a bit ^_^

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites
8 hours ago, flydev said:

Dropbox support is back. It needs to be tested a bit

Thanx a lot! I will check it out this week.

  • Like 1

Share this post


Link to post
Share on other sites

Cool! I forgot to say that the Dropbox API installation is only supported trough Composer. I will see if I got the time to make a "standalone SDK".

 

Also I don't know if people here already heard about of the cloud backup solution for professional, iDrive. Our company is a long time customer of their services and we never had an issue. They have military grade security implemented on backups. I was not going to promote their service as I trough they had only paid plans, but finally they have a free plan of 5Gb. I would like to say that there are no more reason to not have a professional backup solution for your client !

It will be implemented in Duplicator very soon as I need it quickly! 💪

 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites
45 minutes ago, flydev said:

Also I don't know if people here already heard about of the cloud backup solution for professional, iDrive.

 

Started using iDrive after CrashPlan announced the end of their Consumer plans. Not a bad product at all and they often have great discounts on the Macworld newsletters. 

I'm a bit of a backup junkie and have been through (or am still using)

  • Syncplicity
  • Sugar Sync
  • Crash Plan
  • DropBox
  • Google Drive
  • Amazon Backup Drive
  • Amazon S3 storage
  • oDrive
    and probably more

However realising this is a ridiculous setup I am going to consolidate soon :)

Just discovered a really nice app called pCloud recently and it works a little different. It creates a virtual cloud drive on your machine so that any files you put in there don't take up space on your local machine. Worth a look as the Apps and website based account ar every nicely done. As much as I like iDrive and others, some of the interfaces are awful. iDrive looks like something from the 90s.

  • Like 1

Share this post


Link to post
Share on other sites
57 minutes ago, flydev said:

but finally they have a free plan of 5Gb.

Sounds great! I think I will give it a test drive, however, I cannot find its features listed:

https://www.idrive.com/pricing

Do they mean that the Free plan is exactly the same as Personal except the difference in storage limit?

  • Like 1

Share this post


Link to post
Share on other sites
6 minutes ago, Peter Knight said:

iDrive looks like something from the 90s.

I lol'd, thanks.

Yes sure, but its robust! Like ProcessWire and his 90s homepage 😅 They work on features, no time for frontend fashion things!

  • Like 2

Share this post


Link to post
Share on other sites
On 4/10/2018 at 9:51 AM, szabesz said:

Sounds great! I think I will give it a test drive, however, I cannot find its features listed:

https://www.idrive.com/pricing

Do they mean that the Free plan is exactly the same as Personal except the difference in storage limit?

If you're considering a paid plan, there's 90% off for the first year here

https://www.idrive.com/idrive/signup/el/macworld90

That's not my affiliate link but probably MacWorlds

  • Like 2

Share this post


Link to post
Share on other sites

Thanks Peter, however I never fall for "first year is cheaper" and such because after that period normally one has to pay the full price.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By jaro
      This module (github) does with site/assets/files what Ryan's DatabaseBackups module does with the database:
      Backup site/assets Download ZIP archive Upload ZIP archive Restore site/assets Motivation: This module can be the missing part for projects with content backup responsibility on the client's side: The client will be able to download DB and assets/files snapshots through the backend without filesystem access, thus backing up all content themselves.
      Release state alpha – do not use in production environments.
      Credits for the nice UI go to @ryan – I reused most of it and some other code from the DatabaseBackups module.
    • By David Karich
      ProcessWire InputfieldRepeaterMatrixDuplicate
      Thanks to the great ProModule "RepeaterMatrix" I have the possibility to create complex repeater items. With it I have created a quite powerful page builder. Many different content modules, with many more possible design options. The RepeaterMatrix module supports the cloning of items, but only within the same page. Now I often have the case that very design-intensive pages and items are created. If you want to use a content module on a different page (e.g. in the same design), you have to rebuild each item manually every time.
      This module extends the commercial ProModule "RepeaterMatrix" by the function to duplicate repeater items from one page to another page. The condition is that the target field is the same matrix field from which the item is duplicated. This module is currently understood as proof of concept. There are a few limitations that need to be considered. The intention of the module is that this functionality is integrated into the core of RepeaterMatrix and does not require an extra module.
      Check out the screencast
      What the module can do
      Duplicate a repeater item from one page to another No matter how complex the item is Full support for file and image fields Multilingual support Support of Min and Max settings Live synchronization of clipboard between multiple browser tabs. Copy an item and simply switch the browser tab to the target page and you will immediately see the past button Support of multiple RepeaterMatrix fields on one page Configurable which roles and fields are excluded Duplicated items are automatically pasted to the end of the target field and set to hidden status so that changes are not directly published Automatic clipboard update when other items are picked Automatically removes old clipboard data if it is not pasted within 6 hours Delete clipboard itself by clicking the selected item again Benefit: unbelievably fast workflow and content replication What the module can't do
      Before an item can be duplicated in its current version, the source page must be saved. This means that if you make changes to an item and copy this, the old saved state will be duplicated Dynamic loading is currently not possible. Means no AJAX. When pasting, the target page is saved completely No support for nested repeater items. Currently only first level items can be duplicated. Means a repeater field in a repeater field cannot be duplicated. Workaround: simply duplicate the parent item Dynamic reloading and adding of repeater items cannot be registered. Several interfaces and events from the core are missing. The initialization occurs only once after the page load event Changelog
      1.0.4
      Bug fix: Various bug fixes and improvements in live synchronization Bug fix: Items are no longer inserted when the normal save button is clicked. Only when the past button is explicitly clicked Feature: Support of multiple repeater fields in one page Feature: Support of repeater Min/Max settings Feature: Configurable roles and fields Enhancement: Improved clipboard management Enhancement: Documentation improvement Enhancement: Corrected few typos #1 1.0.3
      Feature: Live synchronization Enhancement: Load the module only in the backend Enhancement: Documentation improvement 1.0.2
      Bug fix: Various bug fixes and improvements in JS functions Enhancement: Documentation improvement Enhancement: Corrected few typos 1.0.1
      Bug fix: Various bug fixes and improvements in the duplication process 1.0.0
      Initial release Support this module
      If this module is useful for you, I am very thankful for your small donation: Donate 5,- Euro (via PayPal – or an amount of your choice. Thank you!)
      Download this module
      > Github: https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDuplicate
      > PW module directory: – soon –
    • By NorbertH
      Is there a hook to do something right after cloning a page ?
      I want the page to be saved right after cloning it either from the button in the tree or from a lister, because saving the page triggers several calculations that are not triggered by just cloning the page.
       
      Thanks in advance !
    • By John W.
      Question 1
      I recently installed PW 3.0.62 for a new site and also have sites running older version of PW 3.x.
      Can I export the database on an older version of PW 3.x and import it to PW 3.0.62 without any issues?
       
      Question 2
      (This is kind of alternative to the above for long term use - and maybe a better solution...)
      On  the sites I've previously built I have templates (home, basic-page, contact) and fields that I commonly use, such as business_name, phone_1.  The last site I built is running PW 3.0.42.  I was considering cloning this into a local site and running the upgrade module to bring it up to PW 3.0.62. From there on out when I start I new project I could just run the PW upgrade module, copy the folder to the location for the new project and duplicate the database using the new projects name.

      So basically, I'll always keep a "blank slate" site that I can just run the PW upgrade on, then duplicate into a new project. This would cut down on the work and time spent having to re-create these common fields, that I use. From there, I would just add fields, templates, etc, specific for the new website project.

      Is this a sound approach to speed up development?

       
×
×
  • Create New...