@@ -2527,25 +2527,37 @@ public function update_jailkit_chroot($home_dir, $sections = array(), $programs
25272527 $ cmd = 'jk_update --jail=? ' . $ jk_update_args . $ skips ;
25282528 $ this ->exec_safe ($ cmd , $ home_dir );
25292529$ app ->log ('jk_update returned: ' .print_r ($ this ->_last_exec_out , true ), LOGLEVEL_DEBUG );
2530+ # handle jk_update output
25302531 foreach ($ this ->_last_exec_out as $ line ) {
2532+ # jk_update sample output:
2533+ # skip /var/www/clients/client1/web1/opt/
25312534 if (substr ( $ line , 0 , 4 ) === "skip " ) {
25322535 continue ;
25332536 }
2534- if (preg_match ('/^(WARNING|ERROR)/ ' , $ line , $ matches )) {
2535- $ app ->log ("jk_update: $ line " , LOGLEVEL_DEBUG );
2536- } elseif (preg_match ('@^(?: [^ ]+){6}(.+) ' .preg_quote ($ home_dir , '@ ' ).'$@ ' , $ line , $ matches )) {
2537+
2538+ # jk_update sample output:
2539+ # ERROR: failed to remove deprecated directory /var/www/clients/client1/web10/usr/lib/x86_64-linux-gnu/libGeoIP.so.1.6.9
2540+ if (preg_match ('@^(?:[^ ]+){6}(?:.+)( ' .preg_quote ($ home_dir , '@ ' ).'.+)@ ' , $ line , $ matches )) {
25372541 # remove deprecated files that jk_update failed to remove
25382542 if (is_file ($ matches [1 ])) {
25392543$ app ->log ("update_jailkit_chroot: removing deprecated file which jk_update failed to remove: " .$ matches [1 ], LOGLEVEL_DEBUG );
25402544 unlink ($ matches [1 ]);
25412545 } elseif (is_dir ($ matches [1 ])) {
25422546$ app ->log ("update_jailkit_chroot: removing deprecated directory which jk_update failed to remove: " .$ matches [1 ], LOGLEVEL_DEBUG );
25432547 $ this ->rmdir ($ matches [1 ], true );
2548+ } else {
2549+ # unhandled error
2550+ //$app->log("jk_update error for jail $home_dir: ".$matches[1], LOGLEVEL_DEBUG);
2551+ // at least for 3.2 beta, lets gather some of this info:
2552+ $ app ->log ("jk_update error for jail $ home_dir, feel free to pass to ispconfig developers: " .print_r ( $ matches , true ), LOGLEVEL_DEBUG );
25442553 }
2545- # unhandled error
2546- //$app->log("jk_update error for jail $home_dir: ".$matches[1], LOGLEVEL_DEBUG);
2547- // at least for 3.2 beta, lets gather some of this info:
2548- $ app ->log ("jk_update error for jail $ home_dir, feel free to pass to ispconfig developers: " .print_r ( $ matches , true ), LOGLEVEL_DEBUG );
2554+
2555+ # any other ERROR or WARNING
2556+ # sample so far:
2557+ # ERROR: /usr/bin/nano does not exist
2558+ # WARNING: section [whatever] does not exist in /etc/jailkit/jk_init.ini
2559+ } elseif (preg_match ('/^(WARNING|ERROR)/ ' , $ line , $ matches )) {
2560+ $ app ->log ("jk_update: $ line " , LOGLEVEL_DEBUG );
25492561 }
25502562 }
25512563
0 commit comments