mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-21 23:20:24 +00:00
update
This commit is contained in:
parent
e82d70fb3a
commit
aef89cc325
2 changed files with 14 additions and 6 deletions
|
@ -10,13 +10,14 @@ class HostingSubscriptionBackupLog extends Component
|
|||
|
||||
public $backupLog;
|
||||
|
||||
public $backupLogFile = '';
|
||||
|
||||
public function pullBackupLog()
|
||||
{
|
||||
$findHsb = \App\Models\HostingSubscriptionBackup::where('id', $this->hostingSubscriptionBackupId)->first();
|
||||
if ($findHsb) {
|
||||
$backupLog = $findHsb->path . '/backup.log';
|
||||
if (file_exists($backupLog)) {
|
||||
$backupLogContent = file_get_contents($backupLog);
|
||||
if ($this->backupLogFile) {
|
||||
if (file_exists($this->backupLogFile)) {
|
||||
|
||||
$backupLogContent = shell_exec('tail -n 1000 ' . $this->backupLogFile);
|
||||
// Get last 1000 lines of the log
|
||||
$backupLogContent = substr($backupLogContent, -5000, 5000);
|
||||
$backupLogContent = str_replace("\n", "<br>", $backupLogContent);
|
||||
|
@ -25,9 +26,16 @@ class HostingSubscriptionBackupLog extends Component
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function mount($hostingSubscriptionBackupId)
|
||||
{
|
||||
$this->hostingSubscriptionBackupId = $hostingSubscriptionBackupId;
|
||||
|
||||
$findHsb = \App\Models\HostingSubscriptionBackup::where('id', $this->hostingSubscriptionBackupId)->first();
|
||||
if ($findHsb) {
|
||||
$this->backupLogFile = $findHsb->path . '/backup.log';
|
||||
$this->pullBackupLog();
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
|
|
@ -227,7 +227,7 @@ class HostingSubscriptionBackup extends Model
|
|||
}
|
||||
|
||||
// With find, we can search for all files,directories (including hidden) in the current directory and zip them
|
||||
$shellFileContent .= 'cd '.$backupTempPath .' && find . -exec zip -r '.$backupFilePath.' {} \;'. PHP_EOL;
|
||||
$shellFileContent .= 'cd '.$backupTempPath .' && find . -exec zip --symlinks -r '.$backupFilePath.' {} \;'. PHP_EOL;
|
||||
|
||||
$shellFileContent .= 'rm -rf '.$backupTempPath.PHP_EOL;
|
||||
$shellFileContent .= 'echo "Backup complete"' . PHP_EOL;
|
||||
|
|
Loading…
Reference in a new issue