wavelog/application/controllers/Migrate.php

26 lines
734 B
PHP
Raw Permalink Normal View History

2024-07-21 19:51:03 +02:00
<?php
class Migrate extends CI_Controller {
public function index() {
$this->load->library('Migration');
2024-08-02 11:48:41 +02:00
$this->load->config('migration');
$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'))) {
sleep(1);
}
$result['status'] = 'success';
$result['version'] = $latest;
}
header('Content-Type: application/json');
echo json_encode($result);
}
2024-07-21 17:46:52 +02:00
}