From b9cb0016637779934823d76a2122982623e65d0c Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 17 Jan 2023 13:26:18 +0800 Subject: [PATCH] add more index for translate --- DataObjects/Core_templatestr.php | 29 +++++++++++++++++------------ sql/core_templatestr.sql | 1 + 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/DataObjects/Core_templatestr.php b/DataObjects/Core_templatestr.php index c1aadbff..dbbd76f1 100644 --- a/DataObjects/Core_templatestr.php +++ b/DataObjects/Core_templatestr.php @@ -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); diff --git a/sql/core_templatestr.sql b/sql/core_templatestr.sql index 15bf3c3e..5bc8cd86 100644 --- a/sql/core_templatestr.sql +++ b/sql/core_templatestr.sql @@ -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); -- 2.39.2