auto-format all files; add table-definitions to test-bootstrap file
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -23,7 +23,8 @@
|
||||
*
|
||||
* @return integer 0 if equal, 1 if a>b and -1 if b>a
|
||||
*/
|
||||
function version_compare2($a, $b) {
|
||||
function version_compare2($a, $b)
|
||||
{
|
||||
|
||||
// split version into pieces and remove trailing .0
|
||||
$a = explode(".", $a);
|
||||
@@ -35,8 +36,7 @@ function version_compare2($a, $b) {
|
||||
while (count($a) != count($b)) {
|
||||
if (count($a) < count($b)) {
|
||||
$a[] = '0';
|
||||
}
|
||||
elseif (count($b) < count($a)) {
|
||||
} elseif (count($b) < count($a)) {
|
||||
$b[] = '0';
|
||||
}
|
||||
}
|
||||
@@ -47,9 +47,8 @@ function version_compare2($a, $b) {
|
||||
// if B matches A to this depth, compare the values
|
||||
if ($aVal > $b[$depth]) {
|
||||
return 1; // A > B
|
||||
}
|
||||
else if ($aVal < $b[$depth]) {
|
||||
return -1; // B > A
|
||||
} else if ($aVal < $b[$depth]) {
|
||||
return - 1; // B > A
|
||||
}
|
||||
// an equal result is inconclusive at this point
|
||||
} else {
|
||||
@@ -59,31 +58,30 @@ function version_compare2($a, $b) {
|
||||
}
|
||||
// at this point, we know that to the depth that A and B extend to, they are equivalent.
|
||||
// either the loop ended because A is shorter than B, or both are equal.
|
||||
return (count($a) < count($b)) ? -1 : 0;
|
||||
return (count($a) < count($b)) ? - 1 : 0;
|
||||
}
|
||||
|
||||
function _parseVersionArray(&$arr = null) {
|
||||
function _parseVersionArray(&$arr = null)
|
||||
{
|
||||
// -svn or -dev or -rc ?
|
||||
if (stripos($arr[count($arr)-1], '-') !== false) {
|
||||
$x = explode("-", $arr[count($arr)-1]);
|
||||
$arr[count($arr)-1] = $x[0];
|
||||
if (stripos($arr[count($arr) - 1], '-') !== false) {
|
||||
$x = explode("-", $arr[count($arr) - 1]);
|
||||
$arr[count($arr) - 1] = $x[0];
|
||||
if (stripos($x[1], 'rc') !== false) {
|
||||
$arr[] = '-1';
|
||||
$arr[] = '2'; // rc > dev > svn
|
||||
// number of rc
|
||||
// number of rc
|
||||
$arr[] = substr($x[1], 2);
|
||||
}
|
||||
else if (stripos($x[1], 'dev') !== false) {
|
||||
} else if (stripos($x[1], 'dev') !== false) {
|
||||
$arr[] = '-1';
|
||||
$arr[] = '1'; // svn < dev < rc
|
||||
// number of dev
|
||||
// number of dev
|
||||
$arr[] = substr($x[1], 3);
|
||||
}
|
||||
// -svn version are deprecated
|
||||
} // -svn version are deprecated
|
||||
else if (stripos($x[1], 'svn') !== false) {
|
||||
$arr[] = '-1';
|
||||
$arr[] = '0'; // svn < dev < rc
|
||||
// number of svn
|
||||
// number of svn
|
||||
$arr[] = substr($x[1], 3);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user