mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
migration lockfile lifetime
This commit is contained in:
@@ -37,5 +37,20 @@ $config['migration_version'] = 211;
|
||||
$config['migration_path'] = APPPATH . 'migrations/';
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Lockfile
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Path to the migration lockfile.
|
||||
| This lockfile prevents migrations from running twice
|
||||
|
|
||||
*/
|
||||
$config['migration_lockfile'] = sys_get_temp_dir() . '/.migration_running';
|
||||
|
||||
// the maximum age of the lockfile in seconds
|
||||
$config['migration_lf_maxage'] = 30;
|
||||
|
||||
|
||||
/* End of file migration.php */
|
||||
/* Location: ./application/config/migration.php */
|
||||
|
||||
@@ -3,6 +3,7 @@ class Migrate extends CI_Controller {
|
||||
|
||||
public function index() {
|
||||
$this->load->library('Migration');
|
||||
$this->load->config('migration');
|
||||
|
||||
$result = array();
|
||||
$latest = $this->migration->latest();
|
||||
@@ -12,7 +13,7 @@ class Migrate extends CI_Controller {
|
||||
log_message('error', 'Migration failed');
|
||||
$result['status'] = 'error';
|
||||
} else {
|
||||
while (file_exists(APPPATH . 'cache/.migration_running')) {
|
||||
while (file_exists($this->config->item('migration_lockfile'))) {
|
||||
sleep(1);
|
||||
}
|
||||
$result['status'] = 'success';
|
||||
|
||||
Reference in New Issue
Block a user