]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/cmd.php
timestamp info message and repeat warnings at end
[nominatim.git] / lib / cmd.php
index 588bb7d1aeab70a4dd4cef0a1c38da0dd82ea6df..d7ba285d431b8ab1e1a594b75c84abe31fc11498 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+
 function getCmdOpt($aArg, $aSpec, &$aResult, $bExitOnError = false, $bExitOnUnknown = false)
 {
     $aQuick = array();
@@ -109,8 +110,8 @@ function showUsage($aSpec, $bExit = false, $sError = false)
             $aNames = array();
             if ($aLine[1]) $aNames[] = '-'.$aLine[1];
             if ($aLine[0]) $aNames[] = '--'.$aLine[0];
-            $sName = join(', ',$aNames);
-            echo '  '.$sName.str_repeat(' ',30-strlen($sName)).$aLine[7]."\n";
+            $sName = join(', ', $aNames);
+            echo '  '.$sName.str_repeat(' ', 30-strlen($sName)).$aLine[7]."\n";
         } else {
             echo $aLine."\n";
         }
@@ -127,3 +128,23 @@ function chksql($oSql, $sMsg = false)
 
     return $oSql;
 }
+
+function info($sMsg)
+{
+    echo date('Y-m-d H:i:s == ').$sMsg."\n";
+}
+
+$aWarnings = [];
+
+function warn($sMsg)
+{
+    $GLOBALS['aWarnings'][] = $sMsg;
+    echo date('Y-m-d H:i:s == ').'WARNING: '.$sMsg."\n";
+}
+
+function repeatWarnings()
+{
+    foreach ($GLOBALS['aWarnings'] as $sMsg) {
+        echo '  * ',$sMsg."\n";
+    }
+}