mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-21 23:20:24 +00:00
update
This commit is contained in:
parent
6c9016ae0c
commit
071a519db5
2 changed files with 9 additions and 2 deletions
|
@ -53,7 +53,7 @@ class Backup extends Model
|
|||
});
|
||||
}
|
||||
|
||||
private function checkCronJob()
|
||||
public function checkCronJob()
|
||||
{
|
||||
$cronJobCommand = 'phyre-php /usr/local/phyre/web/artisan phyre:run-backup';
|
||||
$findCronJob = CronJob::where('command', $cronJobCommand)->first();
|
||||
|
@ -63,7 +63,9 @@ class Backup extends Model
|
|||
$cronJob->command = $cronJobCommand;
|
||||
$cronJob->user = 'root';
|
||||
$cronJob->save();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function backupRelated() : Attribute
|
||||
|
@ -144,7 +146,7 @@ class Backup extends Model
|
|||
$findHostingSubscription = HostingSubscription::where('id', $this->hosting_subscription_id)->first();
|
||||
if ($findHostingSubscription) {
|
||||
|
||||
$backupFileName = Str::slug($findHostingSubscription->domain .'-'. date('Ymd-His')) . '.tar.gz';
|
||||
$backupFileName = Str::slug($findHostingSubscription->system_username .'-'. date('Ymd-His')) . '.tar.gz';
|
||||
$backupFilePath = $backupPath.'/'.$backupFileName;
|
||||
|
||||
$backupLogFileName = 'backup.log';
|
||||
|
|
|
@ -15,6 +15,10 @@ class BackupTest extends ActionTestCase
|
|||
{
|
||||
public function testBackup()
|
||||
{
|
||||
$backup = new Backup();
|
||||
$checkCronJob = $backup->checkCronJob();
|
||||
$this->assertTrue($checkCronJob);
|
||||
|
||||
$customer = new Customer();
|
||||
$customer->name = 'UnitBackupTest' . time();
|
||||
$customer->email = 'UnitBackupTest' . time() . '@unit-test.com';
|
||||
|
@ -75,6 +79,7 @@ class BackupTest extends ActionTestCase
|
|||
$this->assertTrue(is_dir($findBackup->path . '/unit-test/' . $hostingSubscription->system_username . '/public_html/cgi-bin'));
|
||||
$this->assertTrue(is_file($findBackup->path . '/unit-test/' . $hostingSubscription->system_username . '/public_html/index.php'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue