mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-22 14:27:42 +01:00
39 lines
763 B
PHP
Executable File
39 lines
763 B
PHP
Executable File
<?php
|
|
|
|
namespace Modules\Backups;
|
|
|
|
use Backup;
|
|
use Hooks\Manager;
|
|
|
|
class BackupHook extends Manager
|
|
{
|
|
public function isSingleton()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function needsExecution()
|
|
{
|
|
return setting('Backup automatico') && !Backup::isDailyComplete();
|
|
}
|
|
|
|
public function execute()
|
|
{
|
|
$result = Backup::daily();
|
|
|
|
return $result;
|
|
}
|
|
|
|
public function response()
|
|
{
|
|
$show = boolval(setting('Backup automatico')) && !Backup::isDailyComplete();
|
|
$message = $show ? tr('Backup in corso...') : tr('Backup automatico completato!');
|
|
|
|
return [
|
|
'icon' => 'fa fa-file-o text-success',
|
|
'message' => $message,
|
|
'show' => $show,
|
|
];
|
|
}
|
|
}
|