diff --git a/fetchupd.php b/fetchupd.php index a1089bf..d87844d 100644 --- a/fetchupd.php +++ b/fetchupd.php @@ -169,7 +169,7 @@ function uupFetchUpd( ); } -function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku = '48') { +function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku) { $updateNumId = preg_replace('/|<\/ID>.*/i', '', $updateInfo); $updates = preg_replace('//', "\n", $out); @@ -234,6 +234,29 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku $updateString = $updateId.'_rev.'.$updateRev; } + $ids = uupListIds(); + if(!isset($ids['error'])) { + $ids = $ids['builds']; + $namesList = array(); + + foreach($ids as $val) { + $testName = $val['build'].' '.$val['title'].' '.$val['arch']; + + if($val['uuid'] != $updateString) { + $namesList[$val['uuid']] = $testName; + } + } + + $num = 1; + $buildName = $foundBuild.' '.$updateTitle.' '.$foundArch; + while(in_array($buildName, $namesList, true)) { + $num++; + $buildName = "$foundBuild $updateTitle ($num) $foundArch"; + } + + if($num > 1) $updateTitle = "$updateTitle ($num)"; + } + consoleLogger("--- UPDATE INFORMATION ---"); consoleLogger("Title: ".$updateTitle); consoleLogger("Architecture: ".$foundArch); @@ -305,23 +328,6 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku consoleLogger('This build already exists in the database.'); } - $ids = uupListIds(); - if(!isset($ids['error'])) { - $ids = $ids['builds']; - $buildName = $foundBuild.' '.$updateTitle.' '.$foundArch; - - foreach($ids as $val) { - $testName = $val['build'].' '.$val['title'].' '.$val['arch']; - if($buildName == $testName && $val['uuid'] != $updateString) { - unlink(realpath('fileinfo/'.$val['uuid'].'.json')); - if(file_exists('packs/'.$val['uuid'].'.json.gz')) { - unlink(realpath('packs/'.$val['uuid'].'.json.gz')); - } - consoleLogger('Removed superseded update: '.$val['uuid']); - } - } - } - return array( 'updateId' => $updateString, 'updateTitle' => $updateTitle, diff --git a/shared/main.php b/shared/main.php index 8f23ab4..fe936e2 100644 --- a/shared/main.php +++ b/shared/main.php @@ -16,7 +16,7 @@ limitations under the License. */ function uupApiVersion() { - return '1.22.0'; + return '1.23.0'; } require_once dirname(__FILE__).'/auths.php';