Fixed migration version check

- Login now checks the current db version against the latest migration available and displays the migration update message before login.
This commit is contained in:
objecttothis
2023-01-31 01:56:55 +04:00
committed by Steve Ireland
parent 6a9b3342d5
commit 70f49ace6f
2 changed files with 8 additions and 6 deletions

View File

@@ -24,8 +24,8 @@ class Login extends BaseController
$migration = new MY_Migration(config('Migrations'));
$data = [
'validation' => Services::validation(),
'latest_version' => $migration->is_latest(),
'application_version' => $migration->get_current_version()
'is_latest' => $migration->is_latest(),
'latest_version' => $migration->get_last_migration()
];
if($this->request->getMethod() != 'post')
@@ -129,4 +129,4 @@ class Login extends BaseController
return $result;
}
}
}

View File

@@ -1,6 +1,8 @@
<?php
/**
* @var object $validation
* @var bool $is_latest
* @var string $latest_version
*/
helper('form');
?>
@@ -47,11 +49,11 @@ helper('form');
</div>
<?php endif; ?>
<?php /*if(!$latest_version):*/ //TODO: This needs to be uncommented and fixed. CI4 does the latest version check differently, so we need to create a function that assigns a bool to $latest_version and includes it in view $data ?>
<?php if(!$is_latest): ?>
<div class="alert alert-info mt-3">
<?php echo lang('Login.migration_needed', ['version' => config('OSPOS')->settings['application_version']]) ?>
<?php echo lang('Login.migration_needed', ['version' => $latest_version]) ?>
</div>
<?php /*endif;*/ ?>
<?php endif; ?>
<?php if (empty(config('OSPOS')->settings['login_form']) || 'floating_labels'==(config('OSPOS')->settings['login_form'])): ?>
<div class="form-floating mt-3">