diff --git a/update.php b/update.php index c8a54f6..7b3e487 100644 --- a/update.php +++ b/update.php @@ -78,7 +78,7 @@ $flag = (int) getpost('flag'); -if (PHP_SAPI == 'cli') cliUpdate(); +if (PHP_SAPI == 'cli') cliUpdate($argv); elseif ($action == 'update') update($dir_to_update); elseif ($action == 'imageUpdate') imageUpdate($flag); elseif ($action == 'saveImage') saveImage($flag); @@ -91,17 +91,21 @@ // +------------------------------------------------------------------------+ // | CLI Update wrapper | // +------------------------------------------------------------------------+ -function cliUpdate() { +function cliUpdate($argv_) { global $cfg, $db, $lastGenre_id, $getID3, $dirsCounter, $filesCounter, $curFilesCounter, $curDirsCounter, $last_update, $file; $cfg['cli_update'] = true; - cliLog( "CLI update of " . $cfg['media_dir'] ); + cliLog( "CLI update of " . $argv_[1] ); - echo ("Update started\n"); - echo ("Update in progress...\n"); - - update_impl( $cfg['media_dir'] ); + echo ("Update started\n"); + echo ("Update in progress...\n"); + + try { + update_impl( $argv_[1] ); + } catch (Exception $e) { + echo ("Update error") + } }