forked from uup-dump/api
Implemented superseded update removal to fetchupd.php
This commit is contained in:
parent
03727b01ce
commit
901414dcd4
17
fetchupd.php
17
fetchupd.php
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
|
|
||||||
require_once dirname(__FILE__).'/shared/main.php';
|
require_once dirname(__FILE__).'/shared/main.php';
|
||||||
require_once dirname(__FILE__).'/shared/requests.php';
|
require_once dirname(__FILE__).'/shared/requests.php';
|
||||||
|
require_once dirname(__FILE__).'/listid.php';
|
||||||
|
|
||||||
function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build = '16251') {
|
function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build = '16251') {
|
||||||
uupApiPrintBrand();
|
uupApiPrintBrand();
|
||||||
@ -89,7 +90,7 @@ function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build
|
|||||||
$fileWrite = 'NO_SAVE';
|
$fileWrite = 'NO_SAVE';
|
||||||
if(!file_exists('fileinfo/'.$updateId.'.json')) {
|
if(!file_exists('fileinfo/'.$updateId.'.json')) {
|
||||||
consoleLogger('WARNING: This build is NOT in the database. It will be saved now.');
|
consoleLogger('WARNING: This build is NOT in the database. It will be saved now.');
|
||||||
consoleLogger('Parsing information to write');
|
consoleLogger('Parsing information to write...');
|
||||||
if(!file_exists('fileinfo')) mkdir('fileinfo');
|
if(!file_exists('fileinfo')) mkdir('fileinfo');
|
||||||
|
|
||||||
$fileList = preg_replace('/<Files>|<\/Files>/', '', $fileList[0]);
|
$fileList = preg_replace('/<Files>|<\/Files>/', '', $fileList[0]);
|
||||||
@ -144,6 +145,20 @@ function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build
|
|||||||
consoleLogger('This build already exists in the database.');
|
consoleLogger('This build already exists in the database.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ids = uupListIds();
|
||||||
|
if(!isset($ids['error'])) {
|
||||||
|
$ids = $ids['builds'];
|
||||||
|
$buildName = $foundBuild.' '.$updateTitle.' '.$arch;
|
||||||
|
|
||||||
|
foreach($ids as $val) {
|
||||||
|
$testName = $val['build'].' '.$val['title'].' '.$val['arch'];
|
||||||
|
if($buildName == $testName && $val['uuid'] != $updateId) {
|
||||||
|
unlink(realpath('fileinfo/'.$val['uuid'].'.json'));
|
||||||
|
consoleLogger('Removed superseded update: '.$val['uuid']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'apiVersion' => uupApiVersion(),
|
'apiVersion' => uupApiVersion(),
|
||||||
'updateId' => $updateId,
|
'updateId' => $updateId,
|
||||||
|
@ -16,11 +16,16 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function uupApiVersion() {
|
function uupApiVersion() {
|
||||||
return '0.4.0-alpha';
|
return '0.5.0-beta';
|
||||||
}
|
}
|
||||||
|
|
||||||
function uupApiPrintBrand() {
|
function uupApiPrintBrand() {
|
||||||
|
global $uupApiBrandPrinted;
|
||||||
|
|
||||||
|
if(!isset($uupApiBrandPrinted)) {
|
||||||
consoleLogger('UUP dump API v'.uupApiVersion());
|
consoleLogger('UUP dump API v'.uupApiVersion());
|
||||||
|
$uupApiBrandPrinted = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function randStr($length = 4) {
|
function randStr($length = 4) {
|
||||||
|
Loading…
Reference in New Issue
Block a user