From 361a3b2b25343c164ab3b4d585157e982f3544bf Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 15 Jun 2018 16:34:05 -0400 Subject: [PATCH] HOR-4636 --- workflow/engine/classes/WorkspaceTools.php | 27 +++++++++++----------- workflow/engine/classes/model/Content.php | 6 ++--- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index 0f4614cde..30559c0d9 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -289,6 +289,12 @@ class WorkspaceTools $stop = microtime(true); CLI::logging("<*> Optimizing content data took " . ($stop - $start) . " seconds.\n"); + $start = microtime(true); + CLI::logging("> Migrating and populating indexing for avoiding the use of table APP_CACHE_VIEW...\n"); + $this->migratePopulateIndexingACV($workSpace); + $stop = microtime(true); + CLI::logging("<*> Migrating an populating indexing for avoiding the use of table APP_CACHE_VIEW process took " . ($stop - $start) . " seconds.\n"); + /*----------------------------------********---------------------------------*/ $start = microtime(true); CLI::logging("> Migrate new lists...\n"); @@ -316,12 +322,6 @@ class WorkspaceTools $stop = microtime(true); CLI::logging("<*> Migrating Self-Service records Process took " . ($stop - $start) . " seconds.\n"); - $start = microtime(true); - CLI::logging("> Migrating and populating indexing for avoiding the use of table APP_CACHE_VIEW...\n"); - $this->migratePopulateIndexingACV($workSpace); - $stop = microtime(true); - CLI::logging("<*> Migrating an populating indexing for avoiding the use of table APP_CACHE_VIEW process took " . ($stop - $start) . " seconds.\n"); - $start = microtime(true); CLI::logging("> Updating rows in Web Entry table for classic processes...\n"); $this->updatingWebEntryClassicModel($workSpace); @@ -1249,6 +1249,7 @@ class WorkspaceTools public function upgradeData() { + $this->getSchema(); if (file_exists(PATH_CORE . 'data' . PATH_SEP . 'check.data')) { $checkData = unserialize(file_get_contents(PATH_CORE . 'data' . PATH_SEP . 'check.data')); if (is_array($checkData)) { @@ -2029,6 +2030,13 @@ class WorkspaceTools $stop = microtime(true); CLI::logging("<*> Optimizing content data took " . ($stop - $start) . " seconds.\n"); + //Populate the new fields for replace string UID to Interger ID + $start = microtime(true); + CLI::logging("> Migrating and populating indexing for APP_CACHE_VIEW...\n"); + $workspace->migratePopulateIndexingACV($workspace->name); + $stop = microtime(true); + CLI::logging("<*> Migrating an populating indexing for APP_CACHE_VIEW process took " . ($stop - $start) . " seconds.\n"); + //Move the data of cases to the corresponding List /*----------------------------------********---------------------------------*/ $start = microtime(true); @@ -2044,13 +2052,6 @@ class WorkspaceTools $stop = microtime(true); CLI::logging("<*> Updating Files Manager took " . ($stop - $start) . " seconds.\n"); - //Populate the new fields for replace string UID to Interger ID - $start = microtime(true); - CLI::logging("> Migrating and populating indexing for APP_CACHE_VIEW...\n"); - $workspace->migratePopulateIndexingACV($workspace->name); - $stop = microtime(true); - CLI::logging("<*> Migrating an populating indexing for APP_CACHE_VIEW process took " . ($stop - $start) . " seconds.\n"); - //Updating generated class files for PM Tables passthru(PHP_BINARY . ' processmaker regenerate-pmtable-classes ' . $workspace->name); diff --git a/workflow/engine/classes/model/Content.php b/workflow/engine/classes/model/Content.php index 9404162eb..549e39282 100644 --- a/workflow/engine/classes/model/Content.php +++ b/workflow/engine/classes/model/Content.php @@ -323,7 +323,7 @@ class Content extends BaseContent DB::connection($connection)->statement($query); - $languages = DB::table('CONTENT')->select('CON_LANG')->distinct()->get(); + $languages = DB::connection($connection)->table('CONTENT')->select('CON_LANG')->distinct()->get(); foreach ($languages as $value) { if (array_search($value->CON_LANG, $langs) === false) { @@ -335,7 +335,7 @@ class Content extends BaseContent DB::connection($connection)->statement('SET FOREIGN_KEY_CHECKS=0'); DB::connection($connection)->statement('SET SQL_BIG_SELECTS=1'); - $result = DB::table('CONTENT') + $result = DB::connection($connection)->table('CONTENT') ->select('CON_ID', 'CON_CATEGORY', 'CON_LANG', 'CON_PARENT', 'CON_VALUE') ->orderBy('CON_ID', 'CON_CATEGORY', 'CON_LANG', 'CON_PARENT', 'CON_VALUE') ->get(); @@ -385,7 +385,7 @@ class Content extends BaseContent DB::connection($connection)->statement('DROP TABLE CONTENT_BACKUP'); $result = DB::connection($connection) - ->select("SELECT * FROM information_schema.processlist WHERE command = 'Sleep' and user = SUBSTRING_INDEX(USER(),'@',1) and db = DATABASE() ORDER BY id"); + ->select("SELECT * FROM information_schema.processlist WHERE COMMAND = 'Sleep' AND USER = SUBSTRING_INDEX(USER(),'@',1) AND DB = DATABASE() AND TIME > 0 ORDER BY ID"); foreach ($result as $value) { DB::connection($connection)->statement('kill ' . $value->ID);