forked from uup-dump/api
		
	Add support for Cumulative Updates
This commit is contained in:
		
							
								
								
									
										22
									
								
								fetchupd.php
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								fetchupd.php
									
									
									
									
									
								
							@@ -144,15 +144,19 @@ function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build
 | 
			
		||||
 | 
			
		||||
        ksort($shaArray);
 | 
			
		||||
 | 
			
		||||
        $temp = array(
 | 
			
		||||
            'title' => $updateTitle,
 | 
			
		||||
            'ring' => $ring,
 | 
			
		||||
            'flight' => $flight,
 | 
			
		||||
            'arch' => $arch,
 | 
			
		||||
            'build' => $foundBuild,
 | 
			
		||||
            'checkBuild' => $build,
 | 
			
		||||
            'files' => $shaArray,
 | 
			
		||||
        );
 | 
			
		||||
        $temp = array();
 | 
			
		||||
        $temp['title'] = $updateTitle;
 | 
			
		||||
        $temp['ring'] = $ring;
 | 
			
		||||
        $temp['flight'] = $flight;
 | 
			
		||||
        $temp['arch'] = $arch;
 | 
			
		||||
        $temp['build'] = $foundBuild;
 | 
			
		||||
        $temp['checkBuild'] = $build;
 | 
			
		||||
 | 
			
		||||
        if(preg_match('/Cumulative Update/', $updateTitle)) {
 | 
			
		||||
            $temp['containsCU'] = 1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $temp['files'] = $shaArray;
 | 
			
		||||
 | 
			
		||||
        consoleLogger('Successfully parsed the information.');
 | 
			
		||||
        consoleLogger('Writing new build information to the disk...');
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								get.php
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								get.php
									
									
									
									
									
								
							@@ -45,12 +45,12 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if($desiredEdition) {
 | 
			
		||||
    $desiredEdition = strtoupper($desiredEdition);
 | 
			
		||||
    if($desiredEdition && $desiredEdition != 'UPDATEONLY') {
 | 
			
		||||
        if(!$usePack) {
 | 
			
		||||
            return array('error' => 'UNSPECIFIED_LANG');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $desiredEdition = strtoupper($desiredEdition);
 | 
			
		||||
        if(!isset($editionPacks[$desiredEdition])) {
 | 
			
		||||
            return array('error' => 'UNSUPPORTED_EDITION');
 | 
			
		||||
        }
 | 
			
		||||
@@ -78,6 +78,12 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
 | 
			
		||||
        $info = json_decode($info, true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if($desiredEdition == 'UPDATEONLY') {
 | 
			
		||||
        if(!isset($info['containsCU']) || !$info['containsCU']) {
 | 
			
		||||
            return array('error' => 'NOT_CUMULATIVE_UPDATE');
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $uupFix = 0;
 | 
			
		||||
    if(isset($info['needsFix'])) {
 | 
			
		||||
        if($info['needsFix'] == true) $uupFix = 1;
 | 
			
		||||
@@ -150,10 +156,12 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
 | 
			
		||||
                $files = array_merge($files, array($name => $temp));
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            if(!preg_match('/^Windows10\.0-KB/', $name)) {
 | 
			
		||||
                $name = preg_replace('/\.psf$/', '', $name);
 | 
			
		||||
                $removeFiles = array_merge($removeFiles, array($name));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(!$uupFix) {
 | 
			
		||||
        foreach($removeFiles as $val) {
 | 
			
		||||
@@ -176,8 +184,22 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
 | 
			
		||||
        $filesKeys = array_keys($files);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if($usePack) {
 | 
			
		||||
    if($desiredEdition == 'UPDATEONLY') {
 | 
			
		||||
        $removeFiles = preg_grep('/Windows10\.0-KB.*-EXPRESS/i', $filesKeys);
 | 
			
		||||
 | 
			
		||||
        foreach($removeFiles as $val) {
 | 
			
		||||
            if(isset($files[$val])) unset($files[$val]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        unset($removeFiles, $temp);
 | 
			
		||||
        $filesKeys = array_keys($files);
 | 
			
		||||
 | 
			
		||||
        $filesKeys = preg_grep('/Windows10\.0-KB/i', $filesKeys);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if($usePack && $desiredEdition != 'UPDATEONLY') {
 | 
			
		||||
        $removeFiles = preg_grep('/RetailDemo-OfflineContent/i', $filesKeys);
 | 
			
		||||
        $removeFiles = preg_grep('/Windows10\.0-KB.*-EXPRESS/i', $filesKeys);
 | 
			
		||||
 | 
			
		||||
        foreach($removeFiles as $val) {
 | 
			
		||||
            if(isset($files[$val])) unset($files[$val]);
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,7 @@ limitations under the License.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
function uupApiVersion() {
 | 
			
		||||
    return '1.2.1';
 | 
			
		||||
    return '1.3.0';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function uupApiPrintBrand() {
 | 
			
		||||
 
 | 
			
		||||
@@ -37,6 +37,7 @@ $packs = array(
 | 
			
		||||
            'Microsoft-Windows-Hello-Face-Resource-A-Package',
 | 
			
		||||
            'Microsoft-Windows-Hello-Face-Resource-B-Package',
 | 
			
		||||
            'Microsoft-OneCore-ApplicationModel-Sync-Desktop-FOD-Package',
 | 
			
		||||
            'Windows10\.0-KB',
 | 
			
		||||
        ),
 | 
			
		||||
        'CLOUD' => array(
 | 
			
		||||
            'Microsoft-Windows-EditionPack-Professional-Package',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user