Beispiel #1
0
 public function resetAction()
 {
     $this->_checkCanDelete();
     if (Backend_Cache_Manager::resetAll()) {
         Response::jsonSuccess();
     } else {
         Response::jsonError($this->_lang->CANT_RESET_CACHE);
     }
 }
Beispiel #2
0
 /**
  * Save permissions action
  */
 public function savepermissionsAction()
 {
     $this->_checkCanEdit();
     $data = Request::post('data', 'raw', false);
     $groupId = Request::post('group_id', 'int', false);
     $data = json_decode($data, true);
     if (empty($data) || !$groupId) {
         Response::jsonError($this->_lang->WRONG_REQUEST);
     }
     if (Model::factory('Permissions')->updateGroupPermissions($groupId, $data)) {
         if (Backend_Cache_Manager::resetAll()) {
             Response::jsonSuccess();
         } else {
             Response::jsonError($this->_lang->get('CANT_RESET_CACHE'));
         }
     } else {
         Response::jsonError($this->_lang->get('CANT_EXEC'));
     }
 }
Beispiel #3
0
 /**
  * Restore backups (DB data and object configs)
  * @throws Exception
  * @return void
  */
 public function restorebackupAction()
 {
     $this->_checkCanEdit();
     $name = Request::post('name', 'str', '');
     $restoreDb = Request::post('sql', 'bool', false);
     if (!$name) {
         Response::jsonError();
     }
     ini_set('ignore_user_abort', 'On');
     ini_set('max_execution_time', 3600);
     $updater = new Backend_Orm_Backup($this->_db);
     $updater->sql = true;
     $updater->execSql = $restoreDb;
     if (!$updater->update($this->_configMain->get('backups') . $name)) {
         switch ($updater->getErrorStatus()) {
             case Backend_Orm_Backup::ERROR_CANT_WRITE:
                 $err = $updater->getErrors();
                 Response::jsonError($this->_lang->CANT_WRITE_FS . ':<br>' . implode('<br>', $err));
                 break;
             case Backend_Orm_Backup::ERROR_SQL_FAIL:
                 Response::jsonError($this->_lang->SQL_EXEC_FAIL);
                 break;
             case Backend_Orm_Backup::ERROR_CANT_EXTRACT_ZIP:
                 Response::jsonError($this->_lang->CANT_EXTRACT);
                 break;
             case Backend_Orm_Backup::ERROR_EMPTY_BACKUP:
                 Response::jsonError($this->_lang->EMPTY_BACKUP);
                 break;
         }
     }
     if (Backend_Cache_Manager::resetAll()) {
         Response::jsonSuccess();
     } else {
         Response::jsonError($this->_lang->CANT_RESET_CACHE);
     }
 }