Add my own S3 Service to Snapshot

Hi,
I have a question. Can i add my own S3 Service to the list of Backup Providers and how can it be done.
It would be cool if in any futher release there is an option to provide my own S3 Service.

  • Alexander

    Hi @Ludwig,

    If you're referring to adding an entirely new service, this is already possible but you would need to custom code the integration from snapshot to the API you would like to use.

    If you'd just like to link an existing S3 bucket, you can click "Add new" and you'll be able to enter your AWS credentials and select a bucket for storage.

    Thanks for being a WPMU DEV member. Let us know if we can be of any further assistance.
    Best regards,

  • Alexander

    @Ludwig,

    If the API provides a similar interface, or a clone of the Amazon S3 API, you could try copying that module and modifying with anything that would change such as API url etc.

    The main challenge is if the AWS-SDK will connect to it or not. If not, you should check if your service has a PHP library you could use.

    Either way it would still be a different service provider, so custom coding would be needed to adapt it to the new API. But you could always based your code of the existing AWS S3 implementation in snapshot which would help considerably.

    Thanks for being a WPMU DEV member. Let us know if we can be of any further assistance.
    Best regards,

  • Paul

    @Ludwig,

    Saw this thread and wanted to provide a little more technical how to on getting this done. The Snapshot plugin already provide hooks for adding your own providers.

    Best advice is to make a copy of the directory tree snapshot/lib/destinations/aws/ and name it something else outside of the plugin directory. You can for example copy this to be under your theme. Name the base directory 'aws' to something of your own creation. But it needs to be unique.

    Within that directory you will find the index.php. There are some important points to make this unique.

    1. On line 13 you will see the class definition You will see it inherits from the snapshot base class SnapshotDestinationBase. Your new class MUST to the same.
    class SnapshotDestinationAWS extends SnapshotDestinationBase {

    Also, you will notice there is no class constructor. This is on purpose.

    2. Line 34 and line 37. Line 34 provide the unique slug for all entries related to this destination. Line 37 is the nice display name for the destination set.

    3. Line 702 is where/how the destination class loads itself into the Snapshot listing. The second parameter should match your class name per #1 above.

    do_action('snapshot_register_destination', 'SnapshotDestinationAWS');
    Good luck.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.