changeset 165:da70f1c05ebe

Add few comments.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 01 Mar 2018 14:01:41 +0200
parents f48336b0e6a1
children d8387b48b08d
files mgtool.php
diffstat 1 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mgtool.php	Thu Mar 01 13:39:07 2018 +0200
+++ b/mgtool.php	Thu Mar 01 14:01:41 2018 +0200
@@ -247,6 +247,14 @@
 }
 
 
+//
+// Parse a simple image captions file, with format of one entry per line.
+// Lines starting with "# " are comments (note the whitespace), empty lines ignored.
+// First continuous non-whitespace text is file/dirname, followed
+// by caption text, which is separate with whitespace from the filename.
+// Filenames starting with # will be made hidden entries.
+// Filenames starging with % will hide contents.
+//
 function mgReadCaptionsFile($galBasePath, $galPath)
 {
   $captions = [];
@@ -276,6 +284,9 @@
 }
 
 
+//
+// Create directory with specified permissions
+//
 function mgMakeDir($path, $perm)
 {
   if (!file_exists($path))
@@ -287,6 +298,10 @@
 }
 
 
+//
+// Print a simple yes/no prompt with given message
+// and default value.
+//
 function mgYesNoPrompt($msg, $default = FALSE)
 {
   echo $msg." [".($default ? "Y/n" : "y/N")."]? ";
@@ -295,10 +310,13 @@
   if ($default)
     return ($sprompt == "n");
   else
-    return ($sprompt == "y");
+    return $sprompt[0] == 'y';
 }
 
 
+//
+// Delete given directory, with optional recursiveness.
+//
 function mgDelete($path, $recurse)
 {
   global $flagDoDelete, $countDoDelete;
@@ -332,6 +350,10 @@
 }
 
 
+//
+// Check if we have received the quit signal
+// and if yes, quit cleanly now.
+//
 function mgCheckQuit($now = FALSE)
 {
   global $flagQuit;