Compare commits

..

No commits in common. "9e618c405af8e224ac67adba82ad4cd0a57948d4" and "d0bad95c11d119847dca139927de009df28f0960" have entirely different histories.

4 changed files with 30 additions and 55 deletions

View File

@ -21,33 +21,6 @@ require_once dirname(__FILE__).'/shared/cache.php';
require_once dirname(__FILE__).'/shared/fileinfo.php';
require_once dirname(__FILE__).'/listid.php';
function uupApiPrivateParseFlags($str) {
$split = explode('+', $str);
$flags = [];
if(isset($split[1]))
$flags = explode(',', strtolower($split[1]));
return [$split[0], $flags];
}
function uupApiPrivateGetLatestBuild() {
$builds = array('22000.1');
$ids = uupListIds();
if(isset($ids['error'])) {
$ids['builds'] = array();
}
if(empty($ids['builds'])) {
$build = $builds[0];
} else {
$build = $ids['builds'][0]['build'];
}
return $build;
}
function uupFetchUpd(
$arch = 'amd64',
$ring = 'WIF',
@ -65,11 +38,20 @@ function uupFetchUpd(
$flight = ucwords(strtolower($flight));
$flight = 'Active';
$buildWithFlags = $build;
[$build, $flags] = uupApiPrivateParseFlags($build);
if($build == 'latest' || (!$build)) {
$build = uupApiPrivateGetLatestBuild();
$builds = array('22000.1');
$ids = uupListIds();
if(isset($ids['error'])) {
$ids['builds'] = array();
}
if(empty($ids['builds'])) {
$build = $builds[0];
} else {
$build = $ids['builds'][0]['build'];
}
unset($builds, $ids);
}
$build = explode('.', $build);
@ -114,13 +96,13 @@ function uupFetchUpd(
$type = 'Production';
}
$res = "api-fetch-$arch-$ring-$flight-$buildWithFlags-$minor-$sku-$type";
$res = "api-fetch-$arch-$ring-$flight-$build-$minor-$sku-$type";
$cache = new UupDumpCache($res);
$fromCache = $cache->get();
if($fromCache !== false) return $fromCache;
consoleLogger('Fetching information from the server...');
$composerArgs = [$arch, $flight, $ring, $build, $sku, $type, $flags];
$composerArgs = [$arch, $flight, $ring, $build, $sku, $type];
$out = sendWuPostRequestHelper('client', 'composeFetchUpdRequest', $composerArgs);
if($out['error'] != 200) {
consoleLogger('The request has failed');
@ -148,7 +130,7 @@ function uupFetchUpd(
$num++;
consoleLogger("Checking build information for update {$num} of {$updatesNum}...");
$info = parseFetchUpdate($val, $out, $arch, $ring, $flight, $build, $sku, $type, $flags);
$info = parseFetchUpdate($val, $out, $arch, $ring, $flight, $build, $sku, $type);
if(isset($info['error'])) {
$errorCount++;
continue;
@ -178,7 +160,7 @@ function uupFetchUpd(
return $data;
}
function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku, $type, $flags) {
function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku, $type) {
$updateNumId = preg_replace('/<UpdateInfo><ID>|<\/ID>.*/i', '', $updateInfo);
$updates = preg_replace('/<Update>/', "\n<Update>", $out);
@ -369,10 +351,6 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
$temp['releasetype'] = $type;
}
if(!empty($flags)) {
$temp['flags'] = $flags;
}
$temp['created'] = time();
$temp['sha256ready'] = true;
$temp['files'] = $shaArray;

View File

@ -18,10 +18,10 @@ Parameters:
- **Supported Flight values:** `Active`, `Skip`, `Current`
- **NOTE:** `Skip` is for `WIF` ring only. `Current` is for `RP` ring only.
- `build` - Build number to use when fetching information. Can also be used to provide optional fetch flags in `major.minor+flag1,flag2` format.
- **Supported values:** Any correctly formatted build (`major` or `major.minor`) from range of 9841 and `PHP_INT_MAX-1`.
- `build` - Build number to use when fetching information
- **Supported values:** >= 9841 and <= PHP_INT_MAX-1
- `minor` - Build minor to use when fetching information. Unused when build is formatted in `major.minor` format
- `minor` - Build minor to use when fetching information
- **Supported values:** >= 0 and <= PHP_INT_MAX-1
- `sku` - SKU number to use when fetching information
@ -80,8 +80,6 @@ Outputs list of languages supported for specified Update ID.
Parameters:
- `updateId` - Update identifier (optional)
- **Supported values:** any update UUID
- `returnInfo` - Should the full update inforation be returned with a list of languages
- **Supported values:** `true` or `false`
#### updateinfo.php: `uupUpdateInfo($updateId, $onlyInfo, $ignoreFiles);`

View File

@ -16,7 +16,7 @@ limitations under the License.
*/
function uupApiVersion() {
return '1.43.0';
return '1.42.1';
}
require_once dirname(__FILE__).'/auths.php';

View File

@ -16,7 +16,7 @@ limitations under the License.
*/
// Composes DeviceAttributes parameter needed to fetch data
function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $flags) {
function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
$branch = branchFromBuild($build);
$blockUpgrades = 0;
$flightEnabled = 1;
@ -216,11 +216,11 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
'WuClientVer='.$build,
);
if(in_array('thisonly', $flags)) {
if(uupApiConfigIsTrue('fetch_sync_current_only')) {
$attrib[] = 'MediaBranch='.$branch;
}
if(in_array('corpnet', $flags) && uupApiConfigIsTrue('allow_corpnet')) {
if($ring == 'MSIT' && uupApiConfigIsTrue('allow_corpnet')) {
$attrib[] = 'DUInternal=1';
}
@ -316,8 +316,7 @@ function composeFileGetRequest($updateId, $info, $rev = 1, $type = 'Production')
isset($info['checkBuild']) ? $info['checkBuild'] : '10.0.19041.1',
isset($info['arch']) ? $info['arch'] : 'amd64',
isset($info['sku']) ? $info['sku'] : 48,
$type,
isset($info['flags']) ? $info['flags'] : [],
$type
);
return <<<XML
@ -361,7 +360,7 @@ XML;
}
// Composes POST data for fetching the latest update information from Windows Update
function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type = 'Production', $flags = []) {
function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type = 'Production') {
$device = uupDevice();
$encData = uupEncryptedData();
$uuid = genUUID();
@ -449,11 +448,11 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
$build,
$arch,
$sku,
$type,
$flags
$type
);
$syncCurrent = in_array('thisonly', $flags) ? 'true' : 'false';
$syncCurrent = uupApiConfigIsTrue('fetch_sync_current_only');
$syncCurrentStr = $syncCurrent ? 'true' : 'false';
return <<<XML
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
@ -576,7 +575,7 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
</ExtendedUpdateInfoParameters>
<ClientPreferredLanguages/>
<ProductsParameters>
<SyncCurrentVersionOnly>$syncCurrent</SyncCurrentVersionOnly>
<SyncCurrentVersionOnly>$syncCurrentStr</SyncCurrentVersionOnly>
<DeviceAttributes>$deviceAttributes</DeviceAttributes>
<CallerAttributes>$callerAttrib</CallerAttributes>
<Products>$products</Products>