function beforeSave($record) { if ($record->valueChanged('active')) { // The active flag has changed so we need to update the effective active // flag of this page and all its children $this->pouch['update_active'] = 1; } if ($record->valueChanged('locked')) { // The active flag has changed so we need to update the effective active // flag of this page and all its children $this->pouch['update_locked'] = 1; } if ($record->valueChanged('translation_memory_id')) { // The active flag has changed so we need to update the effective active // flag of this page and all its children $this->pouch['update_translation_memory_id'] = 1; } if ($record->valueChanged('auto_approve')) { // The active flag has changed so we need to update the effective active // flag of this page and all its children $this->pouch['update_auto_approve'] = 1; } if (class_exists('LiveCache')) { LiveCache::touchSite($record->val('website_id')); } }
function beforeSave($record) { //if base_path doesn't start with // then add it on $base_path = $record->val('base_path'); $changedBasePath = false; if (strpos($base_path, '//') !== false) { $base_path = preg_replace('#//#', '/', $base_path); $changedBasePath = true; } if (substr($base_path, 0, 1) !== '/') { $base_path = '/' . $base_path; $changedBasePath = true; } if (!preg_match('/\\/$/', $base_path)) { $base_path .= '/'; $changedBasePath = true; } if ($changedBasePath) { $record->setValue('base_path', $base_path); } if (class_exists('LiveCache')) { LiveCache::touchSite($record->val('website_id')); } }