@@ -33,6 +33,9 @@ class apache2_plugin {
3333 var $ plugin_name = 'apache2_plugin ' ;
3434 var $ class_name = 'apache2_plugin ' ;
3535
36+ // private variables
37+ var $ action = '' ;
38+
3639
3740 /*
3841 This function is called when the plugin is loaded
@@ -169,6 +172,7 @@ function ssl($event_name,$data) {
169172 function insert ($ event_name ,$ data ) {
170173 global $ app , $ conf ;
171174
175+ $ this ->action = 'insert ' ;
172176 // just run the update function
173177 $ this ->update ($ event_name ,$ data );
174178
@@ -179,6 +183,7 @@ function insert($event_name,$data) {
179183 function update ($ event_name ,$ data ) {
180184 global $ app , $ conf ;
181185
186+ if ($ this ->action != 'insert ' ) $ this ->action = 'update ' ;
182187
183188 if ($ data ["new " ]["type " ] != "vhost " && $ data ["new " ]["parent_domain_id " ] > 0 ) {
184189 // This is not a vhost, so we need to update the parent record instead.
@@ -234,12 +239,14 @@ function update($event_name,$data) {
234239 }
235240 }
236241
237- // Copy the error pages
238- $ error_page_path = escapeshellcmd ($ data ["new " ]["document_root " ])."/web/error/ " ;
239- exec ("cp /usr/local/ispconfig/server/conf/error/ " .substr (escapeshellcmd ($ conf ["language " ]),0 ,2 )."/* " .$ error_page_path );
242+ if ($ this ->action == 'insert ' ) {
243+ // Copy the error pages
244+ $ error_page_path = escapeshellcmd ($ data ["new " ]["document_root " ])."/web/error/ " ;
245+ exec ("cp /usr/local/ispconfig/server/conf/error/ " .substr (escapeshellcmd ($ conf ["language " ]),0 ,2 )."/* " .$ error_page_path );
240246
241- // copy the standard index page
242- exec ("cp /usr/local/ispconfig/server/conf/index/standard_index.html_ " .substr (escapeshellcmd ($ conf ["language " ]),0 ,2 )." " .escapeshellcmd ($ data ["new " ]["document_root " ])."/web/ " );
247+ // copy the standard index page
248+ exec ("cp /usr/local/ispconfig/server/conf/index/standard_index.html_ " .substr (escapeshellcmd ($ conf ["language " ]),0 ,2 )." " .escapeshellcmd ($ data ["new " ]["document_root " ])."/web/index.html " );
249+ }
243250
244251 // Create group and user, if not exist
245252 $ app ->uses ("system " );
0 commit comments