@@ -1342,8 +1342,12 @@ function onBeforeInsert() {
13421342 // Letsencrypt can not be activated before the website has been created
13431343 // So we deactivate it here and add a datalog update in onAfterInsert
13441344 if (isset ($ this ->dataRecord ['ssl_letsencrypt ' ]) && $ this ->dataRecord ['ssl_letsencrypt ' ] == 'y ' && isset ($ this ->dataRecord ['ssl ' ]) && $ this ->dataRecord ['ssl ' ] == 'y ' ) {
1345+ // Disable letsencrypt and ssl temporarily
13451346 $ this ->dataRecord ['ssl_letsencrypt ' ] = 'n ' ;
13461347 $ this ->dataRecord ['ssl ' ] = 'n ' ;
1348+ // Prevent that the datalog history gets written
1349+ $ app ->tform ->formDef ['db_history ' ] = 'no ' ;
1350+ // Set variable that we check in onAfterInsert
13471351 $ this ->_letsencrypt_on_insert = true ;
13481352 }
13491353 }
@@ -1419,13 +1423,13 @@ function onAfterInsert() {
14191423 }
14201424 if (isset ($ this ->dataRecord ['folder_directive_snippets ' ])) $ app ->db ->query ("UPDATE web_domain SET folder_directive_snippets = ? WHERE domain_id = ? " , $ this ->dataRecord ['folder_directive_snippets ' ], $ this ->id );
14211425
1422- // Add a datalog update with letsencrypt enabled (see also onBeforeInsert)
1426+ // Add a datalog insert without letsencrypt and then an update with letsencrypt enabled (see also onBeforeInsert)
14231427 if ($ this ->_letsencrypt_on_insert == true ) {
1424- $ tmp = $ web_rec ;
1425- $ tmp [ ' ssl_letsencrypt ' ] = ' y ' ;
1426- $ tmp [ ' ssl ' ] = 'y ' ;
1427- $ app -> db -> datalogUpdate ( ' web_domain ' , $ tmp , ' domain_id ' , $ this -> id ) ;
1428- unset( $ tmp );
1428+ $ new_data_record = $ app -> tform -> getDataRecord ( $ this -> id ) ;
1429+ $ app -> tform -> datalogSave ( ' INSERT ' , $ this -> id , array (), $ new_data_record ) ;
1430+ $ new_data_record [ ' ssl_letsencrypt ' ] = 'y ' ;
1431+ $ new_data_record [ ' ssl ' ] = ' y ' ;
1432+ $ app -> db -> datalogUpdate ( ' web_domain ' , $ new_data_record , ' domain_id ' , $ this -> id );
14291433 }
14301434
14311435 }
0 commit comments