From 4f131c224817517b9c8e32bf0eb99bda79431d73 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 9 Aug 2014 14:54:15 +0200 Subject: [PATCH 1/3] [ticket/12941] Add sami.conf.php for Travis CI. PHPBB3-12941 --- build/sami.conf.php | 6 ++++-- travis/sami.conf.php | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 travis/sami.conf.php diff --git a/build/sami.conf.php b/build/sami.conf.php index febd0276d4..78d532631c 100644 --- a/build/sami.conf.php +++ b/build/sami.conf.php @@ -45,7 +45,7 @@ $versions = Sami\Version\GitVersionCollection::create(__DIR__ . '/../') ->add('develop-ascraeus') ; -return new Sami\Sami($iterator, array( +$config = array( 'theme' => 'enhanced', 'versions' => $versions, 'title' => 'phpBB API Documentation', @@ -54,4 +54,6 @@ return new Sami\Sami($iterator, array( 'default_opened_level' => 2, // Do not use JsonStore. See https://github.com/fabpot/Sami/issues/79 'store' => new PhpbbArrayStore, -)); +); + +return new Sami\Sami($iterator, $config); diff --git a/travis/sami.conf.php b/travis/sami.conf.php new file mode 100644 index 0000000000..8e7cfa42e9 --- /dev/null +++ b/travis/sami.conf.php @@ -0,0 +1,19 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require __DIR__ . '/../build/' . basename(__FILE__); + +// Removing the versions array key will make Sami use the current branch. +unset($config['versions']); + +return new Sami\Sami($iterator, $config); From 873d1c6d575345619fb2c8ed65b9742dec59a338 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 9 Aug 2014 15:06:34 +0200 Subject: [PATCH 2/3] [ticket/12941] Check for Sami parse errors on Travis CI. PHPBB3-12941 --- .travis.yml | 1 + travis/check-sami-parse-errors.sh | 33 +++++++++++++++++++++++++++++++ travis/setup-phpbb.sh | 1 + travis/setup-unbuffer.sh | 14 +++++++++++++ 4 files changed, 49 insertions(+) create mode 100755 travis/check-sami-parse-errors.sh create mode 100755 travis/setup-unbuffer.sh diff --git a/.travis.yml b/.travis.yml index a246590bb5..cbba07b16d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,6 +37,7 @@ before_script: script: - travis/phing-sniff.sh $DB $TRAVIS_PHP_VERSION + - travis/check-sami-parse-errors.sh $DB $TRAVIS_PHP_VERSION - travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION - travis/check-executable-files.sh $DB $TRAVIS_PHP_VERSION ./ - phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml diff --git a/travis/check-sami-parse-errors.sh b/travis/check-sami-parse-errors.sh new file mode 100755 index 0000000000..847c54a61a --- /dev/null +++ b/travis/check-sami-parse-errors.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e + +DB=$1 +TRAVIS_PHP_VERSION=$2 + +if [ "$TRAVIS_PHP_VERSION" == "5.3.3" -a "$DB" == "mysqli" ] +then + # Workarounds for + # https://github.com/fabpot/Sami/issues/116 + # and + # https://github.com/fabpot/Sami/issues/117 + errors=$( + unbuffer phpBB/vendor/bin/sami.php parse travis/sami.conf.php -v | \ + sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | \ + grep "ERROR: " | \ + tee /dev/tty | \ + wc -l + ) + if [ "$errors" != "0" ] + then + exit 1 + fi +fi diff --git a/travis/setup-phpbb.sh b/travis/setup-phpbb.sh index f065faf8e2..d829772196 100755 --- a/travis/setup-phpbb.sh +++ b/travis/setup-phpbb.sh @@ -17,6 +17,7 @@ TRAVIS_PHP_VERSION=$2 if [ "$TRAVIS_PHP_VERSION" == "5.3.3" -a "$DB" == "mysqli" ] then travis/setup-exiftool.sh + travis/setup-unbuffer.sh fi if [ "$DB" == "mariadb" ] diff --git a/travis/setup-unbuffer.sh b/travis/setup-unbuffer.sh new file mode 100755 index 0000000000..4423d1b8b6 --- /dev/null +++ b/travis/setup-unbuffer.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e + +sudo apt-get update +sudo apt-get install -y expect-dev From 076d4ddd7f146092ce79b4ea1d11b5731ed2e695 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 9 Aug 2014 18:08:49 +0200 Subject: [PATCH 3/3] [ticket/12941] Fix remaining Sami complaints. PHPBB3-12941 --- phpBB/includes/functions_upload.php | 2 ++ phpBB/phpbb/avatar/driver/upload.php | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index e973e6ec28..a0a67ccf3d 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -586,6 +586,7 @@ class fileupload * Upload file from users harddisk * * @param string $form_name Form name assigned to the file input field (if it is an array, the key has to be specified) + * @param \phpbb\mimetype\guesser $mimetype_guesser Mimetype guesser * @param \phpbb\plupload\plupload $plupload The plupload object * * @return object $file Object "filespec" is returned, all further operations can be done with this object @@ -743,6 +744,7 @@ class fileupload * Uploads file from given url * * @param string $upload_url URL pointing to file to upload, for example http://www.foobar.com/example.gif + * @param \phpbb\mimetype\guesser $mimetype_guesser Mimetype guesser * @return object $file Object "filespec" is returned, all further operations can be done with this object * @access public */ diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index edc5941602..f5ba50451a 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -27,7 +27,6 @@ class upload extends \phpbb\avatar\driver\driver * Construct a driver object * * @param \phpbb\config\config $config phpBB configuration - * @param \phpbb\request\request $request Request object * @param string $phpbb_root_path Path to the phpBB root * @param string $php_ext PHP file extension * @param \phpbb_path_helper $path_helper phpBB path helper