UpdateTemplates.php
authorAlan Knowles <alan@roojs.com>
Mon, 9 Oct 2017 05:15:47 +0000 (13:15 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 9 Oct 2017 05:15:47 +0000 (13:15 +0800)
UpdateTemplates.php

index f86ee85..e24b279 100644 (file)
@@ -201,11 +201,27 @@ class Pman_Cms_UpdateTemplates extends Pman
         }
         $ff = HTML_FlexyFramework::get();
         $opt_lang = empty($ff->Pman_Core_I18n) ? array( 'l' => array()) : $ff->Pman_Core_I18n;
+        
+        $langs = $opt_lang['l'] ;
+        // see what languages are in there already!?
+        $cl = DB_DataObject::factory('cms_templatestr');
+        $cl->selectAdd();
+        $cl->selectAdd('distinct(lang) as lang');
+        $cl->whereAdd("lang != ''");
+        $dblangs = $cl->fetchAll('lang');
+        foreach($langs as $l) {
+            if (!in_array($$l, $dblangs)) {
+                $dblangs[] = $l;
+            }
+        }
+        
+        
+        
         // templates.. -- assume the above does the template syncing..
         //DB_DataObject::DebugLevel(1);
         echo "Sync the Languages template.....\n";
         
-        foreach($opt_lang['l'] as $l) {
+        foreach($dblangs as $l) {
             echo "Sync $l Language.....\n";
             $tps = DB_DataObject::factory('cms_templatestr');
             $tps->syncLang($l); /// this should be configured somewhere..