diff --git a/.appveyor.yml b/.appveyor.yml index 14ff43b1e7321..87f9dae4c0180 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -9,14 +9,20 @@ branches: ## Build matrix for lowest and highest possible targets environment: + DLLVersion: "5.6.1" + PHPBuild: "x64" + VC: "vc15" matrix: - php_ver_target: 7.2 + DLLVersion: "5.3.0" + WINCACHE: "2.0.0.8" - php_ver_target: 7.3 + WINCACHE: "2.0.0.8" init: - SET PATH=C:\Program Files\OpenSSL;C:\tools\php;%PATH% - SET COMPOSER_NO_INTERACTION=1 - - SET PHP=1 # This var relates to caching the php install + - SET PHP=1 # This var relates to caching the php install - SET ANSICON=121x90 (121x90) services: - mssql2014 @@ -27,31 +33,32 @@ services: ## Install PHP and composer, and run the appropriate composer command install: - IF EXIST C:\tools\php (SET PHP=0) + # TODO: This is a workaround for https://github.com/chocolatey/choco/issues/1843. Once this is fixed we + # should go back to latest version in appveyor saving ourselves test time + - ps: choco install chocolatey -y --version 0.10.13 --allow-downgrade - ps: >- If ($env:PHP -eq "1") { appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') - $VC = "vc14" - $PHPBuild = "x64" } - appveyor-retry cinst -y sqlite - cd C:\tools\php # Get the MSSQL DLL's - ps: >- If ($env:PHP -eq "1") { - $DLLVersion = "4.3.0" cd c:\tools\php\ext - $source = "http://windows.php.net/downloads/pecl/releases/sqlsrv/$($DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc14-x64.zip" - $destination = "c:\tools\php\ext\php_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc14-x64.zip" + $source = "https://windows.php.net/downloads/pecl/releases/sqlsrv/$($env:DLLVersion)/php_sqlsrv-$($env:DLLVersion)-$($env:php_ver_target)-nts-$($env:VC)-$($env:PHPBuild).zip" + $destination = "c:\tools\php\ext\php_sqlsrv-$($env:DLLVersion)-$($env:php_ver_target)-nts-$($env:VC)-$($env:PHPBuild).zip" Invoke-WebRequest $source -OutFile $destination - #appveyor-retry appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/sqlsrv/$($DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc14-x64.zip - 7z x -y php_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc14-x64.zip > $null - $source = "http://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc14-x64.zip" - $destination = "c:\tools\php\ext\php_pdo_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc14-x64.zip" + #appveyor-retry appveyor DownloadFile https://windows.php.net/downloads/pecl/releases/sqlsrv/$($env:DLLVersion)/php_sqlsrv-$($env:DLLVersion)-$($env:php_ver_target)-nts-$($env:VC)-$($env:PHPBuild).zip + 7z x -y php_sqlsrv-$($env:DLLVersion)-$($env:php_ver_target)-nts-$($env:VC)-$($env:PHPBuild).zip > $null + $source = "https://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($env:DLLVersion)/php_pdo_sqlsrv-$($env:DLLVersion)-$($env:php_ver_target)-nts-$($env:VC)-$($env:PHPBuild).zip" + $destination = "c:\tools\php\ext\php_pdo_sqlsrv-$($env:DLLVersion)-$($env:php_ver_target)-nts-$($env:VC)-$($env:PHPBuild).zip" Invoke-WebRequest $source -OutFile $destination - #appveyor-retry appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc14-x64.zip - 7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc14-x64.zip > $null + #appveyor-retry appveyor DownloadFile https://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($env:DLLVersion)/php_pdo_sqlsrv-$($env:DLLVersion)-$($env:php_ver_target)-nts-$($env:VC)-$($env:PHPBuild).zip + 7z x -y php_pdo_sqlsrv-$($env:DLLVersion)-$($env:php_ver_target)-nts-$($env:VC)-$($env:PHPBuild).zip > $null Remove-Item c:\tools\php\ext* -include .zip - cd c:\tools\php} + cd c:\tools\php + } - IF %PHP%==1 copy php.ini-production php.ini /Y - IF %PHP%==1 echo date.timezone="UTC" >> php.ini - IF %PHP%==1 echo extension_dir=ext >> php.ini @@ -76,18 +83,19 @@ install: - IF %PHP%==1 echo extension=php_curl.dll >> php.ini # Get the Wincache DLLs - ps: >- - If ($env:PHP -eq "1") { - $wincache = "2.0.0.8" + If ($env:PHP -eq "1" -and $env:WINCACHE) { cd c:\tools\php\ext - $source = "http://windows.php.net/downloads/pecl/releases/wincache/$($wincache)/php_wincache-$($wincache)-$($env:php_ver_target)-nts-$($VC)-$($PHPBuild).zip" - $destination = "c:\tools\php\ext\php_wincache-$($wincache)-$($env:php_ver_target)-nts-$($VC)-$($PHPBuild).zip" + $source = "https://windows.php.net/downloads/pecl/releases/wincache/$($env:WINCACHE)/php_wincache-$($env:WINCACHE)-$($env:php_ver_target)-nts-$($env:VC)-$($env:PHPBuild).zip" + $destination = "c:\tools\php\ext\php_wincache-$($env:WINCACHE)-$($env:php_ver_target)-nts-$($env:VC)-$($env:PHPBuild).zip" Invoke-WebRequest $source -OutFile $destination - #appveyor-retry appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/wincache/$($wincache)/php_wincache-$($wincache)-$($env:php_ver_target)-nts-$($VC)-$($PHPBuild).zip - 7z x -y php_wincache-$($wincache)-$($env:php_ver_target)-nts-$($VC)-$($PHPBuild).zip > $null + #appveyor-retry appveyor DownloadFile https://windows.php.net/downloads/pecl/releases/wincache/$($env:WINCACHE)/php_wincache-$($env:WINCACHE)-$($env:php_ver_target)-nts-$($env:VC)-$($env:PHPBuild).zip + 7z x -y php_wincache-$($env:WINCACHE)-$($env:php_ver_target)-nts-$($env:VC)-$($env:PHPBuild).zip > $null Remove-Item C:\tools\php\ext* -include .zip - cd c:\tools\php} - - IF %PHP%==1 echo extension=php_wincache.dll >> php.ini - - IF %PHP%==1 echo wincache.enablecli = 1 >> php.ini + cd c:\tools\php + Add-Content php.ini "`nextension=php_wincache.dll" + Add-Content php.ini "`wincache.enablecli = 1" + Add-Content php.ini "`n" + } - IF %PHP%==1 echo zend_extension=php_opcache.dll >> php.ini - IF %PHP%==1 echo opcache.enable_cli=1 >> php.ini - IF %PHP%==1 echo extension=php_ldap.dll >> php.ini @@ -111,4 +119,4 @@ before_test: test_script: - cd C:\projects\joomla-cms - - libraries/vendor/bin/phpunit + - libraries/vendor/bin/phpunit --testsuite Unit diff --git a/.drone.yml b/.drone.yml index 974c06e61f9ff..2f176bf44eab0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -23,21 +23,22 @@ steps: image: joomlaprojects/docker-tools:develop depends_on: [ restore-cache ] commands: + - composer validate --no-check-all --strict - composer install --no-progress --no-suggest - name: phpcs - image: php:7.2 + image: joomlaprojects/docker-images:php7.2 depends_on: [ composer ] commands: - echo $(date) - - ./libraries/vendor/bin/phpcs --report=full --encoding=utf-8 --extensions=php -p --standard=build/phpcs/Joomla . + - ./libraries/vendor/bin/phpcs --extensions=php -p --standard=libraries/vendor/joomla/cms-coding-standards/lib/Joomla-CMS . - echo $(date) - name: npm image: joomlaprojects/docker-tools:develop depends_on: [ phpcs ] commands: - - npm install --unsafe-perm + - npm ci --unsafe-perm - name: rebuild-cache image: drillster/drone-volume-cache @@ -55,33 +56,93 @@ steps: - name: php72-unit depends_on: [ phpcs ] - image: php:7.2 + image: joomlaprojects/docker-images:php7.2 commands: - php -v - - ./libraries/vendor/bin/phpunit + - ./libraries/vendor/bin/phpunit --testsuite Unit - name: php73-unit depends_on: [ phpcs ] - image: php:7.3 + image: joomlaprojects/docker-images:php7.3 commands: - php -v - - ./libraries/vendor/bin/phpunit + - ./libraries/vendor/bin/phpunit --testsuite Unit - name: php74-unit depends_on: [ phpcs ] - image: phpdaily/php:7.4-dev - errignore: true + image: joomlaprojects/docker-images:php7.4 + failure: ignore commands: - php -v - - ./libraries/vendor/bin/phpunit + - ./libraries/vendor/bin/phpunit --testsuite Unit - name: php80-unit depends_on: [ phpcs ] - image: phpdaily/php:8.0-dev - errignore: true + image: joomlaprojects/docker-images:php8.0 + failure: ignore commands: - php -v - - ./libraries/vendor/bin/phpunit + - ./libraries/vendor/bin/phpunit --testsuite Unit + + - name: php72-integration + depends_on: [ npm ] + image: joomlaprojects/docker-images:php7.2 + commands: + - php -v + - ./libraries/vendor/bin/phpunit --testsuite Integration + + - name: php73-integration + depends_on: [ npm ] + image: joomlaprojects/docker-images:php7.3 + commands: + - php -v + - ./libraries/vendor/bin/phpunit --testsuite Integration + + - name: php74-integration + depends_on: [ npm ] + image: joomlaprojects/docker-images:php7.4 + failure: ignore + commands: + - php -v + - ./libraries/vendor/bin/phpunit --testsuite Integration + + - name: php80-integration + depends_on: [ npm ] + image: joomlaprojects/docker-images:php8.0 + failure: ignore + commands: + - php -v + - ./libraries/vendor/bin/phpunit --testsuite Integration + + - name: php72-integration-pgsql + depends_on: [ npm ] + image: joomlaprojects/docker-images:php7.2 + commands: + - php -v + - ./libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit-pgsql.xml.dist + +# - name: php73-integration-pgsql +# depends_on: [ npm ] +# image: joomlaprojects/docker-images:php7.3 +# commands: +# - php -v +# - ./libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit-pgsql.xml.dist + +# - name: php74-integration-pgsql +# depends_on: [ npm ] +# image: joomlaprojects/docker-images:php7.4 +# failure: ignore +# commands: +# - php -v +# - ./libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit-pgsql.xml.dist + +# - name: php80-integration-pgsql +# depends_on: [ npm ] +# image: joomlaprojects/docker-images:php8.0 +# failure: ignore +# commands: +# - php -v +# - ./libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit-pgsql.xml.dist - name: javascript-cs depends_on: [ npm ] @@ -109,12 +170,40 @@ steps: commands: - bash tests/Codeception/drone-system-run.sh "$(pwd)" mysql - - name: system-tests-postgres + - name: system-tests-mysql8 depends_on: [ system-tests-mysql ] image: joomlaprojects/docker-systemtests:latest + failure: ignore + commands: + - bash tests/Codeception/drone-system-run.sh "$(pwd)" mysql8 + + - name: system-tests-postgres + depends_on: [ system-tests-mysql8 ] + image: joomlaprojects/docker-systemtests:latest commands: - bash tests/Codeception/drone-system-run.sh "$(pwd)" postgres + - name: artifacts-system-tests + image: cschlosser/drone-ftps + depends_on: [ system-tests-postgres ] + environment: + FTP_USERNAME: + from_secret: ftpusername + FTP_PASSWORD: + from_secret: ftppassword + PLUGIN_HOSTNAME: ci.joomla.org:21 + PLUGIN_SRC_DIR: /tests/Codeception/_output/ + PLUGIN_DEST_DIR: /artifacts + PLUGIN_SECURE: false + PLUGIN_EXCLUDE: ^\.git/$ + commands: + - export PLUGIN_DEST_DIR=$PLUGIN_DEST_DIR/$DRONE_REPO/$DRONE_BRANCH/$DRONE_PULL_REQUEST_$DRONE_BUILD_NUMBER/system-tests + - echo https://ci.joomla.org:444$PLUGIN_DEST_DIR + - /bin/upload.sh + when: + status: + - failure + - name: api-tests depends_on: [ system-tests-postgres ] image: joomlaprojects/docker-systemtests:latest @@ -141,7 +230,6 @@ steps: branches: exclude: [ l10n_* ] - volumes: - name: cache host: @@ -156,6 +244,15 @@ services: MYSQL_ROOT_PASSWORD: joomla_ut MYSQL_DATABASE: test_joomla + - name: mysql8 + image: mysql:8 + command: ["--default-authentication-plugin=mysql_native_password"] + environment: + MYSQL_USER: joomla_ut + MYSQL_PASSWORD: joomla_ut + MYSQL_ROOT_PASSWORD: joomla_ut + MYSQL_DATABASE: test_joomla + - name: memcached image: memcached:alpine @@ -173,6 +270,6 @@ services: --- kind: signature -hmac: fe0f4efe905e680da49bd332d26fd3fe68e43f392747b1ceb821693d26459bb8 +hmac: 9462caf361ab517c63d66d10ba0c934ead624ecf116828ab71ddc889f1b0a137 ... diff --git a/.editorconfig b/.editorconfig index 287896868eaa4..59d8eec2608ae 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,3 +10,7 @@ end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true + +[*.{js,scss,css}] +indent_style = space +indent_size = 2 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8cab11d0ccb3d..f3aaf432e239f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -7,14 +7,13 @@ plugins/fields/* @laoneo plugins/systems/fields/* @laoneo # Smart Search -#administrator/components/com_finder/* -#components/com_finder/* -#modules/mod_finder/* -#plugins/content/finder/* -#plugins/finder/* +administrator/components/com_finder/* @hackwar +components/com_finder/* @hackwar +modules/mod_finder/* @hackwar +plugins/content/finder/* @hackwar +plugins/finder/* @hackwar # CodeMirror -media/editors/codemirror/* @okonomiyaki3000 plugins/editors/codemirror/* @okonomiyaki3000 # Statistics Server @@ -32,25 +31,20 @@ libraries/src/Installer/* @rdeutz @wilsonge @zero-24 libraries/src/Updater/* @rdeutz @wilsonge @zero-24 # Automated Testing -build/jenkins/* @rdeutz -build/travis/* @rdeutz -tests/codeception/* @rdeutz -tests/javascript/* @dgrammatiko @rdeutz -tests/unit/* @rdeutz -.appveyor.yml @rdeutz -.drone.yml @rdeutz -.hound.yml @wilsonge -.travis.yml @rdeutz -appveyor-phpunit.xml @rdeutz -codeception.yml @rdeutz -karma.conf.js @dgrammatiko @rdeutz -phpunit.xml.dist @rdeutz -RoboFile.dist.ini @rdeutz -RoboFile.php @rdeutz -travis-phpunit.xml @rdeutz +tests/* @hackwar +tests/Codeception/* @rdeutz +tests/javascript/* @wilsonge @rdeutz +tests/Unit/* @rdeutz +.appveyor.yml @rdeutz @hackwar +.drone.yml @rdeutz @hackwar +.hound.yml @wilsonge @hackwar +codeception.yml @rdeutz @hackwar +phpunit.xml.dist @rdeutz @hackwar +phpunit-pgsql.xml.dist @rdeutz @hackwar +RoboFile.php @rdeutz @hackwar # Core JS -media/*/js/* @dgrammatiko +build/media_source/*/js/* @wilsonge # CSP Tooling plugins/system/httpheaders/* @zero-24 diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000000..0be9be57ae051 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: https://community.joomla.org/sponsorship-campaigns.html diff --git a/SECURITY.md b/.github/SECURITY.md similarity index 87% rename from SECURITY.md rename to .github/SECURITY.md index 449c2a5978fdd..52af74f0b6c0a 100644 --- a/SECURITY.md +++ b/.github/SECURITY.md @@ -9,9 +9,7 @@ This document outlines security procedures and policies for the `Joomla! Project ## Reporting a Bug -The `Joomla` team and community take all security bugs in `Joomla` seriously. - -The Joomla! Project takes security vulnerabilities very seriously. As such, the Joomla! Security Strike Team (JSST) oversees the project's security issues and follows some specific procedures when dealing with these issues. +The `Joomla` team and community take all security bugs in `Joomla` seriously. The Joomla! Security Strike Team (JSST) oversees the project's security issues and follows some specific procedures when dealing with these issues. If you find a possible vulnerability, please report it to the JSST using the [online form](https://developer.joomla.org/security/contact-the-team.html) or via email at security@joomla.org @@ -25,7 +23,7 @@ Thank you for improving the security of `Joomla`. ## Response Handling -The JSST aims to ensure all issues are handled in a timely manner and for clear communication between the team and issue reporters. As such, we have established the following guidelines for responding to issue reports: +The JSST aims to ensure all issues are handled in a timely manner and for clear communication between the team and issue reporters. We have established the following guidelines for responding to issue reports: * Within 24 hours every report gets acknowledged * Within 7 days every report gets a further response stating either diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 990fc7493fc7f..c16b819d5d35f 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,6 +1,6 @@ # Joomla Contributor Covenant Code of Conduct -This document outlines the Code of Conduct for all persons volunteering their service to the Joomla Project and/or Open Source Matters. It covers your behaviour as a member of the Joomla community, in any forum, mailing list, Wiki, Web site, IRC channel, install-fest, public meeting or private correspondence. +This document outlines the Code of Conduct for all persons volunteering their service to the Joomla Project and/or Open Source Matters. It covers your behaviour as a member of the Joomla community, in any forum, mailing list, Wiki, website, IRC channel, install-fest, public meeting or private correspondence. If you cannot agree to any of these principles, then volunteering in the Joomla Project is not for you. Contributing to our community assumes acceptance of these principles: ## Be Considerate @@ -35,7 +35,7 @@ Check your e-mails regularly and answer them promptly—even if it's "I'll get b Sometimes the hardest thing to say is "no" or admit you've forgotten do something. Be honest with each other and yourself with regards to what you say and what you can realistically commit to. ## Follow the Rules -Volunteers are expected to uphold Joomla's licensing and trademark requirements including, but not limited to, compliance on their own or affiliate Web sites and extensions. Make sure you have sought the appropriate approvals for domain name, name and logo usage prior to volunteering and that any extensions you distribute comply with the Joomla license. +Volunteers are expected to uphold Joomla's licensing and trademark requirements including, but not limited to, compliance on their own or affiliate websites and extensions. Make sure you have sought the appropriate approvals for domain name, name and logo usage prior to volunteering and that any extensions you distribute comply with the Joomla license. All work contributed to the Project, whether code, documentation or other material, must observe the appropriate licenses as set down by the Core Team and Open Source Matters. diff --git a/README.md b/README.md index 7ba8896c336cb..618890eef17c1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Build Status --------------------- | Drone-CI | AppVeyor | | ------------- | ------------- | -| [![Build Status](https://ci.joomla.org/api/badges/joomla/joomla-cms/status.svg?branch=4.0-dev)](https://ci.joomla.org/joomla/joomla-cms) | [![Build status](https://ci.appveyor.com/api/projects/status/bpcxulw6nnxlv8kb/branch/staging?svg=true)](https://ci.appveyor.com/project/joomla/joomla-cms) | +| [![Build Status](https://ci.joomla.org/api/badges/joomla/joomla-cms/status.svg?branch=4.0-dev)](https://ci.joomla.org/joomla/joomla-cms) | [![Build status](https://ci.appveyor.com/api/projects/status/ru6sxal8jmfckvjc/branch/4.0-dev?svg=true)](https://ci.appveyor.com/project/release-joomla/joomla-cms) | What is this? --------------------- @@ -69,6 +69,5 @@ Do you want to improve Joomla? Copyright --------------------- * Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved. -* [Special Thanks](https://docs.joomla.org/Special:MyLanguage/Joomla!_Credits_and_Thanks) * Distributed under the GNU General Public License version 2 or later * See [License details](https://docs.joomla.org/Special:MyLanguage/Joomla_Licenses) diff --git a/README.txt b/README.txt index 75a33e037933b..09203ba7d7151 100644 --- a/README.txt +++ b/README.txt @@ -5,7 +5,7 @@ * Detailed changes in the Changelog: https://github.com/joomla/joomla-cms/commits/4.0-dev 2- What is Joomla? - * Joomla! is a Content Management System (CMS) which enables you to build Web sites and powerful online applications. + * Joomla! is a Content Management System (CMS) which enables you to build websites and powerful online applications. * It's a free and Open Source software, distributed under the GNU General Public License version 2 or later. * This is a simple and powerful web server application and it requires a server with PHP and either MySQL, PostgreSQL or SQL Server to run. You can find full technical requirements here: https://downloads.joomla.org/technical-requirements. @@ -68,6 +68,5 @@ Copyright: * Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved. - * Special Thanks: https://docs.joomla.org/Special:MyLanguage/Joomla!_Credits_and_Thanks * Distributed under the GNU General Public License version 2 or later - * See Licenses details at https://docs.joomla.org/Special:MyLanguage/Joomla_Licenses + * See License details at https://docs.joomla.org/Special:MyLanguage/Joomla_Licenses diff --git a/RoboFile.php b/RoboFile.php index bfc45cea93ef6..4223b3680be66 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -7,6 +7,8 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ +use Robo\Tasks; + /** * This is joomla project's console command file for Robo.li task runner. * @@ -29,7 +31,7 @@ * * @since 3.7.3 */ -class RoboFile extends \Robo\Tasks +class RoboFile extends Tasks { use JoomlaRobo\Tasks; @@ -70,7 +72,6 @@ class RoboFile extends \Robo\Tasks */ public function __construct() { - // Set default timezone (so no warnings are generated if it is not set) date_default_timezone_set('UTC'); } @@ -78,11 +79,12 @@ public function __construct() /** * Creates a testing Joomla site for running the tests (use it before run:test) * - * @param bool $useHtaccess (1/0) Rename and enable embedded Joomla .htaccess file + * @param bool $useHtaccess (1/0) Rename and enable embedded Joomla .htaccess file * + * @return void * @since 3.7.3 * - * @return void + * @throws Exception */ public function createTestingSite($useHtaccess = false) { @@ -119,6 +121,7 @@ public function createTestingSite($useHtaccess = false) '.appveyor.yml', '.babelrc', '.drone.yml', + '.editorconfig', '.eslintignore', '.eslintrc', '.gitignore', @@ -223,9 +226,10 @@ protected function copyJoomla($dst, $exclude = array()) * - 'use-htaccess': renames and enable embedded Joomla .htaccess file * - 'env': set a specific environment to get configuration from * + * @return void * @since 3.7.3 * - * @return mixed + * @throws Exception */ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop']) { @@ -258,9 +262,10 @@ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop']) * * @param array $opts Additional options * + * @return void * @since 4.0.0 * - * @return void + * @throws Exception */ public function runInstall($opts = ['use-htaccess' => false, 'env' => 'desktop']) { @@ -286,6 +291,7 @@ public function runInstall($opts = ['use-htaccess' => false, 'env' => 'desktop'] * @return string Path to codeception * * @since 4.0.0 + * @throws Exception */ protected function prepareRun($opts = ['use-htaccess' => false, 'env' => 'desktop']) { diff --git a/administrator/components/com_actionlogs/controllers/actionlogs.php b/administrator/components/com_actionlogs/Controller/ActionlogsController.php similarity index 67% rename from administrator/components/com_actionlogs/controllers/actionlogs.php rename to administrator/components/com_actionlogs/Controller/ActionlogsController.php index 748e75a27918e..ba3d9c9f0a1f3 100644 --- a/administrator/components/com_actionlogs/controllers/actionlogs.php +++ b/administrator/components/com_actionlogs/Controller/ActionlogsController.php @@ -7,61 +7,61 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Actionlogs\Administrator\Controller; + defined('_JEXEC') or die; +use DateTimeZone; +use Exception; +use InvalidArgumentException; +use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Date\Date; -use Joomla\CMS\Factory; +use Joomla\CMS\Input\Input; use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\Controller\AdminController; +use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\Router\Route; +use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper; +use Joomla\Component\Actionlogs\Administrator\Model\ActionlogsModel; use Joomla\Utilities\ArrayHelper; -JLoader::register('ActionlogsHelper', JPATH_ADMINISTRATOR . '/components/com_actionlogs/helpers/actionlogs.php'); - /** * Actionlogs list controller class. * * @since 3.9.0 */ -class ActionlogsControllerActionlogs extends JControllerAdmin +class ActionlogsController extends AdminController { /** * Constructor. * - * @param array $config An optional associative array of configuration settings. + * @param array $config An optional associative array of configuration settings. + * Recognized key values include 'name', 'default_task', 'model_path', and + * 'view_path' (this list is not meant to be comprehensive). + * @param MVCFactoryInterface $factory The factory. + * @param CmsApplication $app The JApplication for the dispatcher + * @param Input $input Input * * @since 3.9.0 + * + * @throws Exception */ - public function __construct(array $config = array()) + public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null) { - parent::__construct($config); + parent::__construct($config, $factory, $app, $input); $this->registerTask('exportSelectedLogs', 'exportLogs'); } - /** - * Method to get a model object, loading it if required. - * - * @param string $name The model name. Optional. - * @param string $prefix The class prefix. Optional. - * @param array $config Configuration array for model. Optional. - * - * @return object The model. - * - * @since 3.9.0 - */ - public function getModel($name = 'Actionlogs', $prefix = 'ActionlogsModel', $config = array('ignore_request' => true)) - { - // Return the model - return parent::getModel($name, $prefix, $config); - } - /** * Method to export logs * * @return void * * @since 3.9.0 + * + * @throws Exception */ public function exportLogs() { @@ -78,7 +78,7 @@ public function exportLogs() $pks = ArrayHelper::toInteger(explode(',', $this->input->post->getString('cids'))); } - /** @var ActionlogsModelActionlogs $model */ + /** @var ActionlogsModel $model */ $model = $this->getModel(); // Get the logs data @@ -86,7 +86,6 @@ public function exportLogs() if (count($data)) { - try { $rows = ActionlogsHelper::getCsvData($data); @@ -107,8 +106,7 @@ public function exportLogs() $csvDelimiter = ComponentHelper::getComponent('com_actionlogs')->getParams()->get('csv_delimiter', ','); - $app = Factory::getApplication(); - $app->setHeader('Content-Type', 'application/csv', true) + $this->app->setHeader('Content-Type', 'application/csv', true) ->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '.csv"', true) ->setHeader('Cache-Control', 'must-revalidate', true) ->sendHeaders(); @@ -121,8 +119,8 @@ public function exportLogs() } fclose($output); - - $app->close(); + $this->app->triggerEvent('onAfterLogExport', array()); + $this->app->close(); } else { @@ -131,6 +129,23 @@ public function exportLogs() } } + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return object The model. + * + * @since 3.9.0 + */ + public function getModel($name = 'Actionlogs', $prefix = 'Administrator', $config = ['ignore_request' => true]) + { + // Return the model + return parent::getModel($name, $prefix, $config); + } + /** * Clean out the logs * diff --git a/administrator/components/com_actionlogs/Controller/DisplayController.php b/administrator/components/com_actionlogs/Controller/DisplayController.php new file mode 100644 index 0000000000000..7921f2f8e0b85 --- /dev/null +++ b/administrator/components/com_actionlogs/Controller/DisplayController.php @@ -0,0 +1,30 @@ +getQuery(true) ->select('DISTINCT ' . $db->quoteName('extension')) ->from($db->quoteName('#__action_logs')) diff --git a/administrator/components/com_actionlogs/models/fields/logcreator.php b/administrator/components/com_actionlogs/Field/LogcreatorField.php similarity index 83% rename from administrator/components/com_actionlogs/models/fields/logcreator.php rename to administrator/components/com_actionlogs/Field/LogcreatorField.php index def002b19722f..133e1ece5080a 100644 --- a/administrator/components/com_actionlogs/models/fields/logcreator.php +++ b/administrator/components/com_actionlogs/Field/LogcreatorField.php @@ -7,35 +7,35 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +namespace Joomla\Component\Actionlogs\Administrator\Field; + defined('_JEXEC') or die; use Joomla\CMS\Factory; -use Joomla\CMS\Form\FormHelper; - -FormHelper::loadFieldClass('list'); +use Joomla\CMS\Form\Field\ListField; /** * Field to load a list of all users that have logged actions * * @since 3.9.0 */ -class JFormFieldLogCreator extends JFormFieldList +class LogcreatorField extends ListField { /** - * The form field type. + * Cached array of the category items. * - * @var string + * @var array * @since 3.9.0 */ - protected $type = 'LogCreator'; + protected static $options = []; /** - * Cached array of the category items. + * The form field type. * - * @var array + * @var string * @since 3.9.0 */ - protected static $options = array(); + protected $type = 'LogCreator'; /** * Method to get the options to populate list @@ -53,19 +53,17 @@ protected function getOptions() { static::$options[$hash] = parent::getOptions(); - $options = array(); - $db = Factory::getDbo(); // Construct the query $query = $db->getQuery(true) ->select($db->quoteName('u.id', 'value')) - ->select($db->quoteName('u.name', 'text')) + ->select($db->quoteName('u.username', 'text')) ->from($db->quoteName('#__users', 'u')) ->join('INNER', $db->quoteName('#__action_logs', 'c') . ' ON ' . $db->quoteName('c.user_id') . ' = ' . $db->quoteName('u.id')) ->group($db->quoteName('u.id')) - ->group($db->quoteName('u.name')) - ->order($db->quoteName('u.name')); + ->group($db->quoteName('u.username')) + ->order($db->quoteName('u.username')); // Setup the query $db->setQuery($query); diff --git a/administrator/components/com_actionlogs/models/fields/logsdaterange.php b/administrator/components/com_actionlogs/Field/LogsdaterangeField.php similarity index 83% rename from administrator/components/com_actionlogs/models/fields/logsdaterange.php rename to administrator/components/com_actionlogs/Field/LogsdaterangeField.php index 970c1664981f2..44f37727d298a 100644 --- a/administrator/components/com_actionlogs/models/fields/logsdaterange.php +++ b/administrator/components/com_actionlogs/Field/LogsdaterangeField.php @@ -7,19 +7,20 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +namespace Joomla\Component\Actionlogs\Administrator\Field; + defined('_JEXEC') or die; use Joomla\CMS\Factory; -use Joomla\CMS\Form\FormHelper; - -FormHelper::loadFieldClass('predefinedlist'); +use Joomla\CMS\Form\Field\PredefinedlistField; +use Joomla\CMS\Form\Form; /** * Field to show a list of range dates to sort with * * @since 3.9.0 */ -class JFormFieldLogsDateRange extends JFormFieldPredefinedList +class LogsdaterangeField extends PredefinedlistField { /** * The form field type. @@ -47,7 +48,7 @@ class JFormFieldLogsDateRange extends JFormFieldPredefinedList /** * Method to instantiate the form field object. * - * @param JForm $form The form to attach to the form field object. + * @param Form $form The form to attach to the form field object. * * @since 3.9.0 */ diff --git a/administrator/components/com_actionlogs/models/fields/logtype.php b/administrator/components/com_actionlogs/Field/LogtypeField.php similarity index 76% rename from administrator/components/com_actionlogs/models/fields/logtype.php rename to administrator/components/com_actionlogs/Field/LogtypeField.php index 261a6ef3a43a2..4a82a9fe1630f 100644 --- a/administrator/components/com_actionlogs/models/fields/logtype.php +++ b/administrator/components/com_actionlogs/Field/LogtypeField.php @@ -7,23 +7,23 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +namespace Joomla\Component\Actionlogs\Administrator\Field; + defined('_JEXEC') or die; use Joomla\CMS\Application\ApplicationHelper; use Joomla\CMS\Factory; -use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Form\Field\CheckboxesField; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; - -FormHelper::loadFieldClass('checkboxes'); -JLoader::register('ActionlogsHelper', JPATH_ADMINISTRATOR . '/components/com_actionlogs/helpers/actionlogs.php'); +use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper; /** * Field to load a list of all users that have logged actions * - * @since 3.9.0 + * @since 3.9.0 */ -class JFormFieldLogType extends JFormFieldCheckboxes +class LogtypeField extends CheckboxesField { /** * The form field type. @@ -42,7 +42,7 @@ class JFormFieldLogType extends JFormFieldCheckboxes */ public function getOptions() { - $db = Factory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('extension')) ->from($db->quoteName('#__action_logs_extensions')); @@ -55,7 +55,7 @@ public function getOptions() foreach ($extensions as $extension) { ActionlogsHelper::loadTranslationFiles($extension); - $option = HTMLHelper::_('select.option', $extension, Text::_($extension)); + $option = HTMLHelper::_('select.option', $extension, Text::_($extension)); $options[ApplicationHelper::stringURLSafe(Text::_($extension)) . '_' . $extension] = (object) array_merge($tmp, (array) $option); } diff --git a/administrator/components/com_actionlogs/models/fields/plugininfo.php b/administrator/components/com_actionlogs/Field/PlugininfoField.php similarity index 76% rename from administrator/components/com_actionlogs/models/fields/plugininfo.php rename to administrator/components/com_actionlogs/Field/PlugininfoField.php index d3b3008132856..6f5ad1670bd31 100644 --- a/administrator/components/com_actionlogs/models/fields/plugininfo.php +++ b/administrator/components/com_actionlogs/Field/PlugininfoField.php @@ -7,9 +7,12 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Actionlogs\Administrator\Field; + defined('JPATH_BASE') or die; use Joomla\CMS\Factory; +use Joomla\CMS\Form\FormField; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; @@ -19,7 +22,7 @@ * * @since 3.9.2 */ -class JFormFieldPluginInfo extends JFormField +class PlugininfoField extends FormField { /** * The form field type. @@ -32,29 +35,21 @@ class JFormFieldPluginInfo extends JFormField /** * Method to get the field input markup. * - * @return string The field input markup. + * @return string The field input markup. * * @since 3.9.2 */ protected function getInput() { - $db = Factory::getDbo(); - $result = null; - $query = $db->getQuery(true) + $db = Factory::getDbo(); + $query = $db->getQuery(true) ->select($db->quoteName('extension_id')) ->from($db->quoteName('#__extensions')) ->where($db->quoteName('folder') . ' = ' . $db->quote('actionlog')) ->where($db->quoteName('element') . ' = ' . $db->quote('joomla')); $db->setQuery($query); - try - { - $result = (int) $db->loadResult(); - } - catch (RuntimeException $e) - { - JError::raiseWarning(500, $e->getMessage()); - } + $result = (int) $db->loadResult(); $link = HTMLHelper::_( 'link', @@ -64,6 +59,9 @@ protected function getInput() ); return '