public function actionClear()
 {
     $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'cache';
     switch ($type) {
         case 'cache':
             if (Yii::app()->cache instanceof CApcCache) {
                 // Not support Cache for APC Cache
                 user()->setFlash('error', t('cms', 'Not support for APC Cache!'));
             } else {
                 if (Yii::app()->cache->flush()) {
                     user()->setFlash('success', t('cms', 'Cache cleared!'));
                 } else {
                     user()->setFlash('error', t('cms', 'Error whilte clearing cache!'));
                 }
             }
             break;
         case 'asset':
             # Clear Asset Cache
             $path = Yii::getPathOfAlias('webroot.assets');
             $get_sub_folders = get_subfolders_name($path);
             foreach ($get_sub_folders as $folder) {
                 recursive_remove_directory($path . DIRECTORY_SEPARATOR . $folder);
             }
             user()->setFlash('success', t('cms', 'Assets cleared!'));
             break;
     }
     $this->redirect(Yii::app()->createUrl('cache/default/index'));
 }
Exemple #2
0
 public static function getAvailableContentType($render_view = false)
 {
     $types = array();
     $folders = get_subfolders_name(Yii::getPathOfAlias('common.content_type'));
     foreach ($folders as $folder) {
         $temp = parse_ini_file(Yii::getPathOfAlias('common.content_type.' . $folder . '') . DIRECTORY_SEPARATOR . 'info.ini');
         if ($render_view) {
             $types[$temp['id']] = $temp['name'];
         } else {
             $types[$temp['id']] = $temp;
         }
     }
     return $types;
 }
Exemple #3
0
 /**
  * Function to Get Available Settings
  **/
 public static function getAvailableLanguages($render_view = false)
 {
     $cache_id = $render_view ? 'gxchelpers-available-languages' : 'gxchelpers-available-languages-false';
     $langs = Yii::app()->cache->get($cache_id);
     if ($langs === false) {
         $layouts = array();
         $folders = get_subfolders_name(Yii::getPathOfAlias('common.messages'));
         foreach ($folders as $folder) {
             $temp = parse_ini_file(Yii::getPathOfAlias('common.messages.' . $folder . '') . DIRECTORY_SEPARATOR . 'info.ini');
             if ($render_view) {
                 $langs[$temp['id']] = $temp['name'];
             } else {
                 $langs[$temp['id']] = $temp;
             }
         }
         Yii::app()->cache->set($cache_id, $langs, 7200);
     }
     return $langs;
 }
 public function clearCacheAssets($where)
 {
     $get_sub_folders = array();
     switch ($where) {
         case 'frontend':
             //Clear the assets folder
             $get_sub_folders = get_subfolders_name(FRONT_STORE . DIRECTORY_SEPARATOR . 'assets');
             foreach ($get_sub_folders as $folder) {
                 recursive_remove_directory(FRONT_STORE . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . $folder);
             }
             break;
         case 'backend':
             $get_sub_folders = get_subfolders_name(BACK_STORE . DIRECTORY_SEPARATOR . 'assets');
             foreach ($get_sub_folders as $folder) {
                 recursive_remove_directory(BACK_STORE . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . $folder);
             }
             break;
         default:
             break;
     }
     return;
 }
Exemple #5
0
 public static function getAvailableContentType($render_view = false)
 {
     $cache_id = $render_view ? 'gxchelpers-content-types' : 'gxchelpers-content-types-false';
     $types = Yii::app()->cache->get($cache_id);
     if ($types === false) {
         $types = array();
         $folders = get_subfolders_name(Yii::getPathOfAlias('common.content_type'));
         foreach ($folders as $folder) {
             $temp = parse_ini_file(Yii::getPathOfAlias('common.content_type.' . $folder . '') . DIRECTORY_SEPARATOR . 'info.ini');
             if ($render_view) {
                 $types[$temp['id']] = $temp['name'];
             } else {
                 $types[$temp['id']] = $temp;
             }
         }
         Yii::app()->cache->set($cache_id, $types, 7200);
     }
     return $types;
 }