add more index for translate
authorAlan <alan@roojs.com>
Tue, 17 Jan 2023 05:26:18 +0000 (13:26 +0800)
committerAlan <alan@roojs.com>
Tue, 17 Jan 2023 05:26:18 +0000 (13:26 +0800)
DataObjects/Core_templatestr.php
sql/core_templatestr.sql

index c1aadbf..dbbd76f 100644 (file)
@@ -442,18 +442,23 @@ class Pman_Core_DataObjects_Core_templatestr extends DB_DataObject
         
         // find all the id's from lang that have not been generated..
         
-        //find the origanal 
-        $t = DB_DataObject::factory($tn);
-        $t->whereAdd("lang = ''");
-        $t->active = 1;
-        
-        //old code, this did not support the on_table
-//        $id_tmp = $t->fetchAll('id','template_id');
-//        $ids = array_keys($id_tmp);
-        $id_tmp = array();
-        //new code for support the sync tables 
-        foreach($t->fetchAll() as $ori){
-            $id_tmp[$ori->id] = $ori;
+        
+        static $id_tmp = false;
+        
+        if ($id_tmp == false) {
+            //find the origanal 
+            $t = DB_DataObject::factory($tn);
+            $t->whereAdd("lang = ''");
+            $t->active = 1;
+            
+            //old code, this did not support the on_table
+    //        $id_tmp = $t->fetchAll('id','template_id');
+    //        $ids = array_keys($id_tmp);
+            $id_tmp = array();
+            //new code for support the sync tables 
+            foreach($t->fetchAll() as $ori){
+                $id_tmp[$ori->id] = $ori;
+            }
         }
         $ids = array_keys($id_tmp);
         
index 15bf3c3..5bc8cd8 100644 (file)
@@ -23,3 +23,4 @@ ALTER TABLE core_templatestr ADD COLUMN on_col VARCHAR(64) DEFAULT '';
 
 ALTER TABLE core_templatestr ADD INDEX lookup_a(active, lang, on_table, on_id, on_col);
 
+alter table core_templatestr add index lookup_b(src_id, lang, mdsum, template_id);