@@ -43,7 +43,7 @@ NEWSCHEMA('Templates', function(schema) {
43
43
}
44
44
45
45
if ( model . template === 'restore' ) {
46
- PATH . exists ( CONF . directory_dump + model . id + '-backup.tar.gz' , function ( e ) {
46
+ PATH . exists ( CONF . directory_dump + model . app . id + '-backup.tar.gz' , function ( e ) {
47
47
if ( e )
48
48
$ . success ( ) ;
49
49
else
@@ -80,7 +80,7 @@ NEWSCHEMA('Templates', function(schema) {
80
80
81
81
schema . addWorkflow ( 'backup' , function ( $ , model ) {
82
82
if ( model . backup )
83
- Exec ( 'bash {0} {1} {2}' . format ( PATH . private ( 'backup.sh' ) , Path . join ( CONF . directory_www , model . app . linker ) , Path . join ( CONF . directory_dump , model . id + '-backup.tar.gz' ) ) , $ . done ( ) ) ;
83
+ Exec ( 'bash {0} {1} {2}' . format ( PATH . private ( 'backup.sh' ) , Path . join ( CONF . directory_www , model . app . linker ) , Path . join ( CONF . directory_dump , model . app . id + '-backup.tar.gz' ) ) , $ . done ( ) ) ;
84
84
else
85
85
$ . success ( ) ;
86
86
} ) ;
@@ -109,14 +109,15 @@ NEWSCHEMA('Templates', function(schema) {
109
109
110
110
// Restore from backup
111
111
if ( model . template === 'restore' ) {
112
- Exec ( 'tar -xzvf {0} --directory {1} > /dev/null' . format ( CONF . directory_dump + model . id + '-backup.tar.gz' , directory ) , function ( ) {
112
+ Exec ( 'tar -xzvf {0} --directory {1} > /dev/null' . format ( CONF . directory_dump + model . app . id + '-backup.tar.gz' , directory ) , function ( ) {
113
113
SuperAdmin . wsnotify ( 'app_template' , model . app ) ;
114
114
Spawn ( 'chown' , [ '-R' , SuperAdmin . run_as_user . user , directory ] ) ;
115
115
$ . success ( ) ;
116
116
} ) ;
117
117
} else {
118
118
// Extract file
119
119
Exec ( 'unzip -o {0}.zip' . format ( model . app . id ) , { cwd : directory } , function ( ) {
120
+ PATH . unlink ( '{0}/{1}.zip' . format ( directory , model . app . id ) ) ;
120
121
SuperAdmin . wsnotify ( 'app_template' , model . app ) ;
121
122
Spawn ( 'chown' , [ '-R' , SuperAdmin . run_as_user . user , directory ] ) ;
122
123
$ . success ( ) ;
0 commit comments