Skip to content

Commit

Permalink
feat: added experimental support for PDO_MYSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Feb 9, 2025
1 parent 233867d commit 817021e
Show file tree
Hide file tree
Showing 13 changed files with 345 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This is a log of major user-visible changes in each phpMyFAQ release.
- added Symfony Routing for administration backend (Thorsten)
- added code snippets plugin with syntax highlighting in WYSIWYG editor (Thorsten)
- added plugin administration backend (Thorsten)
- added experimental support for PDO_MYSQL (Thorsten)
- improved online update feature (Thorsten)
- migrated from WYSIWYG editor from TinyMCE to Jodit Editor (Thorsten)
- migrated from JavaScript to TypeScript (Thorsten)
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#
# This image uses a php:8.4.2-apache base image and do not have any phpMyFAQ code with it.
# This image uses a php:8.4-apache base image and do not have any phpMyFAQ code with it.
# It's for development only, it's meant to be run with docker-compose
#

#####################################
#=== Unique stage without payload ===
#####################################
FROM php:8.4.2-apache
FROM php:8.4-apache

#=== Install gd PHP dependencie ===
RUN set -x \
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"suggest": {
"ext-ldap": "*",
"ext-openssl": "*",
"ext-pdo": "*",
"ext-pgsql": "*",
"ext-sqlite3": "*",
"ext-sqlsrv": "*"
Expand Down
7 changes: 2 additions & 5 deletions phpmyfaq/src/phpMyFAQ/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,8 @@ public function getOrderedCategories(bool $withPermission = true, bool $withInac
}

if ($this->language !== null && preg_match("/^[a-z\-]{2,}$/", $this->language)) {
$where .= $where === '' || $where === '0' ? '
WHERE' : '
AND';
$where .= "
fc.lang = '" . $this->configuration->getDb()->escape($this->language) . "'";
$where .= $where === '' || $where === '0' ? ' WHERE' : ' AND';
$where .= sprintf(' fc.lang = \'%s\'', $this->configuration->getDb()->escape($this->language));
}

$query = sprintf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ public function index(Request $request): Response
'Web server Interface' => strtoupper(PHP_SAPI),
'PHP Version' => PHP_VERSION,
'PHP Extensions' => implode(', ', get_loaded_extensions()),
'PHP Session path' => session_save_path(),
'Database Server' => Database::getType(),
'Database Driver' => Database::getType(),
'Database Server Version' => $this->configuration->getDb()->serverVersion(),
'Database Client Version' => $this->configuration->getDb()->clientVersion(),
'Elasticsearch Version' => $esInformation
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/src/phpMyFAQ/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static function factory(string $type): ?DatabaseDriver
self::$dbType = $type;

if (str_starts_with($type, 'pdo_')) {
$class = 'phpMyFAQ\Database\Pdo_' . ucfirst(substr($type, 4));
$class = 'phpMyFAQ\Database\Pdo' . ucfirst(substr($type, 4));
} else {
$class = 'phpMyFAQ\Database\\' . ucfirst($type);
}
Expand Down
6 changes: 3 additions & 3 deletions phpmyfaq/src/phpMyFAQ/Database/DatabaseDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ public function fetchObject(mixed $result): mixed;
/**
* Fetch a result row as an array.
*
*
* @return array
* @param mixed $result
* @return array|false|null
*/
public function fetchArray(mixed $result): ?array;
public function fetchArray(mixed $result): array|false|null;

/**
* Fetch a result row.
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/src/phpMyFAQ/Database/Mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* @copyright 2005-2025 phpMyFAQ Team
* @license https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
* @link https://www.phpmyfaq.de
* @since 2005-12-13
*/

namespace phpMyFAQ\Database;
Expand All @@ -22,7 +23,6 @@
use mysqli_sql_exception;
use phpMyFAQ\Database;
use phpMyFAQ\Core\Exception;
use phpMyFAQ\Utils;
use SensitiveParameter;

/**
Expand Down
Loading

0 comments on commit 817021e

Please sign in to comment.