Exemplo n.º 1
0
 public function install($id)
 {
     $module = $this->find($id);
     if ($module['is_setup'] == 1) {
         return array('error_code' => '模块已安装。');
     }
     $uninstallSql = APP_PATH . '/' . $module['name'] . '/Info/install.sql';
     $res = D()->executeSqlFile($uninstallSql);
     if ($res === true) {
         $module['is_setup'] = 1;
         $this->save($module);
     }
     clean_all_cache();
     //清除全站缓存
     return $res;
 }
Exemplo n.º 2
0
 public function doEditRule($id = null, $title, $app, $controller, $action2, $seo_title, $seo_keywords, $seo_description, $status)
 {
     //判断是否为编辑模式
     $isEdit = $id ? true : false;
     //写入数据库
     $data = array('title' => $title, 'app' => $app, 'controller' => $controller, 'action' => $action2, 'seo_title' => $seo_title, 'seo_keywords' => $seo_keywords, 'seo_description' => $seo_description, 'status' => $status);
     $model = M('SeoRule');
     if ($isEdit) {
         $result = $model->where(array('id' => $id))->save($data);
     } else {
         $result = $model->add($data);
     }
     clean_all_cache();
     //如果失败的话,显示失败消息
     if (!$result) {
         $this->error($isEdit ? '编辑失败' : '创建失败');
     }
     //显示成功信息,并返回规则列表
     $this->success($isEdit ? '编辑成功' : '创建成功', U('index'));
 }
Exemplo n.º 3
0
 public function cleanAll()
 {
     clean_all_cache();
     $this->success('清除完成');
 }
Exemplo n.º 4
0
 public function use_pack($id = '')
 {
     if (IS_GET && $id != '') {
         //  $db = new Database(array('', $this->pack_sql_dir . "/{$title}.sql"), array(), 'import');
         $error = D('')->executeSqlFile($this->pack_sql_dir . "/{$id}.sql");
         if ($error['error_code'] != '') {
             $this->error($error['error_code']);
             exit;
         } else {
             clean_all_cache();
             $this->success('使用补丁成功。');
         }
     } else {
         $this->error('请选择补丁。');
     }
 }
 public function use_pack($id = '')
 {
     if (IS_GET && $id != '') {
         //  $db = new Database(array('', $this->pack_sql_dir . "/{$title}.sql"), array(), 'import');
         $error = D('')->executeSqlFile($this->pack_sql_dir . "/{$id}.sql");
         if ($error['error_code'] != '') {
             $this->error($error['error_code']);
             exit;
         } else {
             clean_all_cache();
             $this->success(L('_USING_THE_PATCH_TO_SUCCEED_'));
         }
     } else {
         $this->error(L('_PLEASE_SELECT_THE_PATCH_'));
     }
 }
Exemplo n.º 6
0
function reset_user_info()
{
    clean_all_cache();
    $user_info = query_user(array('avatar128', 'nickname', 'uid', 'mobile'));
    $user_info['identity'] = D('shuo')->where(array('uid' => is_login()))->getField('identity');
    session('user_info', $user_info);
}