From a281722e10b74e769eec8b894fda85257706da1b Mon Sep 17 00:00:00 2001 From: "mike.morgan%oregonstate.edu" Date: Tue, 24 Oct 2006 19:04:46 +0000 Subject: [PATCH] Checked in patch for bug 357455, also fixed the build comparison bug that would cause release channels to not offer an update for a build that was older. Will tag the config change for prod, but other changes only for staging. --- webtools/aus/xml/inc/config-dist.php | 3 ++ webtools/aus/xml/inc/patch.class.php | 42 ++++++++++++++++++---------- webtools/aus/xml/index.php | 21 ++++++-------- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/webtools/aus/xml/inc/config-dist.php b/webtools/aus/xml/inc/config-dist.php index 7148e9a5e6db..4751395bb5b9 100644 --- a/webtools/aus/xml/inc/config-dist.php +++ b/webtools/aus/xml/inc/config-dist.php @@ -81,6 +81,9 @@ $branchVersions = array( '1.5.0.7pre' => '1.5.0.x', '1.5.0.7' => '1.5.0.x', '1.5.0.8pre' => '1.5.0.x', + '1.5.0.8' => '1.5.0.x', + '1.5.0.9pre' => '1.5.0.x', + '1.5.0.9' => '1.5.0.x', '1.6a1' => 'trunk', '2.0' => '2.0', '2.0a1' => '2.0', diff --git a/webtools/aus/xml/inc/patch.class.php b/webtools/aus/xml/inc/patch.class.php index 76a458a3840f..81d769d9fd56 100644 --- a/webtools/aus/xml/inc/patch.class.php +++ b/webtools/aus/xml/inc/patch.class.php @@ -65,9 +65,6 @@ class Patch extends AUS_Object { // Array the defines which channels are flagged as 'nightly' channels. var $nightlyChannels; - // Valid patch flag. - var $isPatch; - // Is this patch a complete or partial patch? var $patchType; @@ -160,12 +157,13 @@ class Patch extends AUS_Object { $this->setVar('hasUpdateInfo',true,true); } - // Pull updat emetadata if it exists, and the patch is a complete patch. + // Pull update metadata if it exists, and the patch is a complete patch. if ($this->isComplete() && isset($file[8])) { $this->setVar('detailsUrl',$file[8],true); $this->setVar('hasDetailsUrl',true,true); } + $this->setVar('isPatch',true,true); return true; } @@ -202,6 +200,7 @@ class Patch extends AUS_Object { } } + $this->setVar('isPatch',true,true); return true; } else { error_log("Unknown snippet schema version: $snippetSchemaVersion"); @@ -229,9 +228,7 @@ class Patch extends AUS_Object { // If a specific update exists for the specified channel, it takes priority over the branch update. if (!empty($channel) && $this->setPath($product,$platform,$locale,$version,$build,3,$channel) && file_exists($this->path) && filesize($this->path) > 0) { - $this->setSnippet($this->path); - $this->setVar('isPatch',true,true); - return true; + return $this->setSnippet($this->path); } // Determine the branch of the client's version. @@ -245,17 +242,13 @@ class Patch extends AUS_Object { // If we have the latest complete build, the path is valid, the file exists, and the filesize is greater than zero, we have a valid complete patch. if ($latestCompleteBuild && $this->setPath($product,$platform,$locale,$branchVersion,$latestCompleteBuild,2,$channel) && file_exists($this->path) && filesize($this->path) > 0) { - $this->setSnippet($this->path); - $this->setVar('isPatch',true,true); - return true; + return $this->setSnippet($this->path); } } // Otherwise, check for the partial snippet info. If an update exists, pass it along. if ($this->isPartial() && $this->isNightlyChannel($channel) && $this->setPath($product,$platform,$locale,$branchVersion,$build,2,$channel) && file_exists($this->path) && filesize($this->path) > 0) { - $this->setSnippet($this->path); - $this->setVar('isPatch',true,true); - return true; + return $this->setSnippet($this->path); } // Note: Other data sets were made obsolete in 0.6. May incoming/0,1 rest in peace. @@ -330,9 +323,28 @@ class Patch extends AUS_Object { /** * Does this object contain a valid patch file? + * The build id check only happens for nightly channels. + * + * For business logic that doesn't exist yet, this is also a good place to extend overriding reasons why + * a patch should be invalid even if the data exists. + * + * @TODO migrate the os compatibility stuff here + * @param string $build + * @param string $channel */ - function isPatch() { - return $this->isPatch; + function isPatch($build, $channel=null) { + + // For nightlies, we only want to deliver the complete patch if the destination build is newer than the client build. + if ($this->isNightlyChannel($channel) && $this->isComplete()) { + return $this->isNewBuild($build); + } + + // For nightlies, we only want to deliver the partial patch if the destination build for the partial patch is equal to the build in the complete patch (which will always point to the latest). + elseif ($this->isNightlyChannel($channel) && $this->isPartial()) { + return $this->isNewBuild($build); + } else { + return $this->isPatch; + } } /** diff --git a/webtools/aus/xml/index.php b/webtools/aus/xml/index.php index 98518d16222c..91bdb7295e0d 100644 --- a/webtools/aus/xml/index.php +++ b/webtools/aus/xml/index.php @@ -113,11 +113,8 @@ switch ($clean['updateVersion']) { // Instantiate our complete patch. $completePatch = new Patch($branchVersions,$nightlyChannels,'complete'); - // Find our complete patch. - $completePatch->findPatch($clean['product'],$clean['platform'],$clean['locale'],$clean['version'],$clean['build'],$clean['channel']); - - // If our complete patch is valid, set the patch line. - if ($completePatch->isPatch() && $completePatch->isNewBuild($clean['build'])) { + // If our complete patch exists and is valid, set the patch line. + if ($completePatch->findPatch($clean['product'],$clean['platform'],$clean['locale'],$clean['version'],$clean['build'],$clean['channel']) && $completePatch->isPatch($clean['build'],$clean['channel'])) { // Set our patchLine. $xml->setPatchLine($completePatch); @@ -146,15 +143,15 @@ switch ($clean['updateVersion']) { } // We only check for a partial patch if the complete patch was successfully retrieved. - if ($completePatch->isPatch()) { + if ($completePatch->isPatch($clean['build'],$clean['channel'])) { // Instantiate our partial patch. $partialPatch = new Patch($branchVersions,$nightlyChannels,'partial'); - $partialPatch->findPatch($clean['product'],$clean['platform'],$clean['locale'],$clean['version'],$clean['build'],$clean['channel']); - // If our partial patch is valid, set the patch line. - // We only want to deliver the partial patch if the destination build for the partial patch is equal to the build in the complete patch (which will always point to the latest). - if ($partialPatch->isPatch() && $partialPatch->isNewBuild($clean['build']) && $partialPatch->isOneStepFromLatest($completePatch->build)) { + // If our partial patch exists and is valid, set the patch line. + if ($partialPatch->findPatch($clean['product'],$clean['platform'],$clean['locale'],$clean['version'],$clean['build'],$clean['channel']) + && $partialPatch->isPatch($clean['build'],$clean['channel']) + && $partialPatch->isOneStepFromLatest($completePatch->build)) { $xml->setPatchLine($partialPatch); } } @@ -182,13 +179,13 @@ switch ($clean['updateVersion']) { $patch->findPatch($clean['product'],$clean['platform'],$clean['locale'],$clean['version'],$clean['build'],null); - if ($patch->isPatch()) { + if ($patch->isPatch($clean['build'])) { $xml->setPatchLine($patch); } // If we have a new build, draw the update block and patch line. // If there is no valid patch file, client will receive no updates by default. - if ($xml->hasPatchLine() && $patch->isNewBuild($clean['build'])) { + if ($xml->hasPatchLine()) { $xml->startUpdate($update); $xml->drawPatchLines(); $xml->endUpdate();