BUG 9040 "The Task column doesn't update whith the last changes on..." SOLVED

- The APP_CACHE_VIEW table does not contain the changes made in the CONTENT table when you rename processes/tasks
- The name change in processes/tasks is now reflected in the APP_CACHE_VIEW table
- Note.- The APP_CACHE_VIEW table contains values ..for only one language
This commit is contained in:
Victor Saisa Lopez
2012-05-10 11:06:44 -04:00
parent c62f18b054
commit c4af5f8d23
5 changed files with 102 additions and 6 deletions

View File

@@ -427,6 +427,7 @@ class workspaceTools {
$triggers[] = $appCache->triggerAppDelegationUpdate($lang, $checkOnly); $triggers[] = $appCache->triggerAppDelegationUpdate($lang, $checkOnly);
$triggers[] = $appCache->triggerApplicationUpdate($lang, $checkOnly); $triggers[] = $appCache->triggerApplicationUpdate($lang, $checkOnly);
$triggers[] = $appCache->triggerApplicationDelete($lang, $checkOnly); $triggers[] = $appCache->triggerApplicationDelete($lang, $checkOnly);
$triggers[] = $appCache->triggerContentUpdate($lang, $checkOnly);
if ($fill) { if ($fill) {
CLI::logging("-> Filling cache view\n"); CLI::logging("-> Filling cache view\n");

View File

@@ -1066,7 +1066,7 @@ class AppCacheView extends BaseAppCacheView {
if ( ! $found ) { if ( ! $found ) {
$filenameSql = $this->pathToAppCacheFiles . '/triggerApplicationUpdate.sql'; $filenameSql = $this->pathToAppCacheFiles . '/triggerApplicationUpdate.sql';
if ( !file_exists ( $filenameSql ) ) if ( !file_exists ( $filenameSql ) )
throw ( new Exception ( "file triggerAppDelegationUpdate.sql doesn't exist ") ); throw ( new Exception ( "file triggerApplicationUpdate.sql doesn't exist ") );
$sql = file_get_contents ( $filenameSql ); $sql = file_get_contents ( $filenameSql );
$sql = str_replace('{lang}', $lang, $sql); $sql = str_replace('{lang}', $lang, $sql);
$stmt->executeQuery($sql); $stmt->executeQuery($sql);
@@ -1103,7 +1103,7 @@ class AppCacheView extends BaseAppCacheView {
if ( ! $found ) { if ( ! $found ) {
$filenameSql = $this->pathToAppCacheFiles . '/triggerApplicationDelete.sql'; $filenameSql = $this->pathToAppCacheFiles . '/triggerApplicationDelete.sql';
if ( !file_exists ( $filenameSql ) ) if ( !file_exists ( $filenameSql ) )
throw ( new Exception ( "file triggerAppDelegationDelete.sql doesn't exist") ); throw ( new Exception ( "file triggerApplicationDelete.sql doesn't exist") );
$sql = file_get_contents ( $filenameSql ); $sql = file_get_contents ( $filenameSql );
$sql = str_replace('{lang}', $lang, $sql); $sql = str_replace('{lang}', $lang, $sql);
$stmt->executeQuery($sql); $stmt->executeQuery($sql);
@@ -1111,6 +1111,45 @@ class AppCacheView extends BaseAppCacheView {
} }
return 'exists'; return 'exists';
} }
function triggerContentUpdate($lang, $recreate = false)
{
$cnn = Propel::getConnection("workflow");
$stmt = $cnn->createStatement();
$rs = $stmt->executeQuery("Show TRIGGERS", ResultSet::FETCHMODE_ASSOC);
$found = false;
while ($rs->next()) {
$row = $rs->getRow();
if (strtolower($row["Trigger"] == "CONTENT_UPDATE") && strtoupper($row["Table"]) == "CONTENT") {
$found = true;
}
}
if ($recreate) {
$rs = $stmt->executeQuery("DROP TRIGGER IF EXISTS CONTENT_UPDATE");
$found = false;
}
if (!$found) {
$filenameSql = $this->pathToAppCacheFiles . PATH_SEP . "triggerContentUpdate.sql";
if (!file_exists($filenameSql)) {
throw (new Exception("file triggerContentUpdate.sql doesn't exist"));
}
$sql = file_get_contents($filenameSql);
$sql = str_replace("{lang}", $lang, $sql);
$stmt->executeQuery($sql);
return "created";
}
return "exists";
}
/** /**
* Retrieve the SQL code to create the APP_CACHE_VIEW triggers. * Retrieve the SQL code to create the APP_CACHE_VIEW triggers.
@@ -1122,7 +1161,8 @@ class AppCacheView extends BaseAppCacheView {
'triggerApplicationDelete.sql', 'triggerApplicationDelete.sql',
'triggerApplicationUpdate.sql', 'triggerApplicationUpdate.sql',
'triggerAppDelegationUpdate.sql', 'triggerAppDelegationUpdate.sql',
'triggerAppDelegationInsert.sql'); 'triggerAppDelegationInsert.sql',
'triggerContentUpdate.sql');
$triggers = array(); $triggers = array();
foreach ($triggerFiles as $triggerFile) { foreach ($triggerFiles as $triggerFile) {
$trigger = file_get_contents("{$this->pathToAppCacheFiles}/$triggerFile"); $trigger = file_get_contents("{$this->pathToAppCacheFiles}/$triggerFile");

View File

@@ -718,11 +718,13 @@ class Installer extends Controller
if (file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationInsert.sql') && if (file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationInsert.sql') &&
file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationUpdate.sql') && file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationUpdate.sql') &&
file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationUpdate.sql') && file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationUpdate.sql') &&
file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationDelete.sql')) { file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationDelete.sql') &&
file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerContentUpdate.sql')) {
$this->mysqlQuery(@file_get_contents(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationInsert.sql')); $this->mysqlQuery(@file_get_contents(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationInsert.sql'));
$this->mysqlQuery(@file_get_contents(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationUpdate.sql')); $this->mysqlQuery(@file_get_contents(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationUpdate.sql'));
$this->mysqlQuery(@file_get_contents(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationUpdate.sql')); $this->mysqlQuery(@file_get_contents(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationUpdate.sql'));
$this->mysqlQuery(@file_get_contents(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationDelete.sql')); $this->mysqlQuery(@file_get_contents(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationDelete.sql'));
$this->mysqlQuery(@file_get_contents(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerContentUpdate.sql'));
$this->mysqlQuery("INSERT INTO `CONFIGURATION` ( $this->mysqlQuery("INSERT INTO `CONFIGURATION` (
`CFG_UID`, `CFG_UID`,
`CFG_VALUE` `CFG_VALUE`
@@ -792,6 +794,9 @@ class Installer extends Controller
//APPLICATION DELETE //APPLICATION DELETE
$res = $appCache->triggerApplicationDelete($lang, true); $res = $appCache->triggerApplicationDelete($lang, true);
//CONTENT UPDATE
$res = $appCache->triggerContentUpdate($lang, true);
//build using the method in AppCacheView Class //build using the method in AppCacheView Class
$res = $appCache->fillAppCacheView($lang); $res = $appCache->fillAppCacheView($lang);
@@ -978,11 +983,13 @@ class Installer extends Controller
if (file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql') && if (file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql') &&
file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql') && file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql') &&
file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql') && file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql') &&
file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql')) { file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql') &&
file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql')) {
$this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql')); $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql'));
$this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql')); $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql'));
$this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql')); $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql'));
$this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql')); $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql'));
$this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql'));
$this->mssqlQuery("INSERT INTO CONFIGURATION ( $this->mssqlQuery("INSERT INTO CONFIGURATION (
CFG_UID, CFG_UID,
CFG_VALUE CFG_VALUE

View File

@@ -102,6 +102,10 @@
//APPLICATION DELETE //APPLICATION DELETE
$res = $appCache->triggerApplicationDelete($lang, false); $res = $appCache->triggerApplicationDelete($lang, false);
$result->info[] = array ('name' => 'Trigger APPLICATION DELETE', 'value'=> $res); $result->info[] = array ('name' => 'Trigger APPLICATION DELETE', 'value'=> $res);
//CONTENT UPDATE
$res = $appCache->triggerContentUpdate($lang, false);
$result->info[] = array("name" => "Trigger CONTENT UPDATE", "value" => $res);
//show language //show language
$result->info[] = array ('name' => 'Language', 'value'=> $lang ); $result->info[] = array ('name' => 'Language', 'value'=> $lang );
@@ -152,7 +156,10 @@
//APPLICATION DELETE //APPLICATION DELETE
$res = $appCache->triggerApplicationDelete($lang, true); $res = $appCache->triggerApplicationDelete($lang, true);
//$result->info[] = array ('name' => 'Trigger APPLICATION DELETE', 'value'=> $res); //$result->info[] = array ('name' => 'Trigger APPLICATION DELETE', 'value'=> $res);
//CONTENT UPDATE
$res = $appCache->triggerContentUpdate($lang, true);
//$result->info[] = array("name" => "Trigger CONTENT UPDATE", "value" => $res);
//build using the method in AppCacheView Class //build using the method in AppCacheView Class
$res = $appCache->fillAppCacheView($lang); $res = $appCache->fillAppCacheView($lang);

View File

@@ -0,0 +1,41 @@
CREATE TRIGGER CONTENT_UPDATE BEFORE UPDATE ON CONTENT
FOR EACH ROW
BEGIN
DECLARE str TEXT;
IF (NEW.CON_VALUE IS NULL) THEN
SET str = '';
ELSE
SET str = NEW.CON_VALUE;
END IF;
CASE (NEW.CON_CATEGORY)
WHEN 'APP_TITLE' THEN
BEGIN
UPDATE APP_CACHE_VIEW
SET APP_TITLE = str
WHERE APP_UID = NEW.CON_ID;
END;
WHEN 'PRO_TITLE' THEN
BEGIN
UPDATE APP_CACHE_VIEW
SET APP_PRO_TITLE = str
WHERE PRO_UID = NEW.CON_ID;
END;
WHEN 'TAS_TITLE' THEN
BEGIN
UPDATE APP_CACHE_VIEW
SET APP_TAS_TITLE = str
WHERE TAS_UID = NEW.CON_ID;
END;
ELSE
BEGIN
END;
END CASE;
END;