File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,14 @@ public function createCommand(): void
2424 $ this ->quit ();
2525 }
2626
27- $ this ->output ('Creating backup... ' );
28- $ this ->backupService ->createBackup ();
29- $ this ->outputLine ('<success>success</success> ' );
27+ $ this ->outputLine ('Creating backup... ' );
28+
29+ if (!$ this ->backupService ->createBackup ()) {
30+ $ this ->outputLine ('<error>couldn \'t create backup</error> ' );
31+ $ this ->quit ();
32+ }
33+
34+ $ this ->outputLine ('<success>backup created</success> ' );
3035 }
3136
3237 /**
Original file line number Diff line number Diff line change @@ -148,13 +148,23 @@ public function createBackup()
148148 // create archive
149149 $ compressor = $ this ->getCompressor ();
150150 $ archivePath = $ compressor ->compress ($ backupPath , $ this ->config ['tempPath ' ]);
151+
152+ if (!is_file ($ archivePath )) {
153+ $ this ->logger ->error ('couldn\`t create backup archive file: ' . $ archivePath );
154+
155+ return false ;
156+ }
157+
151158 // upload to file system and delete local one
152159 $ this ->filesystem ->writeStream (basename ($ archivePath ), fopen ($ archivePath , 'r ' ));
153160 unlink ($ archivePath );
154161 Files::removeDirectoryRecursively ($ backupPath );
162+
155163 // update index
156164 $ this ->indexService ->addBackup ($ backupName , new \DateTime (), $ meta );
157165 $ this ->logger ->info ('added backup ' .$ backupName );
166+
167+ return true ;
158168 }
159169
160170 /**
You can’t perform that action at this time.
0 commit comments