Fix page()->kill() behaviour for php-cli.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 24 Jun 2008 20:50:41 +0000 (22:50 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 24 Jun 2008 20:50:41 +0000 (22:50 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/plpage.php

index 5c2172b..7a28303 100644 (file)
@@ -223,6 +223,12 @@ abstract class PlPage extends Smarty
 
     public function kill($msg)
     {
+        // PHP is used on command line... do not run the whole page stuff.
+        if (php_sapi_name() == 'cli') {
+            echo $msg . "\n";
+            exit;
+        }
+
         global $platal;
 
         $this->assign('platal', $platal);