Merge pull request #2679 from HB9HIL/migration_from_db_in_debug

Show latest Migration in Database in the Debug View
这个提交包含在:
Peter Goodhall 2023-11-12 14:44:26 +00:00 提交者 GitHub
当前提交 9f3d6d823f
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 3 个文件被更改,包括 29 次插入0 次删除

查看文件

@ -14,6 +14,10 @@ class Debug extends CI_Controller {
{ {
$this->load->helper('file'); $this->load->helper('file');
$this->load->model('MigrationVersion');
$data['migration_version'] = $this->MigrationVersion->getMigrationVersion();
// Test writing to backup folder // Test writing to backup folder
$backup_folder = $this->is_really_writable('backup'); $backup_folder = $this->is_really_writable('backup');
$data['backup_folder'] = $backup_folder; $data['backup_folder'] = $backup_folder;

查看文件

@ -0,0 +1,20 @@
<?php
class MigrationVersion extends CI_Model {
function getMigrationVersion() {
$this->db->select_max('version');
$query = $this->db->get('migrations');
$migration_version = $query->row();
if ($query->num_rows() == 1) {
$migration_version = $query->row()->version;
return $migration_version;
} else {
return null;
}
}
}
?>

查看文件

@ -21,6 +21,11 @@
<td>Base URL</td> <td>Base URL</td>
<td><span id="baseUrl"><a href="<?php echo $this->config->item('base_url')?>" target="_blank"><?php echo $this->config->item('base_url'); ?></a></span> <span data-toggle="tooltip" data-original-title="<?php echo lang('copy_to_clipboard'); ?>" onclick='copyURL("<?php echo $this->config->item('base_url'); ?>")'><i class="copy-icon fas fa-copy"></span></td> <td><span id="baseUrl"><a href="<?php echo $this->config->item('base_url')?>" target="_blank"><?php echo $this->config->item('base_url'); ?></a></span> <span data-toggle="tooltip" data-original-title="<?php echo lang('copy_to_clipboard'); ?>" onclick='copyURL("<?php echo $this->config->item('base_url'); ?>")'><i class="copy-icon fas fa-copy"></span></td>
</tr> </tr>
<tr>
<td>Migration</td>
<td><?php echo (isset($migration_version) ? $migration_version : "<span class='badge badge-danger'>There is something wrong with your Migration in Database!</span>"); ?></td>
</tr>
</table> </table>
</div> </div>
</div> </div>