Commit 43dc67fb authored by Andrey Filippov's avatar Andrey Filippov

ignoring minor version number, updating automatically

parent 1b799ea6
...@@ -369,6 +369,7 @@ if ($_SERVER ['REQUEST_METHOD'] == "GET") { ...@@ -369,6 +369,7 @@ if ($_SERVER ['REQUEST_METHOD'] == "GET") {
} else { } else {
$old_versions=array(); $old_versions=array();
foreach ( $GLOBALS ['ports'] as $port ) { foreach ( $GLOBALS ['ports'] as $port ) {
update_minor_version($port, array_key_exists('--ignore-revision',$_SERVER ['argv'])?1:0);
$old_versions[]=$GLOBALS['configs'][$port]['version']; $old_versions[]=$GLOBALS['configs'][$port]['version'];
} }
foreach ( $_SERVER ['argv'] as $param ) { foreach ( $_SERVER ['argv'] as $param ) {
...@@ -388,7 +389,6 @@ if ($_SERVER ['REQUEST_METHOD'] == "GET") { ...@@ -388,7 +389,6 @@ if ($_SERVER ['REQUEST_METHOD'] == "GET") {
foreach ( $GLOBALS ['ports'] as $port ) { foreach ( $GLOBALS ['ports'] as $port ) {
$GLOBALS['configs'][$port]['version'] = $GLOBALS['version']; $GLOBALS['configs'][$port]['version'] = $GLOBALS['version'];
log_msg("processPost($port) --ignore_revision"); log_msg("processPost($port) --ignore_revision");
// log_msg("GLOBALS['configs']=".print_r($GLOBALS['configs'],1));
saveRotateConfig ($port, $GLOBALS['numBackups'] ); saveRotateConfig ($port, $GLOBALS['numBackups'] );
} }
...@@ -471,6 +471,23 @@ log_close (); ...@@ -471,6 +471,23 @@ log_close ();
exit ( 0 ); exit ( 0 );
// ============ Functions ============= // ============ Functions =============
/** Update and warn if only minor revision number has changed*/
function update_minor_version($port, $silent = 0) {
if ($GLOBALS ['configs'] [$port] ['version'] != $GLOBALS ['version']) {
if (substr ( $GLOBALS ['configs'] [$port] ['version'], 0, strrpos ( $GLOBALS ['configs'] [$port] ['version'], '.' ) ) ==
substr ( $GLOBALS ['version'], 0, strrpos ( $GLOBALS ['version'], '.' ) )) {
if (!$silent) {
log_msg ( "+++ WARNING: updating minor mismatch version for port $port: " .
$GLOBALS ['configs'] [$port] ['version'] . " to " . $GLOBALS ['version'] );
}
$GLOBALS ['configs'] [$port] ['version'] = $GLOBALS ['version'];
$GLOBALS['configs'][$port]['version'] = $GLOBALS['version'];
saveRotateConfig ($port, $GLOBALS['numBackups'] );
}
}
}
function get_port_index($port){ function get_port_index($port){
for ($i = 0; $i < count($GLOBALS ['ports']); $i++) if ( $GLOBALS ['ports'][$i] == $port ) return $i; for ($i = 0; $i < count($GLOBALS ['ports']); $i++) if ( $GLOBALS ['ports'][$i] == $port ) return $i;
return -1; return -1;
...@@ -1039,9 +1056,9 @@ WARN_PORT; ...@@ -1039,9 +1056,9 @@ WARN_PORT;
if (array_key_exists ( 'ignore-revision', $_GET ) && ($GLOBALS['version'] != $GLOBALS['configs'][$port] ['version'])) { if (array_key_exists ( 'ignore-revision', $_GET ) && ($GLOBALS['version'] != $GLOBALS['configs'][$port] ['version'])) {
$GLOBALS['configs'][$port]['version'] = $GLOBALS['version']; $GLOBALS['configs'][$port]['version'] = $GLOBALS['version'];
log_msg("processGet($port) - processGet ignore-revision"); log_msg("processGet($port) - processGet ignore-revision");
// log_msg("GLOBALS['configs']=".print_r($GLOBALS['configs'],1));
saveRotateConfig ($port, $GLOBALS['numBackups'] ); saveRotateConfig ($port, $GLOBALS['numBackups'] );
} }
update_minor_version($port, 0);
if ($GLOBALS['version'] != $GLOBALS['configs'][$port]['version']) { if ($GLOBALS['version'] != $GLOBALS['configs'][$port]['version']) {
startPage ( "Warning: version numbers mismatch", "function updateLink(){}" ); startPage ( "Warning: version numbers mismatch", "function updateLink(){}" );
$warn = <<<WARN $warn = <<<WARN
......
Markdown is supported
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