Command/QueryWikipediaCommand.php
changeset 58 87bf6ec8af90
parent 43 54f204bceb28
child 67 989d9e117586
--- 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'])));
             }
         }