auto_backup

Hi Folks,

I have deployed "auto_backup", and it has created /backup/<...>.zdb, which looks like JSON. I assume that it is working correctly, since I don't really know how to test it. Do you have any advice how I would test this backup?

I don't see anything that looks like images, encoded or otherwise, so this raises the question, what is the scope of the backup? Can I configure the scope? I'd like my images, videos, and other content to be backuped up as well.

Thanks for the help,

Chris.

Comments

  • acrylian Administrator, Developer
    edited June 2021

    The plugin description actually tells what it does:

    Periodically backup the Zenphoto database content.

    And it is not JSON, it is a custom format. And it is not a mysql backup of the full database.

    To re-apply a backup you use the "backup/restore" utility on the overview page.

    If you wish your images to be backuped you have to do that server side on your server. It is all in the "albums" folder. Perhaps you host already does some regular backup of your contents. We recommedn to keep a local mirror of your albums folder as well as a staging version of your site, especially for testing updates and such.

  • This is one of (many) issues I'm looking into to support a particular requirement by a group of friends. They have many volunteers each scanning irreplaceable physical images for an archive and adding metadata to each image.

    Requirement is to get both images and DB in a safe place (in case the web host goes bang)

    Current best pseudo code is to get the latest DB backup from the backup folder and all images since the last backup, zip them together and offer as a download (so they are off site). Update "since the last backup" so that next time you get...

    The idea is simple, the implementation less so...

  • acrylian Administrator, Developer

    The best is to embed meta data for the important into into the images itself before uploading them. Titles, desriptions, tags etc.

    Since Zenphoto's albums are physical any folder with images becomes an image within the albums folder. Only data entered manually afterwards on the backend is stored in the db but the physical folders are always the base.

  • Thanks @acrylian - potentially we have dozen's of volunteers uploading (through the web interface) historic images which may be annotated prior to upload. Other viewers may then comment "That's not 1963, in 1965, look at the..." which may in turn call for an update to the description. One alternative is to find which volunteer did the upload, get them to re-annotate and re-upload (and lose the comments). The other is to annotate within ZenPhoto.

    Strictly we can backup with FTP and "suck" the Albums folder to DropBox or similar, then FTP the relevant DB Backup to go with it so we have everything to rebuild ZenPhoto if we have to. But that needs an Admin (in the archive sense) who knows FTP.

    I'm working on an incremental backup for ZenPhoto which is "click twice and download a zip" but I'm having issues with the web user interface (the incremental backup bit proved surprisingly easy, at least at first sight)

  • acrylian Administrator, Developer
    edited June 2021

    Strictly we can backup with FTP and "suck" the Albums folder to DropBox or similar, then FTP the relevant DB Backup to go with it so we have everything to rebuild ZenPhoto if we have to. But that needs an Admin (in the archive sense) who knows FTP.

    But keep in mind that the database is matched with the filesystem being the base for the gallery part not the other way round!

    Using Dropbox or similar or at least another path on the same server would be a way to do this. And I would recommend to do this via a real cronjob as that is much more performant.

    One alternative is to find which volunteer did the upload, get them to re-annotate and re-upload (and lose the comments).

    Yes, you would have to delete the item first currently and then re-upload. If you use FTP you could also replace the image itself without that.

  • But keep in mind that the database is matched with the filesystem being the base for the gallery part not the other way round!

    Using Dropbox or similar or at least another path on the same server would be a way to do this. And I would recommend to do this via a real cronjob as that is much more performant.

    All noted thanks - we use a commercial hosting company and all this is insurance (hoping never to be needed) - I'm trying not to back up to the same server as our worst fear is a (1:1,000,000) server failure where the host comes back and says "sorry; here's your new server back on line, you do have your site backed up don't you?"

    If I understand correctly the "Albums" folder is not a lot of use without the database (unless every image has all the metadata embedded) and the database is not a lot of use without the images - all tied together by the "images" table which links "000001.jpg" with the caption, title etc and (via other tables) which album it's in, what tags are set etc.

    Now if only I could work out why my link doesn't appear in Admin --> overview --> Utility functions (but that's a different story)

  • acrylian Administrator, Developer

    If I understand correctly the "Albums" folder is not a lot of use without the database (unless every image has all the metadata embedded) and the database is not a lot of use without the images - all tied together by the "images" table which links "000001.jpg" with the caption, title etc and (via other tables) which album it's in, what tags are set etc.

    Not exactly. It is just if a folder or an image is missing Zenphoto will note that and remove the database entry. Same the other way round by recongnizing folders and images. That's why you can upload directly via FTP. Both do work together but for important images it is useful to have the data embedded.

    Working on the backend only of course both works hand in hand. If you delete something there both the database and the folder/file entries are deleted.

    We have a graphic about that on https://www.zenphoto.org/news/caching/

    Perhaps ask you host if it offers backup. Many hosts do this voluntary or offer it as an extra service.

    Now if only I could work out why my link doesn't appear in Admin --> overview --> Utility functions (but that's a different story)

    What link do you mean exactly?

  • The backup strategy was based on https://www.zenphoto.org/news/moving-and-changing-existing-installations/ with the proviso that the old server might not be available! So (at a minimum) having the "Albums" folder" and a matching Database backup available would help - We've already covered having the same version of Zenphoto (don't try and upgrade as well as restore...) and the theme we are using which I hope to put on GitHub when nearer completion. Backing up ZenPages can be done but we've already got a copy of the text to be added to the (two) pages so if it's not automated, it's not a drama.

    The link reference (excuse me trying to run before I can walk...) is that I've written a bare skeleton of my backup plugin (no error checking yet) and wanted to demo to the non-technical other members of the team. We've tried the "bulk captions" plugin from Marcus Wong https://github.com/wongm/zenphoto-captions/ and i liked the way it integrated into the Admin --> overview --> utility page - so I added my bare script to "plugins" with the below as a "backup-images.php"

    <?php
    /**
     * Bulk Captions
     *
     * Helper page for Zenphoto, enabling the incremental backup of images.
     *
     * @author Adrian Moss (mossa)
     * @package plugins
     */
    
    $plugin_description = gettext("Helper page for Zenphoto, enabling the incremental backup of images");
    $plugin_author = "Adrian Moss (mossa)";
    $plugin_version = '1.0.0'; 
    $plugin_URL = "http://***";
    $plugin_is_filter = 500 | ADMIN_PLUGIN;
    
    zp_register_filter('admin_utilities_buttons', 'backup-images::button');
    
    class backupImages {
    
        static function button($buttons) {
            $buttons[] = array(
                            'category'       => gettext('Admin'),
                            'enable'             => true,
                            'button_text'    => gettext('Image Backup'),
                            'formname'       => 'Submit',
                            'action'             => FULLWEBPATH.'/plugins/backup-images/index.php',
                            'icon'               => 'images/pictures.png',
                            'title'              => gettext('Incremental Image Backup'),
                            'alt'                    => '',
                            'hidden'             => '',
                            'rights'             => ALBUM_RIGHTS
            );
            return $buttons;
        }
    }
    ?>
    

    If (and it's a big if) I stick with the class as "bulkCaptions" (as per Marcus) then the link displays fine, but I can't have my plugin and Marcus's enabled at the same time. If the class is "backupImages" as above then it simply does not appear in the admin overview page.

    I'm probably missing something really simple but any hints are welcome!

  • acrylian Administrator, Developer
    edited July 2021

    You used backup-images above for the filter but your class is namedbackupImages . You should have a fatal error in the logs

    backup-images would not be alloweed anyway beauses function, method and class names in PHP are not allowed to have a dash.

  • I thought would be something simple! Thanks, will try when I finish work today.

  • @acrylian - thanks - now working.

Sign In or Register to comment.