--- a/Command/QueryWikipediaCommand.php Tue Dec 06 14:53:12 2011 +0100
+++ b/Command/QueryWikipediaCommand.php Thu Dec 08 23:48:55 2011 +0100
@@ -41,8 +41,9 @@
$this
->setName('wikitag:query-wikipedia')
->setDescription('Query wikipedia for tags.')
- ->addOption("force","f",InputOption::VALUE_NONE, "Force remove tags")
- ->addOption("all","a",InputOption::VALUE_NONE, "all")
+ ->addOption("force","f",InputOption::VALUE_NONE, "Force processing tags, will ask no confirmation")
+ ->addOption("all","a",InputOption::VALUE_NONE, "Search all tags")
+ ->addOption("null","n",InputOption::VALUE_NONE, "Treat only non processed tags")
->addOption("redirection",null,InputOption::VALUE_NONE, "Treat redirections")
->addOption("random","r",InputOption::VALUE_NONE, "randomize query on tags")
->addOption("site","S",InputOption::VALUE_OPTIONAL, "the url for the wikipedia site", "http://fr.wikipedia.org/w/api.php")
@@ -60,6 +61,7 @@
$site = $input->getOption('site');
$limit = intval($input->getOption('limit'));
$start = intval($input->getOption('start'));
+ $null = $input->getOption('null');
$doctrine = $this->getContainer()->get('doctrine');
$qb = $doctrine->getEntityManager()->createQueryBuilder();
@@ -72,8 +74,11 @@
if($redirection) {
$qb->where($qb->expr()->andx($qb->expr()->eq("t.urlStatus",Tag::$TAG_URL_STATUS_DICT['redirection']), $qb->expr()->isNull("t.alternativeLabel")));
}
+ elseif($null) {
+ $qb->where($qb->expr()->isNull("t.urlStatus"));
+ }
else {
- $qb->where($qb->expr()->isNull("t.urlStatus"));
+ $qb->where($qb->expr()->orx($qb->expr()->isNull("t.urlStatus"), $qb->expr()->eq("t.urlStatus", Tag::$TAG_URL_STATUS_DICT['null_result'])));
}
}