/** * After saving this configuration item, perform any updates. * * @return void */ public function postConfigurationChange() { Yii::app()->params[$this->key_name] = $this->key_value; switch ($this->key_name) { case 'STORE_OFFLINE': if ($this->key_value == 1) { $this->key_value = rand(2, 99999999); $this->save(); Yii::app()->user->setFlash('warning', Yii::t('global', 'Your store is currently set offline for maintenance -- you can access it via the url {url}', array('{url}' => Yii::app()->createAbsoluteUrl('site/index', array('offline' => $this->key_value))))); } else { Yii::app()->user->getFlash('warning'); } Yii::app()->params[$this->key_name] = $this->key_value; break; case 'INVENTORY_OUT_ALLOW_ADD': Category::updateAllChildCounts(); Family::updateAllChildCounts(); break; } }