upgrade-functions.php 1020 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. function upgradeCheck()
  3. {
  4. $updateDB = false;
  5. $updateSuccess = true;
  6. $compare = new Composer\Semver\Comparator;
  7. $oldVer = $GLOBALS['configVersion'];
  8. // Upgrade check start for version below
  9. $versionCheck = '2.0.0-beta-200';
  10. if ($compare->lessThan($oldVer, $versionCheck)) {
  11. $updateDB = true;
  12. $oldVer = $versionCheck;
  13. }
  14. // End Upgrade check start for version above
  15. if ($updateDB == true) {
  16. //return 'Upgraded Needed - Current Version '.$oldVer.' - New Version: '.$versionCheck;
  17. // Upgrade database to latest version
  18. $updateSuccess = (updateDB($GLOBALS['dbLocation'], $GLOBALS['dbName'], $oldVer)) ? true : false;
  19. }
  20. // Update config.php version if different to the installed version
  21. if ($updateSuccess && $GLOBALS['installedVersion'] !== $GLOBALS['configVersion']) {
  22. updateConfig(array('apply_CONFIG_VERSION' => $GLOBALS['installedVersion']));
  23. }
  24. if ($updateSuccess == false) {
  25. die('Database update failed - Please manually check logs and fix - Then reload this page');
  26. }
  27. return true;
  28. }