1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-14 04:30:29 +01:00

[ticket/16643] Add Doctrine DBAL to phpBB

PHPBB3-16643
This commit is contained in:
Máté Bartus 2021-01-16 10:53:46 +01:00
parent d9bfb4d01d
commit aab2679966
17 changed files with 990 additions and 123 deletions

View File

@ -22,7 +22,7 @@ jobs:
matrix:
include:
- db: 'none'
php: '7.1'
php: '7.3'
NOTESTS: 1
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
@ -37,7 +37,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
extensions: dom, curl, libxml, mbstring, zip, pcntl, intl, gd, exif, iconv
coverage: none
- name: Get Composer Cache Directory
@ -95,30 +95,26 @@ jobs:
strategy:
matrix:
include:
- php: '7.1'
- php: '7.3'
db: "mariadb:10.1"
- php: '7.1'
- php: '7.3'
db: "mariadb:10.2"
- php: '7.1'
- php: '7.3'
db: "mariadb:10.3"
- php: '7.1'
- php: '7.3'
db: "mariadb:10.4"
- php: '7.1'
- php: '7.3'
db: "mariadb:10.5"
- php: '7.1'
- php: '7.3'
db: "mysql:5.6"
db_alias: "MySQL Slow Tests"
SLOWTESTS: 1
- php: '7.1'
- php: '7.3'
db: "mysql:5.6"
db_alias: "MyISAM Tests"
MYISAM: 1
- php: '7.1'
- php: '7.3'
db: "mysql:5.6"
- php: '7.1'
db: "mysql:5.7"
- php: '7.2'
db: "mysql:5.7"
- php: '7.3'
db: "mysql:5.7"
- php: '7.4'
@ -172,7 +168,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
extensions: dom, curl, libxml, mbstring, zip, pcntl, intl, gd, exif, iconv, mysqli, pdo, pdo_mysql, ldap
coverage: none
- name: Get Composer Cache Directory
@ -235,17 +231,17 @@ jobs:
strategy:
matrix:
include:
- php: '7.1'
- php: '7.3'
db: "postgres:9.5"
- php: '7.1'
- php: '7.3'
db: "postgres:9.6"
- php: '7.1'
- php: '7.3'
db: "postgres:10"
- php: '7.1'
- php: '7.3'
db: "postgres:11"
- php: '7.1'
- php: '7.3'
db: "postgres:12"
- php: '7.1'
- php: '7.3'
db: "postgres:13"
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
@ -292,7 +288,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
extensions: dom, curl, libxml, mbstring, zip, pcntl, intl, gd, exif, iconv, pgsql, pdo, pdo_pgsql
coverage: none
- name: Get Composer Cache Directory
@ -338,12 +334,12 @@ jobs:
strategy:
matrix:
include:
- php: '7.1'
- php: '7.3'
db: "sqlite3"
- php: '7.2'
- php: '7.3'
db: "mcr.microsoft.com/mssql/server:2017-latest"
db_alias: 'MSSQL 2017'
- php: '7.2'
- php: '7.3'
db: "mcr.microsoft.com/mssql/server:2019-latest"
db_alias: 'MSSQL 2019'
@ -395,7 +391,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
extensions: dom, curl, libxml, mbstring, zip, pcntl, intl, gd, exif, iconv, sqlsrv, pdo, pdo_sqlsrv
coverage: none
- name: Get Composer Cache Directory

View File

@ -25,7 +25,7 @@
"phpbb/phpbb-core": "self.version"
},
"require": {
"php": "^7.1.3",
"php": "^7.3 || ^8.0",
"ext-json": "*",
"ext-mbstring": "*",
"bantu/ini-get-wrapper": "~1.0",
@ -33,6 +33,7 @@
"composer/composer": "^2.0",
"composer/installers": "^1.9",
"composer/package-versions-deprecated": "^1.11",
"doctrine/dbal": "^3.0",
"google/recaptcha": "~1.1",
"guzzlehttp/guzzle": "~6.3",
"lusitanian/oauth": "^0.8.1",
@ -73,7 +74,7 @@
},
"config": {
"platform": {
"php": "7.1.3"
"php": "7.3.0"
}
}
}

478
phpBB/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "8436b462289aea75fb1758aeb17fdc4e",
"content-hash": "98c49df46e2368bee9696e5a87c82fcc",
"packages": [
{
"name": "bantu/ini-get-wrapper",
@ -700,6 +700,311 @@
],
"time": "2020-11-13T08:04:11+00:00"
},
{
"name": "doctrine/cache",
"version": "1.10.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "13e3381b25847283a91948d04640543941309727"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/13e3381b25847283a91948d04640543941309727",
"reference": "13e3381b25847283a91948d04640543941309727",
"shasum": ""
},
"require": {
"php": "~7.1 || ^8.0"
},
"conflict": {
"doctrine/common": ">2.2,<2.4"
},
"require-dev": {
"alcaeus/mongo-php-adapter": "^1.1",
"doctrine/coding-standard": "^6.0",
"mongodb/mongodb": "^1.1",
"phpunit/phpunit": "^7.0",
"predis/predis": "~1.0"
},
"suggest": {
"alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.",
"homepage": "https://www.doctrine-project.org/projects/cache.html",
"keywords": [
"abstraction",
"apcu",
"cache",
"caching",
"couchdb",
"memcached",
"php",
"redis",
"xcache"
],
"support": {
"issues": "https://github.com/doctrine/cache/issues",
"source": "https://github.com/doctrine/cache/tree/1.10.x"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache",
"type": "tidelift"
}
],
"time": "2020-07-07T18:54:01+00:00"
},
{
"name": "doctrine/dbal",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "ee6d1260d5cc20ec506455a585945d7bdb98662c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/ee6d1260d5cc20ec506455a585945d7bdb98662c",
"reference": "ee6d1260d5cc20ec506455a585945d7bdb98662c",
"shasum": ""
},
"require": {
"composer/package-versions-deprecated": "^1.11.99",
"doctrine/cache": "^1.0",
"doctrine/event-manager": "^1.0",
"php": "^7.3 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^8.1",
"jetbrains/phpstorm-stubs": "^2019.1",
"phpstan/phpstan": "^0.12.40",
"phpstan/phpstan-strict-rules": "^0.12.2",
"phpunit/phpunit": "^9.4",
"psalm/plugin-phpunit": "^0.10.0",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0",
"vimeo/psalm": "^3.17.2"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
},
"bin": [
"bin/doctrine-dbal"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\DBAL\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
}
],
"description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.",
"homepage": "https://www.doctrine-project.org/projects/dbal.html",
"keywords": [
"abstraction",
"database",
"db2",
"dbal",
"mariadb",
"mssql",
"mysql",
"oci8",
"oracle",
"pdo",
"pgsql",
"postgresql",
"queryobject",
"sasql",
"sql",
"sqlite",
"sqlserver",
"sqlsrv"
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/3.0.0"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal",
"type": "tidelift"
}
],
"time": "2020-11-15T18:20:41+00:00"
},
{
"name": "doctrine/event-manager",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/event-manager.git",
"reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f",
"reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"doctrine/common": "<2.9@dev"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\": "lib/Doctrine/Common"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
},
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com"
}
],
"description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.",
"homepage": "https://www.doctrine-project.org/projects/event-manager.html",
"keywords": [
"event",
"event dispatcher",
"event manager",
"event system",
"events"
],
"support": {
"issues": "https://github.com/doctrine/event-manager/issues",
"source": "https://github.com/doctrine/event-manager/tree/1.1.x"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager",
"type": "tidelift"
}
],
"time": "2020-05-29T18:28:51+00:00"
},
{
"name": "google/recaptcha",
"version": "1.2.4",
@ -1157,33 +1462,34 @@
},
{
"name": "ocramius/proxy-manager",
"version": "2.1.1",
"version": "2.2.3",
"source": {
"type": "git",
"url": "https://github.com/Ocramius/ProxyManager.git",
"reference": "e18ac876b2e4819c76349de8f78ccc8ef1554cd7"
"reference": "4d154742e31c35137d5374c998e8f86b54db2e2f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/e18ac876b2e4819c76349de8f78ccc8ef1554cd7",
"reference": "e18ac876b2e4819c76349de8f78ccc8ef1554cd7",
"url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/4d154742e31c35137d5374c998e8f86b54db2e2f",
"reference": "4d154742e31c35137d5374c998e8f86b54db2e2f",
"shasum": ""
},
"require": {
"ocramius/package-versions": "^1.1.1",
"php": "^7.1.0",
"zendframework/zend-code": "^3.1.0"
"ocramius/package-versions": "^1.1.3",
"php": "^7.2.0",
"zendframework/zend-code": "^3.3.0"
},
"require-dev": {
"couscous/couscous": "^1.5.2",
"couscous/couscous": "^1.6.1",
"ext-phar": "*",
"humbug/humbug": "dev-master@DEV",
"nikic/php-parser": "^3.0.4",
"humbug/humbug": "1.0.0-RC.0@RC",
"nikic/php-parser": "^3.1.1",
"padraic/phpunit-accelerator": "dev-master@DEV",
"phpbench/phpbench": "^0.12.2",
"phpstan/phpstan": "^0.6.4",
"phpunit/phpunit": "^5.6.4",
"phpunit/phpunit-mock-objects": "^3.4.1",
"squizlabs/php_codesniffer": "^2.7.0"
"phpstan/phpstan": "dev-master#856eb10a81c1d27c701a83f167dc870fd8f4236a as 0.9.999",
"phpstan/phpstan-phpunit": "dev-master#5629c0a1f4a9c417cb1077cf6693ad9753895761",
"phpunit/phpunit": "^6.4.3",
"squizlabs/php_codesniffer": "^2.9.1"
},
"suggest": {
"ocramius/generated-hydrator": "To have very fast object to array to object conversion for ghost objects",
@ -1224,9 +1530,9 @@
],
"support": {
"issues": "https://github.com/Ocramius/ProxyManager/issues",
"source": "https://github.com/Ocramius/ProxyManager/tree/master"
"source": "https://github.com/Ocramius/ProxyManager/tree/2.2.x"
},
"time": "2017-05-04T11:12:50+00:00"
"time": "2019-08-10T08:37:15+00:00"
},
{
"name": "patchwork/utf8",
@ -3438,20 +3744,20 @@
},
{
"name": "twig/twig",
"version": "v2.13.1",
"version": "v2.14.3",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "57e96259776ddcacf1814885fc3950460c8e18ef"
"reference": "8bc568d460d88b25c00c046256ec14a787ea60d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/57e96259776ddcacf1814885fc3950460c8e18ef",
"reference": "57e96259776ddcacf1814885fc3950460c8e18ef",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/8bc568d460d88b25c00c046256ec14a787ea60d9",
"reference": "8bc568d460d88b25c00c046256ec14a787ea60d9",
"shasum": ""
},
"require": {
"php": ">=7.1.3",
"php": ">=7.2.5",
"symfony/polyfill-ctype": "^1.8",
"symfony/polyfill-mbstring": "^1.3"
},
@ -3462,7 +3768,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.13-dev"
"dev-master": "2.14-dev"
}
},
"autoload": {
@ -3501,7 +3807,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v2.13.1"
"source": "https://github.com/twigphp/Twig/tree/v2.14.3"
},
"funding": [
{
@ -3513,7 +3819,7 @@
"type": "tidelift"
}
],
"time": "2020-08-05T15:09:04+00:00"
"time": "2021-01-05T15:34:33+00:00"
},
{
"name": "zendframework/zend-code",
@ -4093,25 +4399,25 @@
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.1.0",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b"
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b",
"reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b",
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b",
"shasum": ""
},
"require": {
"php": ">=7.1"
"php": "^7.2 || ^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
"dev-2.x": "2.x-dev"
}
},
"autoload": {
@ -4140,47 +4446,43 @@
],
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/master"
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
},
"time": "2020-04-27T09:25:28+00:00"
"time": "2020-06-27T09:03:43+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "4.3.4",
"version": "5.2.2",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c"
"reference": "069a785b2141f5bcf49f3e353548dc1cce6df556"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c",
"reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556",
"reference": "069a785b2141f5bcf49f3e353548dc1cce6df556",
"shasum": ""
},
"require": {
"php": "^7.0",
"phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0",
"phpdocumentor/type-resolver": "~0.4 || ^1.0.0",
"webmozart/assert": "^1.0"
"ext-filter": "*",
"php": "^7.2 || ^8.0",
"phpdocumentor/reflection-common": "^2.2",
"phpdocumentor/type-resolver": "^1.3",
"webmozart/assert": "^1.9.1"
},
"require-dev": {
"doctrine/instantiator": "^1.0.5",
"mockery/mockery": "^1.0",
"phpdocumentor/type-resolver": "0.4.*",
"phpunit/phpunit": "^6.4"
"mockery/mockery": "~1.3.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.x-dev"
"dev-master": "5.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
"phpDocumentor\\Reflection\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -4191,42 +4493,44 @@
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
},
{
"name": "Jaap van Otterdijk",
"email": "account@ijaap.nl"
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/4.x"
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master"
},
"time": "2019-12-28T18:55:12+00:00"
"time": "2020-09-03T19:13:55+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.0.1",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9"
"reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
"reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
"shasum": ""
},
"require": {
"php": "^7.1",
"php": "^7.2 || ^8.0",
"phpdocumentor/reflection-common": "^2.0"
},
"require-dev": {
"ext-tokenizer": "^7.1",
"mockery/mockery": "~1",
"phpunit/phpunit": "^7.0"
"ext-tokenizer": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
"dev-1.x": "1.x-dev"
}
},
"autoload": {
@ -4247,39 +4551,39 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/0.7.2"
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0"
},
"time": "2019-08-22T18:11:29+00:00"
"time": "2020-09-17T18:55:26+00:00"
},
{
"name": "phpspec/prophecy",
"version": "v1.10.3",
"version": "1.12.2",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "451c3cd1418cf640de218914901e51b064abb093"
"reference": "245710e971a030f42e08f4912863805570f23d39"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093",
"reference": "451c3cd1418cf640de218914901e51b064abb093",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39",
"reference": "245710e971a030f42e08f4912863805570f23d39",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0",
"sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0",
"sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0"
"doctrine/instantiator": "^1.2",
"php": "^7.2 || ~8.0, <8.1",
"phpdocumentor/reflection-docblock": "^5.2",
"sebastian/comparator": "^3.0 || ^4.0",
"sebastian/recursion-context": "^3.0 || ^4.0"
},
"require-dev": {
"phpspec/phpspec": "^2.5 || ^3.2",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1"
"phpspec/phpspec": "^6.0",
"phpunit/phpunit": "^8.0 || ^9.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.10.x-dev"
"dev-master": "1.11.x-dev"
}
},
"autoload": {
@ -4314,9 +4618,9 @@
],
"support": {
"issues": "https://github.com/phpspec/prophecy/issues",
"source": "https://github.com/phpspec/prophecy/tree/v1.10.3"
"source": "https://github.com/phpspec/prophecy/tree/1.12.2"
},
"time": "2020-03-05T15:02:03+00:00"
"time": "2020-12-19T10:15:11+00:00"
},
{
"name": "phpunit/dbunit",
@ -5679,23 +5983,23 @@
},
{
"name": "theseer/tokenizer",
"version": "1.1.3",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/theseer/tokenizer.git",
"reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9"
"reference": "75a63c33a8577608444246075ea0af0d052e452a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9",
"reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a",
"reference": "75a63c33a8577608444246075ea0af0d052e452a",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": "^7.0"
"php": "^7.2 || ^8.0"
},
"type": "library",
"autoload": {
@ -5719,7 +6023,13 @@
"issues": "https://github.com/theseer/tokenizer/issues",
"source": "https://github.com/theseer/tokenizer/tree/master"
},
"time": "2019-06-13T22:48:21+00:00"
"funding": [
{
"url": "https://github.com/theseer",
"type": "github"
}
],
"time": "2020-07-12T23:59:07+00:00"
},
{
"name": "webmozart/assert",
@ -5781,13 +6091,13 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "^7.1.3",
"php": ">=7.3.0",
"ext-json": "*",
"ext-mbstring": "*"
},
"platform-dev": [],
"platform-overrides": {
"php": "7.1.3"
"php": "7.3.0"
},
"plugin-api-version": "2.0.0"
}

View File

@ -258,7 +258,7 @@ class phpbb_questionnaire_phpbb_data_provider
extract($phpbb_config_php_file->get_all());
unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution
$dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
$dbms = \phpbb\config_php_file::convert_30_dbms_to_31($dbms);
// Only send certain config vars
$config_vars = array(

View File

@ -493,7 +493,7 @@ class convertor
$error[] = $this->language->lang('INST_ERR_DB_CONNECT');
}
$src_dbms = $this->config_php_file->convert_30_dbms_to_31($src_dbms);
$src_dbms = \phpbb\config_php_file::convert_30_dbms_to_31($src_dbms);
// Check table prefix
if (empty($error))

View File

@ -71,7 +71,7 @@ class convertor
require_once($phpbb_root_path . 'includes/constants.' . $phpEx);
require_once($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
$dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
$dbms = \phpbb\config_php_file::convert_30_dbms_to_31($dbms);
/** @var \phpbb\db\driver\driver_interface $db */
$db = new $dbms();

View File

@ -29,7 +29,7 @@ $phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
extract($phpbb_config_php_file->get_all());
unset($dbpasswd);
$dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
$dbms = \phpbb\config_php_file::convert_30_dbms_to_31($dbms);
/**
* $convertor_data provides some basic information about this convertor which is

View File

@ -182,6 +182,7 @@ $lang = array_merge($lang, array(
'CONGRATULATIONS' => 'Congratulations to',
'CONNECTION_FAILED' => 'Connection failed.',
'CONNECTION_SUCCESS' => 'Connection was successful!',
'DB_CONNECTION_FAILED' => 'Connecting to the database failed.',
'CONTACT' => 'Contact',
'CONTACT_USER' => 'Contact %s',
'CONTACT_US' => 'Contact us',

View File

@ -121,7 +121,7 @@ class config_php_file
* @return string driver class
* @throws \RuntimeException
*/
public function convert_30_dbms_to_31($dbms)
public static function convert_30_dbms_to_31($dbms)
{
// Note: this check is done first because mysqli extension
// supplies a mysqli class, and class_exists($dbms) would return

View File

@ -0,0 +1,114 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\doctrine;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Exception;
use InvalidArgumentException;
use phpbb\config_php_file;
use phpbb\exception\runtime_exception;
/**
* Doctrine DBAL connection factory.
*/
class connection_factory
{
use driver_convertor;
/**
* Creates a Doctrine DBAL connection from phpBB configuration.
*
* @param config_php_file $config Config PHP file wrapper.
*
* @return Connection Doctrine DBAL connection.
*
* @throws runtime_exception If the database connection could not be established.
* @throws InvalidArgumentException If $driver_name is not a valid phpBB database driver.
*/
public static function get_connection(config_php_file $config) : Connection
{
$driver = $config->get('dbms');
$host = $config->get('dbhost');
$user = $config->get('dbuser');
$pass = $config->get('dbpasswd');
$name = $config->get('dbname');
$port = $config->get('dbport');
return self::get_connection_from_params(
$driver,
$host,
$user,
$pass,
$name,
$port
);
}
/**
* Creates a database connection from the specified parameters.
*
* @param string $driver Driver name.
* @param string $host Hostname.
* @param string|null $user Username.
* @param string|null $password Password.
* @param string|null $name Database name.
* @param string|null $port Database port.
*
* @return Connection Doctrine DBAL connection.
*
* @throws runtime_exception If the database connection could not be established.
* @throws InvalidArgumentException If $driver_name is not a valid phpBB database driver.
*/
public static function get_connection_from_params(
string $driver,
string $host,
?string $user = null,
?string $password = null,
?string $name = null,
?string $port = null) : Connection
{
$available_drivers = DriverManager::getAvailableDrivers();
if (!in_array($driver, $available_drivers))
{
$driver = config_php_file::convert_30_dbms_to_31($driver);
$driver = self::to_doctrine_driver($driver);
}
$params = connection_parameter_factory::get_configuration(
$driver,
$host,
$user,
$password,
$name,
$port
);
try
{
return DriverManager::getConnection($params);
}
catch (Exception $e)
{
throw new runtime_exception('DB_CONNECTION_FAILED');
}
}
/*
* Disable constructor.
*/
private function __construct()
{
}
}

View File

@ -0,0 +1,180 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\doctrine;
use InvalidArgumentException;
/**
* Helper class to generate Doctrine DBAL configuration.
*/
class connection_parameter_factory
{
/**
* Returns configuration options for Doctrine DBAL.
*
* @param string $driver Driver name.
* @param string $host Hostname.
* @param string|null $user Username.
* @param string|null $password Password.
* @param string|null $name Database name.
* @param string|null $port Database port.
*
* @return array Doctrine DBAL connection parameters.
*
* @throws InvalidArgumentException If a required parameter is empty or null.
*/
public static function get_configuration(
string $driver,
string $host,
?string $user = null,
?string $password = null,
?string $name = null,
?string $port = null) : array
{
$params = [
'driver' => $driver,
];
return self::build_connection_parameters(
$params,
$host,
$user,
$password,
$name,
$port
);
}
/**
* Build Doctrine configuration array.
*
* @param array $params Parameter array.
* @param string $host Database hostname.
* @param string|null $user Username.
* @param string|null $password Password.
* @param string|null $name Database name.
* @param string|null $port Database port.
*
* @return array Doctrine's DBAL configuration for SQLite.
*
* @throws InvalidArgumentException If a required parameter is empty or null.
*/
private static function build_connection_parameters(
array $params,
string $host,
?string $user = null,
?string $password = null,
?string $name = null,
?string $port = null) : array
{
if ($params['driver'] === 'pdo_sqlite')
{
return self::enrich_parameters(
self::build_sqlite_parameters($params, $host, $user, $password)
);
}
if (empty($host) || empty($user) || empty($name))
{
throw new InvalidArgumentException('Required database parameter is not set.');
}
$params = array_merge($params, [
'host' => $host,
'user' => $user,
'dbname' => $name,
]);
if (!empty($password))
{
$params['password'] = $password;
}
if (!empty($port))
{
$params['port'] = (int) $port;
}
return self::enrich_parameters($params);
}
/**
* Build configuration array for SQLite.
*
* @param array $params Parameter array.
* @param string $path Path to the database.
* @param string|null $user Username.
* @param string|null $password Password.
*
* @return array Doctrine's DBAL configuration for SQLite.
*/
private static function build_sqlite_parameters(array $params, string $path, ?string $user, ?string $password) : array
{
$params['path'] = $path;
if (!empty($user))
{
$params['user'] = $user;
}
if (!empty($password))
{
$params['password'] = $password;
}
return $params;
}
/**
* Add additional configuration options to the parameter list.
*
* @param array $params The parameter list to enrich.
*
* @return array The enriched parameter list.
*/
private static function enrich_parameters(array $params) : array
{
$enrichment_tags = [
'pdo_mysql' => [
'charset' => 'UTF8',
],
'oci8' => [
'charset' => 'UTF8',
],
'pdo_pgsql' => [
'charset' => 'UTF8',
],
];
if ($params['driver'] === 'pdo_mysql')
{
$enrichment_tags['pdo_mysql'][\PDO::MYSQL_ATTR_FOUND_ROWS] = true;
}
$driver = $params['driver'];
if (!array_key_exists($driver, $enrichment_tags))
{
return $params;
}
return array_merge($params, $enrichment_tags[$driver]);
}
/*
* Disable constructing this class.
*/
private function __construct()
{
}
}

View File

@ -0,0 +1,68 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\doctrine;
use InvalidArgumentException;
/**
* Driver convertor utility for Doctrine DBAL.
*/
trait driver_convertor
{
/**
* Converts phpBB driver names to Doctrine's equivalent.
*
* @param string $driver_name phpBB database driver name.
*
* @return string Doctrine DBAL's driver name.
*
* @throws InvalidArgumentException If $driver_name is not a valid phpBB database driver.
*/
public static function to_doctrine_driver(string $driver_name) : string
{
// Normalize driver name.
$name = str_replace('phpbb\db\driver', '', $driver_name);
$name = preg_replace('/mysql$/i', 'mysqli', $name);
$name = trim($name, '\\');
switch ($name)
{
case 'mssql_odbc':
case 'mssqlnative':
$name = 'pdo_sqlsrv';
break;
case 'mysqli':
$name = 'pdo_mysql';
break;
case 'oracle':
$name = 'oci8';
break;
case 'postgres':
$name = 'pdo_pgsql';
break;
case 'sqlite3':
$name = 'pdo_sqlite';
break;
default:
throw new InvalidArgumentException('Invalid phpBB database driver provided: ' . $driver_name);
}
return $name;
}
}

View File

@ -572,7 +572,7 @@ class container_builder
{
if ($this->dbal_connection === null)
{
$dbal_driver_class = $this->config_php_file->convert_30_dbms_to_31($this->config_php_file->get('dbms'));
$dbal_driver_class = \phpbb\config_php_file::convert_30_dbms_to_31($this->config_php_file->get('dbms'));
/** @var \phpbb\db\driver\driver_interface $dbal_connection */
$this->dbal_connection = new $dbal_driver_class();
$this->dbal_connection->sql_connect(

View File

@ -0,0 +1,167 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\install;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\Exception as DriverException;
use Doctrine\DBAL\Driver\Statement as DriverStmt;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Statement;
use phpbb\db\doctrine\connection_factory;
use phpbb\install\helper\config;
use phpbb\install\helper\database;
use phpbb\install\helper\iohandler\iohandler_interface;
/**
* Abstract base class for common database manipulation tasks.
*/
abstract class database_task extends task_base
{
/**
* @var Connection
*/
private $conn;
/**
* @var iohandler_interface
*/
private $io;
/**
* Constructor.
*
* @param Connection $connection Doctrine DBAL connection.
* @param iohandler_interface $io IO handler to use.
* @param bool $essential Whether the task is essential.
*/
public function __construct(Connection $connection, iohandler_interface $io, bool $essential = true)
{
$this->conn = $connection;
$this->io = $io;
parent::__construct($essential);
}
/**
* Execute a SQL query.
*
* @param string $sql The SQL to execute.
*/
protected function exec_sql(string $sql)
{
try
{
$this->conn->executeStatement($sql);
}
catch (Exception $e)
{
$this->report_error($e->getMessage());
}
}
/**
* Creates a prepared statement.
*
* @param string $sql The SQL.
*
* @return DriverStmt|Statement The prepared statement object.
*/
protected function create_prepared_stmt(string $sql)
{
try
{
return $this->conn->prepare($sql);
}
catch (Exception $e)
{
$this->report_error($e->getMessage());
}
return null;
}
/**
* Create and execute a prepared statement.
*
* @param string $sql The SQL to create the statement from.
* @param array $params The parameters to bind to it.
*/
protected function create_and_execute_prepared_stmt(string $sql, array $params)
{
try
{
$stmt = $this->conn->prepare($sql);
$this->exec_prepared_stmt($stmt, $params);
}
catch (Exception $e)
{
$this->report_error($e->getMessage());
}
}
/**
* Bind values and execute a prepared statement.
*
* @param Statement|DriverStmt $stmt Prepared statement.
* @param array $params Parameters.
*/
protected function exec_prepared_stmt($stmt, array $params)
{
try
{
foreach ($params as $name => $val)
{
$stmt->bindValue($name, $val);
}
$stmt->execute();
}
catch (DriverException $e)
{
$this->report_error($e->getMessage());
}
}
/**
* Report a database error.
*
* @param string $message The error message.
*/
private function report_error(string $message)
{
$this->io->add_error_message('INST_ERR_DB', $message);
}
/**
* Create a Doctrine connection in the installer context.
*
* @param database $db_helper Database helper.
* @param config $config Config options.
*
* @return Connection Doctrine DBAL connection object.
*/
protected static function get_doctrine_connection(database $db_helper, config $config) : Connection
{
$dbms = $db_helper->get_available_dbms($config->get('dbms'));
$dbms = $dbms[$config->get('dbms')]['DRIVER'];
return connection_factory::get_connection_from_params(
$dbms,
$config->get('dbhost'),
$config->get('dbuser'),
$config->get('dbpasswd'),
$config->get('dbname'),
$config->get('dbport')
);
}
}

View File

@ -41,6 +41,7 @@ class database
'LABEL' => 'MySQL with MySQLi Extension',
'SCHEMA' => 'mysql_41',
'MODULE' => 'mysqli',
'DOCTRINE' => ['pdo_mysql'],
'DELIM' => ';',
'DRIVER' => 'phpbb\db\driver\mysqli',
'AVAILABLE' => true,
@ -50,6 +51,7 @@ class database
'LABEL' => 'MS SQL Server [ ODBC ]',
'SCHEMA' => 'mssql',
'MODULE' => 'odbc',
'DOCTRINE' => ['pdo_sqlsrv'],
'DELIM' => ';',
'DRIVER' => 'phpbb\db\driver\mssql_odbc',
'AVAILABLE' => true,
@ -59,6 +61,7 @@ class database
'LABEL' => 'MS SQL Server 2005+ [ Native ]',
'SCHEMA' => 'mssql',
'MODULE' => 'sqlsrv',
'DOCTRINE' => ['pdo_sqlsrv'],
'DELIM' => ';',
'DRIVER' => 'phpbb\db\driver\mssqlnative',
'AVAILABLE' => true,
@ -77,6 +80,7 @@ class database
'LABEL' => 'PostgreSQL 8.3+',
'SCHEMA' => 'postgres',
'MODULE' => 'pgsql',
'DOCTRINE' => ['pdo_pgsql'],
'DELIM' => ';',
'DRIVER' => 'phpbb\db\driver\postgres',
'AVAILABLE' => true,
@ -86,6 +90,7 @@ class database
'LABEL' => 'SQLite3',
'SCHEMA' => 'sqlite',
'MODULE' => 'sqlite3',
'DOCTRINE' => ['pdo_sqlite'],
'DELIM' => ';',
'DRIVER' => 'phpbb\db\driver\sqlite3',
'AVAILABLE' => true,
@ -166,6 +171,33 @@ class database
continue;
}
if (array_key_exists('DOCTRINE', $db_array))
{
$available = false;
foreach ($db_array['DOCTRINE'] as $dll)
{
if (@extension_loaded($dll))
{
$available = true;
break;
}
}
if (!$available)
{
if ($return_unavailable)
{
$available_dbms[$db_name]['AVAILABLE'] = false;
}
else
{
unset($available_dbms[$db_name]);
}
continue;
}
}
$any_dbms_available = true;
}

View File

@ -30,9 +30,7 @@ class phpbb_convert_30_dbms_to_31_test extends phpbb_test_case
public function test_convert_30_dbms_to_31($input)
{
$expected = "phpbb\\db\\driver\\$input";
$config_php_file = new \phpbb\config_php_file('', '');
$output = $config_php_file->convert_30_dbms_to_31($input);
$output = \phpbb\config_php_file::convert_30_dbms_to_31($input);
$this->assertEquals($expected, $output);
}

View File

@ -154,7 +154,7 @@ class phpbb_test_case_helpers
extract($config_php_file->get_all());
$config = array_merge($config, array(
'dbms' => $config_php_file->convert_30_dbms_to_31($dbms),
'dbms' => \phpbb\config_php_file::convert_30_dbms_to_31($dbms),
'dbhost' => $dbhost,
'dbport' => $dbport,
'dbname' => $dbname,
@ -196,7 +196,7 @@ class phpbb_test_case_helpers
if (isset($_SERVER['PHPBB_TEST_DBMS']))
{
$config = array_merge($config, array(
'dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? $config_php_file->convert_30_dbms_to_31($_SERVER['PHPBB_TEST_DBMS']) : '',
'dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? \phpbb\config_php_file::convert_30_dbms_to_31($_SERVER['PHPBB_TEST_DBMS']) : '',
'dbhost' => isset($_SERVER['PHPBB_TEST_DBHOST']) ? $_SERVER['PHPBB_TEST_DBHOST'] : '',
'dbport' => isset($_SERVER['PHPBB_TEST_DBPORT']) ? $_SERVER['PHPBB_TEST_DBPORT'] : '',
'dbname' => isset($_SERVER['PHPBB_TEST_DBNAME']) ? $_SERVER['PHPBB_TEST_DBNAME'] : '',