Jump to content
flydev 👊🏻

☁️ Duplicator: Backup and move sites

Recommended Posts

Duplicator-logo-v2-Dlong.thumb.png.8898ec8cda79046779b10d8527fc0def.png

 

Current version: 1.3.14-ATO

You can find the module on Github and in the modules directory :

 

Quote

To restore a website, just upload the package and the installer, then go to yourwebsite.com/installer.php then follow the instructions.

PLEASE, do not forget - after the end of the process - to delete the installer.php file and your package 

 

Screenshots / Features

  • Dir and files exclusion

dup2-feat-exclude.thumb.png.066de2c6ea27ae20db8abad2e91fa6a0.png

 

  • CRON job

dup3-feat-cron.thumb.png.060aff48a1cdd05d9687eca51f3cab4b.png

 

  • Advanced settings 

dup4-feat-adv.thumb.png.9f5d8726392ad5a63e0aa1e42347a545.png

 

  • Local and Cloud storage

dup5-feat-storage.thumb.png.35aa9c87454f472c2d04609988a42b44.png

 

Changelog :

Spoiler

[Unreleased]

  • new logging mechanism
  • auto-deploy thought FTP/FTPS
  • installer optional deletion

[1.3.14-ATO] - 2020-01-06

ATO DEVELOPMENT version

Fixed

  • Fix: undefined variable ($zipFilename)

[1.3.13-ATO] - 2020-01-06

ATO DEVELOPMENT version

Added

  • Supporting ~ in local path to prefix input with current webroot ($config->paths->root)

Fixed

  • Fix: Removing colon from default package name (port in URL)
  • Fix: Custom filename not used
  • Fix: Archive function not returning ZIP (lead to fail of FTP etc.)

[1.3.12-ATO] - 2019-05-15

ATO DEVELOPMENT version

Added

  • Duplicator: added a config option to set the quantity of megabytes saved before an archive flush

[1.3.11-ATO] - 2019-05-14

ATO DEVELOPMENT version

Fixed

  • ProcessDuplicator: support dash char in domain name

[1.3.10-ATO] - 2019-03-18

ATO DEVELOPMENT version

Added

  • Added regexp exclusion feature
  • Added checkbox for ProcessWire image variations exclusion (checked by default)

Fixed

  • fix installer.php

Changed

  • zipData revised
  • package structure: SQL dump included in site structure zip
  • exclusion feature: extensions are now case-insensitive

[1.2.9] - 2018-04-09

Added

  • added Dropbox v2 support (composer support only)
  • added Package Manager shortcut to Duplicator

[1.1.9] - 2018-04-09

Fixed

  • fix ProcessDuplicator: log file existence check on initialization

[1.1.8] - 2018-04-09

Changed

  • ProcessDuplicator UI

Fixed

  • fix Duplicator: ZIP file (zipData) work properly on Windows and Unix

[1.1.7] - 2017-12-12

Changed

  • changed check for cron triggers from ready() to init()
  • changed support links in both modules

[1.1.6] - 2017-12-09

Added

  • added js debug mode

Fixed

  • fix Duplicator: zipData() RecursiveFilterIterator check for unreadable dir
  • fix Duplicator: getLocalFolderInfo() check if the destination path exist
  • fix ProcessDuplicator: corrected the trash-icon action link
  • fix ProcessDuplicator: packages stored on the cloud are shown in the table even if LocalFodler is not used
  • various fix in DUP_Util class

[1.1.5] - 2017-12-07

Fixed

  • fix ProcessDuplicator: checking for mod_userdir is not needed anymore
  • fix: packages are retrieved, blended and re-ordered by timestamp

[1.1.4] - 2017-12-07

Fixed

  • fix ProcessDuplicator: now it work with Apache mod_userdir

[1.1.3] - 2017-12-07

Added

  • ___cronJob() is now hookable.

Fixed

  • fix FTP class were DEFINE() was replaced by Constants in earlier version
  • fix HookEvent in cronJob()

[1.1.2] - 2017-12-04

Added

  • added support for running cron jobs wihtout external module

[1.0.2] - 2017-12-03

Fixed

  • fix the module's version number for the ProcessWire modules directory

Removed

  • removed Dropbox support due to the deprecation of the API v1 since september 2017 - link

[1.0.1] - 2017-12-01

Fixed

  • the installer parse correctly the config.php file on windows machine
  • small typo in ProcessDuplicator

[1.0.0] - 2017-11-30

Added

  • check if ProcessDuplicator module is installed then display the link in the local folder overview to the manager if yes.

Fixed

  • changed all _() call to __() for translation string

 

Edited by flydev 👊🏻
Release of the v1.3.14
  • Like 21
  • Thanks 1

Share this post


Link to post
Share on other sites

Great work! I think this module could be very handy. And I think if your module has other options than @rot's module you can release it. But if it is exactly the same, I don't know what solution would fit this situation.

  • Like 2

Share this post


Link to post
Share on other sites

Hey flydev,

Looks great. How far have you developed this?

The other module is at the very least beta software. I've got it running on several websites and it is running quite fast and smoothly. On the other hand I think there could be improvements. Perhaps you could join forces? Your modules both have the same goal. If you need help, I'm happy to help in any way.

  • Like 4

Share this post


Link to post
Share on other sites
58 minutes ago, arjen said:

If you need help, I'm happy to help in any way.

+1 :) Since @rot does not seem to have enough time to work on his module (he can correct me anytime... ;) ), I think it is quite reasonable for you to finish and maintain this module of yours. I would also be happy to use it, and share my findings about how it performs, etc.. meaning "testing it". 

  • Like 4

Share this post


Link to post
Share on other sites

It's weird, I was also about to start on something very similar, but also just recently noticed @rot's module, and now yours. @rot has been quiet here for a couple of months, so it would be good if he could confirm his intentions with updating his module. If you are close to being functional, it would be great to test both to figure out the differences in feature set.

  • Like 4

Share this post


Link to post
Share on other sites

Currently the module is functional, I use it on every site and it work quite well, no error since November.  At this moment only ProcessWire >3.0.0 is supported but I was planning to release it being compatible with 2.7.

 

What you can do with the module (working features) :

  • You can modify package's settings :  name of final filename, ignore some folders, set a maximum number of packages, remove older packages and trigger the backup function with LazyCron or PwCron.
  • Save the package in a local folder
  • Upload package to Dropbox
  • Upload package to GoogleDrive
  • Remove packages from those cloud services (depending on the configuration set)

*A package is a ZIP file bundled with a database dump and a full website directory dump (site, wire, etc)

 

I think I will finish the first public version and we'll see what happens as I tested the @arjen's fork of @rot's module and didn't managed to get it working as expected. I also find my module more "simple" to use; I mean you set options, check some checkbox, set a cronjob, click submit and let it run.

Also I saw some good features like emailing the logs on failure that could be added easily. I'll look at the module a little closer this afternoon.

 

Thanks for your input guys.

  • Like 8

Share this post


Link to post
Share on other sites

Thanks for the update @flydev - I am definitely very excited to try this - thanks for the hard work!

  • Like 3

Share this post


Link to post
Share on other sites
Quote

I also find my module more "simple" to use.

Thanks @flydev I think you are right about this. If you need any testing help, please let me know.

  • Like 2

Share this post


Link to post
Share on other sites

A small preview of uploading package to Dropbox and GoogleDrive at the same time :

 

duplicator-preview.gif

 

In this screencast I am using my own connection, thus the upload process is a bit slow.

 

 

  • Like 6

Share this post


Link to post
Share on other sites

Thanks for sharing the preview! A few questions:

  • Will it be possible to do a manual backup without changing the module's Event trigger? It is not practical to change it back-and-forth just to do it manually once in a while. Or am I missing something?
  • Is a timestamp like this possible: 2017-01-28_13-55-17 (year-month-day-hour-minute-second)? This can be alphabetically sorted so we also get the order arranged chronologically at the same time.
  • Are you planning to implement any sort of "installer functionality" to simplify deployment/restore from the packages a little bit?
  • Like 2

Share this post


Link to post
Share on other sites
5 minutes ago, szabesz said:

Will it be possible to do a manual backup without changing the module's Event trigger? It is not practical to change it back-and-forth just to do it manually once in a while. Or am I missing something?

Good point. How about a simple button "Backup Now" to do it ?

 

8 minutes ago, szabesz said:

Is a timestamp like this possible: 2017-01-28_13-55-17 (year-month-day-hour-minute-second)? This can be alphabetically sorted so we also get the order arranged chronologically at the same time.

This is a thing in which I have to brainstorm; But definitely yes. I am looking for a good solution to name the packages files. Thanks here.

 

16 minutes ago, szabesz said:

Are you planning to implement any sort of "installer functionality" to simplify deployment/restore from the packages a little bit?

It was stipulated on my first post, this will be the best part of the module :) 

This one is the hardest part to implement in my point of view so it will come in a second time but ASAP! What I mean by ASAP - I will finish to implement Amazon upload  and the s/FTP as this last feature is required to jump to the installer one.

  • Like 4

Share this post


Link to post
Share on other sites
  • "How about a simple button "Backup Now" to do it ?" - Sure :)
  • "I am looking for a good solution to name the packages files." - Normally I name them like this: 2017-01-28_13-55-17-anything-i-find-descriptive.zip

Since you dubbed the module "Duplicator" you also implied that it will also be able to help in installing so I just wanted to make sure I got that right.

Thanks again for the awesome work!

  • Like 3

Share this post


Link to post
Share on other sites

This is going to be amazing! - here is a wishlist.., not sure if these can be gradually implemented..

- backup from scheduled cron job
- exclude by file extension, for example exclude all .mp3, or .jpg etc;  /alternately if the above is not possible, then the existing functionality of excluding directory would be ok (like exclude the site/assets/files in case that folder is multiple GB; we often just sync that folder with an S3 directory to keep a backup)...
- protect access to the module screen by role/user

  • Like 5

Share this post


Link to post
Share on other sites
9 hours ago, Macrura said:

- backup from scheduled cron job

This is already implemented as far as I can see in the preview gif. The module requires PwCron and in the Event trigger dropdown there are time intervals to choose from. This is where an "OnSubmit" option is also included, but that one needs to be turned into a standalone button. @flydev That reminds me that you will probably need to handle the situation when a scheduled cron job will try to run while a manual backup is running (and vice versa...) I guess it is not a good idea to let both run at the same time.

Edit: but I might be mistaken about the two jobs running parallel being a problem... I was just guessing here.

Edited by szabesz
  • Like 3

Share this post


Link to post
Share on other sites

As @szabesz already spotted it, scheduled cron job is already implemented using PwCron. About the Event-trigger dropdown, its meant to work with LazyCron but I had in mind to give a try to interact with PwCron directly from the interface of Duplicator.

For the situation where a package will be built manually at the same time as a scheduled cron job, there is a File Locking technique implemented, so it should not be an issue.

 

On 29/01/2017 at 0:08 AM, Macrura said:

- exclude by file extension, for example exclude all .mp3, or .jpg etc;  /alternately if the above is not possible, then the existing functionality of excluding directory would be ok (like exclude the site/assets/files in case that folder is multiple GB; we often just sync that folder with an S3 directory to keep a backup)...

It should not be a problem - In the todo list !  Thanks you !

 

On 29/01/2017 at 0:08 AM, Macrura said:

- protect access to the module screen by role/user

Any clue how I could start that ?

 

22 hours ago, szabesz said:

This is where an "OnSubmit" option is also included, but that one needs to be turned into a standalone button.

duplicator-preview.gif

 

 

  • Like 2

Share this post


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

Any clue how I could start that ?

Something like the below in your module's init() method. You can of course change it to  lookup a role or roles or some user IDs [if(!in_array()...].

public function init() {	
	if ($this->permissions->get('duplicator')->id && !$this->user->hasPermission('duplicator'))
		 throw new WirePermissionException($this->_('Duplicator: You have no permission to use this module.'));
}

 

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, flydev said:
On 29/01/2017 at 0:08 PM, Macrura said:

- protect access to the module screen by role/user

Any clue how I could start that ?

If the module is a Process module you can create and require a custom permission in the module info (that is, getModuleInfo(), etc).

See the ProcessHello module for an example: https://github.com/ryancramerdesign/ProcessHello/blob/9c1aa18eb40d069c7fb227f09badddc90f0b3276/ProcessHello.info.php#L33-L39

  • Like 2

Share this post


Link to post
Share on other sites

Just finished improving the exclude feature. You can now exclude multiple dir, files, or excluding files by extension.

 

ignore feature.png

 

Edited by flydev
typo
  • Like 6

Share this post


Link to post
Share on other sites

Pretty cool. I especially like the shortcuts of logs/sessions/cache :) 

  • Like 3

Share this post


Link to post
Share on other sites

When can we get our hands on this? Where do I throw my money?! :D

  • Like 3

Share this post


Link to post
Share on other sites

As I have just finished implementing the FTP transfer protocol, I hope it will be available for beta testing this week-end :-X. I have to implement Amazon before. I am going to buy an Amazon account tonight and implement this feature tomorrow.

 

Capture d’écran 2017-02-02 à 17.56.29.png

 

  • Like 10

Share this post


Link to post
Share on other sites

A small news for this morning, the AmazonS3 feature is implemented on the module (its a pain when you don't know about a SDK).

Also please check the name of the final package as it was suggested by @szabesz.  Thanks again for the suggestion, its better and easily manageable.

 

Edit:

For information, all SDKs are installed via composer. Is it a problem for you ?

 

duplicator-preview.gif

 

 

 

Edited by flydev
infos
  • Like 6
  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks for your work => it looks very good!

On 2/5/2017 at 9:52 AM, flydev said:

For information, all SDKs are installed via composer. Is it a problem for you ?

Will this work together with ProcessWireUpgrade? This will make updates through more easily I presume.

  • Like 5

Share this post


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

Will this work together with ProcessWireUpgrade?

+1 Experienced developers should not have problem learning the basics of Composer, however, using the ProcessWireUpgrade module is easier and even site owners can use it out of the box, so generally I prefer relying on it instead of Composer. This is a module that should support ProcessWireUpgrade as well, I think.

  • Like 5

Share this post


Link to post
Share on other sites

Mmm the module itself will be, but updating the SDKs with ProcessWireUpgrade (if that what you mean) will be hard if I am not missing something with this module.

What I am thinking after some tests, and in particular about shared hosting,  its to put on Github the vendor directory and let the user download and upload it to the their server if they want to use third party service storage. This approach only work (as the module itself) for ProcessWire 2.8 and 3.x. And if some people want simplicity on their virtual/private server, they just have to run a simple command line - composer update - in the root directory. Really, composer is nothing more than a tool to manage dependencies, and installing/using it require only one command line or a simple exe setup on Windows.

Anyway, I will try to find a compromise and/or to figure how to manage theses dependencies in the module directory itself. If I can manage this, the module will be compatible with ProcessWire 2.7.

  • Like 4

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • 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: https://modules.processwire.com/modules/inputfield-repeater-matrix-duplicate/
    • 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 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...