Initial import from local backup (Documents-Playground/pakerpale)
This commit is contained in:
120
application/controllers/admin/config/Dbupgrade.php
Normal file
120
application/controllers/admin/config/Dbupgrade.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Dbupgrade class
|
||||
*/
|
||||
|
||||
/**
|
||||
* 관리자>환경설정>DB 업그레이드 controller 입니다.
|
||||
*/
|
||||
class Dbupgrade extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'config/dbupgrade';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array();
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = '';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 디비 업그레이드 페이지입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 마이그레이션 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('migration');
|
||||
$this->config->load('migration');
|
||||
$row = $this->db->get('migrations')->row();
|
||||
$view['view']['current_version'] = $row ? $row->version : 0;
|
||||
$view['view']['latest_version'] = $latest_version = config_item('migration_version');
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'execute',
|
||||
'label' => '실행',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
if ($this->migration->version($latest_version) === false) {
|
||||
$view['view']['alert_message'] = $this->migration->error_string();
|
||||
} else {
|
||||
$row = $this->db->get('migrations')->row();
|
||||
$view['view']['current_version'] = $row ? $row->version : 0;
|
||||
$view['view']['latest_version'] = config_item('migration_version');
|
||||
$view['view']['alert_message'] = '최신버전으로 업그레이드가 완료되었습니다';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user