From 1c68d4c8c29d75a37cac165c3f9f0309e2ffbd07 Mon Sep 17 00:00:00 2001 From: abbodi1406 <33669284+abbodi1406@users.noreply.github.com> Date: Thu, 21 Jan 2021 20:35:43 +0300 Subject: [PATCH] Add packsgen.php generate missing packs based on fileinfo builds, skipping unreachable builds --- fetchdetect.php | 22 ++++++++++++---------- fetchupd.php | 22 ++++++++++++---------- packsgen.php | 16 ++++++++++++++++ shared/genpack.php | 12 +++++++----- shared/main.php | 2 +- 5 files changed, 48 insertions(+), 26 deletions(-) create mode 100644 packsgen.php diff --git a/fetchdetect.php b/fetchdetect.php index add38a9..5ad1722 100644 --- a/fetchdetect.php +++ b/fetchdetect.php @@ -25,14 +25,16 @@ foreach($fetchedUpdate['updateArray'] as $update) { generatePack($update['updateId']); } -echo $fetchedUpdate['foundBuild']; -echo '|'; -echo $fetchedUpdate['arch']; -echo '|'; -echo $fetchedUpdate['updateId']; -echo '|'; -echo $fetchedUpdate['updateTitle']; -echo '|'; -echo $fetchedUpdate['fileWrite']; -echo "\n"; +foreach($fetchedUpdate['updateArray'] as $update) { + echo $update['foundBuild']; + echo '|'; + echo $update['arch']; + echo '|'; + echo $update['updateId']; + echo '|'; + echo $update['updateTitle']; + echo '|'; + echo $update['fileWrite']; + echo "\n"; +} ?> diff --git a/fetchupd.php b/fetchupd.php index ad93539..bdf6bfb 100644 --- a/fetchupd.php +++ b/fetchupd.php @@ -15,14 +15,16 @@ if(isset($fetchedUpdate['error'])) { throwError($fetchedUpdate['error']); } -echo $fetchedUpdate['foundBuild']; -echo '|'; -echo $fetchedUpdate['arch']; -echo '|'; -echo $fetchedUpdate['updateId']; -echo '|'; -echo $fetchedUpdate['updateTitle']; -echo '|'; -echo $fetchedUpdate['fileWrite']; -echo "\n"; +foreach($fetchedUpdate['updateArray'] as $update) { + echo $update['foundBuild']; + echo '|'; + echo $update['arch']; + echo '|'; + echo $update['updateId']; + echo '|'; + echo $update['updateTitle']; + echo '|'; + echo $update['fileWrite']; + echo "\n"; +} ?> diff --git a/packsgen.php b/packsgen.php new file mode 100644 index 0000000..c20b5c5 --- /dev/null +++ b/packsgen.php @@ -0,0 +1,16 @@ + diff --git a/shared/genpack.php b/shared/genpack.php index b08d930..e04a717 100644 --- a/shared/genpack.php +++ b/shared/genpack.php @@ -26,10 +26,12 @@ function generatePack($updateId) { return 2; } + if($updateId == 'd7ac1db8-230e-47df-8e6f-49fb976f6f5c') return 2; + consoleLogger('Generating packs for '.$updateId.'...'); $files = uupGetFiles($updateId, 0, 0); if(isset($files['error'])) { - throwError($files['error']); + return 0; } $files = $files['files']; @@ -58,7 +60,7 @@ function generatePack($updateId) { $files = preg_grep('/Path = /', $out); $files = preg_replace('/Path = /', '', $files); - $dataFiles = preg_grep('/DesktopTargetCompDB_.*_.*\./i', $files); + $dataFiles = preg_grep('/DesktopTargetCompDB_.*_.*\.|ServerTargetCompDB_.*_.*\./i', $files); unset($out); exec("$z7z x -o\"$tmp\" \"$loc\" -y", $out, $errCode); @@ -78,7 +80,7 @@ function generatePack($updateId) { throwError('7ZIP_ERROR'); } - $temp = preg_grep('/^-.*DesktopTargetCompDB_.*_.*\./i', $out); + $temp = preg_grep('/^-.*DesktopTargetCompDB_.*_.*\.|^-.*ServerTargetCompDB_.*_.*\./i', $out); sort($temp); $temp = preg_replace('/^- /', '', $temp[0]); @@ -132,8 +134,8 @@ function generatePack($updateId) { $file = $tmp.'/'.$val; $xml = simplexml_load_file($file); - $lang = preg_replace('/.*DesktopTargetCompDB_.*_/', '', $filNam); - $edition = preg_replace('/.*DesktopTargetCompDB_|_'.$lang.'/', '', $filNam); + $lang = preg_replace('/.*DesktopTargetCompDB_.*_|.*ServerTargetCompDB_.*_/', '', $filNam); + $edition = preg_replace('/.*DesktopTargetCompDB_|.*ServerTargetCompDB_|_'.$lang.'/', '', $filNam); $lang = strtolower($lang); $edition = strtoupper($edition); diff --git a/shared/main.php b/shared/main.php index ab327bb..6507768 100644 --- a/shared/main.php +++ b/shared/main.php @@ -2,7 +2,7 @@ require_once dirname(__FILE__).'/../api/shared/main.php'; function brand($script = null) { - $projVersion = '1.0.1'; + $projVersion = '1.0.2'; return 'UUP dump standalone v'.$projVersion; }