зеркало из https://github.com/mozilla/pjs.git
*** empty log message ***
This commit is contained in:
Родитель
e3c912827b
Коммит
3065759a4a
|
@ -178,29 +178,30 @@ class Patch extends AUS_Object {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, if it is a complete patch and a nightly channel, force the complete update to take the user to the latest build.
|
||||
elseif ($this->isComplete() && $this->isNightlyChannel($channel)) {
|
||||
// If our first check fails for the official channels, we will check for nightly updates, but only if the
|
||||
// given channel is a nightly channel as defined in config.php.
|
||||
//
|
||||
// If the complete snippet exists and isn't null, it's valid and we should read its contents and return true.
|
||||
elseif ($this->isComplete() && $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;
|
||||
}
|
||||
|
||||
// Get the latest build for this branch.
|
||||
$latestbuild = $this->getLatestBuild($product,$branchVersion,$platform);
|
||||
elseif ($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);
|
||||
|
||||
if ($latestbuild && $this->setPath($product,$platform,$locale,$branchVersion,$latestbuild,2,$channel) && file_exists($this->path) && filesize($this->path) > 0) {
|
||||
$this->setSnippet($this->path);
|
||||
// As a special check for nightly partials, we add the call to isOneStepFromLatest() which determines
|
||||
// if the destination (what we'd upgrade to) build is equal to the latest build.
|
||||
//
|
||||
// This way we will only offer a partial update if the partial will upgrade to the latest build.
|
||||
if ($this->isOneStepFromLatest($product,$branchVersion,$platform)) {
|
||||
$this->setVar('isPatch',true,true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Otherwise, check for the partial snippet info. If an update exists, pass it along.
|
||||
elseif ($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;
|
||||
}
|
||||
|
||||
// Note: Other data sets were made obsolete in 0.6. May incoming/0,1 rest in peace.
|
||||
|
||||
// If we get here, we know for sure that no updates exist for the current request..
|
||||
// Return false by default, which prompts the "no updates" XML output.
|
||||
return false;
|
||||
|
@ -280,7 +281,14 @@ class Patch extends AUS_Object {
|
|||
* Determine whether or not this patch is complete.
|
||||
*/
|
||||
function isComplete() {
|
||||
return ($this->patchType === 'complete') ? true : false;
|
||||
return $this->patchType === 'complete';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not this patch is partial.
|
||||
*/
|
||||
function isPartial() {
|
||||
return $this->patchType === 'partial';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -297,28 +305,22 @@ class Patch extends AUS_Object {
|
|||
return $this->hasUpdateInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not the to_build matches the latest build for a partial patch.
|
||||
* @param string $build
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function isOneStepFromLatest($build) {
|
||||
return ($this->build == $build) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the latest build for this branch.
|
||||
* @param string $product
|
||||
* @param string $branchVersion
|
||||
* @param string $platform
|
||||
* @param return string|false false if there is no matching build
|
||||
* @return boolean
|
||||
*/
|
||||
function getLatestBuild($product,$branchVersion,$platform) {
|
||||
function isOneStepFromLatest($product,$branchVersion,$platform) {
|
||||
|
||||
$files = array();
|
||||
$latestBuild = '';
|
||||
|
||||
$dir = SOURCE_DIR.'/2/'.$product.'/'.$branchVersion.'/'.$platform;
|
||||
|
||||
// Read the source directory to get the build ids. Sort it numerically
|
||||
// to get the latest build.
|
||||
if (is_dir($dir)) {
|
||||
$fp = opendir($dir);
|
||||
while (false !== ($filename = readdir($fp))) {
|
||||
|
@ -328,14 +330,16 @@ class Patch extends AUS_Object {
|
|||
}
|
||||
closedir($fp);
|
||||
|
||||
if (is_array($files)) {
|
||||
rsort($files,SORT_NUMERIC);
|
||||
}
|
||||
rsort($files,SORT_NUMERIC);
|
||||
|
||||
return $files[1];
|
||||
// If we have a valid build id, set the latest build.
|
||||
$latestBuild = !empty($files[0]) && is_numeric($files[0]) ? $files[0] : '';
|
||||
}
|
||||
|
||||
return false;
|
||||
// If our latest build exists and is equal to the destination build
|
||||
// (the build our patch will upgrade the client to) then that means the current
|
||||
// build is only one hop away. In this case only, we return true.
|
||||
return ( $latestBuild === $this->build) ? true : false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -117,8 +117,7 @@ switch ($clean['updateVersion']) {
|
|||
$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 ($partialPatch->isPatch() && $partialPatch->isNewBuild($clean['build'])) {
|
||||
$xml->setPatchLine($partialPatch);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче