From 09491b4a5c7304441fbebe4cdbe993d05910ff32 Mon Sep 17 00:00:00 2001 From: Dominik Hebeler <dominik@suma-ev.de> Date: Thu, 15 Sep 2022 15:54:23 +0200 Subject: [PATCH] removed traces of old sumasEn file usage --- .gitlab/deployment_scripts/update_secret.sh | 1 - build/fpm/entrypoint/validate_laravel.sh | 4 -- chart/templates/deployment.yaml | 3 -- .../Commands/MonthlyRequestsGather.php | 7 +--- metager/app/Http/Controllers/FokiLoader.php | 41 ------------------- .../app/Http/Controllers/SearchEngineList.php | 9 ++-- metager/app/MetaGer.php | 7 +--- metager/config/.gitignore | 3 -- 8 files changed, 5 insertions(+), 70 deletions(-) delete mode 100644 metager/app/Http/Controllers/FokiLoader.php diff --git a/.gitlab/deployment_scripts/update_secret.sh b/.gitlab/deployment_scripts/update_secret.sh index 522e46aca..78738550b 100755 --- a/.gitlab/deployment_scripts/update_secret.sh +++ b/.gitlab/deployment_scripts/update_secret.sh @@ -9,7 +9,6 @@ HELM_RELEASE_NAME=${HELM_RELEASE_NAME%%*(-)} kubectl -n $KUBE_NAMESPACE create secret generic ${HELM_RELEASE_NAME} \ --from-file=${ENV_PRODUCTION} \ --from-file=${SUMAS} \ - --from-file=${SUMASEN} \ --from-file=${ADBLACKLIST_DOMAINS} \ --from-file=${ADBLACKLIST_URL} \ --from-file=${BLACKLIST_DESCRIPTION_URL} \ diff --git a/build/fpm/entrypoint/validate_laravel.sh b/build/fpm/entrypoint/validate_laravel.sh index 55ee21b01..ebb3838fd 100755 --- a/build/fpm/entrypoint/validate_laravel.sh +++ b/build/fpm/entrypoint/validate_laravel.sh @@ -8,10 +8,6 @@ if [ ! -f "$BASE_DIR/config/sumas.json" ]; then cp $BASE_DIR/config/sumas.json.example $BASE_DIR/config/sumas.json fi -if [ ! -f "$BASE_DIR/config/sumasEn.json" ]; then - cp $BASE_DIR/config/sumas.json.example $BASE_DIR/config/sumasEn.json -fi - if [ ! -d "$BASE_DIR/database/databases/" ]; then mkdir -p "$BASE_DIR/database/databases/" fi diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index 9af9f4bef..5bb6730cb 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -60,9 +60,6 @@ spec: - name: secrets mountPath: /metager/metager_app/config/sumas.json subPath: SUMAS - - name: secrets - mountPath: /metager/metager_app/config/sumasEn.json - subPath: SUMASEN - name: secrets mountPath: /metager/metager_app/config/blacklistDomains.txt subPath: BLACKLIST_DOMAINS diff --git a/metager/app/Console/Commands/MonthlyRequestsGather.php b/metager/app/Console/Commands/MonthlyRequestsGather.php index ef9b138a8..343e6f130 100644 --- a/metager/app/Console/Commands/MonthlyRequestsGather.php +++ b/metager/app/Console/Commands/MonthlyRequestsGather.php @@ -43,13 +43,10 @@ class MonthlyRequestsGather extends Command { # Read in the suma Files $sumaFile = config_path('sumas.json'); - $sumaEnFile = config_path('sumasEn.json'); - if (file_exists($sumaFile) && file_exists($sumaEnFile)) { + if (file_exists($sumaFile)) { $sumas = json_decode(file_get_contents($sumaFile)); - $sumasEn = json_decode(file_get_contents($sumaEnFile)); $this->gatherLogs($sumas); - $this->gatherLogs($sumasEn); foreach ($this->values as $name => $value) { $entry = DB::table('monthlyrequests')->where(['name' => $name])->first(); @@ -63,7 +60,6 @@ class MonthlyRequestsGather extends Command } $this->disableOverusedEngines($sumaFile, $sumas); - $this->disableOverusedEngines($sumaEnFile, $sumasEn); DB::disconnect('mysql'); } } @@ -115,7 +111,6 @@ class MonthlyRequestsGather extends Command $this->values[$sumaName] = intval($currentValue); } } - } } } diff --git a/metager/app/Http/Controllers/FokiLoader.php b/metager/app/Http/Controllers/FokiLoader.php deleted file mode 100644 index a71e69729..000000000 --- a/metager/app/Http/Controllers/FokiLoader.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -namespace App\Http\Controllers; - -use App; - -class FokiLoader -{ - public static function loadFoki() - { - $sumaFile = ""; - if (App::isLocale('en')) { - $sumaFile = config_path() . "/sumasEn.xml"; - } else { - $sumaFile = config_path() . "/sumas.xml"; - } - - $xml = \simplexml_load_file($sumaFile); - $sumas = $xml->xpath("suma"); - - $foki = []; - foreach ($sumas as $suma) { - if ((!isset($suma['disabled']) || $suma['disabled'] === "") && (!isset($suma['userSelectable']) || $suma['userSelectable']->__toString() === "1")) { - if (isset($suma['type'])) { - $f = explode(",", $suma['type']->__toString()); - foreach ($f as $tmp) { - $displayName = $suma['displayName']->__toString(); - $url = isset($suma['homepage']) ? $suma['homepage']->__toString() : "https://metager.de"; - $foki[$tmp][$suma['name']->__toString()] = ['displayName' => $displayName, 'url' => $url]; - } - } else { - $displayName = $suma['displayName']->__toString(); - $url = isset($suma['homepage']) ? $suma['homepage']->__toString() : "https://metager.de"; - $foki["andere"][$suma['name']->__toString()] = ['displayName' => $displayName, 'url' => $url]; - } - } - } - - return $foki; - } -} diff --git a/metager/app/Http/Controllers/SearchEngineList.php b/metager/app/Http/Controllers/SearchEngineList.php index 4cdbdc43f..65ca36ab8 100644 --- a/metager/app/Http/Controllers/SearchEngineList.php +++ b/metager/app/Http/Controllers/SearchEngineList.php @@ -9,12 +9,9 @@ class SearchEngineList extends Controller { function index() { - $suma_file = ""; - if (App::isLocale("en")) { - $suma_file = config_path() . "/sumasEn.json"; - } else { - $suma_file = config_path() . "/sumas.json"; - } + + $suma_file = config_path() . "/sumas.json"; + if (empty($suma_file)) { abort(404); } diff --git a/metager/app/MetaGer.php b/metager/app/MetaGer.php index 45cac0ae5..226ec1e60 100644 --- a/metager/app/MetaGer.php +++ b/metager/app/MetaGer.php @@ -1748,12 +1748,7 @@ class MetaGer public static function getLanguageFile() { - $locale = LaravelLocalization::getCurrentLocale(); - if ($locale === "en") { - return config_path('sumasEn.json'); - } else { - return config_path('sumas.json'); - } + return config_path('sumas.json'); } public function getLang() diff --git a/metager/config/.gitignore b/metager/config/.gitignore index ea281d5f7..e35db70e1 100644 --- a/metager/config/.gitignore +++ b/metager/config/.gitignore @@ -1,7 +1,4 @@ -sumas.xml -sumasEn.xml sumas.json -sumasEn.json blacklistUrl.txt blacklistDomains.txt spam.txt \ No newline at end of file -- GitLab