Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Schedule backup #12

Open
Ladylain opened this issue Oct 21, 2018 · 2 comments
Open

Schedule backup #12

Ladylain opened this issue Oct 21, 2018 · 2 comments

Comments

@Ladylain
Copy link

Hi,

First, really thanks for this plugin.

Second, i don't know where to post this, so i put it here and i hope that you will tell me what to do exactly if there is something to do. :)

I was needed to have this plugin creating backup automatically and twice a day. So i have register a schedule into the plugin.php file. But i think for the next version we can improve this feature to make this as a setting with more parameters like :

  • when the user wants to create backup,
  • what backup the user need to create automatically.

So, if someone need to automate this plugin, just add this code into plugin.php and be sure to have configure your cron jobs for octobercms like it is said into octobercms docs.

PanaKour\Backup\plugin.php

public function registerSchedule($schedule) {
        $schedule->call(function () {
            $records = Backups::createBackup(['--disable-notifications' => true]);
        })->twiceDaily(1, 12);
    }

and change the function createBackup() to be static

PanaKour\Backup\Controllers\Backups.php:36

public static function createBackup($artisanArguments)

Hope it can help someone :)

@panakour
Copy link
Owner

@Ladylain thank you for your comment. My available time is not enough now for this. I will try in the near future to let the users configure this from settings in the backend

@Piratmac
Copy link

Piratmac commented Aug 27, 2021

Thanks a lot Ladylain for this :)
I tried it on the current version, and there is an error because class Backups doesn't exist.

To fix this, the file Plugin.php must contain this:
panakour/backup/Plugin.php

    public function registerSchedule($schedule) {
        $schedule->call(function () {
            $records = Controllers\Backups::createBackup(['--disable-notifications' => true]);
        })->twiceDaily(1, 12);
    }

("Controllers" is added to on the middle row)

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants