diff --git a/cli/Commands/HelpContent/Migrate.php b/cli/Commands/HelpContent/Migrate.php index 8ab790a00f1c55aa30be1953dbd947682d6093da..00a620b0d6147f76b0af5e8e35b0d52b4fca34e8 100644 --- a/cli/Commands/HelpContent/Migrate.php +++ b/cli/Commands/HelpContent/Migrate.php @@ -94,20 +94,6 @@ class Migrate extends Command } } - if (count($count)) { - if (!\Config::get()->getValue('HELP_CONTENT_CURRENT_VERSION')) { - \Config::get()->create('HELP_CONTENT_CURRENT_VERSION', [ - 'value' => $version, - 'is_default' => 0, - 'type' => 'string', - 'range' => 'global', - 'section' => 'global', - 'description' => _('Aktuelle Version der Helpbar-Einträge in Stud.IP'), - ]); - } else { - \Config::get()->store('HELP_CONTENT_CURRENT_VERSION', $version); - } - } $io->success('help content added for ' . count($count) . ' routes.'); return Command::SUCCESS; } diff --git a/db/migrations/1.150_help_tours_and_content.php b/db/migrations/1.150_help_tours_and_content.php index bb33622c42d5738e56d92ade4f145a9cc25e1240..a0a046a28f23537499101a1265c46d9f1c706efb 100644 --- a/db/migrations/1.150_help_tours_and_content.php +++ b/db/migrations/1.150_help_tours_and_content.php @@ -25,7 +25,7 @@ class HelpToursAndContent extends Migration 'type' => 'string', 'range' => 'global', 'section' => 'global', - 'description' => _('Aktuelle Version der Helpbar-Einträge in Stud.IP') + 'description' => 'Aktuelle Version der Helpbar-Einträge in Stud.IP' ]); } else { Config::get()->store('HELP_CONTENT_CURRENT_VERSION', $version); diff --git a/db/migrations/5.1.20_drop_help_settings.php b/db/migrations/5.1.20_drop_help_settings.php new file mode 100644 index 0000000000000000000000000000000000000000..041837702b425130020ffe6e05ea95b649b34603 --- /dev/null +++ b/db/migrations/5.1.20_drop_help_settings.php @@ -0,0 +1,64 @@ +<?php + +class DropHelpSettings extends Migration +{ + public function description() + { + return 'Drop unused help system settings'; + } + + public function up() + { + $settings = [ + 'EXTERNAL_HELP', + 'EXTERNAL_HELP_LOCATIONID', + 'EXTERNAL_HELP_URL', + 'HELP_CONTENT_CURRENT_VERSION' + ]; + // remove config entries + $query = 'DELETE `config`, `config_values` + FROM `config` LEFT JOIN `config_values` USING (`field`) + WHERE `field` IN (?)'; + DBManager::get()->execute($query, [$settings]); + } + + public function down() + { + // create config entries + $query = 'INSERT INTO `config` (`field`, `value`, `type`, `range`, `section`, `mkdate`, `chdate`, `description`) + VALUES (:name, :value, :type, :range, :section, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :description)'; + $statement = DBManager::get()->prepare($query); + $statement->execute([ + ':name' => 'EXTERNAL_HELP', + ':description' => 'Schaltet das externe Hilfesystem ein', + ':section' => '', + ':range' => 'global', + ':type' => 'boolean', + ':value' => '1' + ]); + $statement->execute([ + ':name' => 'EXTERNAL_HELP_LOCATIONID', + ':description' => 'Eine eindeutige ID zur Identifikation der gewünschten Hilfeseiten, leer bedeutet Standardhilfe', + ':section' => '', + ':range' => 'global', + ':type' => 'string', + ':value' => 'default' + ]); + $statement->execute([ + ':name' => 'EXTERNAL_HELP_URL', + ':description' => 'URL Template für das externe Hilfesystem', + ':section' => '', + ':range' => 'global', + ':type' => 'string', + ':value' => 'https://hilfe.studip.de/index.php/%s' + ]); + $statement->execute([ + ':name' => 'HELP_CONTENT_CURRENT_VERSION', + ':description' => 'Aktuelle Version der Helpbar-Einträge in Stud.IP', + ':section' => 'global', + ':range' => 'global', + ':type' => 'string', + ':value' => '3.1' + ]); + } +} diff --git a/lib/models/HelpContent.class.php b/lib/models/HelpContent.class.php index 5a45970ddf7ebf9c82e89d330c2f5914fdb825c4..ccac2a2b94dc36cfe72e74ad25b2eeec8d54357f 100644 --- a/lib/models/HelpContent.class.php +++ b/lib/models/HelpContent.class.php @@ -59,9 +59,6 @@ class HelpContent extends SimpleORMap { if (!$language) { $language = mb_substr(Config::get()->DEFAULT_LANGUAGE, 0, 2); } - $version = Config::get()->getValue('HELP_CONTENT_CURRENT_VERSION'); - if (!$version) - return []; $route = get_route($route); $query = "SELECT * FROM help_content