aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/build.xml18
-rwxr-xr-xbuild/build_changelog.php2
-rw-r--r--build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php6
-rw-r--r--build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php118
-rwxr-xr-xbuild/package.php1
-rw-r--r--build/sami-all.conf.php30
-rw-r--r--build/sami-checkout.conf.php (renamed from build/sami.conf.php)15
7 files changed, 118 insertions, 72 deletions
diff --git a/build/build.xml b/build/build.xml
index 8ac7c1758c..b0a9190898 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -2,9 +2,9 @@
<project name="phpBB" description="The phpBB forum software" default="all" basedir="../">
<!-- a few settings for the build -->
- <property name="newversion" value="3.1.0-RC5-dev" />
- <property name="prevversion" value="3.1.0-RC4" />
- <property name="olderversions" value="3.0.12, 3.1.0-a1, 3.1.0-a2, 3.1.0-a3, 3.1.0-b1, 3.1.0-b2, 3.1.0-b3, 3.1.0-b4, 3.1.0-RC1, 3.1.0-RC2, 3.1.0-RC3" />
+ <property name="newversion" value="3.1.4-dev" />
+ <property name="prevversion" value="3.1.3" />
+ <property name="olderversions" value="3.0.12, 3.0.13, 3.0.13-PL1, 3.1.0, 3.1.1, 3.1.2" />
<!-- no configuration should be needed beyond this point -->
<property name="oldversions" value="${olderversions}, ${prevversion}" />
@@ -117,9 +117,16 @@
</if>
</target>
+ <!-- Builds docs for current branch into build/api/output/master -->
<target name="docs">
<exec dir="."
- command="phpBB/vendor/bin/sami.php update build/sami.conf.php"
+ command="phpBB/vendor/bin/sami.php update build/sami-checkout.conf.php"
+ passthru="true" />
+ </target>
+ <!-- Builds docs for multiple branches/tags into build/api/output/$branch -->
+ <target name="docs-all">
+ <exec dir="."
+ command="phpBB/vendor/bin/sami.php update build/sami-all.conf.php"
passthru="true" />
</target>
@@ -273,6 +280,9 @@
</else>
</if>
+ <!-- Create schema.json -->
+ <exec dir="${dir}" command="php develop/create_schema_files.php" />
+
<delete file="${dir}/config.php" />
<delete dir="${dir}/develop" />
<delete dir="${dir}/install/data" />
diff --git a/build/build_changelog.php b/build/build_changelog.php
index be0fb625ea..2d38480f9f 100755
--- a/build/build_changelog.php
+++ b/build/build_changelog.php
@@ -20,7 +20,7 @@ if ($_SERVER['argc'] != 2)
$fixVersion = $_SERVER['argv'][1];
-$query = 'project = PHPBB3
+$query = 'project IN (PHPBB3, SECURITY)
AND resolution = Fixed
AND fixVersion = "' . $fixVersion . '"
AND status IN ("Unverified Fix", Closed)';
diff --git a/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php
index fa7d3b40c1..8337cf02ee 100644
--- a/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php
+++ b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php
@@ -84,12 +84,12 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
$line = $tokens[$i]['content'];
// Check that each line starts with a '*'
- if (substr($line, 0, 1) !== '*')
+ if (substr($line, 0, 1) !== '*' && substr($line, 0, 2) !== ' *')
{
- $message = 'The file doc comment should not be idented.';
+ $message = 'The file doc comment should not be indented.';
$phpcsFile->addWarning($message, $i);
}
- else if (preg_match('/^\*\s+@([\w]+)\s+(.*)$/', $line, $match) !== 0)
+ else if (preg_match('/^[ ]?\*\s+@([\w]+)\s+(.*)$/', $line, $match) !== 0)
{
if (!isset($tags[$match[1]]))
{
diff --git a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
index f81ec46579..18cb8ba82e 100644
--- a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
+++ b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
@@ -24,6 +24,23 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
return array(T_USE);
}
+ protected function check($phpcsFile, $found_name, $full_name, $short_name, $line)
+ {
+
+ if ($found_name === $full_name)
+ {
+ $error = 'Either use statement or full name must be used.';
+ $phpcsFile->addError($error, $line, 'FullName');
+ }
+
+ if ($found_name === $short_name)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
/**
* {@inheritdoc}
*/
@@ -74,16 +91,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
$simple_class_name = trim($phpcsFile->getTokensAsString($simple_class_name_start, ($simple_class_name_end - $simple_class_name_start)));
- if ($simple_class_name === $class_name_full)
- {
- $error = 'Either use statement or full name must be used.';
- $phpcsFile->addError($error, $simple_statement, 'FullName');
- }
-
- if ($simple_class_name === $class_name_short)
- {
- $ok = true;
- }
+ $ok = $this->check($phpcsFile, $simple_class_name, $class_name_full, $class_name_short, $simple_statement) ? true : $ok;
}
}
@@ -98,16 +106,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
$paamayim_nekudotayim_class_name = trim($phpcsFile->getTokensAsString($paamayim_nekudotayim_class_name_start + 1, ($paamayim_nekudotayim_class_name_end - $paamayim_nekudotayim_class_name_start)));
- if ($paamayim_nekudotayim_class_name === $class_name_full)
- {
- $error = 'Either use statement or full name must be used.';
- $phpcsFile->addError($error, $paamayim_nekudotayim, 'FullName');
- }
-
- if ($paamayim_nekudotayim_class_name === $class_name_short)
- {
- $ok = true;
- }
+ $ok = $this->check($phpcsFile, $paamayim_nekudotayim_class_name, $class_name_full, $class_name_short, $paamayim_nekudotayim) ? true : $ok;
}
// Checks in implements
@@ -126,16 +125,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
$implements_class_name = trim($phpcsFile->getTokensAsString($implements_class_name_start, ($implements_class_name_end - $implements_class_name_start)));
- if ($implements_class_name === $class_name_full)
- {
- $error = 'Either use statement or full name must be used.';
- $phpcsFile->addError($error, $implements, 'FullName');
- }
-
- if ($implements_class_name === $class_name_short)
- {
- $ok = true;
- }
+ $ok = $this->check($phpcsFile, $implements_class_name, $class_name_full, $class_name_short, $implements) ? true : $ok;
}
}
@@ -145,34 +135,64 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
{
$old_function_declaration = $function_declaration;
- $end_function = $phpcsFile->findNext(array(T_CLOSE_PARENTHESIS), ($function_declaration + 1));
- $old_argument = $function_declaration;
- while (($argument = $phpcsFile->findNext(T_VARIABLE, ($old_argument + 1), $end_function)) !== false)
+ // Check docblocks
+ $find = array(
+ T_COMMENT,
+ T_DOC_COMMENT,
+ T_CLASS,
+ T_FUNCTION,
+ T_OPEN_TAG,
+ );
+
+ $comment_end = $phpcsFile->findPrevious($find, ($function_declaration - 1));
+ if ($comment_end !== false)
{
- $old_argument = $argument;
-
- $start_argument = $phpcsFile->findPrevious(array(T_OPEN_PARENTHESIS, T_COMMA), $argument);
- $argument_class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), ($start_argument + 1), $argument);
-
- // Skip the parameter if no type is defined.
- if ($argument_class_name_start !== false)
+ if (!$tokens[$comment_end]['code'] !== T_DOC_COMMENT)
{
- $argument_class_name_end = $phpcsFile->findNext($find, ($argument_class_name_start + 1), null, true);
-
- $argument_class_name = $phpcsFile->getTokensAsString($argument_class_name_start, ($argument_class_name_end - $argument_class_name_start - 1));
+ $comment_start = ($phpcsFile->findPrevious(T_DOC_COMMENT, ($comment_end - 1), null, true) + 1);
+ $comment = $phpcsFile->getTokensAsString($comment_start, ($comment_end - $comment_start + 1));
- if ($argument_class_name === $class_name_full)
+ try
{
- $error = 'Either use statement or full name must be used.';
- $phpcsFile->addError($error, $function_declaration, 'FullName');
+ $comment_parser = new PHP_CodeSniffer_CommentParser_FunctionCommentParser($comment, $phpcsFile);
+ $comment_parser->parse();
+
+ // Check @param
+ foreach ($comment_parser->getParams() as $param) {
+ $type = $param->getType();
+ $types = explode('|', str_replace('[]', '', $type));
+ foreach ($types as $type)
+ {
+ $ok = $this->check($phpcsFile, $type, $class_name_full, $class_name_short, $param->getLine() + $comment_start) ? true : $ok;
+ }
+ }
+
+ // Check @return
+ $return = $comment_parser->getReturn();
+ if ($return !== null)
+ {
+ $type = $return->getValue();
+ $types = explode('|', str_replace('[]', '', $type));
+ foreach ($types as $type)
+ {
+ $ok = $this->check($phpcsFile, $type, $class_name_full, $class_name_short, $return->getLine() + $comment_start) ? true : $ok;
+ }
+ }
}
-
- if ($argument_class_name === $class_name_short)
+ catch (PHP_CodeSniffer_CommentParser_ParserException $e)
{
- $ok = true;
+ $line = ($e->getLineWithinComment() + $comment_start);
+ $phpcsFile->addError($e->getMessage(), $line, 'FailedParse');
}
}
}
+
+ // Check type hint
+ $params = $phpcsFile->getMethodParameters($function_declaration);
+ foreach ($params as $param)
+ {
+ $ok = $this->check($phpcsFile, $param['type_hint'], $class_name_full, $class_name_short, $function_declaration) ? true : $ok;
+ }
}
if (!$ok)
diff --git a/build/package.php b/build/package.php
index c0db0c4011..d168957ca5 100755
--- a/build/package.php
+++ b/build/package.php
@@ -394,6 +394,7 @@ if (sizeof($package->old_packages))
$package->run_command('mkdir ' . $package->get('files_directory') . '/release');
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $package->get('files_directory') . '/release');
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $package->get('files_directory') . '/release');
+ $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $package->get('files_directory') . '/release');
$package->run_command('rm -v ' . $package->get('files_directory') . '/release/install/install_install.php');
$package->run_command('rm -v ' . $package->get('files_directory') . '/release/install/install_update.php');
diff --git a/build/sami-all.conf.php b/build/sami-all.conf.php
new file mode 100644
index 0000000000..68350fee8f
--- /dev/null
+++ b/build/sami-all.conf.php
@@ -0,0 +1,30 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+require __DIR__ . '/sami-checkout.conf.php';
+
+$config['versions'] = Sami\Version\GitVersionCollection::create(__DIR__ . '/../')
+ /*
+ This would be nice, but currently causes various problems that need
+ debugging.
+ ->addFromTags('release-3.0.*')
+ ->add('develop-olympus', '3.0-next (olympus)')
+ ->addFromTags('release-3.1.*')
+ ->add('develop-ascraeus', '3.1-next (ascraeus)')
+ ->add('develop')
+ */
+ ->add('develop-olympus')
+ ->add('develop-ascraeus')
+;
+
+return new Sami\Sami($iterator, $config);
diff --git a/build/sami.conf.php b/build/sami-checkout.conf.php
index 78d532631c..abbf1d257e 100644
--- a/build/sami.conf.php
+++ b/build/sami-checkout.conf.php
@@ -31,23 +31,8 @@ $iterator = Symfony\Component\Finder\Finder::create()
->notPath('data')
;
-$versions = Sami\Version\GitVersionCollection::create(__DIR__ . '/../')
- /*
- This would be nice, but currently causes various problems that need
- debugging.
- ->addFromTags('release-3.0.*')
- ->add('develop-olympus', '3.0-next (olympus)')
- ->addFromTags('release-3.1.*')
- ->add('develop-ascraeus', '3.1-next (ascraeus)')
- ->add('develop')
- */
- ->add('develop-olympus')
- ->add('develop-ascraeus')
-;
-
$config = array(
'theme' => 'enhanced',
- 'versions' => $versions,
'title' => 'phpBB API Documentation',
'build_dir' => __DIR__.'/api/output/%version%',
'cache_dir' => __DIR__.'/api/cache/%version%',