From c9a741eaeddc472c7929d5be2f4117bc27713ed3 Mon Sep 17 00:00:00 2001 From: mkuba50 Date: Fri, 12 Apr 2019 15:40:27 +0200 Subject: [PATCH] Initial commit --- .gitmodules | 3 + LICENSE | 21 ++++++ api | 1 + fetchdetect.php | 38 ++++++++++ fetchupd.php | 28 +++++++ get.php | 42 +++++++++++ getdetect.php | 52 +++++++++++++ getfile.php | 25 +++++++ listeditions.php | 21 ++++++ listid.php | 23 ++++++ listlangs.php | 15 ++++ readme.md | 14 ++++ shared/genpack.php | 177 +++++++++++++++++++++++++++++++++++++++++++++ shared/main.php | 118 ++++++++++++++++++++++++++++++ 14 files changed, 578 insertions(+) create mode 100644 .gitmodules create mode 100644 LICENSE create mode 160000 api create mode 100644 fetchdetect.php create mode 100644 fetchupd.php create mode 100644 get.php create mode 100644 getdetect.php create mode 100644 getfile.php create mode 100644 listeditions.php create mode 100644 listid.php create mode 100644 listlangs.php create mode 100644 readme.md create mode 100644 shared/genpack.php create mode 100644 shared/main.php diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..07b3695 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "api"] + path = api + url = git@gitlab.com:uup-dump/api.git diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..be5edd5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 UUP dump authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/api b/api new file mode 160000 index 0000000..a90dc04 --- /dev/null +++ b/api @@ -0,0 +1 @@ +Subproject commit a90dc04636104f9857cf44d41ea29b89efb1cb52 diff --git a/fetchdetect.php b/fetchdetect.php new file mode 100644 index 0000000..add38a9 --- /dev/null +++ b/fetchdetect.php @@ -0,0 +1,38 @@ + diff --git a/fetchupd.php b/fetchupd.php new file mode 100644 index 0000000..ad93539 --- /dev/null +++ b/fetchupd.php @@ -0,0 +1,28 @@ + diff --git a/get.php b/get.php new file mode 100644 index 0000000..aafd9a3 --- /dev/null +++ b/get.php @@ -0,0 +1,42 @@ + diff --git a/getdetect.php b/getdetect.php new file mode 100644 index 0000000..2b681e7 --- /dev/null +++ b/getdetect.php @@ -0,0 +1,52 @@ + diff --git a/getfile.php b/getfile.php new file mode 100644 index 0000000..39bf265 --- /dev/null +++ b/getfile.php @@ -0,0 +1,25 @@ + diff --git a/listeditions.php b/listeditions.php new file mode 100644 index 0000000..8aa87e9 --- /dev/null +++ b/listeditions.php @@ -0,0 +1,21 @@ + $val) { + echo $key; + echo '|'; + echo $val; + echo "\n"; +} +?> diff --git a/listid.php b/listid.php new file mode 100644 index 0000000..2047ee0 --- /dev/null +++ b/listid.php @@ -0,0 +1,23 @@ + diff --git a/listlangs.php b/listlangs.php new file mode 100644 index 0000000..ae08f45 --- /dev/null +++ b/listlangs.php @@ -0,0 +1,15 @@ + $val) { + echo $key; + echo '|'; + echo $val; + echo "\n"; +} +?> diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..1d23547 --- /dev/null +++ b/readme.md @@ -0,0 +1,14 @@ +UUP dump standalone +------------------- + +### Description +This code is used by backend server of UUP dump website to automatically +retrieve new builds and automatically generate packs used to create proper +UUP sets. + +### Why the code is being publisned now? +Before now the UUP dump website was internally using the UUP dump UUPDL edition +which was a rebrand of UUP dump 2.x series which was meant for console only +purposes and distributed only with UUPDL. Now I have decided to rebrand this +for the third time and publish it as MIT licensed project. This will allow me +easier updates to the backend in much more transparent way. diff --git a/shared/genpack.php b/shared/genpack.php new file mode 100644 index 0000000..b08d930 --- /dev/null +++ b/shared/genpack.php @@ -0,0 +1,177 @@ +Packages->Package as $val) { + foreach($val->Payload->PayloadItem as $PayloadItem) { + $name = $PayloadItem['Path']; + $name = preg_replace('/.*\\\/', '', $name); + $packages[$lang][$edition][] = $name; + } + } + + $packages[$lang][$edition] = array_unique($packages[$lang][$edition]); + sort($packages[$lang][$edition]); + + unlink($file); + unset($file, $xml, $name, $newName, $lang, $edition); + } + + $removeFiles = scandir($tmp); + foreach($removeFiles as $val) { + if($val == '.' || $val == '..') continue; + unlink($tmp.'/'.$val); + } + + if(!file_exists('packs')) mkdir('packs'); + + $success = file_put_contents( + 'packs/'.$updateId.'.json.gz', + gzencode(json_encode($packages)."\n") + ); + + if($success) { + consoleLogger('Successfully written generated packs.'); + } else { + consoleLogger('An error has occured while writing generated packs to the disk.'); + return 0; + } + + return 1; +} diff --git a/shared/main.php b/shared/main.php new file mode 100644 index 0000000..4c7d156 --- /dev/null +++ b/shared/main.php @@ -0,0 +1,118 @@ +