php-mpos/public/include/version.inc.php
Sebastian Grewe 2568ced4d4 [INITIAL] Working version checks
* Check DB structure version, config file version and MPOS core version
* Added new Admin Dashboard to show this core information
* Cronjobs will be disabled if SQL files are not imported
 * SQL files must re-set the db_upgrade_required setting
* Cronjobs will disabled if config files are not updated
 * Simple config file update and version string update will fix this
* Added MPOS status overview
 * Cronjobs and Wallet information for now, others may be added later
* Added new navigation link for Admin Panel Dashboard
* Added new version file
 * Will require updates whenever DB or configs are updated
* Update SQL file that adds the DB_VERSION setting

This will address #1242 and already includes a huge chunk of changes
required to make this work.
2014-01-05 11:19:09 +01:00

25 lines
1.2 KiB
PHP

<?php
define('DB_VERSION', '0.0.1');
define('CONFIG_VERSION', '0.0.1');
define('MPOS_VERSION', '0.0.1');
// Fetch installed database version
$db_version = $setting->getValue('DB_VERSION');
if ($db_version != DB_VERSION) {
$setting->setValue('db_upgrade_required', 1);
// Notify admins via error popup
if (isset($_SESSION['USERDATA']) && $user->isAdmin($_SESSION['USERDATA']['id']))
$_SESSION['POPUP'][] = array('CONTENT' => 'Database version mismatch (Installed: ' . $db_version . ', Current: ' . DB_VERSION . '). Database update required, please import any new SQL files. Cronjobs have been halted.', 'TYPE' => 'errormsg');
}
if (@$config['version'] != CONFIG_VERSION) {
$setting->setValue('config_upgrade_required', 1);
// Notify admins via error popup
if (isset($_SESSION['USERDATA']) && $user->isAdmin($_SESSION['USERDATA']['id']))
$_SESSION['POPUP'][] = array('CONTENT' => 'Configuration file version mismatch (Installed: ' . @$config['version'] . ', Current: ' . CONFIG_VERSION . '). Configuration update required, please check dist config for changes. Cronjobs have been halted.', 'TYPE' => 'errormsg');
} else {
// Reset option, maybe there is a better way?
$setting->setValue('config_upgrade_required', 0);
}