From 036a3e0f55cfe67d92d0dda830a23aceb1372256 Mon Sep 17 00:00:00 2001 From: Alexandre Rosenfeld Date: Wed, 9 Mar 2011 16:45:47 +0000 Subject: [PATCH] Do not drop APP_CACHE_VIEW when checking the number of rows. - Cases List Cache Builder is now working again. --- .../engine/classes/model/AppCacheView.php | 34 ++----------------- .../engine/methods/setup/appCacheViewAjax.php | 2 -- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/workflow/engine/classes/model/AppCacheView.php b/workflow/engine/classes/model/AppCacheView.php index ac93613d8..13528f5c9 100644 --- a/workflow/engine/classes/model/AppCacheView.php +++ b/workflow/engine/classes/model/AppCacheView.php @@ -945,43 +945,13 @@ class AppCacheView extends BaseAppCacheView { $rs1->next(); } - $needCreateTable = $found == false; - - //if exists the APP_CACHE_VIEW Table, we need to check if it has the correct number of fields, if not recreate the table - $tableRecreated = false; - if ( $found ) { - $sql="SHOW FIELDS FROM APP_CACHE_VIEW"; - $rs1 = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM); - $rs1->next(); - $fields = array(); - while ( is_array($row = $rs1->getRow() ) ) { - $fields[] = $row[0]; - $rs1->next(); - } - if ( count($fields) != 31 ) { - $needCreateTable = true; - } - } - - if ( $needCreateTable ) { - $stmt->executeQuery( "DROP TABLE IF EXISTS `APP_CACHE_VIEW`; "); - - $filenameSql = $this->pathToAppCacheFiles . 'app_cache_view.sql'; - if ( !file_exists ( $filenameSql ) ) - throw ( new Exception ( "file app_cache_view.sql doesn't exists ") ); - $sql = file_get_contents ( $filenameSql ); - $stmt->executeQuery($sql); - $tableRecreated = true; - $found = true; - } - //now count how many records there are .. $count = '-'; if ( $found ) { $oCriteria = new Criteria('workflow'); $count = AppCacheViewPeer::doCount($oCriteria); } - return array( 'found' => $found, 'recreated' => $tableRecreated, 'count' => $count ); + return array( 'found' => $found, 'count' => $count ); } @@ -1005,7 +975,7 @@ class AppCacheView extends BaseAppCacheView { $val = str_replace('{lang}', $lang, $val); $stmt->executeQuery($val); } - + $sql = "select count(*) as CANT from APP_CACHE_VIEW "; $rs1 = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); $rs1->next(); diff --git a/workflow/engine/methods/setup/appCacheViewAjax.php b/workflow/engine/methods/setup/appCacheViewAjax.php index c8c05129e..c67e8413b 100755 --- a/workflow/engine/methods/setup/appCacheViewAjax.php +++ b/workflow/engine/methods/setup/appCacheViewAjax.php @@ -83,8 +83,6 @@ //now check if table APPCACHEVIEW exists, and it have correct number of fields, etc. $res = $appCache->checkAppCacheView(); $result->info[] = array ('name' => 'Table APP_CACHE_VIEW', 'value'=> $res['found']); - if ( $res['recreated'] ) - $result->info[] = array ('name' => 'Table APP_CACHE_VIEW recreated', 'value'=> $res['recreated']); $result->info[] = array ('name' => 'Rows in APP_CACHE_VIEW', 'value'=> $res['count']);