diff --git a/lib/classes/module/console/checkExtension.class.php b/lib/classes/module/console/checkExtension.class.php index 49c119bd40..276ca504c6 100644 --- a/lib/classes/module/console/checkExtension.class.php +++ b/lib/classes/module/console/checkExtension.class.php @@ -27,9 +27,9 @@ class module_console_checkExtension extends Command { parent::__construct($name); - $this->setDescription('Delete a documentation field from a Databox'); + $this->setDescription('Checks if the Phrasea PHP Extension is well installed & working properly.'); - $this->addOption('usr_id', 'u', InputOption::VALUE_OPTIONAL, 'Usr_id to use. If no user, get the first available'); + $this->addArgument('usr_id', InputOption::VALUE_REQUIRED, 'Usr_id to use.'); $this->addOption('query', '', InputOption::VALUE_OPTIONAL, 'The query', 'last'); @@ -39,16 +39,17 @@ class module_console_checkExtension extends Command public function execute(InputInterface $input, OutputInterface $output) { - if ( ! extension_loaded('phrasea2')) + if ( ! extension_loaded('phrasea2')) { printf("Missing Extension php-phrasea"); + } $appbox = \appbox::get_instance(\bootstrap::getCore()); $registry = $appbox->get_registry(); - $usr_id = $input->getOption('usr_id'); + $usrId = $input->getArgument('usr_id'); try { - $TestUser = \User_Adapter::getInstance($usr_id, $appbox); + $TestUser = \User_Adapter::getInstance($usrId, $appbox); } catch (\Exception $e) { $output->writeln("Wrong user !"); @@ -114,9 +115,9 @@ class module_console_checkExtension extends Command $output->writeln("\n-- phrasea_open_session --"); - $ph_session = phrasea_open_session($sessid, $usr_id); + $phSession = phrasea_open_session($sessid, $usrId); - if ($ph_session) { + if ($phSession) { $output->writeln("Succes ! got session "); } else { $output->writeln("Failed ! got no session "); @@ -138,7 +139,7 @@ class module_console_checkExtension extends Command $tbases = array(); - foreach ($ph_session["bases"] as $phbase) { + foreach ($phSession["bases"] as $phbase) { $tcoll = array(); foreach ($phbase["collections"] as $coll) { $tcoll[] = 0 + $coll["base_id"]; @@ -166,12 +167,12 @@ class module_console_checkExtension extends Command $tbases[$kb]["results"] = NULL; $ret = phrasea_query2( - $ph_session["session_id"] + $phSession["session_id"] , $base["sbas_id"] , $base["searchcoll"] , $base["arrayq"] , $registry->get('GV_sit') - , $usr_id + , $usrId , FALSE , PHRASEA_MULTIDOC_DOCONLY , '' @@ -197,7 +198,7 @@ class module_console_checkExtension extends Command $output->writeln("\n-- phrasea_fetch_results --"); - $rs = phrasea_fetch_results($sessid, $usr_id, 1, true, '[[em]]', '[[/em]]'); + $rs = phrasea_fetch_results($sessid, $usrId, 1, true, '[[em]]', '[[/em]]'); if ($rs) { $output->writeln("Succes ! got result ");