Commit 05a208f9 authored by Aaron Wells's avatar Aaron Wells
Browse files

More versioncheck.php cleanup...

Change-Id: I68f9f7c080fbe168b5387e5dfc40321c3199e43e
parent 531b4777
...@@ -33,7 +33,7 @@ $GITREV = 'HEAD'; ...@@ -33,7 +33,7 @@ $GITREV = 'HEAD';
$ERROR = false; $ERROR = false;
$newconfig = get_mahara_version($GITREV, 'htdocs/lib/version.php'); $newconfig = get_mahara_version($GITREV, 'htdocs/lib/version.php');
if (substr($newconfig->release, -3) != 'dev') { if (substr($newconfig->release, -3) == 'dev') {
$STABLEBRANCH = false; $STABLEBRANCH = false;
} }
else { else {
...@@ -132,11 +132,11 @@ function get_mahara_version($gitrevision, $pathtofile) { ...@@ -132,11 +132,11 @@ function get_mahara_version($gitrevision, $pathtofile) {
* @param string $upgradefile The path to the upgrade.php file * @param string $upgradefile The path to the upgrade.php file
*/ */
function find_upgrade_versions($gitrevision, $upgradefile) { function find_upgrade_versions($gitrevision, $upgradefile) {
$p = popen("git show {$gitrevision} -- {$upgradefile}", 'r'); $p = popen("git diff --unified=0 {$gitrevision}~ {$gitrevision} -- {$upgradefile}", 'r');
$upgradeversions = array(); $upgradeversions = array();
while (!feof($p)) { while (!feof($p)) {
$buffer = fgets($p); $buffer = fgets($p);
if (1 == preg_match('#\$oldversion.*\b(\d{10})\b#', $buffer, $matches)) { if (1 == preg_match('#^\+.*\$oldversion.*\b(\d{10})\b#', $buffer, $matches)) {
echo "New {$upgradefile}: {$matches[1]}\n"; echo "New {$upgradefile}: {$matches[1]}\n";
$upgradeversions[] = $matches[1]; $upgradeversions[] = $matches[1];
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment