2024-07-21 19:51:03 +02:00
|
|
|
<?php
|
|
|
|
|
class Migrate extends CI_Controller {
|
2013-02-24 17:56:37 -06:00
|
|
|
|
2024-07-26 23:47:16 +02:00
|
|
|
public function index() {
|
|
|
|
|
$this->load->library('Migration');
|
2024-08-02 11:48:41 +02:00
|
|
|
$this->load->config('migration');
|
2013-02-24 17:56:37 -06:00
|
|
|
|
2024-07-26 23:47:16 +02:00
|
|
|
$result = array();
|
|
|
|
|
$latest = $this->migration->latest();
|
|
|
|
|
|
|
|
|
|
if (!$latest) {
|
|
|
|
|
show_error($this->migration->error_string());
|
|
|
|
|
log_message('error', 'Migration failed');
|
|
|
|
|
$result['status'] = 'error';
|
|
|
|
|
} else {
|
2024-08-02 11:48:41 +02:00
|
|
|
while (file_exists($this->config->item('migration_lockfile'))) {
|
2024-07-26 23:47:16 +02:00
|
|
|
sleep(1);
|
|
|
|
|
}
|
|
|
|
|
$result['status'] = 'success';
|
|
|
|
|
$result['version'] = $latest;
|
|
|
|
|
}
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo json_encode($result);
|
2013-02-24 17:56:37 -06:00
|
|
|
}
|
2024-07-21 17:46:52 +02:00
|
|
|
}
|