diff --git a/.drone.yml b/.drone.yml index 3e079e863341..f0a897df0fa1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -115,15 +115,6 @@ pipeline: matrix: TEST_SUITE: owncloud-coding-standard - php-phan-70: - image: owncloudci/php:7.0 - pull: true - commands: - - make test-php-phan - when: - matrix: - TEST_SUITE: phan-70 - php-phan-71: image: owncloudci/php:7.1 pull: true @@ -488,7 +479,7 @@ pipeline: services: mariadb: - image: mariadb:10.2 + image: ${MARIADB_IMAGE=mariadb:10.2} environment: - MYSQL_USER=owncloud - MYSQL_PASSWORD=owncloud @@ -499,7 +490,7 @@ services: DB_TYPE: mariadb mysql: - image: mysql:5.5 + image: ${MYSQL_IMAGE=mysql:5.5} environment: - MYSQL_USER=owncloud - MYSQL_PASSWORD=owncloud @@ -509,8 +500,10 @@ services: matrix: DB_TYPE: mysql - mysqlmb4: - image: mysql:5.7 + mysql8: + image: ${MYSQL_IMAGE=mysql:8.0} + # see http://php.net/manual/en/mysqli.requirements.php + command: --default-authentication-plugin=mysql_native_password environment: - MYSQL_USER=owncloud - MYSQL_PASSWORD=owncloud @@ -518,10 +511,10 @@ services: - MYSQL_ROOT_PASSWORD=owncloud when: matrix: - DB_TYPE: mysqlmb4 + DB_TYPE: mysql8 postgres: - image: postgres:9.4 + image: ${POSTGRES_IMAGE=postgres:9.4} environment: - POSTGRES_USER=owncloud - POSTGRES_PASSWORD=owncloud @@ -672,11 +665,7 @@ matrix: - PHP_VERSION: 7.3 TEST_SUITE: owncloud-coding-standard - # phan (runs on just PHP 7.0 because that has different dependencies for phan) - - TEST_SUITE: phan-70 - PHP_VERSION: 7.0 - - # phan (runs multiple PHP v7.1+ to provide syntax checks of each PHP version) + # phan (runs multiple PHP v7.* to provide syntax checks of each PHP version) - TEST_SUITE: phan PHP_VERSION: 7.1 @@ -702,58 +691,66 @@ matrix: INSTALL_TESTING_APP: true - PHP_VERSION: 7.1 - DB_TYPE: mysqlmb4 + DB_TYPE: mysql + # mb4 support, with innodb_file_format=Barracuda + MYSQL_IMAGE: mysql:5.7 TEST_SUITE: phpunit INSTALL_SERVER: true INSTALL_TESTING_APP: true - PHP_VERSION: 7.1 - DB_TYPE: postgres + # mb4 support by default + DB_TYPE: mysql8 TEST_SUITE: phpunit - COVERAGE: true + COVERAGE: false INSTALL_SERVER: true INSTALL_TESTING_APP: true - - PHP_VERSION: 7.1 - DB_TYPE: oracle - TEST_SUITE: phpunit - COVERAGE: true - INSTALL_SERVER: true - INSTALL_TESTING_APP: true +# - PHP_VERSION: 7.1 +# DB_TYPE: mariadb +# TEST_SUITE: phpunit +# INSTALL_SERVER: true - PHP_VERSION: 7.1 - DB_TYPE: sqlite + DB_TYPE: postgres + POSTGRES_IMAGE: postgres:9.4 TEST_SUITE: phpunit COVERAGE: true INSTALL_SERVER: true INSTALL_TESTING_APP: true - # PHP 7.0 - - PHP_VERSION: 7.0 - DB_TYPE: mysql - TEST_SUITE: phpunit - INSTALL_SERVER: true - INSTALL_TESTING_APP: true +# - PHP_VERSION: 7.1 +# DB_TYPE: postgres +# POSTGRES_IMAGE: postgres:10.3 +# TEST_SUITE: phpunit +# COVERAGE: true +# INSTALL_SERVER: true +# INSTALL_TESTING_APP: true - - PHP_VERSION: 7.0 - DB_TYPE: mysqlmb4 + - PHP_VERSION: 7.1 + DB_TYPE: mariadb + # mb4 support by default + MARIADB_IMAGE: mariadb:10.3 TEST_SUITE: phpunit + COVERAGE: true INSTALL_SERVER: true INSTALL_TESTING_APP: true - - PHP_VERSION: 7.0 - DB_TYPE: postgres + - PHP_VERSION: 7.1 + DB_TYPE: oracle TEST_SUITE: phpunit + COVERAGE: true INSTALL_SERVER: true INSTALL_TESTING_APP: true - - PHP_VERSION: 7.0 - DB_TYPE: oracle + - PHP_VERSION: 7.1 + DB_TYPE: sqlite TEST_SUITE: phpunit + COVERAGE: true INSTALL_SERVER: true INSTALL_TESTING_APP: true - # PHP 7.2 + # PHP 7.2 - PHP_VERSION: 7.2 DB_TYPE: sqlite TEST_SUITE: phpunit @@ -766,7 +763,7 @@ matrix: INSTALL_SERVER: true INSTALL_TESTING_APP: true - # PHP 7.3 + # PHP 7.3 - PHP_VERSION: 7.3 DB_TYPE: sqlite TEST_SUITE: phpunit @@ -813,15 +810,6 @@ matrix: INSTALL_TESTING_APP: true # Primary Objectstorage - - PHP_VERSION: 7.0 - TEST_SUITE: phpunit - DB_TYPE: sqlite - OBJECTSTORE: swift - PRIMARY_OBJECTSTORE: swift - FILES_EXTERNAL_TYPE: swift - INSTALL_SERVER: true - INSTALL_TESTING_APP: true - - PHP_VERSION: 7.1 TEST_SUITE: phpunit COVERAGE: true @@ -1646,20 +1634,6 @@ matrix: OWNCLOUD_LOG: true CALDAV_CARDDAV_JOB: true - # This suite is part of the encryption app in later core versions - - PHP_VERSION: 7.0 - TEST_SUITE: cli - BEHAT_SUITE: cliEncryption - DB_TYPE: mariadb - USE_SERVER: true - SERVER_PROTOCOL: https - INSTALL_SERVER: true - CHOWN_SERVER: true - OWNCLOUD_LOG: true - CONFIGURE_ENCRYPTION: true - ENCRYPTION_TYPE: masterkey - INSTALL_TESTING_APP: true - # This suite is part of the encryption app in later core versions - PHP_VERSION: 7.1 TEST_SUITE: cli diff --git a/composer.json b/composer.json index 66190d3ba3b2..1948f7af74f7 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "optimize-autoloader": true, "classmap-authoritative": false, "platform": { - "php": "7.0.8" + "php": "7.1" } }, "autoload" : { @@ -30,7 +30,7 @@ "roave/security-advisories": "dev-master" }, "require": { - "php": ">=7.0.8", + "php": ">=7.1", "doctrine/dbal": "^2.5", "phpseclib/phpseclib": "^2.0", "rackspace/php-opencloud": "v1.9.2", diff --git a/composer.lock b/composer.lock index 7cde05af92b9..4c9352400c51 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "de02856e0fd6ffe69f963cb9118ea729", + "content-hash": "9784b743e0f0a6cd497b5900a00b9a7f", "packages": [ { "name": "bantu/ini-get-wrapper", @@ -282,103 +282,40 @@ ], "time": "2019-02-05T21:18:31+00:00" }, - { - "name": "doctrine/annotations", - "version": "v1.4.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", - "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", - "shasum": "" - }, - "require": { - "doctrine/lexer": "1.*", - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "^5.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "time": "2017-02-24T16:22:25+00:00" - }, { "name": "doctrine/cache", - "version": "v1.6.2", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b" + "reference": "d768d58baee9a4862ca783840eca1b9add7a7f57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/eb152c5100571c7a45470ff2a35095ab3f3b900b", - "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b", + "url": "https://api.github.com/repos/doctrine/cache/zipball/d768d58baee9a4862ca783840eca1b9add7a7f57", + "reference": "d768d58baee9a4862ca783840eca1b9add7a7f57", "shasum": "" }, "require": { - "php": "~5.5|~7.0" + "php": "~7.1" }, "conflict": { "doctrine/common": ">2.2,<2.4" }, "require-dev": { - "phpunit/phpunit": "~4.8|~5.0", - "predis/predis": "~1.0", - "satooshi/php-coveralls": "~0.6" + "alcaeus/mongo-php-adapter": "^1.1", + "doctrine/coding-standard": "^4.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.6.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -413,174 +350,40 @@ } ], "description": "Caching library offering an object-oriented API for many cache backends", - "homepage": "http://www.doctrine-project.org", + "homepage": "https://www.doctrine-project.org", "keywords": [ "cache", "caching" ], - "time": "2017-07-22T12:49:21+00:00" - }, - { - "name": "doctrine/collections", - "version": "v1.4.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/collections.git", - "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba", - "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "doctrine/coding-standard": "~0.1@dev", - "phpunit/phpunit": "^5.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Collections\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Collections Abstraction library", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "array", - "collections", - "iterator" - ], - "time": "2017-01-03T10:49:41+00:00" - }, - { - "name": "doctrine/common", - "version": "v2.7.3", - "source": { - "type": "git", - "url": "https://github.com/doctrine/common.git", - "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/4acb8f89626baafede6ee5475bc5844096eba8a9", - "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9", - "shasum": "" - }, - "require": { - "doctrine/annotations": "1.*", - "doctrine/cache": "1.*", - "doctrine/collections": "1.*", - "doctrine/inflector": "1.*", - "doctrine/lexer": "1.*", - "php": "~5.6|~7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "lib/Doctrine/Common" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Common Library for Doctrine projects", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "collections", - "eventmanager", - "persistence", - "spl" - ], - "time": "2017-07-22T08:35:12+00:00" + "time": "2018-08-21T18:01:43+00:00" }, { "name": "doctrine/dbal", - "version": "v2.5.13", + "version": "v2.9.2", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "729340d8d1eec8f01bff708e12e449a3415af873" + "reference": "22800bd651c1d8d2a9719e2a3dc46d5108ebfcc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/729340d8d1eec8f01bff708e12e449a3415af873", - "reference": "729340d8d1eec8f01bff708e12e449a3415af873", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/22800bd651c1d8d2a9719e2a3dc46d5108ebfcc9", + "reference": "22800bd651c1d8d2a9719e2a3dc46d5108ebfcc9", "shasum": "" }, "require": { - "doctrine/common": ">=2.4,<2.8-dev", - "php": ">=5.3.2" + "doctrine/cache": "^1.0", + "doctrine/event-manager": "^1.0", + "ext-pdo": "*", + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "4.*", - "symfony/console": "2.*||^3.0" + "doctrine/coding-standard": "^5.0", + "jetbrains/phpstorm-stubs": "^2018.1.2", + "phpstan/phpstan": "^0.10.1", + "phpunit/phpunit": "^7.4", + "symfony/console": "^2.0.5|^3.0|^4.0", + "symfony/phpunit-bridge": "^3.4.5|^4.0.5" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -591,12 +394,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5.x-dev" + "dev-master": "2.9.x-dev", + "dev-develop": "3.0.x-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\DBAL\\": "lib/" + "psr-4": { + "Doctrine\\DBAL\\": "lib/Doctrine/DBAL" } }, "notification-url": "https://packagist.org/downloads/", @@ -621,45 +425,53 @@ "email": "jonwage@gmail.com" } ], - "description": "Database Abstraction Layer", - "homepage": "http://www.doctrine-project.org", + "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", "dbal", + "mysql", "persistence", + "pgsql", + "php", "queryobject" ], - "time": "2017-07-22T20:44:48+00:00" + "time": "2018-12-31T03:27:51+00:00" }, { - "name": "doctrine/inflector", - "version": "v1.2.0", + "name": "doctrine/event-manager", + "version": "v1.0.0", "source": { "type": "git", - "url": "https://github.com/doctrine/inflector.git", - "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462" + "url": "https://github.com/doctrine/event-manager.git", + "reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/e11d84c6e018beedd929cff5220969a3c6d1d462", - "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/a520bc093a0170feeb6b14e9d83f3a14452e64b3", + "reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.1" + }, + "conflict": { + "doctrine/common": "<2.9@dev" }, "require-dev": { - "phpunit/phpunit": "^6.2" + "doctrine/coding-standard": "^4.0", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { - "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" + "Doctrine\\Common\\": "lib/Doctrine/Common" } }, "notification-url": "https://packagist.org/downloads/", @@ -686,17 +498,20 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" } ], - "description": "Common String Manipulations with regard to casing and singular/plural rules.", - "homepage": "http://www.doctrine-project.org", + "description": "Doctrine Event Manager component", + "homepage": "https://www.doctrine-project.org/projects/event-manager.html", "keywords": [ - "inflection", - "pluralize", - "singularize", - "string" + "event", + "eventdispatcher", + "eventmanager" ], - "time": "2017-07-22T12:18:28+00:00" + "time": "2018-06-11T11:59:03+00:00" }, { "name": "doctrine/lexer", @@ -1266,7 +1081,7 @@ "time": "2015-08-01T16:27:37+00:00" }, { - "name": "jeremeamia/SuperClosure", + "name": "jeremeamia/superclosure", "version": "2.4.0", "source": { "type": "git", @@ -3772,32 +3587,34 @@ }, { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "a2c590166b2133a4633738648b6b064edae0814a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", + "reference": "a2c590166b2133a4633738648b6b064edae0814a", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^6.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -3817,12 +3634,12 @@ } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2015-06-14T21:17:01+00:00" + "time": "2019-03-17T17:37:11+00:00" }, { "name": "jakub-onderka/php-console-color", @@ -3913,7 +3730,7 @@ "time": "2018-09-29T18:48:56+00:00" }, { - "name": "mikey179/vfsStream", + "name": "mikey179/vfsstream", "version": "v1.6.6", "source": { "type": "git", @@ -3960,25 +3777,28 @@ }, { "name": "myclabs/deep-copy", - "version": "1.7.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.1" + "phpunit/phpunit": "^7.1" }, "type": "library", "autoload": { @@ -4001,7 +3821,7 @@ "object", "object graph" ], - "time": "2017-10-19T19:58:43+00:00" + "time": "2019-04-07T13:18:21+00:00" }, { "name": "phar-io/manifest", @@ -4716,6 +4536,17 @@ { "name": "roave/security-advisories", "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/Roave/SecurityAdvisories.git", + "reference": "a53a6f855cbff7edb078f87c72bb808c89443a00" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/a53a6f855cbff7edb078f87c72bb808c89443a00", + "reference": "a53a6f855cbff7edb078f87c72bb808c89443a00", + "shasum": "" + }, "conflict": { "3f/pygmentize": "<1.2", "adodb/adodb-php": "<5.20.12", @@ -5521,7 +5352,7 @@ }, { "name": "Gert de Pagter", - "email": "backendtea@gmail.com" + "email": "BackEndTea@gmail.com" } ], "description": "Symfony polyfill for ctype functions", @@ -5634,11 +5465,11 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.0.8", + "php": ">=7.1", "ext-json": "*" }, "platform-dev": [], "platform-overrides": { - "php": "7.0.8" + "php": "7.1" } } diff --git a/console.php b/console.php index 305f852b53dc..a1ed4c4bd936 100644 --- a/console.php +++ b/console.php @@ -33,10 +33,10 @@ \define('OC_CONSOLE', 1); -// Show warning if a PHP version below 7.0.7 is used, this has to happen here -// because base.php will already use 7.0 syntax. -if (\version_compare(PHP_VERSION, '7.0.7') === -1) { - echo 'This version of ownCloud requires at least PHP 7.0.7'.PHP_EOL; +// Show warning if a PHP version below 7.1.0 is used, this has to happen here +// because base.php will already use 7.1 syntax. +if (\version_compare(PHP_VERSION, '7.1.0') === -1) { + echo 'This version of ownCloud requires at least PHP 7.1.0'.PHP_EOL; echo 'You are currently running PHP ' . PHP_VERSION . '. Please update your PHP version.'.PHP_EOL; exit(1); } diff --git a/index.php b/index.php index 32d7587a0836..0e36dddc8ed6 100644 --- a/index.php +++ b/index.php @@ -27,10 +27,10 @@ * */ -// Show warning if a PHP version below 7.0.7 is used, this has to happen here -// because base.php will already use 7.0 syntax. -if (\version_compare(PHP_VERSION, '7.0.7') === -1) { - echo 'This version of ownCloud requires at least PHP 7.0.7
'; +// Show warning if a PHP version below 7.1.0 is used, this has to happen here +// because base.php will already use 7.1 syntax. +if (\version_compare(PHP_VERSION, '7.1.0') === -1) { + echo 'This version of ownCloud requires at least PHP 7.1.0
'; echo 'You are currently running PHP ' . PHP_VERSION . '. Please update your PHP version.'; return; } diff --git a/lib/private/DB/ConnectionFactory.php b/lib/private/DB/ConnectionFactory.php index 03a04edc1122..732799e2f13c 100644 --- a/lib/private/DB/ConnectionFactory.php +++ b/lib/private/DB/ConnectionFactory.php @@ -117,10 +117,6 @@ public function getConnection($type, $additionalConnectionParams) { case 'mysql': $eventManager->addEventSubscriber( new SQLSessionInit("SET SESSION AUTOCOMMIT=1")); - $eventManager->addEventListener( - Events::onSchemaColumnDefinition, - new MySqlSchemaColumnDefinitionListener() - ); break; case 'oci': $eventManager->addEventSubscriber(new OracleSessionInit); @@ -131,7 +127,6 @@ public function getConnection($type, $additionalConnectionParams) { break; case 'sqlite3': $journalMode = $additionalConnectionParams['sqlite.journal_mode']; - $additionalConnectionParams['platform'] = new OCSqlitePlatform(); $eventManager->addEventSubscriber(new SQLiteSessionInit(true, $journalMode)); break; case 'pgsql': diff --git a/lib/private/DB/MySqlSchemaColumnDefinitionListener.php b/lib/private/DB/MySqlSchemaColumnDefinitionListener.php deleted file mode 100644 index 6dbcc8ddd9bd..000000000000 --- a/lib/private/DB/MySqlSchemaColumnDefinitionListener.php +++ /dev/null @@ -1,244 +0,0 @@ - - * - * @copyright Copyright (c) 2018, ownCloud GmbH - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see - * - */ - -namespace OC\DB; - -use Doctrine\DBAL\DBALException; -use Doctrine\DBAL\Event\SchemaColumnDefinitionEventArgs; -use Doctrine\DBAL\Platforms\MySqlPlatform; -use Doctrine\DBAL\Schema\Column; -use Doctrine\DBAL\Types\Type; - -/** - * Class MySqlSchemaColumnDefinitionListener - * - * @package OC\DB - * - * This class contains the smallest portion of native Doctrine code taken from - * Doctrine\DBAL\Platforms\MySqlSchemaManager that allows to bypass the call to - * native _getPortableTableColumnDefinition method - * - * TODO: remove once https://github.com/owncloud/core/issues/28695 is fixed and Doctrine upgraded - */ -class MySqlSchemaColumnDefinitionListener { - /** - * @var \Doctrine\DBAL\Platforms\AbstractPlatform - */ - protected $_platform; - - public function onSchemaColumnDefinition(SchemaColumnDefinitionEventArgs $eventArgs) { - // We need an instance of platform with ownCloud-specific mappings - // this part can't be moved to constructor - it leads to an infinite recursion - if ($this->_platform === null) { - $this->_platform = \OC::$server->getDatabaseConnection()->getDatabasePlatform(); - } - - $version = \OC::$server->getDatabaseConnection()->getDatabaseVersionString(); - $mariadb = \stripos($version, 'mariadb') !== false; - if ($mariadb && \version_compare($this->getMariaDbMysqlVersionNumber($version), '10.2.7', '>=')) { - $tableColumn = $eventArgs->getTableColumn(); - try { - $column = $this->_getPortableTableColumnDefinition($tableColumn); - $eventArgs->preventDefault(); - $eventArgs->setColumn($column); - } catch (DBALException $e) { - // Pass - } - } - } - - /** - * Given a table comment this method tries to extract a typehint for Doctrine Type, or returns - * the type given as default. - * - * @param string $comment - * @param string $currentType - * - * @return string - */ - public function extractDoctrineTypeFromComment($comment, $currentType) { - if (\preg_match("(\(DC2Type:([a-zA-Z0-9_]+)\))", $comment, $match)) { - $currentType = $match[1]; - } - - return $currentType; - } - - /** - * @param string $comment - * @param string $type - * - * @return string - */ - public function removeDoctrineTypeFromComment($comment, $type) { - return \str_replace('(DC2Type:'.$type.')', '', $comment); - } - - protected function _getPortableTableColumnDefinition($tableColumn) { - $tableColumn = \array_change_key_case($tableColumn, CASE_LOWER); - - $dbType = \strtolower($tableColumn['type']); - $dbType = \strtok($dbType, '(), '); - if (isset($tableColumn['length'])) { - $length = $tableColumn['length']; - } else { - $length = \strtok('(), '); - } - - $fixed = null; - - if (! isset($tableColumn['name'])) { - $tableColumn['name'] = ''; - } - - $scale = null; - $precision = null; - - $type = $this->_platform->getDoctrineTypeMapping($dbType); - - // In cases where not connected to a database DESCRIBE $table does not return 'Comment' - if (isset($tableColumn['comment'])) { - $type = $this->extractDoctrineTypeFromComment($tableColumn['comment'], $type); - $tableColumn['comment'] = $this->removeDoctrineTypeFromComment($tableColumn['comment'], $type); - } - - switch ($dbType) { - case 'char': - case 'binary': - $fixed = true; - break; - case 'float': - case 'double': - case 'real': - case 'numeric': - case 'decimal': - if (\preg_match('([A-Za-z]+\(([0-9]+)\,([0-9]+)\))', $tableColumn['type'], $match)) { - $precision = $match[1]; - $scale = $match[2]; - $length = null; - } - break; - case 'tinytext': - $length = MySqlPlatform::LENGTH_LIMIT_TINYTEXT; - break; - case 'text': - $length = MySqlPlatform::LENGTH_LIMIT_TEXT; - break; - case 'mediumtext': - $length = MySqlPlatform::LENGTH_LIMIT_MEDIUMTEXT; - break; - case 'tinyblob': - $length = MySqlPlatform::LENGTH_LIMIT_TINYBLOB; - break; - case 'blob': - $length = MySqlPlatform::LENGTH_LIMIT_BLOB; - break; - case 'mediumblob': - $length = MySqlPlatform::LENGTH_LIMIT_MEDIUMBLOB; - break; - case 'tinyint': - case 'smallint': - case 'mediumint': - case 'int': - case 'integer': - case 'bigint': - case 'year': - $length = null; - break; - } - - $length = ((int) $length == 0) ? null : (int) $length; - - $default = isset($tableColumn['default']) ? $tableColumn['default'] : null; - $columnDefault = $this->getMariaDb1027ColumnDefault($default); - - $options = [ - 'length' => $length, - 'unsigned' => (bool) (\strpos($tableColumn['type'], 'unsigned') !== false), - 'fixed' => (bool) $fixed, - // This line was changed to fix breaking change introduced in MariaDB 10.2.6 - 'default' => $columnDefault, - 'notnull' => (bool) ($tableColumn['null'] != 'YES'), - 'scale' => null, - 'precision' => null, - 'autoincrement' => (bool) (\strpos($tableColumn['extra'], 'auto_increment') !== false), - 'comment' => isset($tableColumn['comment']) && $tableColumn['comment'] !== '' - ? $tableColumn['comment'] - : null, - ]; - - if ($scale !== null && $precision !== null) { - $options['scale'] = $scale; - $options['precision'] = $precision; - } - - $column = new Column($tableColumn['field'], Type::getType($type), $options); - - if (isset($tableColumn['collation'])) { - $column->setPlatformOption('collation', $tableColumn['collation']); - } - - return $column; - } - - /** - * Return Doctrine/Mysql-compatible column default values for MariaDB 10.2.7+ servers. - * - * - Since MariaDb 10.2.7 column defaults stored in information_schema are now quoted - * to distinguish them from expressions (see MDEV-10134). - * - Note: Quoted 'NULL' is not enforced by Maria, it is technically possible to have - * null in some circumstances (see https://jira.mariadb.org/browse/MDEV-14053) - * - * @link https://mariadb.com/kb/en/library/information-schema-columns-table/ - * @link https://jira.mariadb.org/browse/MDEV-13132 - * - * @param null|string $columnDefault default value as stored in information_schema for MariaDB >= 10.2.7 - * @return string - */ - private function getMariaDb1027ColumnDefault($columnDefault) { - if ($columnDefault === 'NULL' || $columnDefault === null) { - return null; - } - if ($columnDefault[0] === "'") { - return \preg_replace('/^\'(.*)\'$/', '$1', $columnDefault); - } - - return $columnDefault; - } - - /** - * Detect MariaDB server version, including hack for some mariadb distributions - * that starts with the prefix '5.5.5-' - * - * @param string $versionString Version string as returned by mariadb server, i.e. '5.5.5-Mariadb-10.0.8-xenial' - * @return string - * @throws DBALException - */ - private function getMariaDbMysqlVersionNumber($versionString) { - if (!\preg_match('/^(?:5\.5\.5-)?(mariadb-)?(?P\d+)\.(?P\d+)\.(?P\d+)/i', $versionString, $versionParts)) { - throw DBALException::invalidPlatformVersionSpecified( - $versionString, - '^(?:5\.5\.5-)?(mariadb-)?..' - ); - } - return $versionParts['major'] . '.' . $versionParts['minor'] . '.' . $versionParts['patch']; - } -} diff --git a/lib/private/DB/MySqlTools.php b/lib/private/DB/MySqlTools.php index 61409b8bd490..34cd90bf9790 100644 --- a/lib/private/DB/MySqlTools.php +++ b/lib/private/DB/MySqlTools.php @@ -1,6 +1,7 @@ + * @author Vincent Petry * * @copyright Copyright (c) 2018, ownCloud GmbH * @license AGPL-3.0 @@ -22,17 +23,15 @@ namespace OC\DB; use OCP\IDBConnection; +use Doctrine\DBAL\DBALException; +use Doctrine\DBAL\Platforms\MySQL80Platform; +use OC\DB\Connection; /** * Various MySQL specific helper functions. */ class MySqlTools { - - /** - * @param Connection $connection - * @return bool - */ - public function supports4ByteCharset(IDBConnection $connection) { + private function detectBarracuda(IDBConnection $connection) { foreach (['innodb_file_format' => 'Barracuda', 'innodb_large_prefix' => 'ON', 'innodb_file_per_table' => 'ON'] as $var => $val) { $result = $connection->executeQuery("SHOW VARIABLES LIKE '$var'"); $rows = $result->fetch(); @@ -44,6 +43,51 @@ public function supports4ByteCharset(IDBConnection $connection) { return false; } } + return true; } + + /** + * Detect MariaDB server version, including hack for some mariadb distributions + * that starts with the prefix '5.5.5-' + * + * @param string $versionString Version string as returned by mariadb server, i.e. '5.5.5-Mariadb-10.0.8-xenial' + * @return string + * @throws DBALException + */ + private function getMariaDbMysqlVersionNumber($versionString) { + if (!\preg_match('/^(?:5\.5\.5-)?(mariadb-)?(?P\d+)\.(?P\d+)\.(?P\d+)/i', $versionString, $versionParts)) { + throw DBALException::invalidPlatformVersionSpecified( + $versionString, + '^(?:5\.5\.5-)?(mariadb-)?..' + ); + } + return $versionParts['major'] . '.' . $versionParts['minor'] . '.' . $versionParts['patch']; + } + + /** + * Returns whether the database from the given connection supports 4-byte characters. + * + * @param Connection $connection connection to check + * @return bool true if supported, false otherwise + */ + public function supports4ByteCharset(Connection $connection) { + if ($this->detectBarracuda($connection)) { + return true; + } + + if ($connection->getDatabasePlatform() instanceof MySQL80Platform) { + // mb4 supported by default since MySQL 8.0 and innodb_file_format vars were removed + return true; + } + + $version = $connection->getDatabaseVersionString(); + $mariadb = \stripos($version, 'mariadb') !== false; + if ($mariadb && \version_compare($this->getMariaDbMysqlVersionNumber($version), '10.3.1', '>=')) { + // mb4 supported by default on MariaDB since 10.3.1 and innodb_file_format vars were removed + return true; + } + + return false; + } } diff --git a/lib/private/DB/OCSqlitePlatform.php b/lib/private/DB/OCSqlitePlatform.php deleted file mode 100644 index 0ff843abb9e5..000000000000 --- a/lib/private/DB/OCSqlitePlatform.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @author Thomas Müller - * - * @copyright Copyright (c) 2018, ownCloud GmbH - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see - * - */ - -namespace OC\DB; - -class OCSqlitePlatform extends \Doctrine\DBAL\Platforms\SqlitePlatform { - /** - * {@inheritDoc} - */ - public function getColumnDeclarationSQL($name, array $field) { - $def = parent::getColumnDeclarationSQL($name, $field); - if (!empty($field['autoincrement'])) { - $def .= ' PRIMARY KEY AUTOINCREMENT'; - } - return $def; - } - - /** - * {@inheritDoc} - */ - protected function _getCreateTableSQL($name, array $columns, array $options = []) { - // if auto increment is set the column is already defined as primary key - foreach ($columns as $column) { - if (!empty($column['autoincrement'])) { - $options['primary'] = null; - } - } - return parent::_getCreateTableSQL($name, $columns, $options); - } -} diff --git a/tests/drone/install-server.sh b/tests/drone/install-server.sh index 2476ce98618c..94a6e4a6598e 100755 --- a/tests/drone/install-server.sh +++ b/tests/drone/install-server.sh @@ -83,8 +83,8 @@ case "${DB_TYPE}" in wait-for-it mysql:3306 DB=mysql ;; - mysqlmb4) - wait-for-it mysqlmb4:3306 + mysql8) + wait-for-it mysql8:3306 DB=mysql ;; postgres) diff --git a/tests/lib/DB/AdapterTest.php b/tests/lib/DB/AdapterTest.php index ec3ebf15e454..0fe1cb58a9ad 100644 --- a/tests/lib/DB/AdapterTest.php +++ b/tests/lib/DB/AdapterTest.php @@ -22,6 +22,7 @@ namespace Test\DB; use Doctrine\DBAL\DBALException; +use Doctrine\DBAL\Driver\AbstractDriverException; use Doctrine\DBAL\Driver\DriverException; use OC\DB\Adapter; use OCP\DB\QueryBuilder\IExpressionBuilder; @@ -131,7 +132,7 @@ public function testUpsertCatchDeadlockAndThrowsException() { $qb->expects($this->exactly(3))->method('set')->willReturn($qb); $qb->expects($this->exactly(3))->method('setValue')->willReturn($qb); // Make a deadlock driver exception - $ex = $this->createMock(DriverException::class); + $ex = $this->createMock(AbstractDriverException::class); $ex->expects($this->exactly(5))->method('getErrorCode')->willReturn(1213); // Wrap the exception in a doctrine exception $e = new \Doctrine\DBAL\Exception\DriverException('1213', $ex); @@ -170,7 +171,7 @@ public function testUpsertAndThrowOtherDriverExceptions() { $qb->expects($this->exactly(3))->method('set')->willReturn($qb); $qb->expects($this->exactly(3))->method('setValue')->willReturn($qb); // Make a deadlock driver exception - $ex = $this->createMock(DriverException::class); + $ex = $this->createMock(AbstractDriverException::class); $ex->expects($this->exactly(1))->method('getErrorCode')->willReturn(1214); // Wrap the exception in a doctrine exception /** @var DriverException|\PHPUnit\Framework\MockObject\MockObject $ex */ diff --git a/tests/lib/DB/MySqlToolsTest.php b/tests/lib/DB/MySqlToolsTest.php new file mode 100644 index 000000000000..c626f3590f1e --- /dev/null +++ b/tests/lib/DB/MySqlToolsTest.php @@ -0,0 +1,134 @@ + + * + * @copyright Copyright (c) 2018, ownCloud GmbH + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see + * + */ + +namespace Test\DB; + +use OCP\IDBConnection; +use Doctrine\DBAL\Driver\Statement; +use OC\DB\MySqlTools; +use Doctrine\DBAL\Platforms\MySQL80Platform; +use OC\DB\Connection; + +/** + * Class MySqlToolsTest + */ +class MySqlToolsTest extends \Test\TestCase { + + /** + * @var IDBConnection + */ + private $db; + + /** + * @var MySqlTools + */ + + public function setUp() { + parent::setUp(); + + $this->db = $this->createMock(Connection::class); + $this->tools = new MySqlTools(); + } + + public function providesDbVars() { + return [ + [ + ['innodb_file_format' => 'Barracuda', 'innodb_large_prefix' => 'ON', 'innodb_file_per_table' => 'ON'], true, + ['innodb_file_format' => 'Barracuda', 'innodb_large_prefix' => 'ON', 'innodb_file_per_table' => 'OFF'], false, + ['innodb_file_format' => 'Antelope', 'innodb_large_prefix' => 'ON', 'innodb_file_per_table' => 'ON'], false, + ['innodb_file_format' => 'Barracuda', 'innodb_large_prefix' => 'OFF', 'innodb_file_per_table' => 'ON'], false, + ], + ]; + } + + private function mockDatabaseVars($vars) { + $map = []; + foreach ($vars as $key => $value) { + $statementMock = $this->createMock(Statement::class); + $statementMock->expects($this->once())->method('fetch')->willReturn(['Value' => $value]); + $map[] = ["SHOW VARIABLES LIKE '$key'", [], [], null, $statementMock]; + } + // mock vars + $this->db->expects($this->any()) + ->method('executeQuery') + ->will($this->returnValueMap($map)); + } + + private function mockDatabaseEmptyVars() { + $statementMock = $this->createMock(Statement::class); + $statementMock->expects($this->any())->method('fetch')->willReturn(false); + + $this->db->expects($this->any()) + ->method('executeQuery') + ->willReturn($statementMock); + } + + /** + * Test barracuda detection based on MySQL vars + * + * @dataProvider providesDbVars + * @param array $vars + * @param bool $expectedResult + */ + public function testMb4WithBarracuda($vars, $expectedResult) { + $this->mockDatabaseVars($vars); + + $this->assertEquals($expectedResult, $this->tools->supports4ByteCharset($this->db)); + } + + public function testDetectMb4WithMySQL8() { + $this->mockDatabaseEmptyVars(); + + $this->db->expects($this->once()) + ->method('getDatabasePlatform') + ->willReturn($this->createMock(MySQL80Platform::class)); + + $this->assertTrue($this->tools->supports4ByteCharset($this->db)); + } + + public function providesVersionString() { + return [ + ['10.3.2-oracle', false], + ['10.3.0-mariadb', false], + ['mariadb-10.3.0', false], + ['10.3.1-mariadb', true], + ['mariadb-10.3.1', true], + ]; + } + + /** + * Tests whether MariaDB 10.3 is properly detected. + * + * @dataProvider providesVersionString + * @param string $versionString + * @param bool $expectedResult + */ + public function testDetectMb4WithMariaDB103($versionString, $expectedResult) { + $this->mockDatabaseEmptyVars(); + + $this->db->expects($this->once()) + ->method('getDatabaseVersionString') + ->willReturn($versionString); + + $this->assertEquals($expectedResult, $this->tools->supports4ByteCharset($this->db)); + } +}