mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-22 07:30:25 +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 $backupLog;
|
||||||
|
|
||||||
|
public $backupLogFile = '';
|
||||||
|
|
||||||
public function pullBackupLog()
|
public function pullBackupLog()
|
||||||
{
|
{
|
||||||
$findHsb = \App\Models\HostingSubscriptionBackup::where('id', $this->hostingSubscriptionBackupId)->first();
|
if ($this->backupLogFile) {
|
||||||
if ($findHsb) {
|
if (file_exists($this->backupLogFile)) {
|
||||||
$backupLog = $findHsb->path . '/backup.log';
|
|
||||||
if (file_exists($backupLog)) {
|
$backupLogContent = shell_exec('tail -n 1000 ' . $this->backupLogFile);
|
||||||
$backupLogContent = file_get_contents($backupLog);
|
|
||||||
// Get last 1000 lines of the log
|
// Get last 1000 lines of the log
|
||||||
$backupLogContent = substr($backupLogContent, -5000, 5000);
|
$backupLogContent = substr($backupLogContent, -5000, 5000);
|
||||||
$backupLogContent = str_replace("\n", "<br>", $backupLogContent);
|
$backupLogContent = str_replace("\n", "<br>", $backupLogContent);
|
||||||
|
@ -25,9 +26,16 @@ class HostingSubscriptionBackupLog extends Component
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mount($hostingSubscriptionBackupId)
|
public function mount($hostingSubscriptionBackupId)
|
||||||
{
|
{
|
||||||
$this->hostingSubscriptionBackupId = $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()
|
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
|
// 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 .= 'rm -rf '.$backupTempPath.PHP_EOL;
|
||||||
$shellFileContent .= 'echo "Backup complete"' . PHP_EOL;
|
$shellFileContent .= 'echo "Backup complete"' . PHP_EOL;
|
||||||
|
|
Loading…
Reference in a new issue