fix #650 fix description

fix #651 fix arguments/options
This commit is contained in:
Nicolas Le Goff
2012-05-25 19:53:45 +02:00
parent 1be9d11f96
commit 254aaeb52a

View File

@@ -27,9 +27,9 @@ class module_console_checkExtension extends Command
{ {
parent::__construct($name); 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'); $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) public function execute(InputInterface $input, OutputInterface $output)
{ {
if ( ! extension_loaded('phrasea2')) if ( ! extension_loaded('phrasea2')) {
printf("Missing Extension php-phrasea"); printf("Missing Extension php-phrasea");
}
$appbox = \appbox::get_instance(\bootstrap::getCore()); $appbox = \appbox::get_instance(\bootstrap::getCore());
$registry = $appbox->get_registry(); $registry = $appbox->get_registry();
$usr_id = $input->getOption('usr_id'); $usrId = $input->getArgument('usr_id');
try { try {
$TestUser = \User_Adapter::getInstance($usr_id, $appbox); $TestUser = \User_Adapter::getInstance($usrId, $appbox);
} catch (\Exception $e) { } catch (\Exception $e) {
$output->writeln("<error>Wrong user !</error>"); $output->writeln("<error>Wrong user !</error>");
@@ -114,9 +115,9 @@ class module_console_checkExtension extends Command
$output->writeln("\n-- phrasea_open_session --"); $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("<info>Succes ! </info> got session "); $output->writeln("<info>Succes ! </info> got session ");
} else { } else {
$output->writeln("<error>Failed ! </error> got no session "); $output->writeln("<error>Failed ! </error> got no session ");
@@ -138,7 +139,7 @@ class module_console_checkExtension extends Command
$tbases = array(); $tbases = array();
foreach ($ph_session["bases"] as $phbase) { foreach ($phSession["bases"] as $phbase) {
$tcoll = array(); $tcoll = array();
foreach ($phbase["collections"] as $coll) { foreach ($phbase["collections"] as $coll) {
$tcoll[] = 0 + $coll["base_id"]; $tcoll[] = 0 + $coll["base_id"];
@@ -166,12 +167,12 @@ class module_console_checkExtension extends Command
$tbases[$kb]["results"] = NULL; $tbases[$kb]["results"] = NULL;
$ret = phrasea_query2( $ret = phrasea_query2(
$ph_session["session_id"] $phSession["session_id"]
, $base["sbas_id"] , $base["sbas_id"]
, $base["searchcoll"] , $base["searchcoll"]
, $base["arrayq"] , $base["arrayq"]
, $registry->get('GV_sit') , $registry->get('GV_sit')
, $usr_id , $usrId
, FALSE , FALSE
, PHRASEA_MULTIDOC_DOCONLY , PHRASEA_MULTIDOC_DOCONLY
, '' , ''
@@ -197,7 +198,7 @@ class module_console_checkExtension extends Command
$output->writeln("\n-- phrasea_fetch_results --"); $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) { if ($rs) {
$output->writeln("<info>Succes ! </info> got result "); $output->writeln("<info>Succes ! </info> got result ");