Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #39 from andrewying/bug-781

Bug #781 Upgrade slave fails
  • Loading branch information...
commit e29da62f18ed49ec60d165e8cd429c3c4e0e8866 2 parents dc2c1e8 + dc8fd76
@dterweij dterweij authored
Showing with 42 additions and 25 deletions.
  1. +42 −25 kloxo/httpdocs/htmllib/lib/lib.php
View
67 kloxo/httpdocs/htmllib/lib/lib.php
@@ -6479,30 +6479,47 @@ function update_all_slave()
}
-function findNextVersion($lastversion = null)
-{
- global $gbl, $sgbl, $login, $ghtml;
- $thisversion = $sgbl->__ver_major_minor_release;
-
- $upgrade = null;
- $nlist = getVersionList($lastversion);
- dprintr($nlist);
- $k = 0;
- print("Found version(s):");
- foreach($nlist as $l) {
- print(" $l");
- if (version_cmp($thisversion, $l) === -1) {
- $upgrade = $l;
- break;
- }
- $k++;
- }
- print("\n");
- if (!$upgrade) {
- return 0;
- }
-
- print("Upgrading from $thisversion to $upgrade\n");
- return $upgrade;
+/**
+ * Get a version list and see if a update is avaible
+ * Issue #781 - Update to the latest version instead one by one
+ * Added _ () for the future :)
+ *
+ * @param string $LastVersion Not Used?
+ * @return string Returns zero or version number
+ * @author Danny Terweij d.terweij@lxcenter.org
+ */
+function findNextVersion($lastVersion = null)
+{
+
+ global $sgbl;
+
+ $thisVersion = $sgbl->__ver_major_minor_release;
+
+ $Upgrade = null;
+ $versionList = getVersionList($lastVersion);
+ print(_('Found version(s):'));
+
+ foreach ($versionList as $newVersion) {
+ print(' ' . $newVersion);
+ }
+ print(PHP_EOL);
+
+ if (version_cmp($thisVersion, $newVersion) === -1) {
+ $Upgrade = $newVersion;
+ }
+
+ if (version_cmp($thisVersion, $newVersion) === 1) {
+ unset($Upgrade);
+ print(_('Your version ') . $thisVersion . _(' is higher then ') . $newVersion . PHP_EOL);
+ print(_('Script aborted') . PHP_EOL);
+ exit;
+ }
+
+ if (!$Upgrade) {
+ return 0;
+ }
+
+ print(_('Upgrading from ') . $thisVersion . _(' to ') . $Upgrade . PHP_EOL);
+ return $Upgrade;
}
Please sign in to comment.
Something went wrong with that request. Please try again.