File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,11 @@ public static function boot()
29
29
$ model ->checkCronJob ();
30
30
});
31
31
32
+ static ::deleting (function ($ model ) {
33
+ if (is_dir ($ model ->path )) {
34
+ shell_exec ('rm -rf ' . $ model ->path );
35
+ }
36
+ });
32
37
}
33
38
34
39
private function checkCronJob ()
@@ -99,7 +104,7 @@ public function startBackup()
99
104
$ findHostingSubscription = HostingSubscription::where ('id ' , $ this ->hosting_subscription_id )->first ();
100
105
if ($ findHostingSubscription ) {
101
106
102
- $ backupFileName = Str::slug ($ findHostingSubscription ->domain .'- ' . date ('Y-m-d-H-i-s ' )) . '.zip ' ;
107
+ $ backupFileName = Str::slug ($ findHostingSubscription ->domain .'- ' . date ('Y-m-d-H-i-s ' )) . '.tar.gz ' ;
103
108
$ backupFilePath = $ backupPath .'/ ' .$ backupFileName ;
104
109
105
110
$ backupLogFileName = 'backup.log ' ;
@@ -111,7 +116,7 @@ public function startBackup()
111
116
$ shellFileContent .= 'echo "Backup filename: ' .$ backupFileName . PHP_EOL ;
112
117
$ shellFileContent .= 'cp -r /home/ ' .$ findHostingSubscription ->system_username .' ' .$ backupTempPath .PHP_EOL ;
113
118
114
- $ shellFileContent .= 'cd ' .$ backupTempPath .' && zip -r ' .$ backupFilePath .' ./* ' . PHP_EOL ;
119
+ $ shellFileContent .= 'cd ' .$ backupTempPath .' && tar -czvf ' .$ backupFilePath .' ./* ' . PHP_EOL ;
115
120
116
121
$ shellFileContent .= 'rm -rf ' .$ backupTempPath .PHP_EOL ;
117
122
$ shellFileContent .= 'echo "Backup complete" ' . PHP_EOL ;
You can’t perform that action at this time.
0 commit comments