From 399e977b82827a7b7d02cf8132c8dc3b45576843 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Fri, 1 Dec 2023 11:39:55 +0100 Subject: [PATCH] Some cleanup and text improvements --- .github/ISSUE_TEMPLATE/Bug_report.md | 35 ----------------------- .github/ISSUE_TEMPLATE/Feature_request.md | 17 ----------- .gitignore | 1 + README | 19 ++++++++++-- README.md | 13 --------- lang/de/settings.php | 4 +-- lang/en/settings.php | 4 +-- lang/ru/settings.php | 4 +-- plugin.info.txt | 9 +++--- syntax.php | 4 +-- 10 files changed, 30 insertions(+), 80 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/Bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/Feature_request.md create mode 100644 .gitignore delete mode 100644 README.md diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md deleted file mode 100644 index 4de26c7..0000000 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md deleted file mode 100644 index 5384295..0000000 --- a/.github/ISSUE_TEMPLATE/Feature_request.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e4e5f6c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ \ No newline at end of file diff --git a/README b/README index 8b27b3d..d073bb8 100644 --- a/README +++ b/README @@ -1,8 +1,22 @@ sqlquery Plugin for DokuWiki -Processing query to mysql database and display results as a table. +Processing queries to databases and display results as a table. -All documentation for this plugin can be found at +This is a improved version which can connect to different hosts +and databases. The defaults are set in the plugin configuration. +Different types, hosts and databases can be set inside the tag: + + + SELECT foo FROM bar ORDER BY baz + + +For security reasons the credentials for database access are only +stored in the main plugin configuration. At the moment there is +only one user configurable so for access to multiple servers. +So the user and password mast be the same across the servers. + +Based on sqlquery-plugin from George Pirogov, original documentation +for that base plugin can be found at https://www.dokuwiki.org/plugin:sqlquery If you install this plugin manually, make sure it is installed in @@ -13,6 +27,7 @@ Please refer to http://www.dokuwiki.org/plugins for additional info on how to install plugins in DokuWiki. ---- +Copyright (C) Thomas Hooge Copyright (C) George Pirogov This program is free software; you can redistribute it and/or modify diff --git a/README.md b/README.md deleted file mode 100644 index 25836ef..0000000 --- a/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# sqlquery -A dokuwiki plugin for processing query to MySQL databases and display results as a table. - -This is a improved version which cann connect to different hosts -and databases. The defaults are set in the plugin configuration. -Different types, hosts and databases can be set inside the tag: -``` - -SELECT foo FROM bar ORDER BY baz - -``` - -More information at https://www.dokuwiki.org/plugin:sqlquery diff --git a/lang/de/settings.php b/lang/de/settings.php index 202e191..ec4cfaa 100644 --- a/lang/de/settings.php +++ b/lang/de/settings.php @@ -8,8 +8,8 @@ // keys need to match the config setting name $lang['type'] = 'DSN-Prefix (Datenbanktyp)'; -$lang['Host'] = 'Standard MySQL-Serveradresse (DNS or IP)'; -$lang['DB'] = 'Standard MySQL-Datenbankname'; +$lang['Host'] = 'Standard-Serveradresse (DNS oder IP)'; +$lang['DB'] = 'Standard-Datenbankname'; $lang['user'] = 'Datenbankbenutzername'; $lang['password'] = 'Datenbankkennwort'; diff --git a/lang/en/settings.php b/lang/en/settings.php index 476f0de..4680562 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -9,8 +9,8 @@ // $lang['fixme'] = 'FIXME'; $lang['type'] = 'DSN prefix (database type)'; -$lang['Host'] = 'Default MySQL server address (DNS or IP)'; -$lang['DB'] = 'MySQL database name'; +$lang['Host'] = 'Default server address (DNS or IP)'; +$lang['DB'] = 'Default database name'; $lang['user'] = 'Database username'; $lang['password'] = 'Database password'; diff --git a/lang/ru/settings.php b/lang/ru/settings.php index 8407be5..99641fa 100644 --- a/lang/ru/settings.php +++ b/lang/ru/settings.php @@ -9,8 +9,8 @@ // $lang['fixme'] = 'FIXME'; $lang['type'] = 'Префикс DSN (тип базы данных)'; -$lang['Host'] = 'Адрес MySQL сервера по умолчанию (DNS или IP)'; -$lang['DB'] = 'Имя базы данных MySQL по умолчанию'; +$lang['Host'] = 'Адрес сервера по умолчанию (DNS или IP)'; +$lang['DB'] = 'Имя базы данных по умолчанию'; $lang['user'] = 'Логин'; $lang['password'] = 'Пароль'; diff --git a/plugin.info.txt b/plugin.info.txt index 5635d27..5bcfc43 100644 --- a/plugin.info.txt +++ b/plugin.info.txt @@ -1,7 +1,6 @@ base sqlquery -author George Pirogov -email i1557@yandex.ru -date 2018-12-12 +author Thomas Hooge +email thomas@hoogi.de +date 2023-12-01 name SQL query plugin (multidb) -desc Processing query to mysql database and display results as a table. -url https://www.dokuwiki.org/plugin:sqlquery +desc Processing queries to databases and display results as a table. diff --git a/syntax.php b/syntax.php index 8c415e9..b7715c8 100644 --- a/syntax.php +++ b/syntax.php @@ -85,11 +85,11 @@ class syntax_plugin_sqlquery extends DokuWiki_Syntax_Plugin { $password = $this->getConf('password'); // connect to database - $dsn = "{$data['type']}:host={$data['host']};dbname={$data[db]};charset=UTF-8;"; + $dsn = "{$data['type']}:host={$data['host']};dbname={$data[db]};charset=UTF8;"; try { $dbh = new PDO($dsn, $user, $password); } catch (PDOException $e) { - $renderer->doc .= "
Unable to connect ro database:" . $e->getMessage() . "
\n"; + $renderer->doc .= "
Unable to connect to database:" . $e->getMessage() . "
\n"; return true; } $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);