Last active
February 23, 2016 14:02
-
-
Save yuchan/eb92c76db0de6cf15ff2 to your computer and use it in GitHub Desktop.
CodeIgniter Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ index.php?/$1 [L] | |
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined('BASEPATH')) | |
exit("No direct script access allowed"); | |
class Migrate extends CI_Controller { | |
public function __construct() { | |
parent::__construct(); | |
$this->input->is_cli_request() | |
or exit("Execute via command line: php index.php migrate"); | |
$this->load->library('migration'); | |
} | |
public function index() { | |
if (!$this->migration->latest()) { | |
show_error($this->migration->error_string()); | |
} else { | |
show_error('You don\'t have permission for this action'); | |
; | |
} | |
} | |
public function version($version) { | |
if ($this->input->is_cli_request()) { | |
$migration = $this->migration->version($version); | |
if (!$migration) { | |
echo $this->migration->error_string(); | |
} else { | |
echo 'Migration(s) done' . PHP_EOL; | |
} | |
} else { | |
show_error('You don\'t have permission for this action'); | |
; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment