Add triggers for APP_CACHE_VIEW during installation.

This commit is contained in:
Alexandre Rosenfeld
2011-02-23 21:37:12 +00:00
parent ced0f4d771
commit 7f9d0bac81
2 changed files with 36 additions and 1 deletions

View File

@@ -1162,6 +1162,28 @@ class AppCacheView extends BaseAppCacheView {
return 'exists';
}
/**
* Retrieve the SQL code to create the APP_CACHE_VIEW triggers.
*
* @return array each value is a SQL statement to create a trigger.
*/
function getTriggers($lang){
$triggerFiles = array(
'triggerApplicationDelete.sql',
'triggerApplicationUpdate.sql',
'triggerAppDelegationUpdate.sql',
'triggerAppDelegationInsert.sql');
$triggers = array();
foreach ($triggerFiles as $triggerFile) {
$trigger = file_get_contents("{$this->pathToAppCacheFiles}/$triggerFile");
if ($trigger === false)
throw new Exception("Could not read trigger contents in $triggerFile");
$trigger = str_replace('{lang}', $lang, $trigger);
$triggers[$triggerFile] = $trigger;
}
return $triggers;
}
function getFormatedUser($sFormat, $aCaseUser, $userIndex){
require_once('classes/model/Users.php');
$oUser = new Users();