Add a config item for knowing if v2 migration took place

这个提交包含在:
Peter Goodhall 2022-10-10 19:56:46 +01:00
父节点 08d6294e34
当前提交 22f421e9eb
共有 4 个文件被更改,包括 59 次插入21 次删除

查看文件

@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 101;
$config['migration_version'] = 102;
/*
|--------------------------------------------------------------------------

查看文件

@ -11,28 +11,33 @@ class Welcome extends CI_Controller {
public function index()
{
$data['page_title'] = "Welcome to Cloudlog Version 2.0";
// load stations model
$this->load->model('stations');
$data['CountAllStationLocations'] = $this->stations->CountAllStationLocations();
if($this->config->item('option_version2_trigger') == "false") {
$data['page_title'] = "Welcome to Cloudlog Version 2.0";
// load logbooks model
$this->load->model('logbooks_model');
$data['NumberOfStationLogbooks'] = $this->logbooks_model->CountAllStationLogbooks();
// load api model
$this->load->model('api_model');
$data['NumberOfAPIKeys'] = $this->api_model->CountKeysWithNoUserID();
// load note model
$this->load->model('note');
$data['NumberOfNotes'] = $this->note->CountAllNotes();
// load views
$this->load->view('interface_assets/mini_header', $data);
$this->load->view('welcome/index');
$this->load->view('interface_assets/footer');
// load stations model
$this->load->model('stations');
$data['CountAllStationLocations'] = $this->stations->CountAllStationLocations();
// load logbooks model
$this->load->model('logbooks_model');
$data['NumberOfStationLogbooks'] = $this->logbooks_model->CountAllStationLogbooks();
// load api model
$this->load->model('api_model');
$data['NumberOfAPIKeys'] = $this->api_model->CountKeysWithNoUserID();
// load note model
$this->load->model('note');
$data['NumberOfNotes'] = $this->note->CountAllNotes();
// load views
$this->load->view('interface_assets/mini_header', $data);
$this->load->view('welcome/index');
$this->load->view('interface_assets/footer');
} else {
redirect('login');
}
}
public function locationsclaim() {

查看文件

@ -0,0 +1,25 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* This migration creates a table called options which will hold global options needed within cloudlog
* removing the need for lots of configuration files.
*/
class Migration_add_version_two_trigger_to_options extends CI_Migration {
public function up()
{
$data = array(
array('option_name' => "version2_trigger", 'option_value' => "false", 'autoload' => "yes"),
);
$this->db->insert_batch('options', $data);
}
public function down()
{
// No option to down
}
}

查看文件

@ -1,3 +1,6 @@
<?php
echo $this->config->item('option_version2_trigger');
?>
<div class="container">
<br>
@ -149,4 +152,9 @@
</div>
<br>
<button class="btn btn-primary" onClick="window.location.reload();">Check if Migration Complete</button>
<br><br>
</div>