From 789db927758a2b379b94012ccf6e9c7e3086e884 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 12 Dec 2018 10:40:18 +0545 Subject: [PATCH 1/8] Standardize CI and move to drone --- .drone.yml | 196 ++++++++++++++++++++ .gitignore | 18 +- .phan/config.php | 109 +++++++++++ .php_cs.dist | 10 + .travis.yml | 2 - Makefile | 154 +++++++++++++++ composer.json | 18 ++ composer.lock | 60 ++++++ phpstan.neon | 4 + phpunit.xml | 25 +++ tests/bootstrap.php | 3 - tests/phpunit.xml | 25 --- vendor-bin/owncloud-codestyle/composer.json | 11 ++ vendor-bin/phan/composer.json | 5 + vendor-bin/phpstan/composer.json | 5 + 15 files changed, 613 insertions(+), 32 deletions(-) create mode 100644 .drone.yml create mode 100644 .phan/config.php create mode 100644 .php_cs.dist create mode 100644 Makefile create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 phpstan.neon create mode 100644 phpunit.xml delete mode 100644 tests/bootstrap.php delete mode 100644 tests/phpunit.xml create mode 100644 vendor-bin/owncloud-codestyle/composer.json create mode 100644 vendor-bin/phan/composer.json create mode 100644 vendor-bin/phpstan/composer.json diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 00000000000..64d1ed347d1 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,196 @@ +workspace: + base: /var/www/owncloud + path: apps/firstrunwizard + +branches: [master, release*, release/*] + +pipeline: + install-core: + image: owncloudci/core + version: ${OC_VERSION} + pull: true + exclude: "apps/firstrunwizard" + db_type: ${DB_TYPE} + db_name: ${DB_NAME} + db_host: ${DB_TYPE} + db_username: autotest + db_password: owncloud + when: + matrix: + NEED_CORE: true + + install-app: + image: owncloudci/php:${PHP_VERSION} + pull: true + commands: + - cd /var/www/owncloud/ + - php occ a:l + - php occ a:e firstrunwizard + - php occ a:e testing + - php occ a:l + - php occ config:system:set trusted_domains 1 --value=owncloud + - php occ log:manage --level 0 + when: + matrix: + NEED_INSTALL_APP: true + + fix-permissions: + image: owncloudci/php:${PHP_VERSION} + pull: true + commands: + - chown www-data /var/www/owncloud -R + - chmod 777 /var/www/owncloud/tests/acceptance/filesForUpload -R + - chmod +x /var/www/owncloud/tests/acceptance/run.sh + when: + matrix: + NEED_SERVER: true + + owncloud-log: + image: owncloud/ubuntu:16.04 + detach: true + pull: true + commands: + - tail -f /var/www/owncloud/data/owncloud.log + when: + matrix: + NEED_SERVER: true + + owncloud-coding-standard: + image: owncloudci/php:${PHP_VERSION} + pull: true + commands: + - make test-php-style + when: + matrix: + TEST_SUITE: owncloud-coding-standard + + phpunit-tests: + image: owncloudci/php:${PHP_VERSION} + pull: true + environment: + - COVERAGE=${COVERAGE} + commands: + - if [ -z "${COVERAGE}" ]; then make test-php-unit; fi + - if [ "${COVERAGE}" = "true" ]; then make test-php-unit-dbg; fi + when: + matrix: + TEST_SUITE: phpunit + + codecov: + image: plugins/codecov:2 + secrets: [codecov_token] + pull: true + paths: + - tests/output/*.xml + when: + matrix: + COVERAGE: true + + notify: + image: plugins/slack:1 + pull: true + secrets: [slack_webhook] + channel: builds + when: + status: [failure, changed] + event: [push, tag] + +services: + mysql: + image: mysql:5.5 + environment: + - MYSQL_USER=autotest + - MYSQL_PASSWORD=owncloud + - MYSQL_DATABASE=${DB_NAME} + - MYSQL_ROOT_PASSWORD=owncloud + when: + matrix: + DB_TYPE: mysql + + pgsql: + image: postgres:9.4 + environment: + - POSTGRES_USER=autotest + - POSTGRES_PASSWORD=owncloud + - POSTGRES_DB=${DB_NAME} + when: + matrix: + DB_TYPE: pgsql + + oci: + image: deepdiver/docker-oracle-xe-11g + environment: + - ORACLE_USER=system + - ORACLE_PASSWORD=oracle + - ORACLE_DB=${DB_NAME} + when: + matrix: + DB_TYPE: oci + + owncloud: + image: owncloudci/php:${PHP_VERSION} + pull: true + environment: + - APACHE_WEBROOT=/var/www/owncloud/ + command: [ "/usr/local/bin/apachectl", "-e", "debug", "-D", "FOREGROUND" ] + when: + matrix: + NEED_SERVER: true + +matrix: + include: + # owncloud-coding-standard + - PHP_VERSION: 7.2 + TEST_SUITE: owncloud-coding-standard + + - PHP_VERSION: 5.6 + TEST_SUITE: owncloud-coding-standard + + # Unit Tests + - PHP_VERSION: 7.1 + OC_VERSION: daily-master-qa + TEST_SUITE: phpunit + DB_TYPE: mysql + DB_NAME: owncloud + NEED_CORE: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.2 + OC_VERSION: daily-master-qa + TEST_SUITE: phpunit + DB_TYPE: mysql + DB_NAME: owncloud + NEED_CORE: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 5.6 + OC_VERSION: daily-stable10-qa + TEST_SUITE: phpunit + DB_TYPE: mysql + DB_NAME: owncloud + NEED_CORE: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.0 + OC_VERSION: daily-stable10-qa + TEST_SUITE: phpunit + DB_TYPE: mysql + DB_NAME: owncloud + NEED_CORE: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.1 + OC_VERSION: daily-stable10-qa + TEST_SUITE: phpunit + DB_TYPE: mysql + DB_NAME: owncloud + NEED_CORE: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.2 + OC_VERSION: daily-stable10-qa + TEST_SUITE: phpunit + DB_TYPE: mysql + DB_NAME: owncloud + NEED_CORE: true + NEED_INSTALL_APP: true diff --git a/.gitignore b/.gitignore index 9ae0879d2fe..178467ff314 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,16 @@ -# test coverage -tests/clover.xml +# build dir +/build/ +/l10n/.transifexrc +.php_cs.cache + +# Composer +vendor/ +vendor-bin/**/vendor +vendor-bin/**/composer.lock + +# Mac OS +.DS_Store + +# Tests - auto-generated files +/tests/acceptance/output +/tests/output diff --git a/.phan/config.php b/.phan/config.php new file mode 100644 index 00000000000..6004d6e189f --- /dev/null +++ b/.phan/config.php @@ -0,0 +1,109 @@ + + * + * @copyright Copyright (c) 2018, ownCloud GmbH + * @license GPL-2.0 + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +return [ + + // Supported values: '7.0', '7.1', '7.2', null. + // If this is set to null, + // then Phan assumes the PHP version which is closest to the minor version + // of the php executable used to execute phan. + 'target_php_version' => null, + + // A list of directories that should be parsed for class and + // method information. After excluding the directories + // defined in exclude_analysis_directory_list, the remaining + // files will be statically analyzed for errors. + // + // Thus, both first-party and third-party code being used by + // your application should be included in this list. + 'directory_list' => [ + 'appinfo', + 'lib', + 'vendor', + '../../lib', + '../../core' + ], + + // A directory list that defines files that will be excluded + // from static analysis, but whose class and method + // information should be included. + // + // Generally, you'll want to include the directories for + // third-party code (such as "vendor/") in this list. + // + // n.b.: If you'd like to parse but not analyze 3rd + // party code, directories containing that code + // should be added to both the `directory_list` + // and `exclude_analysis_directory_list` arrays. + 'exclude_analysis_directory_list' => [ + 'vendor', + '../../lib', + '../../core' + ], + + // A regular expression to match files to be excluded + // from parsing and analysis and will not be read at all. + // + // This is useful for excluding groups of test or example + // directories/files, unanalyzable files, or files that + // can't be removed for whatever reason. + // (e.g. '@Test\.php$@', or '@vendor/.*/(tests|Tests)/@') + 'exclude_file_regex' => '@.*/[^/]*(tests|Tests|templates)/@', + + // If true, missing properties will be created when + // they are first seen. If false, we'll report an + // error message. + "allow_missing_properties" => false, + + // If enabled, allow null to be cast as any array-like type. + // This is an incremental step in migrating away from null_casts_as_any_type. + // If null_casts_as_any_type is true, this has no effect. + "null_casts_as_any_type" => true, + + // Backwards Compatibility Checking. This is slow + // and expensive, but you should consider running + // it before upgrading your version of PHP to a + // new version that has backward compatibility + // breaks. + 'backward_compatibility_checks' => false, + + // The initial scan of the function's code block has no + // type information for `$arg`. It isn't until we see + // the call and rescan test()'s code block that we can + // detect that it is actually returning the passed in + // `string` instead of an `int` as declared. + 'quick_mode' => false, + + // The minimum severity level to report on. This can be + // set to Issue::SEVERITY_LOW, Issue::SEVERITY_NORMAL or + // Issue::SEVERITY_CRITICAL. Setting it to only + // critical issues is a good place to start on a big + // sloppy mature code base. + 'minimum_severity' => 5, + + // A set of fully qualified class-names for which + // a call to parent::__construct() is required + 'parent_constructor_required' => [ + ], + +]; \ No newline at end of file diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 00000000000..a3540ef1c55 --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,10 @@ +setUsingCache(true) + ->getFinder() + ->exclude('vendor') + ->exclude('vendor-bin') + ->exclude('l10n') + ->in(__DIR__); + return $config; diff --git a/.travis.yml b/.travis.yml index cd2a44e559e..d779e71ec6d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,6 @@ branches: - master - /^stable\d+(\.\d+)?$/ - before_install: - wget https://raw.githubusercontent.com/owncloud/administration/master/travis-ci/before_install.sh - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB @@ -28,7 +27,6 @@ before_script: - cd apps/$APP_NAME/ script: - - cd tests - phpunit --configuration phpunit.xml matrix: diff --git a/Makefile b/Makefile new file mode 100644 index 00000000000..d3976b389f4 --- /dev/null +++ b/Makefile @@ -0,0 +1,154 @@ +# Makefile for building the project + +SHELL := /bin/bash + +COMPOSER_BIN := $(shell command -v composer 2> /dev/null) +ifndef COMPOSER_BIN + $(error composer is not available on your system, please install composer) +endif + +app_name=firstrunwizard +project_directory=$(CURDIR)/../$(app_name) +build_tools_directory=$(CURDIR)/build/tools +source_build_directory=$(CURDIR)/build/artifacts/source +source_package_name=$(source_build_directory)/$(app_name) +appstore_build_directory=$(CURDIR)/build/artifacts/appstore +appstore_package_name=$(appstore_build_directory)/$(app_name) + +# signing +occ=$(CURDIR)/../../occ +private_key=$(HOME)/.owncloud/certificates/$(app_name).key +certificate=$(HOME)/.owncloud/certificates/$(app_name).crt +sign=php -f $(occ) integrity:sign-app --privateKey="$(private_key)" --certificate="$(certificate)" +sign_skip_msg="Skipping signing, either no key and certificate found in $(private_key) and $(certificate) or occ can not be found at $(occ)" + +ifneq (,$(wildcard $(private_key))) +ifneq (,$(wildcard $(certificate))) +ifneq (,$(wildcard $(occ))) + CAN_SIGN=true +endif +endif +endif + +# bin file definitions +PHPUNIT=php -d zend.enable_gc=0 "$(PWD)/../../lib/composer/bin/phpunit" +PHPUNITDBG=phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "$(PWD)/../../lib/composer/bin/phpunit" +PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer +PHAN=php -d zend.enable_gc=0 vendor-bin/phan/vendor/bin/phan +PHPSTAN=php -d zend.enable_gc=0 vendor-bin/phpstan/vendor/bin/phpstan + +all: appstore + +.PHONY: clean +clean: + rm -rf ./build/artifacts + +# Builds the source and appstore package +.PHONY: dist +dist: source appstore + +# Builds the source package +.PHONY: source +source: + rm -rf $(source_build_directory) + mkdir -p $(source_build_directory) + tar cvzf $(source_package_name).tar.gz ../$(app_name) \ + --exclude-vcs \ + --exclude="../$(app_name)/build" \ + --exclude="../$(app_name)/*.log" + +# Builds the source package for the app store, ignores php and js tests +.PHONY: appstore +appstore: + rm -rf $(appstore_build_directory) + mkdir -p $(appstore_package_name) + cp --parents -r \ + ajax \ + appinfo \ + css \ + img \ + js \ + l10n \ + lib \ + templates \ + COPYING \ + CHANGELOG.md \ + wizard.php \ + $(appstore_package_name) + +ifdef CAN_SIGN + $(sign) --path="$(appstore_package_name)" +else + @echo $(sign_skip_msg) +endif + tar -czf $(appstore_package_name).tar.gz -C $(appstore_package_name)/../ $(app_name) + +##--------------------- +## Tests +##--------------------- + +.PHONY: test-php-unit +test-php-unit: ## Run php unit tests +test-php-unit: + $(PHPUNIT) --configuration ./phpunit.xml --testsuite unit + +.PHONY: test-php-unit-dbg +test-php-unit-dbg: ## Run php unit tests using phpdbg +test-php-unit-dbg: + $(PHPUNITDBG) --configuration ./phpunit.xml --testsuite unit + +.PHONY: test-php-style +test-php-style: ## Run php-cs-fixer and check owncloud code-style +test-php-style: vendor-bin/owncloud-codestyle/vendor + $(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes --dry-run + +.PHONY: test-php-style-fix +test-php-style-fix: ## Run php-cs-fixer and fix code style issues +test-php-style-fix: vendor-bin/owncloud-codestyle/vendor + $(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes + +.PHONY: test-php-phan +test-php-phan: ## Run phan +test-php-phan: vendor-bin/phan/vendor + $(PHAN) --config-file .phan/config.php --require-config-exists + +.PHONY: test-php-phpstan +test-php-phpstan: ## Run phpstan +test-php-phpstan: vendor-bin/phpstan/vendor + $(PHPSTAN) analyse --memory-limit=4G --configuration=./phpstan.neon --no-progress --level=5 appinfo lib + +.PHONY: test-acceptance-webui +test-acceptance-webui: ## Run webUI acceptance tests +test-acceptance-webui: + ../../tests/acceptance/run.sh --remote --type webUI + +# +# Dependency management +#-------------------------------------- + +composer.lock: composer.json + @echo composer.lock is not up to date. + +vendor: composer.lock + composer install --no-dev + +vendor/bamarni/composer-bin-plugin: composer.lock + composer install + +vendor-bin/owncloud-codestyle/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/owncloud-codestyle/composer.lock + composer bin owncloud-codestyle install --no-progress + +vendor-bin/owncloud-codestyle/composer.lock: vendor-bin/owncloud-codestyle/composer.json + @echo owncloud-codestyle composer.lock is not up to date. + +vendor-bin/phan/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/phan/composer.lock + composer bin phan install --no-progress + +vendor-bin/phan/composer.lock: vendor-bin/phan/composer.json + @echo phan composer.lock is not up to date. + +vendor-bin/phpstan/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/phpstan/composer.lock + composer bin phpstan install --no-progress + +vendor-bin/phpstan/composer.lock: vendor-bin/phpstan/composer.json + @echo phpstan composer.lock is not up to date. diff --git a/composer.json b/composer.json new file mode 100644 index 00000000000..9678de65179 --- /dev/null +++ b/composer.json @@ -0,0 +1,18 @@ +{ + "name": "owncloud/firstrunwizard", + "config" : { + "platform": { + "php": "5.6.37" + } + }, + "require": { + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.2" + }, + "extra": { + "bamarni-bin": { + "bin-links": false + } + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000000..dc217edd211 --- /dev/null +++ b/composer.lock @@ -0,0 +1,60 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "41ca90ec5e3e06e691ff177b6852cee7", + "packages": [], + "packages-dev": [ + { + "name": "bamarni/composer-bin-plugin", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/bamarni/composer-bin-plugin.git", + "reference": "62fef740245a85f00665e81ea8f0aa0b72afe6e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bamarni/composer-bin-plugin/zipball/62fef740245a85f00665e81ea8f0aa0b72afe6e7", + "reference": "62fef740245a85f00665e81ea8f0aa0b72afe6e7", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "require-dev": { + "composer/composer": "dev-master", + "symfony/console": "^2.5 || ^3.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Bamarni\\Composer\\Bin\\Plugin", + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Bamarni\\Composer\\Bin\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "time": "2017-09-11T13:13:58+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "platform-overrides": { + "php": "5.6.37" + } +} diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 00000000000..fc21becb2a3 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,4 @@ +parameters: + bootstrap: %currentWorkingDirectory%/../../lib/base.php + ignoreErrors: + diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 00000000000..1f0b00f4476 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,25 @@ + + + + ./tests + + + + + . + + ./l10n + ./tests + + + + + + + + diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index 536323d49a1..00000000000 --- a/tests/bootstrap.php +++ /dev/null @@ -1,3 +0,0 @@ - - - - . - - - - - ../firstrunwizard - - ../firstrunwizard/l10n - ../firstrunwizard/tests - - - - - - - - \ No newline at end of file diff --git a/vendor-bin/owncloud-codestyle/composer.json b/vendor-bin/owncloud-codestyle/composer.json new file mode 100644 index 00000000000..73bdb773f73 --- /dev/null +++ b/vendor-bin/owncloud-codestyle/composer.json @@ -0,0 +1,11 @@ +{ + "config" : { + "platform": { + "php": "5.6.37" + } + }, + "require": { + "owncloud/coding-standard": "^1.0" + } + } + \ No newline at end of file diff --git a/vendor-bin/phan/composer.json b/vendor-bin/phan/composer.json new file mode 100644 index 00000000000..b8f6ca70c58 --- /dev/null +++ b/vendor-bin/phan/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "phan/phan": "^1.0.0" + } +} diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json new file mode 100644 index 00000000000..cb0a62328e1 --- /dev/null +++ b/vendor-bin/phpstan/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "phpstan/phpstan": "^0.10.2" + } +} From d762a6352ca68b2de633a102797aa5b02832154e Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 12 Dec 2018 11:22:14 +0545 Subject: [PATCH 2/8] code style changes --- appinfo/app.php | 15 +++++++-------- appinfo/routes.php | 1 - lib/config.php | 3 +-- lib/util.php | 7 +++---- templates/wizard.php | 6 +++--- tests/lib/utiltest.php | 3 +-- wizard.php | 2 +- 7 files changed, 16 insertions(+), 21 deletions(-) diff --git a/appinfo/app.php b/appinfo/app.php index 8f25372a10b..bb579fa4c39 100755 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -4,20 +4,20 @@ * * @author Frank Karlitschek * @copyright 2012 Frank Karlitschek karlitschek@kde.org - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE - * License as published by the Free Software Foundation; either + * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. - * + * * This library 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 along with this library. If not, see . - * + * */ namespace OCA\FirstRunWizard; @@ -32,14 +32,13 @@ $eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher->addListener( 'OCA\Files::loadAdditionalScripts', - function() { + function () { $config = \OC::$server->getConfig(); $userSession = \OC::$server->getUserSession(); $firstRunConfig = new Config($config, $userSession); if ($userSession->isLoggedIn() && $firstRunConfig->isEnabled()) { - Util::addScript( 'firstrunwizard', 'activate'); + Util::addScript('firstrunwizard', 'activate'); } } ); - diff --git a/appinfo/routes.php b/appinfo/routes.php index eb9c5b005d8..df00dc76730 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -14,4 +14,3 @@ ->actionInclude('firstrunwizard/ajax/disable.php'); $this->create('firstrunwizard_wizard', 'wizard.php') ->actionInclude('firstrunwizard/wizard.php'); - diff --git a/lib/config.php b/lib/config.php index e04089104bf..88c565b4b59 100755 --- a/lib/config.php +++ b/lib/config.php @@ -26,7 +26,6 @@ use OCP\IUserSession; class Config { - protected $config; protected $userSession; @@ -68,7 +67,7 @@ public function isEnabled() { $user = $this->userSession->getUser(); if ($user) { $conf = $this->config->getUserValue($user->getUID(), 'firstrunwizard', 'show', 1); - return (intval($conf) === 1); + return (\intval($conf) === 1); } else { return false; } diff --git a/lib/util.php b/lib/util.php index c7db402dc70..bd582e5f4ee 100644 --- a/lib/util.php +++ b/lib/util.php @@ -27,7 +27,6 @@ use OCP\IConfig; class Util { - protected $appManager; protected $config; @@ -46,7 +45,7 @@ public function __construct(IAppManager $appManager, IConfig $config, Defaults $ } /** - * \OC_Util::getEditionString() from global namespace + * \OC_Util::getEditionString() from global namespace * (core:lib/private/legacy/util.php) * @return string */ @@ -58,10 +57,10 @@ public function getEdition() { * @return array */ public function getSyncClientUrls() { - return array( + return [ 'desktop' => $this->config->getSystemValue('customclient_desktop', $this->defaults->getSyncClientUrl()), 'android' => $this->config->getSystemValue('customclient_android', $this->defaults->getAndroidClientUrl()), 'ios' => $this->config->getSystemValue('customclient_ios', $this->defaults->getiOSClientUrl()) - ); + ]; } } diff --git a/templates/wizard.php b/templates/wizard.php index 5e0d56b9061..e1c8ff671e7 100644 --- a/templates/wizard.php +++ b/templates/wizard.php @@ -25,7 +25,7 @@ -

t('Connect your desktop apps to %s', array($theme->getName()))); ?>

+

t('Connect your desktop apps to %s', [$theme->getName()])); ?>

@@ -50,7 +50,7 @@

-t('There’s more information in the documentation and on our website.', array(link_to_docs('user_manual')))); ?>
+t('There’s more information in the documentation and on our website.', [link_to_docs('user_manual')])); ?>
t('If you like ownCloud, spread the word!')); ?> getEntity()); ?> getEntity()); ?>

diff --git a/tests/lib/utiltest.php b/tests/lib/utiltest.php index 8d89a1fcd5b..c0c1c6c9def 100644 --- a/tests/lib/utiltest.php +++ b/tests/lib/utiltest.php @@ -11,10 +11,9 @@ class UtilTest extends \PHPUnit_Framework_TestCase { */ public function testGetEditionString() { $edition = \OC_Util::getEditionString(); - $this->assertTrue(is_string($edition)); + $this->assertTrue(\is_string($edition)); } - /** * @dataProvider getSyncClientUrlsData */ diff --git a/wizard.php b/wizard.php index e412371c027..31a17cd5a29 100644 --- a/wizard.php +++ b/wizard.php @@ -37,7 +37,7 @@ $util = new Util($appManager, $config, $defaults); $tmpl = new Template('firstrunwizard', 'wizard', ''); -$tmpl->assign('logo', CoreUtil::linkTo('core','img/logo-inverted.svg')); +$tmpl->assign('logo', CoreUtil::linkTo('core', 'img/logo-inverted.svg')); $tmpl->assign('clients', $util->getSyncClientUrls()); $tmpl->assign('edition', $util->getEdition()); $tmpl->printPage(); From d1fd4cbbe22f718ec956cf14711785b50805103d Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 12 Dec 2018 12:08:57 +0545 Subject: [PATCH 3/8] Remove travis --- .travis.yml | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d779e71ec6d..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -language: php -php: - - 5.6 - - 7 - -env: - global: - - CORE_BRANCH=master - - APP_NAME=firstrunwizard - matrix: - - DB=sqlite - -branches: - only: - - master - - /^stable\d+(\.\d+)?$/ - -before_install: - - wget https://raw.githubusercontent.com/owncloud/administration/master/travis-ci/before_install.sh - - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB - - # Add some output debugging information - - cd ../core - - ./occ app:enable firstrunwizard - -before_script: - - cd apps/$APP_NAME/ - -script: - - phpunit --configuration phpunit.xml - -matrix: - fast_finish: true From dc52eee82cbe4c39bfbbe9f458529cc13a3c3a24 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 13 Dec 2018 10:44:39 +0545 Subject: [PATCH 4/8] Adjust build status badge for drone --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cbfd337e64a..1da4fea6118 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,4 @@ firstrunwizard A first run wizard that explains the usage of ownCloud to new users -[![Build Status](https://travis-ci.org/owncloud/firstrunwizard.svg?branch=master)](https://travis-ci.org/owncloud/firstrunwizard) +[![Build Status](https://drone.owncloud.com/api/badges/owncloud/firstrunwizard/status.svg?branch=master)](https://drone.owncloud.com/owncloud/firstrunwizard) From beb0e89096674ac6f85ba1ab3ed6181830634e53 Mon Sep 17 00:00:00 2001 From: Dipak Acharya Date: Wed, 19 Dec 2018 16:05:39 +0545 Subject: [PATCH 5/8] Add codecoverage in drone --- .drone.yml | 1 + README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 64d1ed347d1..af5f16830da 100644 --- a/.drone.yml +++ b/.drone.yml @@ -186,6 +186,7 @@ matrix: DB_NAME: owncloud NEED_CORE: true NEED_INSTALL_APP: true + COVERAGE: true - PHP_VERSION: 7.2 OC_VERSION: daily-stable10-qa diff --git a/README.md b/README.md index 1da4fea6118..8cb9efb6975 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,4 @@ firstrunwizard A first run wizard that explains the usage of ownCloud to new users -[![Build Status](https://drone.owncloud.com/api/badges/owncloud/firstrunwizard/status.svg?branch=master)](https://drone.owncloud.com/owncloud/firstrunwizard) +[![Build Status](https://drone.owncloud.com/api/badges/owncloud/firstrunwizard/status.svg?branch=master)](https://drone.owncloud.com/owncloud/firstrunwizard) [![codecov](https://codecov.io/gh/owncloud/firstrunwizard/branch/master/graph/badge.svg)](https://codecov.io/gh/owncloud/firstrunwizard) From e5bde7805d6f0f98ad0db2b782093629af6bc7cb Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Fri, 28 Dec 2018 17:39:28 +0545 Subject: [PATCH 6/8] Do not pin coding-standard to PHP 5.6 --- vendor-bin/owncloud-codestyle/composer.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/vendor-bin/owncloud-codestyle/composer.json b/vendor-bin/owncloud-codestyle/composer.json index 73bdb773f73..da455d6b7e3 100644 --- a/vendor-bin/owncloud-codestyle/composer.json +++ b/vendor-bin/owncloud-codestyle/composer.json @@ -1,9 +1,4 @@ { - "config" : { - "platform": { - "php": "5.6.37" - } - }, "require": { "owncloud/coding-standard": "^1.0" } From b956cc0baf3809421dcc5e8ded642f432137ff81 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 21 Feb 2019 12:54:46 +0545 Subject: [PATCH 7/8] Run drone on stable10 --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index af5f16830da..6c0a49e58f0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,7 +2,7 @@ workspace: base: /var/www/owncloud path: apps/firstrunwizard -branches: [master, release*, release/*] +branches: [master, release*, release/*, stable10] pipeline: install-core: From b7501fa9f97b3b833a65b3bf3ffba46e34765127 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 21 Feb 2019 12:56:33 +0545 Subject: [PATCH 8/8] Fix code style in stable10 --- tests/lib/configtest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/configtest.php b/tests/lib/configtest.php index 6cfa4a12e78..64722d1319b 100644 --- a/tests/lib/configtest.php +++ b/tests/lib/configtest.php @@ -157,4 +157,4 @@ public function isEnabledData() { [null], ]; } -} \ No newline at end of file +}