remove empty strings from output
authorAlan Knowles <alan@roojs.com>
Mon, 1 Mar 2021 04:39:55 +0000 (12:39 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 1 Mar 2021 04:39:55 +0000 (12:39 +0800)
DataObjects/Core_template.php
DataObjects/Core_templatestr.php

index a32b4b8..23f885b 100644 (file)
@@ -411,7 +411,7 @@ WHERE (
         
 
         if (!empty($done[$clsname.':'.$lang])) {
-            return; // already sent headers and everything.
+            return true; // already sent headers and everything.
         }
         
         putenv("LANGUAGE=$lang");
@@ -435,7 +435,7 @@ WHERE (
         $d->filetype = 'php';
         if (! $d->find(true) ){
             $done[$clsname.':'.$lang] = true;
-            return;
+            return false;
         }
         $user = 'www-data'; // ?? do we need other ones
         $compileDir = ini_get('session.save_path') .'/' . 
@@ -470,10 +470,10 @@ WHERE (
         $ts->template_id = $d->id;
         if (!$ts->find(true)) {
             // then in theory there are no translations
-            return;
+            return false;
         }
         if (file_exists($fname) && strtotime($ts->updated) < filemtime($fname)) {
-            return; // file exists and is newer than our updated line.
+            return $fname; // file exists and is newer than our updated line.
         }
         //DB_DataObject::debugLevel(1);
 
@@ -482,6 +482,7 @@ WHERE (
         $ts->selectAdd('join_src_id_id.txt as src_id_txt, core_templatestr.txt as txt');
         $ts->lang = $lang;
         $ts->template_id = $d->id;
+        $ts->whereAdd("LENGTH(join_src_id_id.txt) > 0 AND LENGTH(core_templatestr.txt) > 0");
         $words = $ts->fetchAll('src_id_txt', 'txt' );
                
         if (!file_exists($fdir)) {
@@ -518,7 +519,7 @@ WHERE (
         
          
         
-        return;
+        return $fname;
         
         require_once 'File/Gettext.php';
         $gt = File_Gettext::factory('MO', $fname);
index 00ebbb0..44e58e1 100644 (file)
@@ -613,7 +613,7 @@ class Pman_Core_DataObjects_Core_templatestr extends DB_DataObject
             return false;
         }
         $utime = file_exists($flexy->compiledTemplate) ?  filemtime( $flexy->compiledTemplate) : 0;
-        return strtotime($date) > $utime;
+        return strtotime($date) >  $utime;
     }
     
     // determine if a complied template need recompling