Append number to new updates with the same name instead of removal
This commit is contained in:
parent
c853ef74a4
commit
71ee499b4a
42
fetchupd.php
42
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('/<UpdateInfo><ID>|<\/ID>.*/i', '', $updateInfo);
|
||||
|
||||
$updates = preg_replace('/<Update>/', "\n<Update>", $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,
|
||||
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
function uupApiVersion() {
|
||||
return '1.22.0';
|
||||
return '1.23.0';
|
||||
}
|
||||
|
||||
require_once dirname(__FILE__).'/auths.php';
|
||||
|
Loading…
Reference in New Issue
Block a user