Add diagnostics to check integrity of data folder master
[photocalendar.git] / common.inc.php
blob:a/common.inc.php -> blob:b/common.inc.php
--- a/common.inc.php
+++ b/common.inc.php
@@ -103,6 +103,15 @@
         return false;

     }

 }

+function getFirstDate() {

+    // not romance help

+    $datedFiles = scandir(DATA_DIR); // sorted descendingly by default

+    if (sizeof($datedFiles) > 2) {// always at least 2 even for an empty folder because of ./ and ../

+        return getDateFromFilename($datedFiles[2]);

+    } else {

+        return false;

+    }

+}

 

 function getPhoto($displayDate) {

     $cacheFile = CACHE_DIR . $displayDate . ".png";

@@ -149,7 +158,6 @@
         }

 

         $date = strtotime($displayDate);

-// First we create our bounding box for the first text

         $textDayName = date("l", $date);

         $sizeDayName = 24 + round(($source_image_height - 1000) / 1000) * 2;

         $fontDayName = "./img/mplus-1p-medium.ttf";