Compare commits
1 Commits
prep-relea
...
release-2.
Author | SHA1 | Date | |
---|---|---|---|
|
7944f41f6b |
@@ -1,18 +0,0 @@
|
|||||||
# This file is for standardising the coding style between different editors
|
|
||||||
# http://editorconfig.org/
|
|
||||||
|
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
end_of_line = lf
|
|
||||||
indent_size = 4
|
|
||||||
indent_style = tab
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
|
|
||||||
[*.md]
|
|
||||||
trim_trailing_whitespace = false
|
|
||||||
|
|
||||||
[*.yml]
|
|
||||||
indent_size = 4
|
|
||||||
indent_style = space
|
|
6
.github/CONTRIBUTING.md
vendored
@@ -1,6 +0,0 @@
|
|||||||
## CONTRIBUTE
|
|
||||||
|
|
||||||
1. [Create an account on phpBB.com](http://www.phpbb.com/community/ucp.php?mode=register)
|
|
||||||
2. [Create a ticket (unless there already is one)](http://tracker.phpbb.com/secure/CreateIssue!default.jspa)
|
|
||||||
3. Read our [Coding guidelines](https://area51.phpbb.com/docs/dev/master/development/coding_guidelines.html) and [Git Contribution Guidelines](https://area51.phpbb.com/docs/dev/master/development/git.html)
|
|
||||||
4. Send us a pull request
|
|
10
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,10 +0,0 @@
|
|||||||
Checklist:
|
|
||||||
|
|
||||||
- [ ] Correct branch: master for new features; 3.3.x for fixes
|
|
||||||
- [ ] Tests pass
|
|
||||||
- [ ] Code follows coding guidelines: [master](https://area51.phpbb.com/docs/dev/master/development/coding_guidelines.html) and [3.3.x](https://area51.phpbb.com/docs/dev/3.3.x/development/coding_guidelines.html)
|
|
||||||
- [ ] Commit follows commit message [format](https://area51.phpbb.com/docs/dev/3.3.x/development/git.html)
|
|
||||||
|
|
||||||
Tracker ticket (set the ticket ID to **your ticket ID**):
|
|
||||||
|
|
||||||
https://tracker.phpbb.com/browse/PHPBB3-12345
|
|
26
.github/check-doctum-parse-errors.sh
vendored
@@ -1,26 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ ! -f doctum.phar ]; then
|
|
||||||
# Download the latest (5.1.x) release if the file does not exist
|
|
||||||
# Remove it to update your phar
|
|
||||||
curl -O https://doctum.long-term.support/releases/5.1/doctum.phar
|
|
||||||
rm -f doctum.phar.sha256
|
|
||||||
curl -O https://doctum.long-term.support/releases/5.1/doctum.phar.sha256
|
|
||||||
sha256sum --strict --check doctum.phar.sha256
|
|
||||||
rm -f doctum.phar.sha256
|
|
||||||
# You can fetch the latest (5.1.x) version code here:
|
|
||||||
# https://doctum.long-term.support/releases/5.1/VERSION
|
|
||||||
fi
|
|
||||||
# Show the version to inform users of the script
|
|
||||||
php doctum.phar --version
|
|
||||||
php doctum.phar parse build/doctum-checkout.conf.php -v
|
|
63
.github/check-executable-files.sh
vendored
@@ -1,63 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
|
|
||||||
root="$1"
|
|
||||||
path="${root}phpBB/"
|
|
||||||
|
|
||||||
# Check the permissions of the files
|
|
||||||
|
|
||||||
# The following variables MUST NOT contain any wildcard
|
|
||||||
# Directories to skip
|
|
||||||
directories_skipped="-path ${path}develop -o -path ${path}vendor"
|
|
||||||
|
|
||||||
# Files to skip
|
|
||||||
files_skipped="-false"
|
|
||||||
|
|
||||||
# Files which have to be executable
|
|
||||||
executable_files="-path ${path}bin/* -o -path ${path}install/phpbbcli.php"
|
|
||||||
|
|
||||||
incorrect_files=$( \
|
|
||||||
find ${path} \
|
|
||||||
'(' \
|
|
||||||
'(' \
|
|
||||||
${directories_skipped} \
|
|
||||||
')' \
|
|
||||||
-a -type d -prune -a -type f \
|
|
||||||
')' -o \
|
|
||||||
'(' \
|
|
||||||
-type f -a \
|
|
||||||
-not '(' \
|
|
||||||
${files_skipped} \
|
|
||||||
')' -a \
|
|
||||||
'(' \
|
|
||||||
'(' \
|
|
||||||
'(' \
|
|
||||||
${executable_files} \
|
|
||||||
')' -a \
|
|
||||||
-not -perm /100 \
|
|
||||||
')' -o \
|
|
||||||
'(' \
|
|
||||||
-not '(' \
|
|
||||||
${executable_files} \
|
|
||||||
')' -a \
|
|
||||||
-perm /111 \
|
|
||||||
')' \
|
|
||||||
')' \
|
|
||||||
')' \
|
|
||||||
)
|
|
||||||
|
|
||||||
if [ "${incorrect_files}" != '' ]
|
|
||||||
then
|
|
||||||
echo "The following files do not have proper permissions:";
|
|
||||||
ls -la ${incorrect_files}
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
14
.github/check-image-icc-profiles.sh
vendored
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
|
|
||||||
find . -type f -a -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$' -a -not -wholename '*vendor/*' | \
|
|
||||||
parallel --gnu --keep-order 'phpBB/develop/strip_icc_profiles.sh {}'
|
|
64
.github/ext-check-executable-files.sh
vendored
@@ -1,64 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
|
|
||||||
root="$1"
|
|
||||||
extname="$2"
|
|
||||||
path="${root}phpBB/ext/${extname}/"
|
|
||||||
|
|
||||||
# Check the permissions of the files
|
|
||||||
|
|
||||||
# The following variables MUST NOT contain any wildcard
|
|
||||||
# Directories to skip
|
|
||||||
directories_skipped="-path ${path}develop -o -path ${path}vendor -o -path ${path}.git"
|
|
||||||
|
|
||||||
# Files to skip
|
|
||||||
files_skipped="-false"
|
|
||||||
|
|
||||||
# Files which have to be executable
|
|
||||||
executable_files="-path ${path}bin/* -o -path ${path}install/phpbbcli.php"
|
|
||||||
|
|
||||||
incorrect_files=$( \
|
|
||||||
find ${path} \
|
|
||||||
'(' \
|
|
||||||
'(' \
|
|
||||||
${directories_skipped} \
|
|
||||||
')' \
|
|
||||||
-a -type d -prune -a -type f \
|
|
||||||
')' -o \
|
|
||||||
'(' \
|
|
||||||
-type f -a \
|
|
||||||
-not '(' \
|
|
||||||
${files_skipped} \
|
|
||||||
')' -a \
|
|
||||||
'(' \
|
|
||||||
'(' \
|
|
||||||
'(' \
|
|
||||||
${executable_files} \
|
|
||||||
')' -a \
|
|
||||||
-not -perm /100 \
|
|
||||||
')' -o \
|
|
||||||
'(' \
|
|
||||||
-not '(' \
|
|
||||||
${executable_files} \
|
|
||||||
')' -a \
|
|
||||||
-perm /111 \
|
|
||||||
')' \
|
|
||||||
')' \
|
|
||||||
')' \
|
|
||||||
)
|
|
||||||
|
|
||||||
if [ "${incorrect_files}" != '' ]
|
|
||||||
then
|
|
||||||
echo "The following files do not have proper permissions:";
|
|
||||||
ls -la ${incorrect_files}
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
25
.github/ext-sniff.sh
vendored
@@ -1,25 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
EXTNAME=$1
|
|
||||||
NOTESTS=$2
|
|
||||||
|
|
||||||
if [ "$NOTESTS" == "1" ]
|
|
||||||
then
|
|
||||||
phpBB/vendor/bin/phpcs \
|
|
||||||
-s \
|
|
||||||
--extensions=php \
|
|
||||||
--standard=build/code_sniffer/ruleset-php-extensions.xml \
|
|
||||||
--ignore=*/"$EXTNAME"/tests/*,*/"$EXTNAME"/vendor/* \
|
|
||||||
phpBB/ext/"$EXTNAME"
|
|
||||||
fi
|
|
41
.github/ldap/base.ldif
vendored
@@ -1,41 +0,0 @@
|
|||||||
dn: dc=example,dc=com
|
|
||||||
objectClass: top
|
|
||||||
objectClass: dcObject
|
|
||||||
objectClass: organization
|
|
||||||
o: example
|
|
||||||
dc: example
|
|
||||||
|
|
||||||
dn: ou=foo,dc=example,dc=com
|
|
||||||
objectClass: organizationalUnit
|
|
||||||
ou: foo
|
|
||||||
|
|
||||||
dn: cn=admin,dc=example,dc=com
|
|
||||||
objectClass: simpleSecurityObject
|
|
||||||
objectClass: organizationalRole
|
|
||||||
cn: admin
|
|
||||||
description: LDAP administrator
|
|
||||||
userPassword:: e1NTSEF9NytMR2gveUxTMzdsc3RRd1V1dENZSVA0TWdYdm9SdDY=
|
|
||||||
|
|
||||||
dn: ou=group,dc=example,dc=com
|
|
||||||
objectClass: organizationalUnit
|
|
||||||
ou: group
|
|
||||||
|
|
||||||
dn: cn=admin,ou=foo,dc=example,dc=com
|
|
||||||
objectClass: posixAccount
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
objectClass: organizationalPerson
|
|
||||||
objectClass: person
|
|
||||||
loginShell: /bin/bash
|
|
||||||
homeDirectory: /home/admin
|
|
||||||
uid: admin
|
|
||||||
cn: admin
|
|
||||||
uidNumber: 10000
|
|
||||||
gidNumber: 10000
|
|
||||||
sn: admin
|
|
||||||
mail: admin@example.com
|
|
||||||
userPassword:: e1NTSEF9WHpueGZURHZZc21JSkl6czdMVXBjdCtWYTA1dlMzVlQ=
|
|
||||||
|
|
||||||
dn: cn=admin,ou=group,dc=example,dc=com
|
|
||||||
objectClass: posixGroup
|
|
||||||
gidNumber: 10000
|
|
||||||
cn: admin
|
|
17
.github/ldap/slapd.conf
vendored
@@ -1,17 +0,0 @@
|
|||||||
# See slapd.conf(5) for details on configuration options.
|
|
||||||
include /etc/ldap/schema/core.schema
|
|
||||||
include /etc/ldap/schema/cosine.schema
|
|
||||||
include /etc/ldap/schema/inetorgperson.schema
|
|
||||||
include /etc/ldap/schema/nis.schema
|
|
||||||
|
|
||||||
pidfile /var/tmp/slapd/slapd.pid
|
|
||||||
argsfile /var/tmp/slapd/slapd.args
|
|
||||||
|
|
||||||
modulepath /usr/lib/openldap
|
|
||||||
|
|
||||||
database ldif
|
|
||||||
directory /var/tmp/slapd
|
|
||||||
|
|
||||||
suffix "dc=example,dc=com"
|
|
||||||
rootdn "cn=admin,dc=example,dc=com"
|
|
||||||
rootpw adminadmin
|
|
16
.github/phing-sniff.sh
vendored
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
cd build
|
|
||||||
../phpBB/vendor/bin/phing sniff
|
|
||||||
cd ..
|
|
39
.github/phpunit-mariadb-github.xml
vendored
@@ -1,39 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<phpunit backupGlobals="true"
|
|
||||||
backupStaticAttributes="false"
|
|
||||||
colors="true"
|
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="false"
|
|
||||||
stopOnFailure="false"
|
|
||||||
verbose="true"
|
|
||||||
bootstrap="../tests/bootstrap.php">
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="phpBB Test Suite">
|
|
||||||
<directory suffix="_test.php">../tests</directory>
|
|
||||||
<exclude>../tests/functional</exclude>
|
|
||||||
<exclude>../tests/lint_test.php</exclude>
|
|
||||||
</testsuite>
|
|
||||||
<testsuite name="phpBB Functional Tests">
|
|
||||||
<directory suffix="_test.php">../tests/functional</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
|
|
||||||
<groups>
|
|
||||||
<exclude>
|
|
||||||
<group>slow</group>
|
|
||||||
</exclude>
|
|
||||||
</groups>
|
|
||||||
|
|
||||||
<php>
|
|
||||||
<server name="PHPBB_TEST_DBMS" value="mysqli" />
|
|
||||||
<server name="PHPBB_TEST_DBHOST" value="0.0.0.0" />
|
|
||||||
<server name="PHPBB_TEST_DBPORT" value="3306" />
|
|
||||||
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
|
|
||||||
<server name="PHPBB_TEST_DBUSER" value="root" />
|
|
||||||
<server name="PHPBB_TEST_DBPASSWD" value="" />
|
|
||||||
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
|
|
||||||
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
|
|
||||||
</php>
|
|
||||||
</phpunit>
|
|
41
.github/phpunit-mssql-github.xml
vendored
@@ -1,41 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<phpunit backupGlobals="true"
|
|
||||||
backupStaticAttributes="false"
|
|
||||||
colors="true"
|
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="false"
|
|
||||||
stopOnFailure="false"
|
|
||||||
verbose="true"
|
|
||||||
bootstrap="../tests/bootstrap.php">
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="phpBB Test Suite">
|
|
||||||
<directory suffix="_test.php">../tests</directory>
|
|
||||||
<exclude>../tests/functional</exclude>
|
|
||||||
<exclude>../tests/lint_test.php</exclude>
|
|
||||||
</testsuite>
|
|
||||||
<testsuite name="phpBB Functional Tests">
|
|
||||||
<directory suffix="_test.php">../tests/functional</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
|
|
||||||
<groups>
|
|
||||||
<exclude>
|
|
||||||
<group>slow</group>
|
|
||||||
</exclude>
|
|
||||||
</groups>
|
|
||||||
|
|
||||||
<php>
|
|
||||||
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\mssqlnative" />
|
|
||||||
<server name="PHPBB_TEST_DBHOST" value="127.0.0.1" />
|
|
||||||
<server name="PHPBB_TEST_DBPORT" value="" />
|
|
||||||
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
|
|
||||||
<server name="PHPBB_TEST_DBUSER" value="sa" />
|
|
||||||
<server name="PHPBB_TEST_DBPASSWD" value="Pssw0rd_12" />
|
|
||||||
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
|
|
||||||
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
|
|
||||||
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
|
|
||||||
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
|
|
||||||
</php>
|
|
||||||
</phpunit>
|
|
41
.github/phpunit-mysql-github.xml
vendored
@@ -1,41 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<phpunit backupGlobals="true"
|
|
||||||
backupStaticAttributes="false"
|
|
||||||
colors="true"
|
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="false"
|
|
||||||
stopOnFailure="false"
|
|
||||||
verbose="true"
|
|
||||||
bootstrap="../tests/bootstrap.php">
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="phpBB Test Suite">
|
|
||||||
<directory suffix="_test.php">../tests</directory>
|
|
||||||
<exclude>../tests/functional</exclude>
|
|
||||||
<exclude>../tests/lint_test.php</exclude>
|
|
||||||
</testsuite>
|
|
||||||
<testsuite name="phpBB Functional Tests">
|
|
||||||
<directory suffix="_test.php">../tests/functional</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
|
|
||||||
<groups>
|
|
||||||
<exclude>
|
|
||||||
<group>slow</group>
|
|
||||||
</exclude>
|
|
||||||
</groups>
|
|
||||||
|
|
||||||
<php>
|
|
||||||
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\mysqli" />
|
|
||||||
<server name="PHPBB_TEST_DBHOST" value="0.0.0.0" />
|
|
||||||
<server name="PHPBB_TEST_DBPORT" value="3306" />
|
|
||||||
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
|
|
||||||
<server name="PHPBB_TEST_DBUSER" value="root" />
|
|
||||||
<server name="PHPBB_TEST_DBPASSWD" value="" />
|
|
||||||
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
|
|
||||||
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
|
|
||||||
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
|
|
||||||
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
|
|
||||||
</php>
|
|
||||||
</phpunit>
|
|
41
.github/phpunit-postgres-github.xml
vendored
@@ -1,41 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<phpunit backupGlobals="true"
|
|
||||||
backupStaticAttributes="false"
|
|
||||||
colors="true"
|
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="false"
|
|
||||||
stopOnFailure="false"
|
|
||||||
verbose="true"
|
|
||||||
bootstrap="../tests/bootstrap.php">
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="phpBB Test Suite">
|
|
||||||
<directory suffix="_test.php">../tests</directory>
|
|
||||||
<exclude>../tests/functional</exclude>
|
|
||||||
<exclude>../tests/lint_test.php</exclude>
|
|
||||||
</testsuite>
|
|
||||||
<testsuite name="phpBB Functional Tests">
|
|
||||||
<directory suffix="_test.php">../tests/functional</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
|
|
||||||
<groups>
|
|
||||||
<exclude>
|
|
||||||
<group>slow</group>
|
|
||||||
</exclude>
|
|
||||||
</groups>
|
|
||||||
|
|
||||||
<php>
|
|
||||||
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\postgres"/>
|
|
||||||
<server name="PHPBB_TEST_DBHOST" value="localhost" />
|
|
||||||
<server name="PHPBB_TEST_DBPORT" value="5432" />
|
|
||||||
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
|
|
||||||
<server name="PHPBB_TEST_DBUSER" value="postgres" />
|
|
||||||
<server name="PHPBB_TEST_DBPASSWD" value="postgres" />
|
|
||||||
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
|
|
||||||
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
|
|
||||||
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
|
|
||||||
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
|
|
||||||
</php>
|
|
||||||
</phpunit>
|
|
41
.github/phpunit-psql-windows-github.xml
vendored
@@ -1,41 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<phpunit backupGlobals="true"
|
|
||||||
backupStaticAttributes="false"
|
|
||||||
colors="true"
|
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="false"
|
|
||||||
stopOnFailure="false"
|
|
||||||
verbose="true"
|
|
||||||
bootstrap="../tests/bootstrap.php">
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="phpBB Test Suite">
|
|
||||||
<directory suffix="_test.php">../tests</directory>
|
|
||||||
<exclude>../tests/functional</exclude>
|
|
||||||
<exclude>../tests/lint_test.php</exclude>
|
|
||||||
</testsuite>
|
|
||||||
<testsuite name="phpBB Functional Tests">
|
|
||||||
<directory suffix="_test.php">../tests/functional</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
|
|
||||||
<groups>
|
|
||||||
<exclude>
|
|
||||||
<group>slow</group>
|
|
||||||
</exclude>
|
|
||||||
</groups>
|
|
||||||
|
|
||||||
<php>
|
|
||||||
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\postgres"/>
|
|
||||||
<server name="PHPBB_TEST_DBHOST" value="localhost" />
|
|
||||||
<server name="PHPBB_TEST_DBPORT" value="5432" />
|
|
||||||
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
|
|
||||||
<server name="PHPBB_TEST_DBUSER" value="postgres" />
|
|
||||||
<server name="PHPBB_TEST_DBPASSWD" value="root" />
|
|
||||||
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
|
|
||||||
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
|
|
||||||
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
|
|
||||||
<server name="PHPBB_FUNCTIONAL_URL" value="http://phpbb.test/" />
|
|
||||||
</php>
|
|
||||||
</phpunit>
|
|
35
.github/phpunit-sqlite3-github.xml
vendored
@@ -1,35 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<phpunit backupGlobals="true"
|
|
||||||
backupStaticAttributes="false"
|
|
||||||
colors="true"
|
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="false"
|
|
||||||
stopOnFailure="false"
|
|
||||||
verbose="true"
|
|
||||||
bootstrap="../tests/bootstrap.php">
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="phpBB Test Suite">
|
|
||||||
<directory suffix="_test.php">../tests</directory>
|
|
||||||
<exclude>../tests/functional</exclude>
|
|
||||||
<exclude>../tests/lint_test.php</exclude>
|
|
||||||
</testsuite>
|
|
||||||
<testsuite name="phpBB Functional Tests">
|
|
||||||
<directory suffix="_test.php">../tests/functional</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
|
|
||||||
<groups>
|
|
||||||
<exclude>
|
|
||||||
<group>slow</group>
|
|
||||||
</exclude>
|
|
||||||
</groups>
|
|
||||||
|
|
||||||
<php>
|
|
||||||
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
|
|
||||||
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
|
|
||||||
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
|
|
||||||
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
|
|
||||||
</php>
|
|
||||||
</phpunit>
|
|
22
.github/prepare-extension.sh
vendored
@@ -1,22 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
EXTNAME=$1
|
|
||||||
|
|
||||||
# Move the extension in place
|
|
||||||
mkdir --parents phpBB/ext/$EXTNAME
|
|
||||||
cp -R ../tmp/* phpBB/ext/$EXTNAME
|
|
||||||
|
|
||||||
# Move the test files for extensions in place
|
|
||||||
cp -R .github/*.xml phpBB/ext/$EXTNAME/.github
|
|
||||||
cp -R .github/*.sh phpBB/ext/$EXTNAME/.github
|
|
26
.github/setup-database.sh
vendored
@@ -1,26 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
DB=$1
|
|
||||||
MYISAM=$2
|
|
||||||
|
|
||||||
if [ "$DB" == "postgres" ]
|
|
||||||
then
|
|
||||||
psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres
|
|
||||||
psql -c 'create database phpbb_tests;' -U postgres
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$MYISAM" == '1' ]
|
|
||||||
then
|
|
||||||
mysql -h 127.0.0.1 -u root -e 'SET GLOBAL storage_engine=MyISAM;'
|
|
||||||
fi
|
|
14
.github/setup-exiftool.sh
vendored
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y parallel libimage-exiftool-perl
|
|
19
.github/setup-ldap.sh
vendored
@@ -1,19 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
sudo apt-get -y install ldap-utils slapd
|
|
||||||
mkdir /var/tmp/slapd
|
|
||||||
cp .github/ldap/slapd.conf /var/tmp/slapd/slapd.conf
|
|
||||||
slapd -d 256 -d 128 -f /var/tmp/slapd/slapd.conf -h ldap://localhost:3389 &
|
|
||||||
sleep 3
|
|
||||||
ldapadd -h localhost:3389 -D "cn=admin,dc=example,dc=com" -w adminadmin -f .github/ldap/base.ldif
|
|
36
.github/setup-phpbb.sh
vendored
@@ -1,36 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
DB=$1
|
|
||||||
PHP_VERSION=$2
|
|
||||||
NOTESTS=$3
|
|
||||||
|
|
||||||
if [ "$NOTESTS" == '1' ]
|
|
||||||
then
|
|
||||||
.github/setup-exiftool.sh
|
|
||||||
.github/setup-unbuffer.sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$NOTESTS" != '1' ]
|
|
||||||
then
|
|
||||||
.github/setup-webserver.sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd phpBB
|
|
||||||
php ../composer.phar install --dev --no-interaction
|
|
||||||
if [[ "$PHP_VERSION" =~ ^nightly$ || "$PHP_VERSION" =~ ^8 ]]
|
|
||||||
then
|
|
||||||
php ../composer.phar remove phpunit/dbunit --dev --update-with-dependencies \
|
|
||||||
&& php ../composer.phar require symfony/yaml:~4.4 misantron/dbunit:~5.0 phpunit/phpunit:^9.3 --dev --update-with-all-dependencies --ignore-platform-reqs
|
|
||||||
fi
|
|
||||||
cd ..
|
|
14
.github/setup-unbuffer.sh
vendored
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y expect-dev
|
|
87
.github/setup-webserver.sh
vendored
@@ -1,87 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y nginx coreutils
|
|
||||||
|
|
||||||
sudo service nginx stop
|
|
||||||
|
|
||||||
DIR=$(dirname "$0")
|
|
||||||
USER=$(whoami)
|
|
||||||
PHPBB_ROOT_PATH=$(realpath "$DIR/../phpBB")
|
|
||||||
NGINX_SITE_CONF="/etc/nginx/sites-enabled/default"
|
|
||||||
NGINX_CONF="/etc/nginx/nginx.conf"
|
|
||||||
APP_SOCK=$(realpath "$DIR")/php-app.sock
|
|
||||||
NGINX_PHP_CONF="$DIR/nginx-php.conf"
|
|
||||||
|
|
||||||
# php-fpm
|
|
||||||
PHP_FPM_BIN="/usr/sbin/php-fpm$PHP_VERSION"
|
|
||||||
PHP_FPM_CONF="$DIR/php-fpm.conf"
|
|
||||||
|
|
||||||
if [ "$PHP_VERSION" == '8.1' ]
|
|
||||||
then
|
|
||||||
if [ -f "/usr/sbin/php-fpm8.0" ]
|
|
||||||
then
|
|
||||||
PHP_FPM_BIN="/usr/sbin/php-fpm8.0"
|
|
||||||
elif [ ! -f $PHP_FPM_BIN ] && [ -f "/usr/bin/php-fpm" ]
|
|
||||||
then
|
|
||||||
PHP_FPM_BIN="/usr/bin/php-fpm"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f $PHP_FPM_BIN ] && [ "$PHP_VERSION" != '8.1' ]
|
|
||||||
then
|
|
||||||
sudo apt-get install php$PHP_VERSION-fpm php$PHP_VERSION-cli \
|
|
||||||
php$PHP_VERSION-curl php$PHP_VERSION-xml php$PHP_VERSION-mbstring \
|
|
||||||
php$PHP_VERSION-zip php$PHP_VERSION-mysql php$PHP_VERSION-sqlite3 \
|
|
||||||
php$PHP_VERSION-intl php$PHP_VERSION-gd php$PHP_VERSION-pgsql
|
|
||||||
sudo service php$PHP_VERSION-fpm start
|
|
||||||
sudo service php$PHP_VERSION-fpm status
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "
|
|
||||||
[global]
|
|
||||||
|
|
||||||
[ci]
|
|
||||||
user = $USER
|
|
||||||
group = $USER
|
|
||||||
listen = $APP_SOCK
|
|
||||||
listen.mode = 0666
|
|
||||||
pm = static
|
|
||||||
pm.max_children = 2
|
|
||||||
|
|
||||||
php_admin_value[memory_limit] = 128M
|
|
||||||
" > $PHP_FPM_CONF
|
|
||||||
|
|
||||||
sudo $PHP_FPM_BIN \
|
|
||||||
--fpm-config "$DIR/php-fpm.conf"
|
|
||||||
|
|
||||||
# nginx
|
|
||||||
sudo sed -i "s/user www-data;/user $USER;/g" $NGINX_CONF
|
|
||||||
sudo cp "$DIR/../phpBB/docs/nginx.sample.conf" "$NGINX_SITE_CONF"
|
|
||||||
sudo sed -i \
|
|
||||||
-e "s/example\.com/localhost/g" \
|
|
||||||
-e "s|root /path/to/phpbb;|root $PHPBB_ROOT_PATH;|g" \
|
|
||||||
$NGINX_SITE_CONF
|
|
||||||
|
|
||||||
# Generate FastCGI configuration for Nginx
|
|
||||||
echo "
|
|
||||||
upstream php {
|
|
||||||
server unix:$APP_SOCK;
|
|
||||||
}
|
|
||||||
" > $NGINX_PHP_CONF
|
|
||||||
|
|
||||||
sudo mv "$NGINX_PHP_CONF" /etc/nginx/conf.d/php.conf
|
|
||||||
|
|
||||||
sudo nginx -T
|
|
||||||
sudo service nginx start
|
|
540
.github/workflows/tests.yml
vendored
@@ -1,540 +0,0 @@
|
|||||||
name: Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- 3.3.x
|
|
||||||
- master
|
|
||||||
- 'prep-release-*'
|
|
||||||
tags:
|
|
||||||
- 'release-*'
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- 3.3.x
|
|
||||||
- master
|
|
||||||
- 'prep-release-*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# Basic checks, e.g. parse errors, commit messages, etc.
|
|
||||||
basic-checks:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- db: 'none'
|
|
||||||
php: '7.1'
|
|
||||||
NOTESTS: 1
|
|
||||||
|
|
||||||
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 100
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php }}
|
|
||||||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
|
|
||||||
coverage: none
|
|
||||||
|
|
||||||
- name: Get Composer Cache Directory
|
|
||||||
id: composer-cache
|
|
||||||
env:
|
|
||||||
PHP_VERSION: ${{ matrix.php }}
|
|
||||||
run: |
|
|
||||||
cd phpBB
|
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
||||||
echo "::set-output name=version::${PHP_VERSION%.*}"
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
- name: Cache Composer dependencies
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
|
||||||
key: composer-${{ steps.composer-cache.outputs.version }}-${{ hashFiles('phpBB/composer.lock') }}
|
|
||||||
|
|
||||||
- name: Setup environment for phpBB
|
|
||||||
env:
|
|
||||||
DB: ${{ matrix.db }}
|
|
||||||
PHP_VERSION: ${{ matrix.php }}
|
|
||||||
NOTESTS: '1'
|
|
||||||
run: |
|
|
||||||
.github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
|
|
||||||
|
|
||||||
- name: Phing sniff
|
|
||||||
run: |
|
|
||||||
.github/phing-sniff.sh
|
|
||||||
|
|
||||||
- name: Check doctum parse errors
|
|
||||||
run: |
|
|
||||||
.github/check-doctum-parse-errors.sh
|
|
||||||
|
|
||||||
- name: Check image ICC profiles
|
|
||||||
run: |
|
|
||||||
.github/check-image-icc-profiles.sh
|
|
||||||
|
|
||||||
- name: Check executable files
|
|
||||||
run: |
|
|
||||||
.github/check-executable-files.sh ./
|
|
||||||
|
|
||||||
- name: Check commit message
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
run: |
|
|
||||||
git fetch origin $GITHUB_BASE_REF &> /dev/null
|
|
||||||
git-tools/commit-msg-hook-range.sh $(git rev-parse origin/$GITHUB_BASE_REF)..$GITHUB_SHA
|
|
||||||
|
|
||||||
# Tests for MySQL and MariaDB
|
|
||||||
mysql-tests:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- php: '7.1'
|
|
||||||
db: "mariadb:10.1"
|
|
||||||
- php: '7.1'
|
|
||||||
db: "mariadb:10.2"
|
|
||||||
- php: '7.1'
|
|
||||||
db: "mariadb:10.3"
|
|
||||||
- php: '7.1'
|
|
||||||
db: "mariadb:10.4"
|
|
||||||
- php: '7.1'
|
|
||||||
db: "mariadb:10.5"
|
|
||||||
- php: '7.1'
|
|
||||||
db: "mysql:5.6"
|
|
||||||
db_alias: "MySQL Slow Tests"
|
|
||||||
SLOWTESTS: 1
|
|
||||||
- php: '7.1'
|
|
||||||
db: "mysql:5.6"
|
|
||||||
db_alias: "MyISAM Tests"
|
|
||||||
MYISAM: 1
|
|
||||||
- php: '7.1'
|
|
||||||
db: "mysql:5.6"
|
|
||||||
- php: '7.1'
|
|
||||||
db: "mysql:5.7"
|
|
||||||
- php: '7.2'
|
|
||||||
db: "mysql:5.7"
|
|
||||||
- php: '7.3'
|
|
||||||
db: "mysql:5.7"
|
|
||||||
- php: '7.4'
|
|
||||||
db: "mysql:5.7"
|
|
||||||
- php: '7.4'
|
|
||||||
db: "mysql:8.0"
|
|
||||||
- php: '8.0'
|
|
||||||
db: "mysql:5.7"
|
|
||||||
#- php: '8.1'
|
|
||||||
# db: "mysql:5.7"
|
|
||||||
|
|
||||||
name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }}
|
|
||||||
|
|
||||||
services:
|
|
||||||
mysql:
|
|
||||||
image: ${{ matrix.db }}
|
|
||||||
env:
|
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
|
||||||
MYSQL_DATABASE: phpbb_tests
|
|
||||||
ports:
|
|
||||||
- 3306:3306
|
|
||||||
options: >-
|
|
||||||
--health-cmd="mysqladmin ping"
|
|
||||||
--health-interval=10s
|
|
||||||
--health-timeout=5s
|
|
||||||
--health-retries=3
|
|
||||||
|
|
||||||
redis:
|
|
||||||
image: redis
|
|
||||||
options: >-
|
|
||||||
--health-cmd "redis-cli ping"
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
ports:
|
|
||||||
- 6379:6379
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- id: database-type
|
|
||||||
env:
|
|
||||||
MATRIX_DB: ${{ matrix.db }}
|
|
||||||
run: |
|
|
||||||
db=$(echo "${MATRIX_DB%%:*}")
|
|
||||||
echo "::set-output name=db::$db"
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php }}
|
|
||||||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
|
|
||||||
coverage: none
|
|
||||||
|
|
||||||
- name: Get Composer Cache Directory
|
|
||||||
id: composer-cache
|
|
||||||
env:
|
|
||||||
PHP_VERSION: ${{ matrix.php }}
|
|
||||||
run: |
|
|
||||||
cd phpBB
|
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
||||||
echo "::set-output name=version::${PHP_VERSION%.*}"
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
- name: Cache Composer dependencies
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
|
||||||
key: composer-${{ steps.composer-cache.outputs.version }}-${{ hashFiles('phpBB/composer.lock') }}
|
|
||||||
|
|
||||||
- name: Setup environment for phpBB
|
|
||||||
env:
|
|
||||||
DB: ${{steps.database-type.outputs.db}}
|
|
||||||
PHP_VERSION: ${{ matrix.php }}
|
|
||||||
NOTESTS: '0'
|
|
||||||
run: |
|
|
||||||
.github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
|
|
||||||
|
|
||||||
- name: Setup database
|
|
||||||
env:
|
|
||||||
DB: ${{steps.database-type.outputs.db}}
|
|
||||||
MYISAM: ${{ matrix.MYISAM != 1 && '0' || '1' }}
|
|
||||||
run: |
|
|
||||||
.github/setup-database.sh $DB $MYISAM
|
|
||||||
|
|
||||||
- name: Setup LDAP
|
|
||||||
if: ${{ matrix.SLOWTESTS == 1 }}
|
|
||||||
run: |
|
|
||||||
.github/setup-ldap.sh
|
|
||||||
|
|
||||||
- name: Lint tests
|
|
||||||
if: ${{ matrix.SLOWTESTS != 1 && steps.database-type.outputs.db == 'mysql' }}
|
|
||||||
run: phpBB/vendor/bin/phpunit tests/lint_test.php
|
|
||||||
|
|
||||||
- name: Run unit tests
|
|
||||||
env:
|
|
||||||
DB: ${{steps.database-type.outputs.db}}
|
|
||||||
if: ${{ matrix.SLOWTESTS != 1 && matrix.NOTESTS != 1 }}
|
|
||||||
run: |
|
|
||||||
phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --verbose --stop-on-error
|
|
||||||
|
|
||||||
- name: Slow tests
|
|
||||||
env:
|
|
||||||
DB: ${{steps.database-type.outputs.db}}
|
|
||||||
if: ${{ matrix.SLOWTESTS == 1 }}
|
|
||||||
run: |
|
|
||||||
phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --group slow
|
|
||||||
|
|
||||||
# Tests for PostgreSQL
|
|
||||||
postgres-tests:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- php: '7.1'
|
|
||||||
db: "postgres:9.5"
|
|
||||||
- php: '7.1'
|
|
||||||
db: "postgres:9.6"
|
|
||||||
- php: '7.1'
|
|
||||||
db: "postgres:10"
|
|
||||||
- php: '7.1'
|
|
||||||
db: "postgres:11"
|
|
||||||
- php: '7.1'
|
|
||||||
db: "postgres:12"
|
|
||||||
- php: '7.1'
|
|
||||||
db: "postgres:13"
|
|
||||||
- php: '7.2'
|
|
||||||
db: "postgres:13"
|
|
||||||
- php: '7.3'
|
|
||||||
db: "postgres:13"
|
|
||||||
- php: '7.4'
|
|
||||||
db: "postgres:13"
|
|
||||||
- php: '8.0'
|
|
||||||
db: "postgres:12"
|
|
||||||
- php: '8.0'
|
|
||||||
db: "postgres:13"
|
|
||||||
|
|
||||||
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
|
|
||||||
|
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: ${{ matrix.db != 'postgres:9.5' && matrix.db != 'postgres:9.6' && matrix.db != 'postgres:10' && matrix.db != 'postgres:11' && matrix.db != 'postgres:12' && matrix.db != 'postgres:13' && 'postgres:10' || matrix.db }}
|
|
||||||
env:
|
|
||||||
POSTGRES_HOST: localhost
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
options: >-
|
|
||||||
-v /var/run/postgresql:/var/run/postgresql
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
|
|
||||||
redis:
|
|
||||||
image: redis
|
|
||||||
options: >-
|
|
||||||
--health-cmd "redis-cli ping"
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
ports:
|
|
||||||
- 6379:6379
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- id: database-type
|
|
||||||
env:
|
|
||||||
MATRIX_DB: ${{ matrix.db }}
|
|
||||||
run: |
|
|
||||||
db=$(echo "${MATRIX_DB%%:*}")
|
|
||||||
echo "::set-output name=db::$db"
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php }}
|
|
||||||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
|
|
||||||
coverage: none
|
|
||||||
|
|
||||||
- name: Get Composer Cache Directory
|
|
||||||
id: composer-cache
|
|
||||||
env:
|
|
||||||
PHP_VERSION: ${{ matrix.php }}
|
|
||||||
run: |
|
|
||||||
cd phpBB
|
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
||||||
echo "::set-output name=version::${PHP_VERSION%.*}"
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
- name: Cache Composer dependencies
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
|
||||||
key: composer-${{ steps.composer-cache.outputs.version }}-${{ hashFiles('phpBB/composer.lock') }}
|
|
||||||
|
|
||||||
- name: Setup environment for phpBB
|
|
||||||
env:
|
|
||||||
DB: ${{steps.database-type.outputs.db}}
|
|
||||||
PHP_VERSION: ${{ matrix.php }}
|
|
||||||
NOTESTS: '0'
|
|
||||||
run: |
|
|
||||||
.github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
|
|
||||||
|
|
||||||
- name: Setup database
|
|
||||||
env:
|
|
||||||
DB: ${{steps.database-type.outputs.db}}
|
|
||||||
MYISAM: '0'
|
|
||||||
run: |
|
|
||||||
.github/setup-database.sh $DB $MYISAM
|
|
||||||
|
|
||||||
- name: Run unit tests
|
|
||||||
env:
|
|
||||||
DB: ${{steps.database-type.outputs.db}}
|
|
||||||
run: |
|
|
||||||
phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --verbose --stop-on-error
|
|
||||||
|
|
||||||
# Other database types, namely sqlite3 and mssql
|
|
||||||
other-tests:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- php: '7.1'
|
|
||||||
db: "sqlite3"
|
|
||||||
- php: '7.2'
|
|
||||||
db: "mcr.microsoft.com/mssql/server:2017-latest"
|
|
||||||
db_alias: 'MSSQL 2017'
|
|
||||||
- php: '7.2'
|
|
||||||
db: "mcr.microsoft.com/mssql/server:2019-latest"
|
|
||||||
db_alias: 'MSSQL 2019'
|
|
||||||
|
|
||||||
name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }}
|
|
||||||
|
|
||||||
services:
|
|
||||||
mssql:
|
|
||||||
image: ${{ matrix.db != 'mcr.microsoft.com/mssql/server:2017-latest' && matrix.db != 'mcr.microsoft.com/mssql/server:2019-latest' && 'mcr.microsoft.com/mssql/server:2017-latest' || matrix.db }}
|
|
||||||
env:
|
|
||||||
SA_PASSWORD: "Pssw0rd_12"
|
|
||||||
ACCEPT_EULA: "y"
|
|
||||||
ports:
|
|
||||||
- 1433:1433
|
|
||||||
options: >-
|
|
||||||
--health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Pssw0rd_12' -Q \"Use [master]; CREATE DATABASE [phpbb_tests] COLLATE Latin1_General_CI_AS\" || exit 1"
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
--health-start-period 10s
|
|
||||||
|
|
||||||
redis:
|
|
||||||
image: redis
|
|
||||||
options: >-
|
|
||||||
--health-cmd "redis-cli ping"
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
ports:
|
|
||||||
- 6379:6379
|
|
||||||
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- id: database-type
|
|
||||||
env:
|
|
||||||
MATRIX_DB: ${{ matrix.db }}
|
|
||||||
run: |
|
|
||||||
if [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2017-latest' ] || [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2019-latest' ]
|
|
||||||
then
|
|
||||||
db='mssql'
|
|
||||||
else
|
|
||||||
db=$(echo "${MATRIX_DB%%:*}")
|
|
||||||
fi
|
|
||||||
echo "::set-output name=db::$db"
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php }}
|
|
||||||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
|
|
||||||
coverage: none
|
|
||||||
|
|
||||||
- name: Get Composer Cache Directory
|
|
||||||
id: composer-cache
|
|
||||||
env:
|
|
||||||
PHP_VERSION: ${{ matrix.php }}
|
|
||||||
run: |
|
|
||||||
cd phpBB
|
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
||||||
echo "::set-output name=version::${PHP_VERSION%.*}"
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
- name: Cache Composer dependencies
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
|
||||||
key: composer-${{ steps.composer-cache.outputs.version }}-${{ hashFiles('phpBB/composer.lock') }}
|
|
||||||
|
|
||||||
- name: Setup environment for phpBB
|
|
||||||
env:
|
|
||||||
DB: ${{steps.database-type.outputs.db}}
|
|
||||||
PHP_VERSION: ${{ matrix.php }}
|
|
||||||
NOTESTS: '0'
|
|
||||||
run: |
|
|
||||||
.github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
|
|
||||||
|
|
||||||
- name: Setup database
|
|
||||||
env:
|
|
||||||
DB: ${{steps.database-type.outputs.db}}
|
|
||||||
MYISAM: '0'
|
|
||||||
run: |
|
|
||||||
.github/setup-database.sh $DB $MYISAM
|
|
||||||
|
|
||||||
- name: Run unit tests
|
|
||||||
env:
|
|
||||||
DB: ${{steps.database-type.outputs.db}}
|
|
||||||
run: |
|
|
||||||
phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --verbose --stop-on-error
|
|
||||||
|
|
||||||
# Test with IIS & PostgreSQL on Windows
|
|
||||||
windows-tests:
|
|
||||||
runs-on: windows-2016
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- php: '7.4'
|
|
||||||
db: "postgres"
|
|
||||||
|
|
||||||
name: Windows - PHP ${{ matrix.php }} - ${{ matrix.db }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Prepare git for Windows
|
|
||||||
run: |
|
|
||||||
git config --system core.autocrlf false
|
|
||||||
git config --system core.eol lf
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php }}
|
|
||||||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, intl, gd, exif, iconv, pgsql, pdo_pgsql
|
|
||||||
ini-values: upload_tmp_dir=${{ runner.temp }}, sys_temp_dir=${{ runner.temp }}
|
|
||||||
coverage: none
|
|
||||||
|
|
||||||
- name: Get Composer Cache Directory
|
|
||||||
id: composer-cache
|
|
||||||
run: |
|
|
||||||
cd phpBB
|
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
||||||
$major_version="${{ matrix.php }}".substring(0,1)
|
|
||||||
echo "::set-output name=version::$major_version"
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
- name: Cache Composer dependencies
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
|
||||||
key: composer-${{ steps.composer-cache.outputs.version }}-${{ hashFiles('phpBB/composer.lock') }}
|
|
||||||
|
|
||||||
- name: Setup environment for phpBB
|
|
||||||
env:
|
|
||||||
GITHUB_WORKSPACE: ${{ github.workspace }}
|
|
||||||
TEMP_DIR: ${{ runner.temp }}
|
|
||||||
run: |
|
|
||||||
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole, IIS-WebServer, IIS-CommonHttpFeatures, IIS-ManagementConsole, IIS-HttpErrors, IIS-HttpRedirect, IIS-WindowsAuthentication, IIS-StaticContent, IIS-DefaultDocument, IIS-HttpCompressionStatic, IIS-DirectoryBrowsing, IIS-WebServerManagementTools, IIS-CGI -All
|
|
||||||
Set-Service wuauserv -StartupType Manual
|
|
||||||
(Get-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config).replace("<configuration>", "<configuration>`n`t<system.web>`n`t`t<customErrors mode=`"Off`"/>`n`t</system.web>") | Set-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config
|
|
||||||
(Get-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config).replace("`t</system.webServer>", "`t`t<httpErrors errorMode=`"Detailed`" />`n`t</system.webServer>") | Set-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config
|
|
||||||
choco install urlrewrite -y
|
|
||||||
Import-Module WebAdministration
|
|
||||||
New-WebSite -Name 'phpBBTest' -PhysicalPath "${env:GITHUB_WORKSPACE}\phpBB" -Force
|
|
||||||
$session = Get-PSSession -Name WinPSCompatSession
|
|
||||||
$sb = {Set-ItemProperty 'IIS:\Sites\phpBBTest' -name Bindings -value @{protocol='http';bindingInformation='*:80:phpbb.test'}}
|
|
||||||
Invoke-Command -Scriptblock $sb -Session $session
|
|
||||||
$sb = {Set-WebConfigurationProperty -filter /system.WebServer/security/authentication/AnonymousAuthentication -name enabled -value true -location "IIS:\Sites\phpBBTest"}
|
|
||||||
Invoke-Command -Scriptblock $sb -Session $session
|
|
||||||
Add-Content -Path $env:windir\System32\drivers\etc\hosts -Value "`r`n127.0.0.1`tphpbb.test" -Force
|
|
||||||
[System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+";%windir%\system32\inetsrv")
|
|
||||||
echo Setup FAST-CGI configuration
|
|
||||||
Add-WebConfiguration -Filter /system.webServer/fastCgi -PSPath IIS:\ -Value @{fullpath="C:\tools\php\php-cgi.exe"}
|
|
||||||
echo Setup FACT-CGI handler
|
|
||||||
New-WebHandler -Name "PHP-FastCGI" -Path "*.php" -Modules FastCgiModule -ScriptProcessor "C:\tools\php\php-cgi.exe" -Verb '*' -ResourceType Either
|
|
||||||
iisreset
|
|
||||||
NET START W3SVC
|
|
||||||
mkdir "${env:GITHUB_WORKSPACE}\phpBB\cache\test"
|
|
||||||
mkdir "${env:GITHUB_WORKSPACE}\phpBB\cache\installer"
|
|
||||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\cache" /grant Users:F /T
|
|
||||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\files" /grant Users:F /T
|
|
||||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\store" /grant Users:F /T
|
|
||||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\images\avatars\upload" /grant Users:F /T
|
|
||||||
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("IIS_IUSRS", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
|
|
||||||
$acl = Get-ACL "${env:TEMP_DIR}"
|
|
||||||
$acl.AddAccessRule($accessRule)
|
|
||||||
Set-ACL -Path "${env:TEMP_DIR}" -ACLObject $acl
|
|
||||||
cd ${env:GITHUB_WORKSPACE}\phpBB
|
|
||||||
php ..\composer.phar install
|
|
||||||
cd ..
|
|
||||||
- name: Setup database
|
|
||||||
run: |
|
|
||||||
$postgreSqlSvc = Get-Service "postgresql*"
|
|
||||||
Set-Service $postgreSqlSvc.Name -StartupType manual
|
|
||||||
$postgreSqlSvc.Start()
|
|
||||||
try {
|
|
||||||
(Get-Service "postgresql*").Start()
|
|
||||||
} catch {
|
|
||||||
$_ | select *
|
|
||||||
}
|
|
||||||
[System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+";${env:PGBIN}")
|
|
||||||
$env:PGPASSWORD = 'root'
|
|
||||||
psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres
|
|
||||||
psql -c 'create database phpbb_tests;' -U postgres
|
|
||||||
Add-MpPreference -ExclusionPath "${env:PGDATA}" # Exclude PGDATA directory from Windows Defender
|
|
||||||
- name: Run unit tests
|
|
||||||
run: |
|
|
||||||
phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --verbose --stop-on-error
|
|
32
.gitignore
vendored
@@ -1,32 +0,0 @@
|
|||||||
*~
|
|
||||||
/phpunit.xml
|
|
||||||
/phpBB/cache/*
|
|
||||||
!/phpBB/cache/.htaccess
|
|
||||||
!/phpBB/cache/index.html
|
|
||||||
/phpBB/composer.phar
|
|
||||||
/phpBB/config*.php*
|
|
||||||
/phpBB/ext/*
|
|
||||||
/phpBB/files/*
|
|
||||||
/phpBB/images/avatars/gallery/*
|
|
||||||
/phpBB/images/avatars/upload/*
|
|
||||||
/phpBB/images/ranks/*
|
|
||||||
/phpBB/install/schemas/schema.json
|
|
||||||
/phpBB/language/*
|
|
||||||
!/phpBB/language/en
|
|
||||||
/phpBB/store/*
|
|
||||||
/phpBB/styles/*
|
|
||||||
!/phpBB/styles/prosilver
|
|
||||||
/phpBB/styles/prosilver/theme/*/
|
|
||||||
!/phpBB/styles/prosilver/theme/en
|
|
||||||
!/phpBB/styles/prosilver/theme/images
|
|
||||||
!/phpBB/styles/all
|
|
||||||
node_modules
|
|
||||||
/phpBB/vendor
|
|
||||||
/tests/phpbb_unit_tests.sqlite*
|
|
||||||
/tests/test_config*.php
|
|
||||||
/tests/tmp/*
|
|
||||||
/tests/vendor
|
|
||||||
/vagrant/phpbb-install-config.yml
|
|
||||||
.vagrant
|
|
||||||
.idea
|
|
||||||
*.DS_Store*
|
|
78
.jscsrc
@@ -1,78 +0,0 @@
|
|||||||
|
|
||||||
{
|
|
||||||
"excludeFiles": ["node_modules/**", "**/build/**"],
|
|
||||||
"requireCurlyBraces": [
|
|
||||||
"if", "else", "for", "while", "do", "try", "catch"
|
|
||||||
],
|
|
||||||
"requireSpaceBeforeKeywords": [
|
|
||||||
"else", "while", "catch"
|
|
||||||
],
|
|
||||||
"requireSpaceAfterKeywords": [
|
|
||||||
"do", "for", "if", "else", "switch", "case", "try", "catch", "while", "return", "typeof"
|
|
||||||
],
|
|
||||||
"requireSpaceBeforeBlockStatements": true,
|
|
||||||
"requireParenthesesAroundIIFE": true,
|
|
||||||
"requireSpacesInConditionalExpression": {
|
|
||||||
"afterTest": true,
|
|
||||||
"beforeConsequent": true,
|
|
||||||
"afterConsequent": true,
|
|
||||||
"beforeAlternate": true
|
|
||||||
},
|
|
||||||
"requireSpacesInAnonymousFunctionExpression": {
|
|
||||||
"beforeOpeningCurlyBrace": true
|
|
||||||
},
|
|
||||||
"disallowSpacesInNamedFunctionExpression": {
|
|
||||||
"beforeOpeningRoundBrace": true
|
|
||||||
},
|
|
||||||
"requireSpacesInFunction": {
|
|
||||||
"beforeOpeningCurlyBrace": true
|
|
||||||
},
|
|
||||||
"disallowSpacesInCallExpression": true,
|
|
||||||
"requireBlocksOnNewline": true,
|
|
||||||
"requirePaddingNewlinesBeforeKeywords": ["case"],
|
|
||||||
"disallowEmptyBlocks": true,
|
|
||||||
"disallowSpacesInsideArrayBrackets": "nested",
|
|
||||||
"disallowSpacesInsideParentheses": true,
|
|
||||||
"requireSpacesInsideObjectBrackets": "all",
|
|
||||||
"disallowQuotedKeysInObjects": "allButReserved",
|
|
||||||
"disallowSpaceAfterObjectKeys": true,
|
|
||||||
"requireSpaceBeforeObjectValues": true,
|
|
||||||
"requireCommaBeforeLineBreak": true,
|
|
||||||
"requireOperatorBeforeLineBreak": [
|
|
||||||
"?", "=", "+", "-", "/", "*", "===", "!==", ">", ">=", "<", "<="
|
|
||||||
],
|
|
||||||
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
|
|
||||||
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
|
|
||||||
"requireSpaceBeforeBinaryOperators": [
|
|
||||||
"=", "+", "+=", "-", "-=", "/", "/=", "*", "*=", "===", "!==", "<", "<=", ">", ">="
|
|
||||||
],
|
|
||||||
"requireSpaceAfterBinaryOperators": [
|
|
||||||
"=", "+", "+=", "-", "-=", "/", "/=", "*", "*=", "===", "!==", "<", "<=", ">", ">="
|
|
||||||
],
|
|
||||||
"disallowKeywords": ["with"],
|
|
||||||
"disallowMultipleLineStrings": true,
|
|
||||||
"disallowMixedSpacesAndTabs": "smart",
|
|
||||||
"disallowTrailingWhitespace": true,
|
|
||||||
"disallowTrailingComma": true,
|
|
||||||
"disallowKeywordsOnNewLine": ["else"],
|
|
||||||
"requireLineFeedAtFileEnd": true,
|
|
||||||
"maximumLineLength": {
|
|
||||||
"value": 120,
|
|
||||||
"tabSize": 4,
|
|
||||||
"allowUrlComments": true,
|
|
||||||
"allowRegex": true
|
|
||||||
},
|
|
||||||
"requireCapitalizedConstructors": true,
|
|
||||||
"requireDotNotation": true,
|
|
||||||
"disallowYodaConditions": true,
|
|
||||||
"requireSpaceAfterLineComment": {
|
|
||||||
"allExcept": ["#", "="]
|
|
||||||
},
|
|
||||||
"disallowNewlineBeforeBlockStatements": true,
|
|
||||||
"validateQuoteMarks": {
|
|
||||||
"mark": "'",
|
|
||||||
"escape": true
|
|
||||||
},
|
|
||||||
"validateParameterSeparator": ", ",
|
|
||||||
"safeContextKeyword": ["that"]
|
|
||||||
}
|
|
25
.jshintrc
@@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
{
|
|
||||||
"bitwise": true,
|
|
||||||
"curly": true,
|
|
||||||
"eqeqeq": true,
|
|
||||||
"es3": true,
|
|
||||||
"forin": false,
|
|
||||||
"freeze": true,
|
|
||||||
"newcap": true,
|
|
||||||
"noarg": true,
|
|
||||||
"noempty": true,
|
|
||||||
"nonbsp": true,
|
|
||||||
"undef": true,
|
|
||||||
"unused": true,
|
|
||||||
"strict": true,
|
|
||||||
|
|
||||||
"browser": true,
|
|
||||||
"devel": true,
|
|
||||||
"jquery": true,
|
|
||||||
|
|
||||||
"globals": {
|
|
||||||
"JSON": true,
|
|
||||||
"phpbb": true
|
|
||||||
}
|
|
||||||
}
|
|
47
README.md
@@ -1,47 +0,0 @@
|
|||||||
[](https://www.phpbb.com)
|
|
||||||
|
|
||||||
phpBB is a free open-source bulletin board written in PHP.
|
|
||||||
|
|
||||||
## 🧑🏻🤝🏻🧑🏽 Community
|
|
||||||
|
|
||||||
Get your copy of phpBB, find support and lots more on [phpBB.com](https://www.phpbb.com). Discuss the development on [area51](https://area51.phpbb.com/phpBB/index.php).
|
|
||||||
|
|
||||||
## 👨💻 Contribute
|
|
||||||
|
|
||||||
1. [Create an account on phpBB.com](https://www.phpbb.com/community/ucp.php?mode=register)
|
|
||||||
2. [Create a ticket (unless there already is one)](https://tracker.phpbb.com/secure/CreateIssue!default.jspa)
|
|
||||||
3. Read our [Coding guidelines](https://area51.phpbb.com/docs/dev/development/coding_guidelines.html) and [Git Contribution Guidelines](https://area51.phpbb.com/docs/dev/development/git.html)
|
|
||||||
4. Send us a pull request
|
|
||||||
|
|
||||||
### 🏗️ Setting up a development build of phpBB
|
|
||||||
|
|
||||||
To run an installation from the repo (and not from a pre-built package) on a local server, run the following commands:
|
|
||||||
|
|
||||||
- Fork phpbb/phpbb to your GitHub account, then create a local clone of it:
|
|
||||||
```
|
|
||||||
git clone https://github.com/your_github_name/phpbb.git
|
|
||||||
```
|
|
||||||
- Install phpBB's dependencies (from the root of your phpbb repo):
|
|
||||||
```
|
|
||||||
cd phpBB
|
|
||||||
php ../composer.phar install
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively, you can read our [Vagrant documentation](phpBB/docs/vagrant.md) to find out how to use Vagrant to develop and contribute to phpBB.
|
|
||||||
|
|
||||||
## 📓 Documentation
|
|
||||||
|
|
||||||
phpBB's [Development Documentation](https://area51.phpbb.com/docs/dev/index.html) contains all the information you'll need to learn about developing for phpBB's core, extensions and automated testing.
|
|
||||||
|
|
||||||
## 🔬 Automated Testing
|
|
||||||
|
|
||||||
We have unit and functional tests in order to prevent regressions. You can view the bamboo continuous integration [here](https://bamboo.phpbb.com) or check our travis builds below:
|
|
||||||
|
|
||||||
Branch | Description | Github Actions |
|
|
||||||
------- | ----------- | -------------- |
|
|
||||||
**master** | Latest development version |  |
|
|
||||||
**3.3.x** | Development of version 3.3.x |  |
|
|
||||||
|
|
||||||
## 📜 License
|
|
||||||
|
|
||||||
[GNU General Public License v2](http://opensource.org/licenses/gpl-2.0.php)
|
|
25
Vagrantfile
vendored
@@ -1,25 +0,0 @@
|
|||||||
require 'json'
|
|
||||||
require 'yaml'
|
|
||||||
|
|
||||||
VAGRANTFILE_API_VERSION ||= "2"
|
|
||||||
confDir = $confDir ||= File.expand_path("phpBB/vendor/laravel/homestead", File.dirname(__FILE__))
|
|
||||||
|
|
||||||
homesteadYamlPath = "vagrant/bootstrap.yaml"
|
|
||||||
afterScriptPath = "vagrant/after.sh"
|
|
||||||
aliasesPath = "vagrant/aliases"
|
|
||||||
|
|
||||||
require File.expand_path(confDir + '/scripts/homestead.rb')
|
|
||||||
|
|
||||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
||||||
if File.exists? aliasesPath then
|
|
||||||
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
|
|
||||||
end
|
|
||||||
|
|
||||||
if File.exists? homesteadYamlPath then
|
|
||||||
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
|
|
||||||
end
|
|
||||||
|
|
||||||
if File.exists? afterScriptPath then
|
|
||||||
config.vm.provision "shell", path: afterScriptPath
|
|
||||||
end
|
|
||||||
end
|
|
566
build/build.xml
@@ -1,566 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<project name="phpBB" description="The phpBB forum software" default="all" basedir="../">
|
|
||||||
<!-- a few settings for the build -->
|
|
||||||
<property name="newversion" value="3.3.4" />
|
|
||||||
<property name="prevversion" value="3.3.3" />
|
|
||||||
<property name="olderversions" value="3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.7-pl1, 3.1.8, 3.1.9, 3.1.10, 3.1.11, 3.1.12, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.2.7, 3.2.8, 3.2.9, 3.2.10, 3.2.11, 3.3.0, 3.3.1, 3.3.2, 3.3.4-RC1" />
|
|
||||||
<!-- no configuration should be needed beyond this point -->
|
|
||||||
|
|
||||||
<property name="oldversions" value="${olderversions}, ${prevversion}" />
|
|
||||||
<property name="versions" value="${oldversions}, ${newversion}" />
|
|
||||||
|
|
||||||
<!-- These are the main targets which you will probably want to use -->
|
|
||||||
<target name="all" depends="clean,prepare,composer,test,docs,package" />
|
|
||||||
<target name="build" depends="clean,prepare,composer,test,docs" />
|
|
||||||
|
|
||||||
<target name="prepare">
|
|
||||||
<mkdir dir="build/logs" />
|
|
||||||
<mkdir dir="build/api" />
|
|
||||||
<mkdir dir="build/codebrowser" />
|
|
||||||
<mkdir dir="build/coverage" />
|
|
||||||
<mkdir dir="build/cpd" />
|
|
||||||
<mkdir dir="build/dependencies" />
|
|
||||||
<mkdir dir="build/new_version" />
|
|
||||||
<mkdir dir="build/new_version/files" />
|
|
||||||
<mkdir dir="build/new_version/patches" />
|
|
||||||
<mkdir dir="build/new_version/release_files" />
|
|
||||||
<mkdir dir="build/new_version/update" />
|
|
||||||
<mkdir dir="build/old_versions" />
|
|
||||||
<mkdir dir="build/save" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="clean">
|
|
||||||
<delete dir="build/logs" />
|
|
||||||
<delete dir="build/api" />
|
|
||||||
<delete dir="build/codebrowser" />
|
|
||||||
<delete dir="build/coverage" />
|
|
||||||
<delete dir="build/cpd" />
|
|
||||||
<delete dir="build/dependencies" />
|
|
||||||
<delete dir="build/new_version" />
|
|
||||||
<delete dir="build/old_versions" />
|
|
||||||
<delete dir="build/save" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
This target basically just runs composer in the phpBB tree to ensure
|
|
||||||
all dependencies are loaded. Additional development dependencies are
|
|
||||||
loaded because testing framework may depend on them.
|
|
||||||
-->
|
|
||||||
<target name="composer">
|
|
||||||
<exec dir="phpBB"
|
|
||||||
command="php ../composer.phar install --ignore-platform-reqs"
|
|
||||||
checkreturn="true"
|
|
||||||
passthru="true" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="test" depends="clean,prepare,composer">
|
|
||||||
<exec dir="."
|
|
||||||
command="phpBB/vendor/bin/phpunit
|
|
||||||
--log-junit build/logs/phpunit.xml
|
|
||||||
--coverage-clover build/logs/clover.xml
|
|
||||||
--coverage-html build/coverage"
|
|
||||||
passthru="true" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="test-slow" depends="clean,prepare,composer">
|
|
||||||
<exec dir="."
|
|
||||||
command="phpBB/vendor/bin/phpunit
|
|
||||||
--log-junit build/logs/phpunit.xml
|
|
||||||
--group slow
|
|
||||||
--coverage-clover build/logs/clover-slow.xml
|
|
||||||
--coverage-html build/coverage-slow"
|
|
||||||
passthru="true" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="sniff">
|
|
||||||
<exec command="phpBB/vendor/bin/phpcs
|
|
||||||
-s -p
|
|
||||||
--extensions=php
|
|
||||||
--standard=build/code_sniffer/ruleset-php-strict-core.xml
|
|
||||||
--ignore=${project.basedir}/phpBB/phpbb/db/migration/data/v30x/*
|
|
||||||
phpBB/phpbb"
|
|
||||||
dir="." returnProperty="retval-php-strict" passthru="true" />
|
|
||||||
<php function="preg_replace" returnProperty="sniffIgnoreList">
|
|
||||||
<param value="/\s+/"/>
|
|
||||||
<param value=""/>
|
|
||||||
<param value="${project.basedir}/phpBB/cache/*,
|
|
||||||
${project.basedir}/phpBB/develop/*,
|
|
||||||
${project.basedir}/phpBB/ext/*,
|
|
||||||
${project.basedir}/phpBB/includes/diff/*.php,
|
|
||||||
${project.basedir}/phpBB/includes/sphinxapi.php,
|
|
||||||
${project.basedir}/phpBB/includes/utf/data/*,
|
|
||||||
${project.basedir}/phpBB/install/data/*,
|
|
||||||
${project.basedir}/phpBB/install/database_update.php,
|
|
||||||
${project.basedir}/phpBB/phpbb/*,
|
|
||||||
${project.basedir}/phpBB/vendor/*,
|
|
||||||
${project.basedir}/phpBB/vendor-ext/*,
|
|
||||||
${project.basedir}/phpBB/config.php,
|
|
||||||
${project.basedir}/phpBB/config_dev.php,
|
|
||||||
${project.basedir}/phpBB/config_test.php"/>
|
|
||||||
</php>
|
|
||||||
<exec command="phpBB/vendor/bin/phpcs
|
|
||||||
-s -p
|
|
||||||
--extensions=php
|
|
||||||
--standard=build/code_sniffer/ruleset-php-legacy-core.xml
|
|
||||||
--ignore=${sniffIgnoreList}
|
|
||||||
phpBB"
|
|
||||||
dir="." returnProperty="retval-php-legacy" passthru="true" />
|
|
||||||
<exec command="phpBB/vendor/bin/phpcs
|
|
||||||
-s -p
|
|
||||||
--extensions=php
|
|
||||||
--standard=build/code_sniffer/ruleset-php-extensions.xml
|
|
||||||
--ignore=${project.basedir}/phpBB/ext/*/tests/*,${project.basedir}/phpBB/ext/*/vendor/*
|
|
||||||
phpBB/ext"
|
|
||||||
dir="." returnProperty="retval-php-ext" passthru="true" />
|
|
||||||
<if>
|
|
||||||
<or>
|
|
||||||
<not><equals arg1="${retval-php-strict}" arg2="0" /></not>
|
|
||||||
<not><equals arg1="${retval-php-legacy}" arg2="0" /></not>
|
|
||||||
<not><equals arg1="${retval-php-ext}" arg2="0" /></not>
|
|
||||||
</or>
|
|
||||||
<then>
|
|
||||||
<fail message="PHP Code Sniffer failed." />
|
|
||||||
</then>
|
|
||||||
</if>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- Builds docs for current branch into build/api/output/master -->
|
|
||||||
<target name="docs">
|
|
||||||
<exec dir="."
|
|
||||||
command="php doctum.phar update build/doctum-checkout.conf.php"
|
|
||||||
passthru="true" />
|
|
||||||
</target>
|
|
||||||
<!-- Builds docs for multiple branches/tags into build/api/output/$branch -->
|
|
||||||
<target name="docs-all">
|
|
||||||
<exec dir="."
|
|
||||||
command="php doctum.phar update build/doctum-all.conf.php"
|
|
||||||
passthru="true" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="old-version-diffs">
|
|
||||||
<foreach list="${oldversions}" param="version" target="old-version-diff" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- This target retrieves an old version from the git tag release-${version}
|
|
||||||
and creates a diff between that release and the new one -->
|
|
||||||
<target name="old-version-diff">
|
|
||||||
<echo msg="Retrieving version ${version}" />
|
|
||||||
<mkdir dir="build/old_versions/release-${version}" />
|
|
||||||
|
|
||||||
<phingcall target="export">
|
|
||||||
<property name="revision" value="release-${version}" />
|
|
||||||
<property name="version" value="${version}" />
|
|
||||||
<property name="dir" value="build/old_versions/release-${version}" />
|
|
||||||
<property name="skip-composer" value="true" />
|
|
||||||
</phingcall>
|
|
||||||
|
|
||||||
<phingcall target="clean-diff-dir">
|
|
||||||
<property name="dir" value="build/old_versions/release-${version}" />
|
|
||||||
</phingcall>
|
|
||||||
|
|
||||||
<exec dir="build/old_versions" command="LC_ALL=C diff -crNEBZbd release-${version} release-${newversion} >
|
|
||||||
../new_version/patches/phpBB-${version}_to_${newversion}.patch" escape="false" />
|
|
||||||
<exec dir="build/old_versions" command="LC_ALL=C diff -qr release-${version} release-${newversion} | grep 'Only in release-${version}' > ../new_version/patches/phpBB-${version}_to_${newversion}.deleted" escape="false" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="prepare-new-version">
|
|
||||||
<!-- select the currently checked out commit (HEAD) for packaging -->
|
|
||||||
<mkdir dir="build/new_version/phpBB3" />
|
|
||||||
<phingcall target="export">
|
|
||||||
<property name="revision" value="HEAD" />
|
|
||||||
<property name="dir" value="build/new_version/phpBB3" />
|
|
||||||
</phingcall>
|
|
||||||
|
|
||||||
<!-- copy into directory for diffs -->
|
|
||||||
<exec dir="build" command="cp -rp new_version/phpBB3 old_versions/release-${newversion}" />
|
|
||||||
<!-- and clean up -->
|
|
||||||
<phingcall target="clean-diff-dir">
|
|
||||||
<property name="dir" value="build/old_versions/release-${newversion}" />
|
|
||||||
</phingcall>
|
|
||||||
|
|
||||||
<!-- create an empty config.php file (not for diffs) -->
|
|
||||||
<touch file="build/new_version/phpBB3/config.php" />
|
|
||||||
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="package" depends="clean,prepare,prepare-new-version,old-version-diffs">
|
|
||||||
<exec dir="build" command="php -f package.php '${versions}' > logs/package.log" escape="false" />
|
|
||||||
<exec dir="build" escape="false"
|
|
||||||
command="LC_ALL=C diff -crNEBZbd old_versions/release-${prevversion}/language new_version/phpBB3/language >
|
|
||||||
save/phpbb-${prevversion}_to_${newversion}_language.patch" />
|
|
||||||
<exec dir="build" escape="false"
|
|
||||||
command="LC_ALL=C diff -crNEBZbd old_versions/release-${prevversion}/styles/prosilver new_version/phpBB3/styles/prosilver >
|
|
||||||
save/phpbb-${prevversion}_to_${newversion}_prosilver.patch" />
|
|
||||||
|
|
||||||
<exec dir="build" escape="false"
|
|
||||||
command="git shortlog --summary --numbered release-${prevversion}...HEAD >
|
|
||||||
save/phpbb-${prevversion}_to_${newversion}_git_shortlog.txt" />
|
|
||||||
<exec dir="build" escape="false"
|
|
||||||
command="git diff --stat release-${prevversion}...HEAD >
|
|
||||||
save/phpbb-${prevversion}_to_${newversion}_git_diffstat.txt" />
|
|
||||||
|
|
||||||
<phingcall target="checksum-dir">
|
|
||||||
<property name="dir" value="build/new_version/release_files" />
|
|
||||||
</phingcall>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="checksum-dir">
|
|
||||||
<foreach param="filename" absparam="absfilename" target="checksum-file">
|
|
||||||
<fileset dir="${dir}">
|
|
||||||
<type type="file" />
|
|
||||||
</fileset>
|
|
||||||
</foreach>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="checksum-file">
|
|
||||||
<echo msg="Creating checksum file for ${absfilename}" />
|
|
||||||
<php function="dirname" returnProperty="dir"><param value="${absfilename}"/></php>
|
|
||||||
<exec dir="${dir}" command="sha256sum ${filename} > ${filename}.sha256" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="announcement" depends="prepare">
|
|
||||||
<echo msg="Writing download links and checksums for email announcement to save/announcement_email_${newversion}.txt" />
|
|
||||||
<exec dir="build" escape="false"
|
|
||||||
command="php -f build_announcement.php email '${newversion}' 'new_version/release_files' sha256 >
|
|
||||||
save/announcement_email_${newversion}.txt" />
|
|
||||||
|
|
||||||
<echo msg="Writing download links and checksums for bbcode announcement to save/announcement_bbcode_${newversion}.txt" />
|
|
||||||
<exec dir="build" escape="false"
|
|
||||||
command="php -f build_announcement.php bbcode '${newversion}' 'new_version/release_files' sha256 >
|
|
||||||
save/announcement_bbcode_${newversion}.txt" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="changelog" depends="prepare">
|
|
||||||
<exec dir="build" escape="false"
|
|
||||||
command="php -f build_changelog.php '${newversion}' >
|
|
||||||
save/changelog_${newversion}.html" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
This target can be called using phingcall to retrieve a clean
|
|
||||||
checkout of a commit from git. It will only export the phpBB directory.
|
|
||||||
The properties revision and dir are required.
|
|
||||||
This target will remove directories that are not needed in distribution
|
|
||||||
and set correct permissions.
|
|
||||||
-->
|
|
||||||
<target name="export">
|
|
||||||
<exec dir="phpBB"
|
|
||||||
command="git archive ${revision} | tar -xf - -C ../${dir}"
|
|
||||||
checkreturn="true" />
|
|
||||||
|
|
||||||
<!-- Install composer dependencies, if there are any. -->
|
|
||||||
<exec dir="${dir}"
|
|
||||||
command='php -r "\$j = json_decode(file_get_contents(\"composer.json\")); echo isset(\$j->require);"'
|
|
||||||
checkreturn="true"
|
|
||||||
outputProperty='composer-has-dependencies' />
|
|
||||||
<if>
|
|
||||||
<equals arg1="${composer-has-dependencies}" arg2="1" trim="true" />
|
|
||||||
<then>
|
|
||||||
<!-- We have non-dev composer dependencies -->
|
|
||||||
<if>
|
|
||||||
<not><isset property="skip-composer" /></not>
|
|
||||||
<then>
|
|
||||||
<exec dir="."
|
|
||||||
command="git ls-tree ${revision} composer.phar"
|
|
||||||
checkreturn="true"
|
|
||||||
outputProperty='composer-ls-tree-output' />
|
|
||||||
<if>
|
|
||||||
<equals arg1="${composer-ls-tree-output}" arg2="" trim="true" />
|
|
||||||
<then>
|
|
||||||
<fail message="There are composer dependencies, but composer.phar is missing." />
|
|
||||||
</then>
|
|
||||||
<else>
|
|
||||||
<!-- Export the phar, install dependencies, delete phar. -->
|
|
||||||
<exec dir="."
|
|
||||||
command="git archive ${revision} composer.phar | tar -xf - -C ${dir}"
|
|
||||||
checkreturn="true" />
|
|
||||||
<exec dir="${dir}"
|
|
||||||
command="php composer.phar install --no-dev --optimize-autoloader --ignore-platform-reqs"
|
|
||||||
checkreturn="true"
|
|
||||||
passthru="true" />
|
|
||||||
<delete file="${dir}/composer.phar" />
|
|
||||||
|
|
||||||
<phingcall target="clean-vendor-dir">
|
|
||||||
<property name="dir" value="${dir}" />
|
|
||||||
</phingcall>
|
|
||||||
</else>
|
|
||||||
</if>
|
|
||||||
</then>
|
|
||||||
</if>
|
|
||||||
</then>
|
|
||||||
<else>
|
|
||||||
<!-- We do not have composer dependencies, do not ship composer files -->
|
|
||||||
<delete file="${dir}/composer.json" />
|
|
||||||
<delete file="${dir}/composer.lock" />
|
|
||||||
</else>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<!-- Checkout latest viglink to ext folder -->
|
|
||||||
<available file="${dir}/ext" type="dir" property="add-viglink-ext" />
|
|
||||||
<exec dir="${dir}"
|
|
||||||
command='php -r "echo version_compare('${version}', '3.2.0-RC2', '>=') ? 'true' : 'false';"'
|
|
||||||
checkreturn="true"
|
|
||||||
outputProperty='viglink-available' />
|
|
||||||
<if>
|
|
||||||
<and>
|
|
||||||
<equals arg1="${add-viglink-ext}" arg2="1" trim="true" />
|
|
||||||
<or>
|
|
||||||
<equals arg1="${revision}" arg2="HEAD" trim="true" />
|
|
||||||
<equals arg1="${viglink-available}" arg2="1" trim="true" />
|
|
||||||
</or>
|
|
||||||
</and>
|
|
||||||
<then>
|
|
||||||
<exec dir="${dir}/ext" command="mkdir phpbb" passthru="true" />
|
|
||||||
|
|
||||||
<exec dir="${dir}/ext/phpbb" command="git clone https://github.com/phpbb-extensions/viglink.git viglink" passthru="true" checkreturn="true" />
|
|
||||||
<if>
|
|
||||||
<equals arg1="${revision}" arg2="HEAD" trim="true" />
|
|
||||||
<then>
|
|
||||||
<exec dir="${dir}/ext/phpbb/viglink"
|
|
||||||
command="git rev-parse release-phpbb-${version}"
|
|
||||||
returnProperty='viglink_head_tag_exists' />
|
|
||||||
<if>
|
|
||||||
<equals arg1="${viglink_head_tag_exists}" arg2="0" trim="true" />
|
|
||||||
<then>
|
|
||||||
<exec dir="${dir}/ext/phpbb/viglink" command="git checkout release-phpbb-${version}" passthru="true" />
|
|
||||||
</then>
|
|
||||||
<else>
|
|
||||||
<exec dir="${dir}/ext/phpbb/viglink" command="git checkout master" passthru="true" />
|
|
||||||
</else>
|
|
||||||
</if>
|
|
||||||
</then>
|
|
||||||
<else>
|
|
||||||
<exec dir="${dir}/ext/phpbb/viglink" command="git checkout release-phpbb-${version}" passthru="true" />
|
|
||||||
</else>
|
|
||||||
</if>
|
|
||||||
<delete dir="${dir}/ext/phpbb/viglink/.git" />
|
|
||||||
<delete dir="${dir}/ext/phpbb/viglink/tests" />
|
|
||||||
<delete dir="${dir}/ext/phpbb/viglink/travis" />
|
|
||||||
<delete file="${dir}/ext/phpbb/viglink/.gitattributes" />
|
|
||||||
<delete file="${dir}/ext/phpbb/viglink/.travis.yml" />
|
|
||||||
<delete file="${dir}/ext/phpbb/viglink/phpunit.xml.dist" />
|
|
||||||
<delete file="${dir}/ext/phpbb/viglink/README.md" />
|
|
||||||
</then>
|
|
||||||
</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" />
|
|
||||||
<delete dir="${dir}/config/development" />
|
|
||||||
<delete dir="${dir}/config/test" />
|
|
||||||
|
|
||||||
<echo msg="Setting permissions for checkout of ${revision} in ${dir}" />
|
|
||||||
<!-- set permissions of all files to 644, directories to 755 -->
|
|
||||||
<exec dir="${dir}" command="find . -type f|xargs chmod 644" escape="false" />
|
|
||||||
<exec dir="${dir}" command="find . -type d|xargs chmod 755" escape="false" />
|
|
||||||
<!-- set permissions of some directories to 777 -->
|
|
||||||
<chmod mode="0777" file="${dir}/cache" />
|
|
||||||
<chmod mode="0777" file="${dir}/store" />
|
|
||||||
<chmod mode="0777" file="${dir}/files" />
|
|
||||||
<chmod mode="0777" file="${dir}/images/avatars/upload" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="clean-vendor-dir">
|
|
||||||
<!-- Delete unrelated files from vendor/, see PHPBB3-12390 -->
|
|
||||||
<delete dir="${dir}/vendor/bantu/ini-get-wrapper/tests" />
|
|
||||||
<delete file="${dir}/vendor/bantu/ini-get-wrapper/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/bantu/ini-get-wrapper/.scrutinizer.yml" />
|
|
||||||
<delete file="${dir}/vendor/bantu/ini-get-wrapper/.travis.yml" />
|
|
||||||
<delete file="${dir}/vendor/bantu/ini-get-wrapper/phpunit.xml.dist" />
|
|
||||||
<delete file="${dir}/vendor/bantu/ini-get-wrapper/README.md" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/google/recaptcha/examples" />
|
|
||||||
<delete dir="${dir}/vendor/google/recaptcha/tests" />
|
|
||||||
<delete file="${dir}/vendor/google/recaptcha/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/google/recaptcha/.travis.yml" />
|
|
||||||
<delete file="${dir}/vendor/google/recaptcha/CONTRIBUTING.md" />
|
|
||||||
<delete file="${dir}/vendor/google/recaptcha/phpunit.xml.dist" />
|
|
||||||
<delete file="${dir}/vendor/google/recaptcha/README.md" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/guzzlehttp/guzzle/build" />
|
|
||||||
<delete dir="${dir}/vendor/guzzlehttp/guzzle/docs" />
|
|
||||||
<delete dir="${dir}/vendor/guzzlehttp/guzzle/tests" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/guzzle/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/guzzle/.editorconfig" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/guzzle/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/guzzle/Makefile" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/guzzle/phpunit.xml.dist" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/guzzle/README.md" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/guzzle/.travis.yml" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/guzzle/UPGRADING.md" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/guzzlehttp/ringphp/docs" />
|
|
||||||
<delete dir="${dir}/vendor/guzzlehttp/ringphp/tests" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/ringphp/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/ringphp/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/ringphp/Makefile" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/ringphp/phpunit.xml.dist" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/ringphp/README.rst" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/ringphp/.travis.yml" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/guzzlehttp/streams/tests" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/streams/CHANGELOG.rst" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/streams/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/streams/Makefile" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/streams/phpunit.xml.dist" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/streams/README.rst" />
|
|
||||||
<delete file="${dir}/vendor/guzzlehttp/streams/.travis.yml" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/lusitanian/oauth/examples" />
|
|
||||||
<delete dir="${dir}/vendor/lusitanian/oauth/tests" />
|
|
||||||
<delete file="${dir}/vendor/lusitanian/oauth/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/lusitanian/oauth/.scrutinizer.yml" />
|
|
||||||
<delete file="${dir}/vendor/lusitanian/oauth/.travis.yml" />
|
|
||||||
<delete file="${dir}/vendor/lusitanian/oauth/phpunit.xml.dist" />
|
|
||||||
<delete file="${dir}/vendor/lusitanian/oauth/README.md" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/paragonie/random_compat/dist" />
|
|
||||||
<delete dir="${dir}/vendor/paragonie/random_compat/other" />
|
|
||||||
<delete file="${dir}/vendor/paragonie/random_compat/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/paragonie/random_compat/ERRATA.md" />
|
|
||||||
<delete file="${dir}/vendor/paragonie/random_compat/README.md" />
|
|
||||||
<delete file="${dir}/vendor/paragonie/random_compat/SECURITY.md" />
|
|
||||||
|
|
||||||
<delete file="${dir}/vendor/patchwork/utf8/.travis.yml" />
|
|
||||||
<delete file="${dir}/vendor/patchwork/utf8/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/patchwork/utf8/phpunit.xml.dist" />
|
|
||||||
<delete file="${dir}/vendor/patchwork/utf8/README.md" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/psr/log/Psr/Log/Test" />
|
|
||||||
<delete file="${dir}/vendor/psr/log/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/psr/log/README.md" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/react/promise/tests" />
|
|
||||||
<delete file="${dir}/vendor/react/promise/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/react/promise/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/react/promise/phpunit.xml.dist" />
|
|
||||||
<delete file="${dir}/vendor/react/promise/README.md" />
|
|
||||||
<delete file="${dir}/vendor/react/promise/.travis.yml" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/s9e/text-formatter/.git" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/symfony/config/.git" />
|
|
||||||
<delete dir="${dir}/vendor/symfony/config/Tests" />
|
|
||||||
<delete file="${dir}/vendor/symfony/config/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/symfony/config/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/config/README.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/config/phpunit.xml.dist" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/symfony/console/.git" />
|
|
||||||
<delete dir="${dir}/vendor/symfony/console/Tests" />
|
|
||||||
<delete file="${dir}/vendor/symfony/console/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/symfony/console/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/console/README.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/console/phpunit.xml.dist" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/symfony/debug/.git" />
|
|
||||||
<delete dir="${dir}/vendor/symfony/debug/Tests" />
|
|
||||||
<delete file="${dir}/vendor/symfony/debug/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/symfony/debug/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/debug/README.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/debug/phpunit.xml.dist" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/symfony/dependency-injection/.git" />
|
|
||||||
<delete dir="${dir}/vendor/symfony/dependency-injection/Tests" />
|
|
||||||
<delete file="${dir}/vendor/symfony/dependency-injection/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/symfony/dependency-injection/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/dependency-injection/README.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/dependency-injection/phpunit.xml.dist" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/symfony/event-dispatcher/.git" />
|
|
||||||
<delete dir="${dir}/vendor/symfony/event-dispatcher/Tests" />
|
|
||||||
<delete file="${dir}/vendor/symfony/event-dispatcher/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/symfony/event-dispatcher/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/event-dispatcher/README.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/event-dispatcher/phpunit.xml.dist" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/symfony/filesystem/.git" />
|
|
||||||
<delete dir="${dir}/vendor/symfony/filesystem/Tests" />
|
|
||||||
<delete file="${dir}/vendor/symfony/filesystem/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/symfony/filesystem/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/filesystem/README.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/filesystem/phpunit.xml.dist" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/symfony/finder/.git" />
|
|
||||||
<delete dir="${dir}/vendor/symfony/finder/Tests" />
|
|
||||||
<delete file="${dir}/vendor/symfony/finder/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/symfony/finder/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/finder/README.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/finder/phpunit.xml.dist" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/symfony/http-foundation/.git" />
|
|
||||||
<delete dir="${dir}/vendor/symfony/http-foundation/Tests" />
|
|
||||||
<delete file="${dir}/vendor/symfony/http-foundation/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/symfony/http-foundation/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/http-foundation/README.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/http-foundation/phpunit.xml.dist" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/symfony/http-kernel/.git" />
|
|
||||||
<delete dir="${dir}/vendor/symfony/http-kernel/Tests" />
|
|
||||||
<delete file="${dir}/vendor/symfony/http-kernel/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/symfony/http-kernel/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/http-kernel/README.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/http-kernel/phpunit.xml.dist" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/symfony/proxy-manager-bridge/.git" />
|
|
||||||
<delete dir="${dir}/vendor/symfony/proxy-manager-bridge/Tests" />
|
|
||||||
<delete file="${dir}/vendor/symfony/proxy-manager-bridge/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/symfony/proxy-manager-bridge/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/proxy-manager-bridge/README.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/proxy-manager-bridge/phpunit.xml.dist" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/symfony/routing/.git" />
|
|
||||||
<delete dir="${dir}/vendor/symfony/routing/Tests" />
|
|
||||||
<delete file="${dir}/vendor/symfony/routing/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/symfony/routing/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/routing/README.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/routing/phpunit.xml.dist" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/symfony/twig-bridge/.git" />
|
|
||||||
<delete dir="${dir}/vendor/symfony/twig-bridge/Tests" />
|
|
||||||
<delete file="${dir}/vendor/symfony/twig-bridge/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/symfony/twig-bridge/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/twig-bridge/README.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/twig-bridge/phpunit.xml.dist" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/symfony/yaml/.git" />
|
|
||||||
<delete dir="${dir}/vendor/symfony/yaml/Tests" />
|
|
||||||
<delete file="${dir}/vendor/symfony/yaml/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/symfony/yaml/CHANGELOG.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/yaml/README.md" />
|
|
||||||
<delete file="${dir}/vendor/symfony/yaml/phpunit.xml.dist" />
|
|
||||||
|
|
||||||
<delete dir="${dir}/vendor/twig/twig/doc" />
|
|
||||||
<delete dir="${dir}/vendor/twig/twig/ext" />
|
|
||||||
<delete dir="${dir}/vendor/twig/twig/test" />
|
|
||||||
<delete file="${dir}/vendor/twig/twig/.editorconfig" />
|
|
||||||
<delete file="${dir}/vendor/twig/twig/.gitignore" />
|
|
||||||
<delete file="${dir}/vendor/twig/twig/.travis.yml" />
|
|
||||||
<delete file="${dir}/vendor/twig/twig/CHANGELOG" />
|
|
||||||
<delete file="${dir}/vendor/twig/twig/phpunit.xml.dist" />
|
|
||||||
<delete file="${dir}/vendor/twig/twig/README.rst" />
|
|
||||||
|
|
||||||
<delete file="${dir}/vendor/zendframework/zend-code/CONTRIBUTING.md" />
|
|
||||||
<delete file="${dir}/vendor/zendframework/zend-code/README.md" />
|
|
||||||
|
|
||||||
<delete file="${dir}/vendor/zendframework/zend-eventmanager/CONTRIBUTING.md" />
|
|
||||||
<delete file="${dir}/vendor/zendframework/zend-eventmanager/README.md" />
|
|
||||||
|
|
||||||
<delete file="${dir}/vendor/zendframework/zend-stdlib/CONTRIBUTING.md" />
|
|
||||||
<delete file="${dir}/vendor/zendframework/zend-stdlib/README.md" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="clean-diff-dir">
|
|
||||||
<delete dir="${dir}/cache" />
|
|
||||||
<delete dir="${dir}/docs" />
|
|
||||||
<delete dir="${dir}/files" />
|
|
||||||
<delete dir="${dir}/install" />
|
|
||||||
<delete dir="${dir}/store" />
|
|
||||||
<delete dir="${dir}/vendor" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
</project>
|
|
@@ -1,84 +0,0 @@
|
|||||||
#!/usr/bin/env php
|
|
||||||
<?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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (php_sapi_name() !== 'cli' || $_SERVER['argc'] != 5)
|
|
||||||
{
|
|
||||||
echo "Usage (CLI only): build_announcement.php email|bbcode new_version release_files_dir checksum_algorithm\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
$mode = $_SERVER['argv'][1];
|
|
||||||
$version = $_SERVER['argv'][2];
|
|
||||||
$root = $_SERVER['argv'][3];
|
|
||||||
$checksum_algorithm = $_SERVER['argv'][4];
|
|
||||||
|
|
||||||
$series_version = substr($version, 0, 3);
|
|
||||||
$base_url = "https://download.phpbb.com/pub/release/$series_version";
|
|
||||||
|
|
||||||
if (version_compare($version, "$series_version.0", '<'))
|
|
||||||
{
|
|
||||||
// Everything before 3.x.0, i.e. unstable (e.g. alpha, beta, rc)
|
|
||||||
$url = "$base_url/unstable/$version";
|
|
||||||
}
|
|
||||||
else if (strpos($version, 'RC') !== false)
|
|
||||||
{
|
|
||||||
// Release candidate of stable release
|
|
||||||
$url = "$base_url/qa/$version";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Stable release (e.g. 3.x.0, 3.x.1, 3.x.2, 3.x.3-PL1)
|
|
||||||
$url = "$base_url/$version";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($mode === 'bbcode')
|
|
||||||
{
|
|
||||||
$template = "[url=%1\$s/%2\$s]%2\$s[/url]\n{$checksum_algorithm}sum: %3\$s\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$template = "%s/%s\n{$checksum_algorithm}sum: %s\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
function phpbb_rnatsort($array)
|
|
||||||
{
|
|
||||||
$strrnatcmp = function($a, $b)
|
|
||||||
{
|
|
||||||
return strnatcmp($b, $a);
|
|
||||||
};
|
|
||||||
usort($array, $strrnatcmp);
|
|
||||||
return $array;
|
|
||||||
}
|
|
||||||
|
|
||||||
function phpbb_string_ends_with($haystack, $needle)
|
|
||||||
{
|
|
||||||
return substr($haystack, -strlen($needle)) === $needle;
|
|
||||||
}
|
|
||||||
|
|
||||||
function phpbb_get_checksum($checksum_file)
|
|
||||||
{
|
|
||||||
return array_shift(explode(' ', file_get_contents($checksum_file)));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (phpbb_rnatsort(array_diff(scandir($root), array('.', '..'))) as $filename)
|
|
||||||
{
|
|
||||||
if (phpbb_string_ends_with($filename, $checksum_algorithm))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf($template, $url, $filename, phpbb_get_checksum("$root/$filename.$checksum_algorithm"));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,67 +0,0 @@
|
|||||||
#!/usr/bin/env php
|
|
||||||
<?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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($_SERVER['argc'] != 2)
|
|
||||||
{
|
|
||||||
echo "Please specify the new version as argument (e.g. build_changelog.php '1.0.2').\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_SERVER['argv'][1] == '--stdin')
|
|
||||||
{
|
|
||||||
$stdIn = file_get_contents('php://stdin');
|
|
||||||
// XML output from tracker can be directly piped to this script using:
|
|
||||||
// cat tracker_output.xml | php build/build_changelog.php --stdin
|
|
||||||
$xml = simplexml_load_string($stdIn);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$fixVersion = $_SERVER['argv'][1];
|
|
||||||
|
|
||||||
$query = 'project IN (PHPBB3, SECURITY)
|
|
||||||
AND resolution = Fixed
|
|
||||||
AND fixVersion = "' . $fixVersion . '"
|
|
||||||
AND status IN ("Unverified Fix", Closed)';
|
|
||||||
|
|
||||||
$url = 'https://tracker.phpbb.com/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=' . urlencode($query) . '&tempMax=1000';
|
|
||||||
$xml = simplexml_load_string(file_get_contents($url));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($xml->xpath('//item') as $item)
|
|
||||||
{
|
|
||||||
$key = (string) $item->key;
|
|
||||||
|
|
||||||
$keyUrl = 'https://tracker.phpbb.com/browse/' . $key;
|
|
||||||
$keyLink = '<a href="' . $keyUrl . '">' . $key . '</a>';
|
|
||||||
|
|
||||||
$value = str_replace($key, $keyLink, htmlspecialchars($item->title, ENT_COMPAT));
|
|
||||||
$value = str_replace(']', '] -', $value);
|
|
||||||
|
|
||||||
$types[(string) $item->type][$key] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
ksort($types);
|
|
||||||
foreach ($types as $type => $tickets)
|
|
||||||
{
|
|
||||||
echo "<h4>$type</h4>\n";
|
|
||||||
echo "<ul>\n";
|
|
||||||
|
|
||||||
uksort($tickets, 'strnatcasecmp');
|
|
||||||
|
|
||||||
foreach ($tickets as $ticket)
|
|
||||||
{
|
|
||||||
echo "<li>$ticket</li>\n";
|
|
||||||
}
|
|
||||||
echo "</ul>\n";
|
|
||||||
}
|
|
@@ -1,378 +0,0 @@
|
|||||||
<?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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
class build_package
|
|
||||||
{
|
|
||||||
var $package_infos;
|
|
||||||
var $old_packages;
|
|
||||||
var $versions;
|
|
||||||
var $locations;
|
|
||||||
|
|
||||||
// -c - context diff
|
|
||||||
// -r - compare recursive
|
|
||||||
// -N - Treat missing files as empty
|
|
||||||
// -E - Ignore tab expansions
|
|
||||||
// -Z - Ignore white space at line end.
|
|
||||||
// -b - Ignore changes in the amount of white space.
|
|
||||||
// -B - Ignore blank lines
|
|
||||||
// -d - Try to find smaller set of changes
|
|
||||||
var $diff_options = '-crNEBZbd';
|
|
||||||
var $diff_options_long = '-x images -crNEB'; // -x fonts -x imageset //imageset not used here, because it includes the imageset.cfg file. ;)
|
|
||||||
|
|
||||||
var $verbose = false;
|
|
||||||
var $status_begun = false;
|
|
||||||
var $num_dots = 0;
|
|
||||||
|
|
||||||
function __construct($versions, $verbose = false)
|
|
||||||
{
|
|
||||||
$this->versions = $versions;
|
|
||||||
$this->verbose = $verbose;
|
|
||||||
|
|
||||||
// Get last two entries
|
|
||||||
$_latest = $this->versions[count($this->versions) - 1];
|
|
||||||
$_before = $this->versions[count($this->versions) - 2];
|
|
||||||
|
|
||||||
$this->locations = array(
|
|
||||||
'new_version' => dirname(__DIR__) . '/phpBB/',
|
|
||||||
'old_versions' => __DIR__ . '/old_versions/',
|
|
||||||
'root' => __DIR__ . '/',
|
|
||||||
'package_dir' => __DIR__ . '/new_version/'
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->package_infos = array(
|
|
||||||
'package_name' => 'phpBB3',
|
|
||||||
'name_prefix' => 'phpbb',
|
|
||||||
'simple_name' => 'release-' . $_latest,
|
|
||||||
'new_version_number' => $_latest,
|
|
||||||
'short_version_number' => str_replace('.', '', $_latest),
|
|
||||||
'release_filename' => 'phpBB-' . $_latest,
|
|
||||||
'last_version' => 'release-' . $_before,
|
|
||||||
'last_version_number' => $_before,
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->package_infos['dest_dir'] = $this->locations['package_dir'] . $this->package_infos['package_name'];
|
|
||||||
$this->package_infos['diff_dir'] = $this->locations['old_versions'] . $this->package_infos['simple_name'];
|
|
||||||
$this->package_infos['patch_directory'] = $this->locations['package_dir'] . 'patches';
|
|
||||||
$this->package_infos['files_directory'] = $this->locations['package_dir'] . 'files';
|
|
||||||
$this->package_infos['update_directory'] = $this->locations['package_dir'] . 'update';
|
|
||||||
$this->package_infos['release_directory'] = $this->locations['package_dir'] . 'release_files';
|
|
||||||
|
|
||||||
// Old packages always exclude the latest version. ;)
|
|
||||||
$this->old_packages = array();
|
|
||||||
|
|
||||||
foreach ($this->versions as $package_version)
|
|
||||||
{
|
|
||||||
if ($package_version == $_latest)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->old_packages['release-' . $package_version] = $package_version . '_to_';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function get($var)
|
|
||||||
{
|
|
||||||
return $this->package_infos[$var];
|
|
||||||
}
|
|
||||||
|
|
||||||
function begin_status($headline)
|
|
||||||
{
|
|
||||||
if ($this->status_begun)
|
|
||||||
{
|
|
||||||
echo "\nDone.\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->num_dots = 0;
|
|
||||||
|
|
||||||
echo $headline . "\n ";
|
|
||||||
|
|
||||||
$this->status_begun = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function run_command($command)
|
|
||||||
{
|
|
||||||
$result = trim(`$command`);
|
|
||||||
|
|
||||||
if ($this->verbose)
|
|
||||||
{
|
|
||||||
echo " command : " . getcwd() . '$ ' . $command . "\n";
|
|
||||||
echo " result : " . $result . "\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($this->num_dots > 70)
|
|
||||||
{
|
|
||||||
echo "\n";
|
|
||||||
$this->num_dots = 0;
|
|
||||||
}
|
|
||||||
echo '.';
|
|
||||||
$this->num_dots++;
|
|
||||||
}
|
|
||||||
|
|
||||||
flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_directory($directory, $dir_struct)
|
|
||||||
{
|
|
||||||
if (!file_exists($directory))
|
|
||||||
{
|
|
||||||
$this->run_command("mkdir $directory");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($dir_struct))
|
|
||||||
{
|
|
||||||
foreach ($dir_struct as $_dir => $_dir_struct)
|
|
||||||
{
|
|
||||||
$this->create_directory($directory . '/' . $_dir, $_dir_struct);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function collect_diff_files($diff_filename, $package_name)
|
|
||||||
{
|
|
||||||
$diff_result = $binary = array();
|
|
||||||
$diff_contents = file($diff_filename);
|
|
||||||
|
|
||||||
$special_diff_contents = array();
|
|
||||||
|
|
||||||
foreach ($diff_contents as $num => $line)
|
|
||||||
{
|
|
||||||
$line = trim($line);
|
|
||||||
|
|
||||||
if (!$line)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Special diff content?
|
|
||||||
if (strpos($line, 'diff ' . $this->diff_options . ' ') === 0 || strpos($line, '*** ') === 0 || strpos($line, '--- ') === 0 || (strpos($line, ' Exp $') !== false && strpos($line, '$Id:') !== false))
|
|
||||||
{
|
|
||||||
$special_diff_contents[] = $line;
|
|
||||||
}
|
|
||||||
else if (strpos($line, 'diff ' . $this->diff_options . ' ') === 0 || strpos($line, '*** ') === 0 || strpos($line, '--- ') === 0 || (strpos($line, ' Exp $') !== false && strpos($line, '$Id:') !== false) || (strpos($line, ' $') !== false && strpos($line, '$Id:') !== false))
|
|
||||||
{
|
|
||||||
$special_diff_contents[] = $line;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is diffing line?
|
|
||||||
if (strstr($line, 'diff ' . $this->diff_options . ' '))
|
|
||||||
{
|
|
||||||
$next_line = $diff_contents[$num+1];
|
|
||||||
if (strpos($next_line, '***') === 0)
|
|
||||||
{
|
|
||||||
// *** phpbb208/admin/admin_board.php Sat Jul 10 20:16:26 2004
|
|
||||||
$next_line = explode("\t", $next_line);
|
|
||||||
$next_line = trim($next_line[0]);
|
|
||||||
$next_line = str_replace('*** ' . $package_name . '/', '', $next_line);
|
|
||||||
$diff_result[] = $next_line;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is binary?
|
|
||||||
if (preg_match('/^Binary files ' . $package_name . '\/(.*) and [a-z0-9._-]+\/\1 differ/i', $line, $match))
|
|
||||||
{
|
|
||||||
$binary[] = trim($match[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now go through the list again and find out which files have how many changes...
|
|
||||||
$num_changes = array();
|
|
||||||
|
|
||||||
/* [1070] => diff -crN phpbb200/includes/usercp_avatar.php phpbb2023/includes/usercp_avatar.php
|
|
||||||
[1071] => *** phpbb200/includes/usercp_avatar.php Sat Jul 10 20:16:13 2004
|
|
||||||
[1072] => --- phpbb2023/includes/usercp_avatar.php Wed Feb 6 22:28:04 2008
|
|
||||||
[1073] => *** 6,12 ****
|
|
||||||
[1074] => ! * $Id$
|
|
||||||
[1075] => --- 6,12 ----
|
|
||||||
[1076] => *** 51,59 ****
|
|
||||||
[1077] => --- 51,60 ----
|
|
||||||
[1078] => *** 62,80 ****
|
|
||||||
[1079] => --- 63,108 ----
|
|
||||||
[1080] => *** 87,97 ****
|
|
||||||
*/
|
|
||||||
while (($line = array_shift($special_diff_contents)) !== NULL)
|
|
||||||
{
|
|
||||||
$line = trim($line);
|
|
||||||
|
|
||||||
if (!$line)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is diffing line?
|
|
||||||
if (strstr($line, 'diff ' . $this->diff_options . ' '))
|
|
||||||
{
|
|
||||||
$next_line = array_shift($special_diff_contents);
|
|
||||||
if (strpos($next_line, '*** ') === 0)
|
|
||||||
{
|
|
||||||
// *** phpbb208/admin/admin_board.php Sat Jul 10 20:16:26 2004
|
|
||||||
$next_line = explode("\t", $next_line);
|
|
||||||
$next_line = trim($next_line[0]);
|
|
||||||
$next_line = str_replace('*** ' . $package_name . '/', '', $next_line);
|
|
||||||
|
|
||||||
$is_reached = false;
|
|
||||||
$prev_line = '';
|
|
||||||
|
|
||||||
while (!$is_reached)
|
|
||||||
{
|
|
||||||
$line = array_shift($special_diff_contents);
|
|
||||||
|
|
||||||
if (strpos($line, 'diff ' . $this->diff_options) === 0 || empty($special_diff_contents))
|
|
||||||
{
|
|
||||||
$is_reached = true;
|
|
||||||
array_unshift($special_diff_contents, $line);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strpos($line, '*** ') === 0 && strpos($line, ' ****') !== false)
|
|
||||||
{
|
|
||||||
$is_comment = false;
|
|
||||||
while (!(strpos($line, '--- ') === 0 && strpos($line, ' ----') !== false))
|
|
||||||
{
|
|
||||||
$line = array_shift($special_diff_contents);
|
|
||||||
if (strpos($line, ' Exp $') !== false || strpos($line, '$Id:') !== false)
|
|
||||||
{
|
|
||||||
$is_comment = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$is_comment)
|
|
||||||
{
|
|
||||||
if (!isset($num_changes[$next_line]))
|
|
||||||
{
|
|
||||||
$num_changes[$next_line] = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$num_changes[$next_line]++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now remove those results not having changes
|
|
||||||
$return = array();
|
|
||||||
|
|
||||||
foreach ($diff_result as $key => $value)
|
|
||||||
{
|
|
||||||
if (isset($num_changes[$value]))
|
|
||||||
{
|
|
||||||
$return[] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($binary as $value)
|
|
||||||
{
|
|
||||||
$return[] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$diff_result = $return;
|
|
||||||
unset($return);
|
|
||||||
unset($special_diff_contents);
|
|
||||||
|
|
||||||
$result = array(
|
|
||||||
'files' => array(),
|
|
||||||
'binary' => array(),
|
|
||||||
'all' => $diff_result,
|
|
||||||
);
|
|
||||||
|
|
||||||
$binary_extensions = array('gif', 'jpg', 'jpeg', 'png', 'ttf');
|
|
||||||
|
|
||||||
// Split into file and binary
|
|
||||||
foreach ($diff_result as $filename)
|
|
||||||
{
|
|
||||||
if (strpos($filename, '.') === false)
|
|
||||||
{
|
|
||||||
$result['files'][] = $filename;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$extension = explode('.', $filename);
|
|
||||||
$extension = array_pop($extension);
|
|
||||||
|
|
||||||
if (in_array($extension, $binary_extensions))
|
|
||||||
{
|
|
||||||
$result['binary'][] = $filename;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$result['files'][] = $filename;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Collect the list of the deleted files from a list of deleted files and folders.
|
|
||||||
*
|
|
||||||
* @param string $deleted_filename The full path to a file containing the list of deleted files and directories
|
|
||||||
* @param string $package_name The name of the package
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function collect_deleted_files($deleted_filename, $package_name)
|
|
||||||
{
|
|
||||||
$result = array();
|
|
||||||
$file_contents = file($deleted_filename);
|
|
||||||
|
|
||||||
foreach ($file_contents as $filename)
|
|
||||||
{
|
|
||||||
$filename = trim($filename);
|
|
||||||
|
|
||||||
if (!$filename)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$filename = str_replace('Only in ' . $package_name, '', $filename);
|
|
||||||
$filename = ltrim($filename, '/');
|
|
||||||
|
|
||||||
if (substr($filename, 0, 1) == ':')
|
|
||||||
{
|
|
||||||
$replace = '';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$replace = '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
$filename = str_replace(': ', $replace, $filename);
|
|
||||||
|
|
||||||
if (is_dir("{$this->locations['old_versions']}{$package_name}/{$filename}"))
|
|
||||||
{
|
|
||||||
$iterator = new \RecursiveIteratorIterator(
|
|
||||||
new \RecursiveDirectoryIterator(
|
|
||||||
"{$this->locations['old_versions']}{$package_name}/{$filename}",
|
|
||||||
\FilesystemIterator::UNIX_PATHS | \FilesystemIterator::SKIP_DOTS
|
|
||||||
),
|
|
||||||
\RecursiveIteratorIterator::LEAVES_ONLY
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($iterator as $file_info)
|
|
||||||
{
|
|
||||||
$result[] = "{$filename}/{$iterator->getSubPathname()}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$result[] = $filename;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,235 +0,0 @@
|
|||||||
<?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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
use PHP_CodeSniffer\Files\File;
|
|
||||||
use PHP_CodeSniffer\Sniffs\Sniff;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks that each PHP source file contains a valid header as defined by the
|
|
||||||
* phpBB Coding Guidelines.
|
|
||||||
*
|
|
||||||
* @package code_sniffer
|
|
||||||
* @author Manuel Pichler <mapi@phpundercontrol.org>
|
|
||||||
*/
|
|
||||||
class phpbb_Sniffs_Commenting_FileCommentSniff implements Sniff
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Returns an array of tokens this test wants to listen for.
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function register()
|
|
||||||
{
|
|
||||||
return array(T_OPEN_TAG);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Processes this test, when one of its tokens is encountered.
|
|
||||||
*
|
|
||||||
* @param File $phpcsFile The file being scanned.
|
|
||||||
* @param int $stackPtr The position of the current token
|
|
||||||
* in the stack passed in $tokens.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function process(File $phpcsFile, $stackPtr): void
|
|
||||||
{
|
|
||||||
// We are only interested in the first file comment.
|
|
||||||
if ($stackPtr !== 0)
|
|
||||||
{
|
|
||||||
if ($phpcsFile->findPrevious(T_OPEN_TAG, $stackPtr - 1) !== false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch next non whitespace token
|
|
||||||
$tokens = $phpcsFile->getTokens();
|
|
||||||
$start = $phpcsFile->findNext(T_WHITESPACE, $stackPtr + 1, null, true);
|
|
||||||
|
|
||||||
// Skip empty files
|
|
||||||
if ($tokens[$start]['code'] === T_CLOSE_TAG)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Mark as error if this is not a doc comment
|
|
||||||
else if ($start === false || $tokens[$start]['code'] !== T_DOC_COMMENT_OPEN_TAG)
|
|
||||||
{
|
|
||||||
$phpcsFile->addError('Missing required file doc comment.', $stackPtr, 'MissingComment');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find comment end token
|
|
||||||
$end = $tokens[$start]['comment_closer'];
|
|
||||||
|
|
||||||
// If there is no end, skip processing here
|
|
||||||
if ($end === false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check comment lines without the first(/**) an last(*/) line
|
|
||||||
for ($token = $start + 1, $c = $end - 2; $token <= $c; ++$token)
|
|
||||||
{
|
|
||||||
// Check that each line starts with a '*'
|
|
||||||
if ($tokens[$token]['column'] === 1 && (($tokens[$token]['content'] !== '*' && $tokens[$token]['content'] !== ' ') || ($tokens[$token]['content'] === ' ' && $tokens[$token + 1]['content'] !== '*')))
|
|
||||||
{
|
|
||||||
$message = 'The file doc comment should not be indented.';
|
|
||||||
$phpcsFile->addWarning($message, $token, 'CommentIndented');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that the first and last line is empty
|
|
||||||
// /**T_WHITESPACE
|
|
||||||
// (T_WHITESPACE)*T_WHITESPACE
|
|
||||||
// (T_WHITESPACE)* ...
|
|
||||||
// (T_WHITESPACE)*T_WHITESPACE
|
|
||||||
// T_WHITESPACE*/
|
|
||||||
if (!(($tokens[$start + 2]['content'] !== '*' && $tokens[$start + 4]['content'] !== '*') || ($tokens[$start + 3]['content'] !== '*' && $tokens[$start + 6]['content'] !== '*')))
|
|
||||||
{
|
|
||||||
$message = 'The first file comment line should be empty.';
|
|
||||||
$phpcsFile->addWarning($message, ($start + 1), 'CommentFirstNotEmpty');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($tokens[$end - 3]['content'] !== '*' && $tokens[$end - 6]['content'] !== '*')
|
|
||||||
{
|
|
||||||
$message = 'The last file comment line should be empty.';
|
|
||||||
$phpcsFile->addWarning($message, $end - 1, 'CommentLastNotEmpty');
|
|
||||||
}
|
|
||||||
|
|
||||||
//$this->processPackage($phpcsFile, $start, $tags);
|
|
||||||
//$this->processVersion($phpcsFile, $start, $tags);
|
|
||||||
$this->processCopyright($phpcsFile, $start, $tokens[$start]['comment_tags']);
|
|
||||||
$this->processLicense($phpcsFile, $start, $tokens[$start]['comment_tags']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks that the tags array contains a valid package tag
|
|
||||||
*
|
|
||||||
* @param File $phpcsFile The context source file instance.
|
|
||||||
* @param integer The stack pointer for the first comment token.
|
|
||||||
* @param array(string=>array) $tags The found file doc comment tags.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function processPackage(File $phpcsFile, $ptr, $tags): void
|
|
||||||
{
|
|
||||||
if (!isset($tags['package']))
|
|
||||||
{
|
|
||||||
$message = 'Missing require @package tag in file doc comment.';
|
|
||||||
$phpcsFile->addError($message, $ptr, 'MissingTagPackage');
|
|
||||||
}
|
|
||||||
else if (preg_match('/^([\w]+)$/', $tags['package'][0]) === 0)
|
|
||||||
{
|
|
||||||
$message = 'Invalid content found for @package tag.';
|
|
||||||
$phpcsFile->addWarning($message, $tags['package'][1], 'InvalidTagPackage');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks that the tags array contains a valid version tag
|
|
||||||
*
|
|
||||||
* @param File $phpcsFile The context source file instance.
|
|
||||||
* @param integer The stack pointer for the first comment token.
|
|
||||||
* @param array(string=>array) $tags The found file doc comment tags.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function processVersion(File $phpcsFile, $ptr, $tags): void
|
|
||||||
{
|
|
||||||
if (!isset($tags['version']))
|
|
||||||
{
|
|
||||||
$message = 'Missing require @version tag in file doc comment.';
|
|
||||||
$phpcsFile->addError($message, $ptr, 'MissingTagVersion');
|
|
||||||
}
|
|
||||||
else if (preg_match('/^\$Id:[^\$]+\$$/', $tags['version'][0]) === 0)
|
|
||||||
{
|
|
||||||
$message = 'Invalid content found for @version tag, use "$Id: $".';
|
|
||||||
$phpcsFile->addError($message, $tags['version'][1], 'InvalidTagVersion');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks that the tags array contains a valid copyright tag
|
|
||||||
*
|
|
||||||
* @param File $phpcsFile The context source file instance.
|
|
||||||
* @param integer The stack pointer for the first comment token.
|
|
||||||
* @param array(string=>array) $tags The found file doc comment tags.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function processCopyright(File $phpcsFile, $ptr, $tags): void
|
|
||||||
{
|
|
||||||
$copyright = '(c) phpBB Limited <https://www.phpbb.com>';
|
|
||||||
$tokens = $phpcsFile->getTokens();
|
|
||||||
|
|
||||||
foreach ($tags as $tag)
|
|
||||||
{
|
|
||||||
if ($tokens[$tag]['content'] === '@copyright')
|
|
||||||
{
|
|
||||||
if ($tokens[$tag + 2]['content'] !== $copyright)
|
|
||||||
{
|
|
||||||
$message = 'Invalid content found for the first @copyright tag, use "' . $copyright . '".';
|
|
||||||
$phpcsFile->addError($message, $tags['copyright'][0][1], 'InvalidTagCopyright');
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$message = 'Missing require @copyright tag in file doc comment.';
|
|
||||||
$phpcsFile->addError($message, $ptr, 'MissingTagCopyright');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks that the tags array contains a valid license tag
|
|
||||||
*
|
|
||||||
* @param File $phpcsFile The context source file instance.
|
|
||||||
* @param integer The stack pointer for the first comment token.
|
|
||||||
* @param array(string=>array) $tags The found file doc comment tags.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function processLicense(File $phpcsFile, $ptr, $tags): void
|
|
||||||
{
|
|
||||||
$license = 'GNU General Public License, version 2 (GPL-2.0)';
|
|
||||||
$tokens = $phpcsFile->getTokens();
|
|
||||||
|
|
||||||
$found = false;
|
|
||||||
foreach ($tags as $tag)
|
|
||||||
{
|
|
||||||
if ($tokens[$tag]['content'] === '@license')
|
|
||||||
{
|
|
||||||
if ($found)
|
|
||||||
{
|
|
||||||
$message = 'It must be only one @license tag in file doc comment.';
|
|
||||||
$phpcsFile->addError($message, $ptr, 'MultiTagVersion');
|
|
||||||
}
|
|
||||||
|
|
||||||
$found = true;
|
|
||||||
|
|
||||||
if ($tokens[$tag + 2]['content'] !== $license)
|
|
||||||
{
|
|
||||||
$message = 'Invalid content found for @license tag, use "' . $license . '".';
|
|
||||||
$phpcsFile->addError($message, $tags['license'][0][1], 'InvalidTagLicense');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$found)
|
|
||||||
{
|
|
||||||
$message = 'Missing require @license tag in file doc comment.';
|
|
||||||
$phpcsFile->addError($message, $ptr, 'MissingTagLicense');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,146 +0,0 @@
|
|||||||
<?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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
use PHP_CodeSniffer\Files\File;
|
|
||||||
use PHP_CodeSniffer\Sniffs\Sniff;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks that the opening brace of a control structures is on the line after.
|
|
||||||
* From Generic_Sniffs_Functions_OpeningFunctionBraceBsdAllmanSniff
|
|
||||||
*/
|
|
||||||
class phpbb_Sniffs_ControlStructures_OpeningBraceBsdAllmanSniff implements Sniff
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Registers the tokens that this sniff wants to listen for.
|
|
||||||
*/
|
|
||||||
public function register()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
T_IF,
|
|
||||||
T_ELSE,
|
|
||||||
T_FOREACH,
|
|
||||||
T_WHILE,
|
|
||||||
T_DO,
|
|
||||||
T_FOR,
|
|
||||||
T_SWITCH,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Processes this test, when one of its tokens is encountered.
|
|
||||||
*
|
|
||||||
* @param File $phpcsFile The file being scanned.
|
|
||||||
* @param int $stackPtr The position of the current token in the
|
|
||||||
* stack passed in $tokens.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function process(File $phpcsFile, $stackPtr)
|
|
||||||
{
|
|
||||||
$tokens = $phpcsFile->getTokens();
|
|
||||||
|
|
||||||
if (isset($tokens[$stackPtr]['scope_opener']) === false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* else if ()
|
|
||||||
* {
|
|
||||||
* ...
|
|
||||||
*/
|
|
||||||
if ($tokens[$stackPtr]['code'] === T_ELSE && $tokens[$stackPtr + 2]['code'] === T_IF)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$openingBrace = $tokens[$stackPtr]['scope_opener'];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ...
|
|
||||||
* do
|
|
||||||
* {
|
|
||||||
* <code>
|
|
||||||
* } while();
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* else
|
|
||||||
* {
|
|
||||||
* ...
|
|
||||||
*/
|
|
||||||
if ($tokens[$stackPtr]['code'] === T_DO ||$tokens[$stackPtr]['code'] === T_ELSE)
|
|
||||||
{
|
|
||||||
$cs_line = $tokens[$stackPtr]['line'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// The end of the function occurs at the end of the argument list. Its
|
|
||||||
// like this because some people like to break long function declarations
|
|
||||||
// over multiple lines.
|
|
||||||
$cs_line = $tokens[$tokens[$stackPtr]['parenthesis_closer']]['line'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$braceLine = $tokens[$openingBrace]['line'];
|
|
||||||
|
|
||||||
$lineDifference = ($braceLine - $cs_line);
|
|
||||||
|
|
||||||
if ($lineDifference === 0)
|
|
||||||
{
|
|
||||||
$error = 'Opening brace should be on a new line';
|
|
||||||
$phpcsFile->addError($error, $openingBrace, 'BraceOnSameLine');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($lineDifference > 1)
|
|
||||||
{
|
|
||||||
$error = 'Opening brace should be on the line after the declaration; found %s blank line(s)';
|
|
||||||
$data = array(($lineDifference - 1));
|
|
||||||
$phpcsFile->addError($error, $openingBrace, 'BraceSpacing', $data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We need to actually find the first piece of content on this line,
|
|
||||||
// as if this is a method with tokens before it (public, static etc)
|
|
||||||
// or an if with an else before it, then we need to start the scope
|
|
||||||
// checking from there, rather than the current token.
|
|
||||||
$lineStart = $stackPtr;
|
|
||||||
while (($lineStart = $phpcsFile->findPrevious(array(T_WHITESPACE), ($lineStart - 1), null, false)) !== false)
|
|
||||||
{
|
|
||||||
if (strpos($tokens[$lineStart]['content'], $phpcsFile->eolChar) !== false)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We found a new line, now go forward and find the first non-whitespace
|
|
||||||
// token.
|
|
||||||
$lineStart = $phpcsFile->findNext(array(T_WHITESPACE), $lineStart, null, true);
|
|
||||||
|
|
||||||
// The opening brace is on the correct line, now it needs to be
|
|
||||||
// checked to be correctly indented.
|
|
||||||
$startColumn = $tokens[$lineStart]['column'];
|
|
||||||
$braceIndent = $tokens[$openingBrace]['column'];
|
|
||||||
|
|
||||||
if ($braceIndent !== $startColumn)
|
|
||||||
{
|
|
||||||
$error = 'Opening brace indented incorrectly; expected %s spaces, found %s';
|
|
||||||
$data = array(
|
|
||||||
($startColumn - 1),
|
|
||||||
($braceIndent - 1),
|
|
||||||
);
|
|
||||||
$phpcsFile->addError($error, $openingBrace, 'BraceIndent', $data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,63 +0,0 @@
|
|||||||
<?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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
use PHP_CodeSniffer\Files\File;
|
|
||||||
use PHP_CodeSniffer\Sniffs\Sniff;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks that there is exactly one space between the keyword and the opening
|
|
||||||
* parenthesis of a control structures.
|
|
||||||
*/
|
|
||||||
class phpbb_Sniffs_ControlStructures_OpeningParenthesisSniff implements Sniff
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Registers the tokens that this sniff wants to listen for.
|
|
||||||
*/
|
|
||||||
public function register()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
T_IF,
|
|
||||||
T_FOREACH,
|
|
||||||
T_WHILE,
|
|
||||||
T_FOR,
|
|
||||||
T_SWITCH,
|
|
||||||
T_ELSEIF,
|
|
||||||
T_CATCH,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Processes this test, when one of its tokens is encountered.
|
|
||||||
*
|
|
||||||
* @param File $phpcsFile The file being scanned.
|
|
||||||
* @param int $stackPtr The position of the current token in the
|
|
||||||
* stack passed in $tokens.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function process(File $phpcsFile, $stackPtr)
|
|
||||||
{
|
|
||||||
$tokens = $phpcsFile->getTokens();
|
|
||||||
|
|
||||||
if ($tokens[$stackPtr + 1]['content'] === '(')
|
|
||||||
{
|
|
||||||
$error = 'There should be exactly one space between the keyword and opening parenthesis';
|
|
||||||
$phpcsFile->addError($error, $stackPtr, 'NoSpaceBeforeOpeningParenthesis');
|
|
||||||
}
|
|
||||||
else if ($tokens[$stackPtr + 1]['content'] !== ' ')
|
|
||||||
{
|
|
||||||
$error = 'There should be exactly one space between the keyword and opening parenthesis';
|
|
||||||
$phpcsFile->addError($error, $stackPtr, 'IncorrectSpaceBeforeOpeningParenthesis');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,380 +0,0 @@
|
|||||||
<?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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
use PHP_CodeSniffer\Files\File;
|
|
||||||
use PHP_CodeSniffer\Sniffs\Sniff;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks that each use statement is used.
|
|
||||||
*/
|
|
||||||
class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff
|
|
||||||
{
|
|
||||||
const FIND = [
|
|
||||||
T_NS_SEPARATOR,
|
|
||||||
T_STRING,
|
|
||||||
T_WHITESPACE,
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function register()
|
|
||||||
{
|
|
||||||
return [T_USE];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function check(File $phpcsFile, $found_name, $full_name, $short_name, $stack_pointer)
|
|
||||||
{
|
|
||||||
$found_name_normalized = ltrim($found_name, '\\');
|
|
||||||
$full_name = ltrim($full_name, '\\');
|
|
||||||
|
|
||||||
$is_global = ($full_name === $short_name);
|
|
||||||
$unnecessarily_fully_qualified = ($is_global)
|
|
||||||
? ($found_name_normalized !== $found_name && $found_name_normalized === $short_name)
|
|
||||||
: ($found_name_normalized === $full_name);
|
|
||||||
|
|
||||||
if ($unnecessarily_fully_qualified)
|
|
||||||
{
|
|
||||||
$error = 'Either use statement or full name must be used.';
|
|
||||||
$phpcsFile->addError($error, $stack_pointer, 'FullName');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($found_name === $short_name)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function process(File $phpcsFile, $stackPtr)
|
|
||||||
{
|
|
||||||
if ($this->should_ignore_use($phpcsFile, $stackPtr) === true)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$tokens = $phpcsFile->getTokens();
|
|
||||||
|
|
||||||
$class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), ($stackPtr + 1));
|
|
||||||
|
|
||||||
$class_name_end = $phpcsFile->findNext(self::FIND, ($stackPtr + 1), null, true);
|
|
||||||
|
|
||||||
$aliasing_as_position = $phpcsFile->findNext(T_AS, $class_name_end, null, false, null, true);
|
|
||||||
if ($aliasing_as_position !== false)
|
|
||||||
{
|
|
||||||
$alias_position = $phpcsFile->findNext(T_STRING, $aliasing_as_position, null, false, null, true);
|
|
||||||
$name_short = $tokens[$alias_position]['content'];
|
|
||||||
$name_full = $phpcsFile->getTokensAsString($class_name_start, ($class_name_end - $class_name_start - 1));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$name_full = $phpcsFile->getTokensAsString($class_name_start, ($class_name_end - $class_name_start));
|
|
||||||
$name_short = $tokens[$class_name_end - 1]['content'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($tokens[$class_name_start]['content'] === 'function'
|
|
||||||
&& $tokens[$class_name_start + 1]['code'] === T_WHITESPACE)
|
|
||||||
{
|
|
||||||
$class_name_start += 2;
|
|
||||||
$name_full = $phpcsFile->getTokensAsString(
|
|
||||||
$class_name_start,
|
|
||||||
($class_name_end - $class_name_start - (int) ($aliasing_as_position !== false))
|
|
||||||
);
|
|
||||||
$ok = $this->findFunctionUsage($phpcsFile, $stackPtr, $tokens, $name_full, $name_short);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$ok = $this->findClassUsage($phpcsFile, $stackPtr, $tokens, $name_full, $name_short);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($name_full[0] === '\\')
|
|
||||||
{
|
|
||||||
$phpcsFile->addError("There must not be a leading '\\' in use statements.", $stackPtr, 'Malformed');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$ok)
|
|
||||||
{
|
|
||||||
$error = 'There must not be unused USE statements.';
|
|
||||||
$phpcsFile->addError($error, $stackPtr, 'Unused');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function findClassUsage(File $phpcsFile, $stackPtr, $tokens, $class_name_full, $class_name_short)
|
|
||||||
{
|
|
||||||
$ok = false;
|
|
||||||
|
|
||||||
// Checks in simple statements (new, instanceof and extends)
|
|
||||||
foreach (array(T_INSTANCEOF, T_NEW, T_EXTENDS) as $keyword)
|
|
||||||
{
|
|
||||||
$old_simple_statement = $stackPtr;
|
|
||||||
while (($simple_statement = $phpcsFile->findNext($keyword, ($old_simple_statement + 1))) !== false)
|
|
||||||
{
|
|
||||||
$old_simple_statement = $simple_statement;
|
|
||||||
|
|
||||||
$simple_class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), ($simple_statement + 1));
|
|
||||||
|
|
||||||
if ($simple_class_name_start === false) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$simple_class_name_end = $phpcsFile->findNext(self::FIND, ($simple_statement + 1), null, true);
|
|
||||||
|
|
||||||
$simple_class_name = trim($phpcsFile->getTokensAsString($simple_class_name_start, ($simple_class_name_end - $simple_class_name_start)));
|
|
||||||
|
|
||||||
$ok = $this->check($phpcsFile, $simple_class_name, $class_name_full, $class_name_short, $simple_statement) || $ok;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checks paamayim nekudotayim
|
|
||||||
$old_paamayim_nekudotayim = $stackPtr;
|
|
||||||
while (($paamayim_nekudotayim = $phpcsFile->findNext(T_PAAMAYIM_NEKUDOTAYIM, ($old_paamayim_nekudotayim + 1))) !== false)
|
|
||||||
{
|
|
||||||
$old_paamayim_nekudotayim = $paamayim_nekudotayim;
|
|
||||||
|
|
||||||
$paamayim_nekudotayim_class_name_start = $phpcsFile->findPrevious(self::FIND, $paamayim_nekudotayim - 1, null, true);
|
|
||||||
$paamayim_nekudotayim_class_name_end = $paamayim_nekudotayim - 1;
|
|
||||||
|
|
||||||
$paamayim_nekudotayim_class_name = trim($phpcsFile->getTokensAsString($paamayim_nekudotayim_class_name_start + 1, ($paamayim_nekudotayim_class_name_end - $paamayim_nekudotayim_class_name_start)));
|
|
||||||
|
|
||||||
$ok = $this->check($phpcsFile, $paamayim_nekudotayim_class_name, $class_name_full, $class_name_short, $paamayim_nekudotayim) || $ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checks in implements
|
|
||||||
$old_implements = $stackPtr;
|
|
||||||
while (($implements = $phpcsFile->findNext(T_IMPLEMENTS, ($old_implements + 1))) !== false)
|
|
||||||
{
|
|
||||||
$old_implements = $implements;
|
|
||||||
|
|
||||||
$old_implemented_class = $implements;
|
|
||||||
while (($implemented_class = $phpcsFile->findNext(T_STRING, ($old_implemented_class + 1), null, false, null, true)) !== false)
|
|
||||||
{
|
|
||||||
$old_implemented_class = $implemented_class;
|
|
||||||
|
|
||||||
$implements_class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), ($implemented_class - 1));
|
|
||||||
$implements_class_name_end = $phpcsFile->findNext(self::FIND, ($implemented_class - 1), null, true);
|
|
||||||
|
|
||||||
$implements_class_name = trim($phpcsFile->getTokensAsString($implements_class_name_start, ($implements_class_name_end - $implements_class_name_start)));
|
|
||||||
|
|
||||||
$ok = $this->check($phpcsFile, $implements_class_name, $class_name_full, $class_name_short, $implements) || $ok;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$old_docblock = $stackPtr;
|
|
||||||
while (($docblock = $phpcsFile->findNext(T_DOC_COMMENT_CLOSE_TAG, ($old_docblock + 1))) !== false)
|
|
||||||
{
|
|
||||||
$old_docblock = $docblock;
|
|
||||||
$ok = $this->checkDocblock($phpcsFile, $docblock, $tokens, $class_name_full, $class_name_short) || $ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checks in type hinting
|
|
||||||
$old_function_declaration = $stackPtr;
|
|
||||||
while (($function_declaration = $phpcsFile->findNext(T_FUNCTION, ($old_function_declaration + 1))) !== false)
|
|
||||||
{
|
|
||||||
$old_function_declaration = $function_declaration;
|
|
||||||
|
|
||||||
// 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) || $ok;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checks in catch blocks
|
|
||||||
$old_catch = $stackPtr;
|
|
||||||
while (($catch = $phpcsFile->findNext(T_CATCH, ($old_catch + 1))) !== false)
|
|
||||||
{
|
|
||||||
$old_catch = $catch;
|
|
||||||
|
|
||||||
$caught_class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), $catch + 1);
|
|
||||||
$caught_class_name_end = $phpcsFile->findNext(self::FIND, $caught_class_name_start + 1, null, true);
|
|
||||||
|
|
||||||
$caught_class_name = trim($phpcsFile->getTokensAsString($caught_class_name_start, ($caught_class_name_end - $caught_class_name_start)));
|
|
||||||
|
|
||||||
$ok = $this->check($phpcsFile, $caught_class_name, $class_name_full, $class_name_short, $catch) || $ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
$old_use = $stackPtr;
|
|
||||||
while (($use = $phpcsFile->findNext(T_USE, ($old_use + 1))) !== false)
|
|
||||||
{
|
|
||||||
$old_use = $use;
|
|
||||||
|
|
||||||
// Needs to be inside a class and must not be inside a function scope.
|
|
||||||
if (!$phpcsFile->hasCondition($use, [T_CLASS, T_TRAIT]) || $phpcsFile->hasCondition($use, T_FUNCTION))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$next = $phpcsFile->findNext(T_WHITESPACE, ($use + 1), null, true, null, true);
|
|
||||||
if ($tokens[$next]['code'] === T_OPEN_PARENTHESIS)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), $use + 1, null, false, null, true);
|
|
||||||
$class_name_end = $phpcsFile->findNext(self::FIND, $class_name_start + 1, null, true, null, true);
|
|
||||||
$found_name = trim($phpcsFile->getTokensAsString($class_name_start, ($class_name_end - $class_name_start)));
|
|
||||||
|
|
||||||
$ok = $this->check($phpcsFile, $found_name, $class_name_full, $class_name_short, $use) || $ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function findFunctionUsage(File $phpcsFile, $stackPtr, $tokens, $name_full, $name_short)
|
|
||||||
{
|
|
||||||
$ok = false;
|
|
||||||
$position = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $stackPtr + 1);
|
|
||||||
while ($position !== false)
|
|
||||||
{
|
|
||||||
$function_name_end = $position;
|
|
||||||
$found_start = 1 + $phpcsFile->findPrevious(
|
|
||||||
[T_NS_SEPARATOR, T_STRING, T_WHITESPACE],
|
|
||||||
$function_name_end - 1,
|
|
||||||
null,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$position = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $position + 1);
|
|
||||||
if ($found_start === null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$function_name_start = $found_start;
|
|
||||||
|
|
||||||
// Trim the output.
|
|
||||||
while ($tokens[$function_name_start]['code'] === T_WHITESPACE && $function_name_start < $function_name_end)
|
|
||||||
{
|
|
||||||
++$function_name_start;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ($tokens[$function_name_end]['code'] === T_WHITESPACE && $function_name_end > $function_name_start)
|
|
||||||
{
|
|
||||||
--$function_name_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
$function_name_length = $function_name_end - $function_name_start;
|
|
||||||
|
|
||||||
// Filter out control structures, built in type constructors, etc.
|
|
||||||
if ($function_name_length <= 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This doesn't seem to be valid PHP, where is the opening tag?
|
|
||||||
if ($found_start === 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$previous_token = $found_start - 1;
|
|
||||||
$filter = [
|
|
||||||
T_FUNCTION, // Function declaration
|
|
||||||
T_OBJECT_OPERATOR, // Method call
|
|
||||||
T_DOUBLE_COLON, // Static method call
|
|
||||||
T_NEW, // Constructors
|
|
||||||
];
|
|
||||||
|
|
||||||
// Filter out calls to methods and function declarations.
|
|
||||||
if (in_array($tokens[$previous_token]['code'], $filter))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$function_name = $phpcsFile->getTokensAsString($function_name_start, $function_name_length);
|
|
||||||
$ok = $this->check($phpcsFile, $function_name, $name_full, $name_short, $function_name_start) || $ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if this use statement is part of the namespace block.
|
|
||||||
*
|
|
||||||
* @param File $phpcsFile The file being scanned.
|
|
||||||
* @param int $stackPtr The position of the current token in
|
|
||||||
* the stack passed in $tokens.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
private function should_ignore_use(File $phpcsFile, $stackPtr)
|
|
||||||
{
|
|
||||||
$tokens = $phpcsFile->getTokens();
|
|
||||||
|
|
||||||
// Ignore USE keywords inside closures.
|
|
||||||
$next = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
|
|
||||||
if ($tokens[$next]['code'] === T_OPEN_PARENTHESIS)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ignore USE keywords for traits.
|
|
||||||
if ($phpcsFile->hasCondition($stackPtr, array(T_CLASS, T_TRAIT)) === true)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param File $phpcsFile
|
|
||||||
* @param int $field
|
|
||||||
* @param array $tokens
|
|
||||||
* @param string $class_name_full
|
|
||||||
* @param string $class_name_short
|
|
||||||
* @param bool $ok
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
private function checkDocblock(File $phpcsFile, $comment_end, $tokens, $class_name_full, $class_name_short)
|
|
||||||
{
|
|
||||||
$ok = false;
|
|
||||||
|
|
||||||
$comment_start = $tokens[$comment_end]['comment_opener'];
|
|
||||||
foreach ($tokens[$comment_start]['comment_tags'] as $tag)
|
|
||||||
{
|
|
||||||
if (!in_array($tokens[$tag]['content'], array('@param', '@var', '@return', '@throws'), true))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$classes = $tokens[($tag + 2)]['content'];
|
|
||||||
$space = strpos($classes, ' ');
|
|
||||||
if ($space !== false)
|
|
||||||
{
|
|
||||||
$classes = substr($classes, 0, $space);
|
|
||||||
}
|
|
||||||
|
|
||||||
$tab = strpos($classes, "\t");
|
|
||||||
if ($tab !== false)
|
|
||||||
{
|
|
||||||
$classes = substr($classes, 0, $tab);
|
|
||||||
}
|
|
||||||
|
|
||||||
$classes = explode('|', str_replace('[]', '', $classes));
|
|
||||||
foreach ($classes as $class)
|
|
||||||
{
|
|
||||||
$ok = $this->check($phpcsFile, $class, $class_name_full, $class_name_short, $tag + 2) || $ok;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ok;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<ruleset name="phpBB Minimum Standard">
|
|
||||||
|
|
||||||
<description>phpBB minimum coding standard</description>
|
|
||||||
|
|
||||||
<!-- All code files MUST use only UTF-8 without BOM. -->
|
|
||||||
<rule ref="Generic.Files.ByteOrderMark" />
|
|
||||||
|
|
||||||
<!-- All code files MUST use the Unix LF (linefeed) line ending. -->
|
|
||||||
<rule ref="Generic.Files.LineEndings" />
|
|
||||||
|
|
||||||
<!-- Tabs MUST be used for indentation -->
|
|
||||||
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent" />
|
|
||||||
|
|
||||||
<!-- ALL braces MUST be on their own lines. -->
|
|
||||||
<rule ref="./phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php" />
|
|
||||||
|
|
||||||
</ruleset>
|
|
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<ruleset name="phpBB PHP Strict Standard Extensions">
|
|
||||||
|
|
||||||
<description>phpBB coding standard for PHP files of phpBB extensions</description>
|
|
||||||
|
|
||||||
<rule ref="./ruleset-php-strict.xml" />
|
|
||||||
|
|
||||||
</ruleset>
|
|
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<ruleset name="phpBB PHP Legacy Standard Core">
|
|
||||||
|
|
||||||
<description>phpBB legacy coding standard for PHP files of phpBB core</description>
|
|
||||||
|
|
||||||
<rule ref="./ruleset-php-legacy.xml" />
|
|
||||||
|
|
||||||
<!-- Each file MUST start with a valid header as defined by the Coding Guidelines -->
|
|
||||||
<rule ref="./phpbb/Sniffs/Commenting/FileCommentSniff.php" />
|
|
||||||
|
|
||||||
</ruleset>
|
|
@@ -1,92 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<ruleset name="phpBB PHP Legacy Standard">
|
|
||||||
|
|
||||||
<description>phpBB legacy coding standard for PHP files</description>
|
|
||||||
|
|
||||||
<rule ref="./ruleset-minimum.xml" />
|
|
||||||
|
|
||||||
<!-- "for (; bar; )" should be "while (bar)" instead -->
|
|
||||||
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" />
|
|
||||||
|
|
||||||
<!-- A method MUST not only call its parent -->
|
|
||||||
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />
|
|
||||||
|
|
||||||
<!-- The body of each structure MUST be enclosed by braces. -->
|
|
||||||
<rule ref="Generic.ControlStructures.InlineControlStructure" />
|
|
||||||
|
|
||||||
<!-- There MUST not be more than one statement per line. -->
|
|
||||||
<rule ref="Generic.Formatting.DisallowMultipleStatements" />
|
|
||||||
|
|
||||||
<!-- Call-time pass-by-reference MUST not be used. -->
|
|
||||||
<rule ref="Generic.Functions.CallTimePassByReference.NotAllowed" />
|
|
||||||
|
|
||||||
<!-- Filenames MUST be lowercase. -->
|
|
||||||
<rule ref="Generic.Files.LowercasedFilename" />
|
|
||||||
|
|
||||||
<!-- The function brace MUST be on the line following the function declaration
|
|
||||||
and MUST be indented to the same column as the start of the function declaration. -->
|
|
||||||
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman" />
|
|
||||||
|
|
||||||
<!-- There MUST be exactly one space after a cast. -->
|
|
||||||
<rule ref="Generic.Formatting.SpaceAfterCast" />
|
|
||||||
|
|
||||||
<!-- Class constants MUST be declared in all upper case with underscore separators. -->
|
|
||||||
<rule ref="Generic.NamingConventions.UpperCaseConstantName" />
|
|
||||||
|
|
||||||
<!-- Only <?php, no short tags. -->
|
|
||||||
<rule ref="Generic.PHP.DisallowShortOpenTag.EchoFound" />
|
|
||||||
|
|
||||||
<!-- Method arguments with default values MUST go at the end of the argument list. -->
|
|
||||||
<rule ref="PEAR.Functions.ValidDefaultValue" />
|
|
||||||
|
|
||||||
<!-- Each file MUST end with exactly one newline character -->
|
|
||||||
<rule ref="PSR2.Files.EndFileNewline" />
|
|
||||||
|
|
||||||
<!-- When referencing arrays there MUST NOT be any whitespace around the opening bracket
|
|
||||||
or before the closing bracket. -->
|
|
||||||
<rule ref="Squiz.Arrays.ArrayBracketSpacing" />
|
|
||||||
|
|
||||||
<!-- The "else if" statement MUST be written with a space between the words else and if. -->
|
|
||||||
<rule ref="Squiz.ControlStructures.ElseIfDeclaration" />
|
|
||||||
|
|
||||||
<!-- There MUST be a space between each element of a foreach loop. -->
|
|
||||||
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration" />
|
|
||||||
|
|
||||||
<!-- In a for loop declaration, there MUST be no space inside the brackets
|
|
||||||
and there MUST be 0 spaces before and 1 space after semicolons. -->
|
|
||||||
<rule ref="Squiz.ControlStructures.ForLoopDeclaration" />
|
|
||||||
|
|
||||||
<!-- In the argument list, there MUST NOT be a space before each comma,
|
|
||||||
and there MUST be one space after each comma. -->
|
|
||||||
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
|
|
||||||
<properties>
|
|
||||||
<property name="equalsSpacing" value="1"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint" />
|
|
||||||
|
|
||||||
<!-- All built-in PHP functions MUST be called lowercased. -->
|
|
||||||
<rule ref="Squiz.Functions.LowercaseFunctionKeywords" />
|
|
||||||
|
|
||||||
<!-- The eval() function MUST NOT be used. -->
|
|
||||||
<rule ref="Squiz.PHP.Eval" />
|
|
||||||
|
|
||||||
<!-- There MUST NOT be trailing whitespace at the end of lines. -->
|
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" />
|
|
||||||
|
|
||||||
<!-- There MUST NOT be whitespace before the first content of a file -->
|
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile" />
|
|
||||||
|
|
||||||
<!-- There MUST NOT be whitespace after the last content of a file -->
|
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile" />
|
|
||||||
|
|
||||||
<!-- Functions MUST NOT contain multiple empty lines in a row -->
|
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" />
|
|
||||||
|
|
||||||
<!-- The ?> closing tag MUST be omitted from files containing only PHP. -->
|
|
||||||
<rule ref="Zend.Files.ClosingTag" />
|
|
||||||
|
|
||||||
<!-- There MUST be one space between control structure and opening parenthesis -->
|
|
||||||
<rule ref="./phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php" />
|
|
||||||
|
|
||||||
</ruleset>
|
|
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<ruleset name="phpBB PHP Strict Standard Core">
|
|
||||||
|
|
||||||
<description>phpBB coding standard for PHP files of phpBB core</description>
|
|
||||||
|
|
||||||
<rule ref="./ruleset-php-legacy-core.xml" />
|
|
||||||
<rule ref="./ruleset-php-strict.xml" />
|
|
||||||
|
|
||||||
</ruleset>
|
|
@@ -1,48 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<ruleset name="phpBB PHP Strict Standard">
|
|
||||||
|
|
||||||
<description>phpBB coding standard for PHP files</description>
|
|
||||||
|
|
||||||
<rule ref="./ruleset-php-legacy.xml" />
|
|
||||||
|
|
||||||
<!-- There SHOULD NOT be more than 80 characters per line
|
|
||||||
There MUST NOT be more than 120 characters per line -->
|
|
||||||
<!--
|
|
||||||
<rule ref="Generic.Files.LineLength">
|
|
||||||
<properties>
|
|
||||||
<property name="lineLimit" value="80"/>
|
|
||||||
<property name="absoluteLineLimit" value="120"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- The PHP constants true, false, and null MUST be in lower case. -->
|
|
||||||
<rule ref="Generic.PHP.LowerCaseConstant" />
|
|
||||||
|
|
||||||
<!-- PHP keywords MUST be in lower case. -->
|
|
||||||
<rule ref="Generic.PHP.LowerCaseKeyword" />
|
|
||||||
|
|
||||||
<!-- Constructors MUST be called __construct() instead of after the class. -->
|
|
||||||
<rule ref="Generic.NamingConventions.ConstructorName" />
|
|
||||||
|
|
||||||
<!-- Classes etc. MUST be namespaced -->
|
|
||||||
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace" />
|
|
||||||
|
|
||||||
<!-- A file MUST not contain more than one class/interface -->
|
|
||||||
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses" />
|
|
||||||
|
|
||||||
<!-- Files containing classes MUST not have any side-effects -->
|
|
||||||
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols" />
|
|
||||||
|
|
||||||
<!-- When present, all use declarations MUST go after the namespace declaration.
|
|
||||||
There MUST be one use keyword per declaration.
|
|
||||||
There MUST be one blank line after the use block. -->
|
|
||||||
<rule ref="PSR2.Namespaces.UseDeclaration" />
|
|
||||||
|
|
||||||
<!-- There MUST be one blank line after the namespace declaration -->
|
|
||||||
<rule ref="PSR2.Namespaces.NamespaceDeclaration" />
|
|
||||||
|
|
||||||
<!-- There MUST NOT be unused use statements. -->
|
|
||||||
<rule ref="./phpbb/Sniffs/Namespaces/UnusedUseSniff.php" />
|
|
||||||
|
|
||||||
</ruleset>
|
|
@@ -1,39 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
orig_dir="../../phpBB"
|
|
||||||
|
|
||||||
|
|
||||||
rm -rf test_release_files
|
|
||||||
mkdir test_release_files
|
|
||||||
cd test_release_files
|
|
||||||
|
|
||||||
for ext in "tar.bz2" "zip"
|
|
||||||
do
|
|
||||||
cp "../new_version/release_files/$1.$ext" ./
|
|
||||||
|
|
||||||
if [ "$ext" = "tar.bz2" ]
|
|
||||||
then
|
|
||||||
command="tar -xjf"
|
|
||||||
else
|
|
||||||
command="unzip -q"
|
|
||||||
fi
|
|
||||||
|
|
||||||
$command "$1.$ext"
|
|
||||||
|
|
||||||
for file in `find phpBB3 -name '.svn' -prune -o -type f -print`
|
|
||||||
do
|
|
||||||
orig_file="${file/#phpBB3/$orig_dir}"
|
|
||||||
diff_result=`diff $orig_file $file`
|
|
||||||
|
|
||||||
if [ -n "$diff_result" ]
|
|
||||||
then
|
|
||||||
echo "Difference in package $1.$ext"
|
|
||||||
echo $diff_result
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
rm -rf phpBB3
|
|
||||||
done
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
rm -rf test_release_files
|
|
||||||
|
|
@@ -1,21 +0,0 @@
|
|||||||
<?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__ . '/doctum-checkout.conf.php';
|
|
||||||
|
|
||||||
$config['versions'] = Doctum\Version\GitVersionCollection::create(__DIR__ . '/../')
|
|
||||||
->add('3.3.x')
|
|
||||||
->add('master')
|
|
||||||
;
|
|
||||||
|
|
||||||
return new Doctum\Doctum($iterator, $config);
|
|
@@ -1,31 +0,0 @@
|
|||||||
<?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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
$iterator = Symfony\Component\Finder\Finder::create()
|
|
||||||
->files()
|
|
||||||
->name('*.php')
|
|
||||||
->in(__DIR__ . '/../phpBB/')
|
|
||||||
->notPath('#^cache/#')
|
|
||||||
->notPath('#^develop/#')
|
|
||||||
->notPath('#^ext/#')
|
|
||||||
->notPath('#^vendor/#')
|
|
||||||
->notPath('data');
|
|
||||||
|
|
||||||
// This variable will be used and changed in doctum-all.conf.php
|
|
||||||
$config = [
|
|
||||||
'title' => 'phpBB API Documentation',
|
|
||||||
'build_dir' => __DIR__ . '/api/output/%version%',
|
|
||||||
'cache_dir' => __DIR__ . '/api/cache/%version%',
|
|
||||||
];
|
|
||||||
|
|
||||||
return new Doctum\Doctum($iterator, $config);
|
|
@@ -1,127 +0,0 @@
|
|||||||
#!/usr/bin/env php
|
|
||||||
<?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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (version_compare(PHP_VERSION, '7.0-dev', '<'))
|
|
||||||
{
|
|
||||||
die('generate_package_json.php requires at least PHP 7.0.');
|
|
||||||
}
|
|
||||||
|
|
||||||
define('IN_PHPBB', true);
|
|
||||||
include_once('../phpBB/includes/functions.php');
|
|
||||||
|
|
||||||
$json_data = new \stdClass();
|
|
||||||
$json_data->metadata = new stdClass();
|
|
||||||
|
|
||||||
$json_data->metadata->current_version_date = '';
|
|
||||||
$json_data->metadata->current_version = '';
|
|
||||||
$json_data->metadata->download_path = '';
|
|
||||||
$json_data->metadata->show_update_package = true;
|
|
||||||
$json_data->metadata->historic = false;
|
|
||||||
|
|
||||||
$json_data->package = [];
|
|
||||||
|
|
||||||
// Open build.xml
|
|
||||||
$build_xml = simplexml_load_file('build.xml');
|
|
||||||
$current_version = (string) $build_xml->xpath('/project/property[@name=\'newversion\']/@value')[0]->value;
|
|
||||||
$previous_version = (string) $build_xml->xpath('/project/property[@name=\'prevversion\']/@value')[0]->value;
|
|
||||||
$older_verions = explode(', ', (string) $build_xml->xpath('/project/property[@name=\'olderversions\']/@value')[0]->value);
|
|
||||||
|
|
||||||
// Clean and sort version info
|
|
||||||
$older_verions[] = $previous_version;
|
|
||||||
$older_verions = array_filter($older_verions, function($version) {
|
|
||||||
preg_match(get_preg_expression('semantic_version'), $version, $matches);
|
|
||||||
return empty($matches['prerelease']) || strpos($matches['prerelease'], 'pl') !== false;
|
|
||||||
});
|
|
||||||
usort($older_verions, function($version_a, $version_b)
|
|
||||||
{
|
|
||||||
return phpbb_version_compare($version_b, $version_a);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Set metadata
|
|
||||||
$json_data->metadata->current_version = $current_version;
|
|
||||||
$json_data->metadata->current_version_date = date('Y-m-d');
|
|
||||||
$json_data->metadata->download_path = 'https://download.phpbb.com/pub/release/' . preg_replace('#([0-9]+\.[0-9]+)(\..+)#', '$1', $current_version) . '/' . $current_version . '/';
|
|
||||||
|
|
||||||
// Add package, patch files, and changed files
|
|
||||||
phpbb_add_package_file(
|
|
||||||
$json_data->package,
|
|
||||||
'phpBB ' . $current_version,
|
|
||||||
'phpBB-' . $current_version,
|
|
||||||
'full',
|
|
||||||
''
|
|
||||||
);
|
|
||||||
phpbb_add_package_file(
|
|
||||||
$json_data->package,
|
|
||||||
'phpBB ' . $current_version . ' Patch Files',
|
|
||||||
'phpBB-' . $current_version . '-patch',
|
|
||||||
'update',
|
|
||||||
'patch'
|
|
||||||
);
|
|
||||||
phpbb_add_package_file(
|
|
||||||
$json_data->package,
|
|
||||||
'phpBB ' . $current_version . ' Changed Files',
|
|
||||||
'phpBB-' . $current_version . '-files',
|
|
||||||
'update',
|
|
||||||
'files'
|
|
||||||
);
|
|
||||||
|
|
||||||
// Loop through packages and assign to packages array
|
|
||||||
foreach ($older_verions as $version)
|
|
||||||
{
|
|
||||||
phpbb_add_package_file(
|
|
||||||
$json_data->package,
|
|
||||||
'phpBB ' . $version . ' to ' . $current_version . ' Update Package',
|
|
||||||
'phpBB-' . $version . '_to_' . $current_version,
|
|
||||||
'update',
|
|
||||||
'update',
|
|
||||||
$version
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo(json_encode($json_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n");
|
|
||||||
|
|
||||||
function phpbb_add_package_file(array &$package_list, $name, $file_name, $type, $subtype, $from = '')
|
|
||||||
{
|
|
||||||
if (!file_exists(__DIR__ . '/new_version/release_files/' . $file_name . '.zip'))
|
|
||||||
{
|
|
||||||
trigger_error('File does not exist: ' . __DIR__ . '/new_version/release_files/' . $file_name . '.zip');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$package_file = new stdClass();
|
|
||||||
$package_file->name = $name;
|
|
||||||
$package_file->filename = $file_name;
|
|
||||||
$package_file->type = $type;
|
|
||||||
if (!empty($subtype))
|
|
||||||
{
|
|
||||||
$package_file->subtype = $subtype;
|
|
||||||
}
|
|
||||||
if (!empty($from))
|
|
||||||
{
|
|
||||||
$package_file->from = $from;
|
|
||||||
}
|
|
||||||
$package_file->files = [];
|
|
||||||
|
|
||||||
foreach (['zip', 'tar.bz2'] as $extension)
|
|
||||||
{
|
|
||||||
$file_path = 'new_version/release_files/' . $file_name . '.' . $extension;
|
|
||||||
$filedata = new stdClass();
|
|
||||||
$filedata->filesize = filesize($file_path);
|
|
||||||
$filedata->checksum = trim(preg_replace('/(^\w+)(.+)/', '$1', file_get_contents($file_path . '.sha256')));
|
|
||||||
$filedata->filetype = $extension;
|
|
||||||
$package_file->files[] = $filedata;
|
|
||||||
}
|
|
||||||
|
|
||||||
$package_list[] = $package_file;
|
|
||||||
}
|
|
@@ -1,503 +0,0 @@
|
|||||||
#!/usr/bin/env php
|
|
||||||
<?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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
//$versions = array('3.0.2', '3.0.3', '3.0.4', '3.0.5', '3.0.6', '3.0.7-RC1', '3.0.7-RC2', '3.0.7', '3.0.7-PL1');
|
|
||||||
|
|
||||||
if ($_SERVER['argc'] < 2)
|
|
||||||
{
|
|
||||||
die("Please specify a list of versions as the first argument (e.g. package.php '1.0.0, 1.0.1, 1.0.2').");
|
|
||||||
}
|
|
||||||
|
|
||||||
$versions = explode(',', $_SERVER['argv'][1]);
|
|
||||||
$versions = array_map('trim', $versions);
|
|
||||||
|
|
||||||
$verbose = true;
|
|
||||||
|
|
||||||
require('build_helper.php');
|
|
||||||
|
|
||||||
$package = new build_package($versions, $verbose);
|
|
||||||
|
|
||||||
echo "Building Release Packages\n";
|
|
||||||
echo "Now all three package types (patch, files, release) are built as well as the update package (update).\n";
|
|
||||||
|
|
||||||
// Go trough all versions making a diff if we even have old versions
|
|
||||||
// For phpBB 3.0.x we might choose a different update method, rendering the things below useless...
|
|
||||||
if (count($package->old_packages))
|
|
||||||
{
|
|
||||||
chdir($package->locations['old_versions']);
|
|
||||||
|
|
||||||
// This array is for holding the filenames change
|
|
||||||
$diff_file_changes = array();
|
|
||||||
|
|
||||||
foreach ($package->old_packages as $_package_name => $dest_package_filename)
|
|
||||||
{
|
|
||||||
$package->begin_status('Parsing patch/diff files for phpBB-' . $dest_package_filename . $package->get('new_version_number'));
|
|
||||||
|
|
||||||
// Parse this diff to determine file changes from the checked versions and save them
|
|
||||||
$diff_file_changes[$_package_name] = $package->collect_diff_files(
|
|
||||||
$package->get('patch_directory') . '/phpBB-' . $dest_package_filename . $package->get('new_version_number') . '.patch',
|
|
||||||
$_package_name
|
|
||||||
);
|
|
||||||
$diff_file_changes[$_package_name]['deleted'] = $package->collect_deleted_files(
|
|
||||||
$package->get('patch_directory') . '/phpBB-' . $dest_package_filename . $package->get('new_version_number') . '.deleted',
|
|
||||||
$_package_name
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now put those files determined within the correct directories
|
|
||||||
foreach ($diff_file_changes as $_package_name => $file_contents)
|
|
||||||
{
|
|
||||||
$package->begin_status('Creating files-only informations for ' . $package->old_packages[$_package_name] . $package->get('new_version_number'));
|
|
||||||
|
|
||||||
$dest_filename_dir = $package->get('files_directory') . '/' . $package->old_packages[$_package_name] . $package->get('new_version_number');
|
|
||||||
|
|
||||||
if (!file_exists($dest_filename_dir))
|
|
||||||
{
|
|
||||||
$package->run_command('mkdir ' . $dest_filename_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now copy the file contents
|
|
||||||
foreach ($file_contents['all'] as $file)
|
|
||||||
{
|
|
||||||
$source_filename = $package->get('dest_dir') . '/' . $file;
|
|
||||||
$dest_filename = $dest_filename_dir . '/' . $file;
|
|
||||||
|
|
||||||
// Create Directories along the way?
|
|
||||||
$file = explode('/', $file);
|
|
||||||
// Remove filename portion
|
|
||||||
$file[count($file)-1] = '';
|
|
||||||
|
|
||||||
chdir($dest_filename_dir);
|
|
||||||
foreach ($file as $entry)
|
|
||||||
{
|
|
||||||
$entry = trim($entry);
|
|
||||||
if ($entry)
|
|
||||||
{
|
|
||||||
if (!file_exists('./' . $entry))
|
|
||||||
{
|
|
||||||
$package->run_command('mkdir ' . $entry);
|
|
||||||
}
|
|
||||||
chdir('./' . $entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$package->run_command('cp ' . $source_filename . ' ' . $dest_filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Because there might be binary changes, we re-create the patch files... without parsing file differences.
|
|
||||||
$package->run_command('rm -Rv ' . $package->get('patch_directory'));
|
|
||||||
|
|
||||||
if (!file_exists($package->get('patch_directory')))
|
|
||||||
{
|
|
||||||
$package->run_command('mkdir ' . $package->get('patch_directory'));
|
|
||||||
}
|
|
||||||
|
|
||||||
chdir($package->locations['old_versions']);
|
|
||||||
|
|
||||||
foreach ($package->old_packages as $_package_name => $dest_package_filename)
|
|
||||||
{
|
|
||||||
$package->begin_status('Creating patch/diff files for phpBB-' . $dest_package_filename . $package->get('new_version_number'));
|
|
||||||
|
|
||||||
$dest_package_filename = $package->get('patch_directory') . '/phpBB-' . $dest_package_filename . $package->get('new_version_number') . '.patch';
|
|
||||||
$package->run_command('diff ' . $package->diff_options_long . ' ' . $_package_name . ' ' . $package->get('simple_name') . ' > ' . $dest_package_filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
$packages = $diff_file_changes;
|
|
||||||
|
|
||||||
foreach ($packages as $_package_name => $file_contents)
|
|
||||||
{
|
|
||||||
$package->begin_status('Building specific update files for ' . $package->old_packages[$_package_name] . $package->get('new_version_number'));
|
|
||||||
|
|
||||||
$dest_filename_dir = $package->get('update_directory') . '/' . $package->old_packages[$_package_name] . $package->get('new_version_number');
|
|
||||||
|
|
||||||
if (!file_exists($dest_filename_dir))
|
|
||||||
{
|
|
||||||
$package->run_command('mkdir ' . $dest_filename_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $dest_filename_dir);
|
|
||||||
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $dest_filename_dir);
|
|
||||||
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $dest_filename_dir);
|
|
||||||
|
|
||||||
$package->run_command('mkdir ' . $dest_filename_dir . '/install/update');
|
|
||||||
$package->run_command('mkdir ' . $dest_filename_dir . '/install/update/old');
|
|
||||||
$package->run_command('mkdir ' . $dest_filename_dir . '/install/update/new');
|
|
||||||
|
|
||||||
// Remove some files
|
|
||||||
$package->run_command('rm -v ' . $dest_filename_dir . '/install/install_install.php');
|
|
||||||
$package->run_command('rm -v ' . $dest_filename_dir . '/install/install_convert.php');
|
|
||||||
$package->run_command('rm -Rv ' . $dest_filename_dir . '/install/schemas');
|
|
||||||
$package->run_command('rm -Rv ' . $dest_filename_dir . '/install/convertors');
|
|
||||||
|
|
||||||
foreach ($file_contents['all'] as $index => $file)
|
|
||||||
{
|
|
||||||
if (strpos($file, 'recode_cjk') !== false)
|
|
||||||
{
|
|
||||||
unset($file_contents['all'][$index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$source_filename = $package->locations['old_versions'] . $package->get('simple_name') . '/' . $file;
|
|
||||||
if (!file_exists($source_filename))
|
|
||||||
{
|
|
||||||
unset($file_contents['all'][$index]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// First of all, fill the 'old' directory
|
|
||||||
foreach ($file_contents['all'] as $file)
|
|
||||||
{
|
|
||||||
$source_filename = $package->locations['old_versions'] . $_package_name . '/' . $file;
|
|
||||||
$dest_filename = $dest_filename_dir . '/install/update/old/' . $file;
|
|
||||||
|
|
||||||
if (!file_exists($source_filename))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create Directories along the way?
|
|
||||||
$file = explode('/', $file);
|
|
||||||
// Remove filename portion
|
|
||||||
$file[count($file)-1] = '';
|
|
||||||
|
|
||||||
chdir($dest_filename_dir . '/install/update/old');
|
|
||||||
foreach ($file as $entry)
|
|
||||||
{
|
|
||||||
$entry = trim($entry);
|
|
||||||
if ($entry)
|
|
||||||
{
|
|
||||||
if (!file_exists('./' . $entry))
|
|
||||||
{
|
|
||||||
$package->run_command('mkdir ' . $entry);
|
|
||||||
}
|
|
||||||
chdir('./' . $entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$package->run_command('cp ' . $source_filename . ' ' . $dest_filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We try to keep the update packages as small as possible while creating them.
|
|
||||||
* However, we sometimes need to include additional files that are not included
|
|
||||||
* in the diff in order to be able to correctly include the relatively
|
|
||||||
* referenced files from the same or subsequent directories.
|
|
||||||
*/
|
|
||||||
$copy_relative_directories = array(
|
|
||||||
'config/' => array(
|
|
||||||
'recursive' => true,
|
|
||||||
'copied' => false,
|
|
||||||
'copy' => array(
|
|
||||||
'config/*' => 'config',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Then fill the 'new' directory
|
|
||||||
foreach ($file_contents['all'] as $file)
|
|
||||||
{
|
|
||||||
$source_filename = $package->locations['old_versions'] . $package->get('simple_name') . '/' . $file;
|
|
||||||
$dest_filename = $dest_filename_dir . '/install/update/new/' . $file;
|
|
||||||
$filename = $file;
|
|
||||||
|
|
||||||
// Create Directories along the way?
|
|
||||||
$file = explode('/', $file);
|
|
||||||
// Remove filename portion
|
|
||||||
$file[count($file)-1] = '';
|
|
||||||
|
|
||||||
chdir($dest_filename_dir . '/install/update/new');
|
|
||||||
foreach ($file as $entry)
|
|
||||||
{
|
|
||||||
$entry = trim($entry);
|
|
||||||
if ($entry)
|
|
||||||
{
|
|
||||||
if (!file_exists('./' . $entry))
|
|
||||||
{
|
|
||||||
$package->run_command('mkdir ' . $entry);
|
|
||||||
}
|
|
||||||
chdir('./' . $entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$package->run_command('cp ' . $source_filename . ' ' . $dest_filename);
|
|
||||||
|
|
||||||
foreach ($copy_relative_directories as $reference => $data)
|
|
||||||
{
|
|
||||||
// Copy all relative referenced files if needed
|
|
||||||
if (strpos($filename, $reference) === 0 && !$data['copied'])
|
|
||||||
{
|
|
||||||
foreach ($data['copy'] as $source_dir_files => $destination_dir)
|
|
||||||
{
|
|
||||||
// Create directories along the way?
|
|
||||||
$directories = explode('/', $destination_dir);
|
|
||||||
|
|
||||||
chdir($dest_filename_dir . '/install/update/new');
|
|
||||||
foreach ($directories as $dir)
|
|
||||||
{
|
|
||||||
$dir = trim($dir);
|
|
||||||
if ($dir)
|
|
||||||
{
|
|
||||||
if (!file_exists('./' . $dir))
|
|
||||||
{
|
|
||||||
$package->run_command('mkdir ' . $dir);
|
|
||||||
}
|
|
||||||
chdir('./' . $dir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$source_dir_files = $package->locations['old_versions'] . $package->get('simple_name') . '/' . $source_dir_files;
|
|
||||||
$destination_dir = $dest_filename_dir . '/install/update/new/' . $destination_dir;
|
|
||||||
|
|
||||||
if (isset($data['recursive']) && $data['recursive'])
|
|
||||||
{
|
|
||||||
$package->run_command('cp -Rp ' . $source_dir_files . ' ' . $destination_dir);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$package->run_command('cp ' . $source_dir_files . ' ' . $destination_dir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$copy_relative_directories[$reference]['copied'] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We need to always copy the template and asset files that we need in
|
|
||||||
* the update, to ensure that the page is displayed correctly.
|
|
||||||
*/
|
|
||||||
$copy_update_files = array(
|
|
||||||
'adm/images/*' => 'adm/images',
|
|
||||||
'adm/style/admin.css' => 'adm/style',
|
|
||||||
'adm/style/admin.js' => 'adm/style',
|
|
||||||
'adm/style/ajax.js' => 'adm/style',
|
|
||||||
'adm/style/installer_*' => 'adm/style',
|
|
||||||
'assets/javascript/*' => 'assets/javascript',
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($copy_update_files as $source_files => $destination_dir)
|
|
||||||
{
|
|
||||||
// Create directories along the way?
|
|
||||||
$directories = explode('/', $destination_dir);
|
|
||||||
|
|
||||||
chdir($dest_filename_dir . '/install/update/new');
|
|
||||||
foreach ($directories as $dir)
|
|
||||||
{
|
|
||||||
$dir = trim($dir);
|
|
||||||
if ($dir)
|
|
||||||
{
|
|
||||||
if (!file_exists('./' . $dir))
|
|
||||||
{
|
|
||||||
$package->run_command('mkdir ' . $dir);
|
|
||||||
}
|
|
||||||
chdir('./' . $dir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$source_dir_files = $package->locations['old_versions'] . $package->get('simple_name') . '/' . $source_files;
|
|
||||||
$destination_dir = $dest_filename_dir . '/install/update/new/' . $destination_dir;
|
|
||||||
$package->run_command('cp ' . $source_dir_files . ' ' . $destination_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build index.php file for holding the file structure
|
|
||||||
$index_contents = '<?php
|
|
||||||
|
|
||||||
if (!defined(\'IN_PHPBB\'))
|
|
||||||
{
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set update info with file structure to update
|
|
||||||
$update_info = array(
|
|
||||||
\'version\' => array(\'from\' => \'' . str_replace('_to_', '', $package->old_packages[$_package_name]) . '\', \'to\' => \'' . $package->get('new_version_number') . '\'),
|
|
||||||
';
|
|
||||||
|
|
||||||
if (count($file_contents['all']))
|
|
||||||
{
|
|
||||||
$index_contents .= "\t'files' => array(\n\t\t'" . implode("',\n\t\t'", $file_contents['all']) . "',\n\t),\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$index_contents .= "\t'files' => array(),\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($file_contents['binary']))
|
|
||||||
{
|
|
||||||
$index_contents .= "\t'binary' => array(\n\t\t'" . implode("',\n\t\t'", $file_contents['binary']) . "',\n\t),\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$index_contents .= "\t'binary' => array(),\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($file_contents['deleted']))
|
|
||||||
{
|
|
||||||
$index_contents .= "\t'deleted' => array(\n\t\t'" . implode("',\n\t\t'", $file_contents['deleted']) . "',\n\t),\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$index_contents .= "\t'deleted' => array(),\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$index_contents .= ");\n";
|
|
||||||
|
|
||||||
$fp = fopen($dest_filename_dir . '/install/update/index.php', 'wt');
|
|
||||||
fwrite($fp, $index_contents);
|
|
||||||
fclose($fp);
|
|
||||||
}
|
|
||||||
unset($diff_file_changes);
|
|
||||||
|
|
||||||
$package->begin_status('Clean up all install files');
|
|
||||||
|
|
||||||
// Copy the install files to their respective locations
|
|
||||||
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $package->get('patch_directory'));
|
|
||||||
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $package->get('patch_directory'));
|
|
||||||
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $package->get('patch_directory'));
|
|
||||||
|
|
||||||
// Remove some files
|
|
||||||
chdir($package->get('patch_directory') . '/install');
|
|
||||||
|
|
||||||
$package->run_command('rm -v install_install.php');
|
|
||||||
$package->run_command('rm -v install_update.php');
|
|
||||||
$package->run_command('rm -v install_convert.php');
|
|
||||||
$package->run_command('rm -Rv schemas');
|
|
||||||
$package->run_command('rm -Rv convertors');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build Main phpBB Release
|
|
||||||
$compress_programs = array(
|
|
||||||
// 'tar.gz' => 'tar -czf',
|
|
||||||
'tar.bz2' => 'tar -cjf',
|
|
||||||
'zip' => 'zip -r'
|
|
||||||
);
|
|
||||||
|
|
||||||
if (count($package->old_packages))
|
|
||||||
{
|
|
||||||
// Build Patch Files
|
|
||||||
chdir($package->get('patch_directory'));
|
|
||||||
|
|
||||||
foreach ($compress_programs as $extension => $compress_command)
|
|
||||||
{
|
|
||||||
$package->begin_status('Packaging phpBB Patch Files for ' . $extension);
|
|
||||||
|
|
||||||
// Build Package
|
|
||||||
$package->run_command($compress_command . ' ../release_files/' . $package->get('release_filename') . '-patch.' . $extension . ' *');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build Files Package
|
|
||||||
chdir($package->get('files_directory'));
|
|
||||||
|
|
||||||
foreach ($compress_programs as $extension => $compress_command)
|
|
||||||
{
|
|
||||||
$package->begin_status('Packaging phpBB Files for ' . $extension);
|
|
||||||
|
|
||||||
$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');
|
|
||||||
$package->run_command('rm -v ' . $package->get('files_directory') . '/release/install/install_convert.php');
|
|
||||||
$package->run_command('rm -Rv ' . $package->get('files_directory') . '/release/install/schemas');
|
|
||||||
$package->run_command('rm -Rv ' . $package->get('files_directory') . '/release/install/convertors');
|
|
||||||
|
|
||||||
// Pack files
|
|
||||||
foreach ($package->old_packages as $_package_name => $package_path)
|
|
||||||
{
|
|
||||||
chdir($package_path . $package->get('new_version_number'));
|
|
||||||
$command = ($extension == 'zip') ? 'zip -r' : 'tar cf';
|
|
||||||
$_ext = ($extension == 'zip') ? 'zip' : 'tar';
|
|
||||||
$package->run_command("$command ../release/phpBB-$package_path" . $package->get('new_version_number') . ".$_ext *");
|
|
||||||
chdir('..');
|
|
||||||
}
|
|
||||||
|
|
||||||
chdir('./release');
|
|
||||||
$package->run_command("$compress_command ../../release_files/" . $package->get('release_filename') . '-files.' . $extension . ' *');
|
|
||||||
chdir('..');
|
|
||||||
|
|
||||||
$package->run_command('rm -Rv ' . $package->get('files_directory') . '/release');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build Update Package
|
|
||||||
foreach ($compress_programs as $extension => $compress_command)
|
|
||||||
{
|
|
||||||
chdir($package->get('update_directory'));
|
|
||||||
|
|
||||||
$package->begin_status('Packaging phpBB Update for ' . $extension);
|
|
||||||
|
|
||||||
$package->run_command('mkdir ' . $package->get('update_directory') . '/release');
|
|
||||||
|
|
||||||
// Pack update files
|
|
||||||
$packages = $package->old_packages;
|
|
||||||
|
|
||||||
foreach ($packages as $_package_name => $package_path)
|
|
||||||
{
|
|
||||||
chdir($package_path . $package->get('new_version_number'));
|
|
||||||
|
|
||||||
$package->run_command('rm -v install/install_install.php');
|
|
||||||
$package->run_command('rm -v install/install_convert.php');
|
|
||||||
$package->run_command('rm -v includes/utf/data/recode_cjk.php');
|
|
||||||
$package->run_command('rm -Rv install/schemas');
|
|
||||||
$package->run_command('rm -Rv install/convertors');
|
|
||||||
|
|
||||||
$command = ($extension == 'zip') ? 'zip -r' : 'tar cf';
|
|
||||||
$_ext = ($extension == 'zip') ? 'zip' : 'tar';
|
|
||||||
$package->run_command("$command ../release/$package_path" . $package->get('new_version_number') . ".$_ext *");
|
|
||||||
chdir('..');
|
|
||||||
|
|
||||||
$last_version = $package_path . $package->get('new_version_number');
|
|
||||||
|
|
||||||
// chdir('./release');
|
|
||||||
// $package->run_command("$compress_command ../../release_files/" . $package->get('release_filename') . '-update.' . $extension . ' *');
|
|
||||||
// chdir('..');
|
|
||||||
|
|
||||||
chdir('./' . $last_version);
|
|
||||||
// Copy last package over...
|
|
||||||
$package->run_command('rm -v ../release_files/phpBB-' . $last_version . ".$extension");
|
|
||||||
$package->run_command("$compress_command ../../release_files/phpBB-$last_version.$extension *");
|
|
||||||
chdir('..');
|
|
||||||
}
|
|
||||||
|
|
||||||
$package->run_command('rm -Rv ' . $package->get('update_directory') . '/release');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete updater and convertor from main archive
|
|
||||||
chdir($package->get('dest_dir') . '/install');
|
|
||||||
|
|
||||||
// $package->run_command('rm -v database_update.php');
|
|
||||||
$package->run_command('rm -v install_update.php');
|
|
||||||
|
|
||||||
chdir($package->locations['package_dir']);
|
|
||||||
foreach ($compress_programs as $extension => $compress_command)
|
|
||||||
{
|
|
||||||
$package->begin_status('Packaging phpBB for ' . $extension);
|
|
||||||
$package->run_command('rm -v ./release_files/' . $package->get('release_filename') . ".{$extension}");
|
|
||||||
|
|
||||||
// Build Package
|
|
||||||
$package->run_command("$compress_command ./release_files/" . $package->get('release_filename') . '.' . $extension . ' ' . $package->get('package_name'));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Microsoft Web PI packaging
|
|
||||||
$package->begin_status('Packaging phpBB for Microsoft WebPI');
|
|
||||||
$file = './release_files/' . $package->get('release_filename') . '.webpi.zip';
|
|
||||||
$package->run_command('cp -p ./release_files/' . $package->get('release_filename') . ".zip $file");
|
|
||||||
$package->run_command('cd ./../webpi && ' . $compress_programs['zip'] . " ./../new_version/$file *");
|
|
||||||
|
|
||||||
// verify results
|
|
||||||
chdir($package->locations['root']);
|
|
||||||
$package->begin_status('********** Verifying packages **********');
|
|
||||||
$package->run_command('./compare.sh ' . $package->package_infos['release_filename']);
|
|
||||||
|
|
||||||
echo "Done.\n";
|
|
@@ -1,54 +0,0 @@
|
|||||||
<?php declare(strict_types=1);
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (php_sapi_name() !== 'cli')
|
|
||||||
{
|
|
||||||
die("This program must be run from the command line.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version_compare(PHP_VERSION, '7.1.3', '<'))
|
|
||||||
{
|
|
||||||
die('update_stylesheet_querystrings.php requires at least PHP 7.1.3');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Usage: "$ php build/update_stylesheet_querystrings.php"
|
|
||||||
$targets = [dirname(dirname(__FILE__)) . '/phpBB/styles/prosilver/theme/stylesheet.css'];
|
|
||||||
|
|
||||||
array_map('patch_glob', $targets);
|
|
||||||
|
|
||||||
function patch_glob($glob): void
|
|
||||||
{
|
|
||||||
array_map('patch_file', glob($glob));
|
|
||||||
}
|
|
||||||
|
|
||||||
function patch_file(string $filepath): void
|
|
||||||
{
|
|
||||||
$file = file_get_contents($filepath);
|
|
||||||
$old = $file;
|
|
||||||
$new = preg_replace_callback(
|
|
||||||
'(^@import\\s+url\\([\'"](?<basename>\\w++\\.css)\\?\\K(?:hash|v)=[^\'"]++)m',
|
|
||||||
function ($match) use ($filepath)
|
|
||||||
{
|
|
||||||
$path = dirname($filepath) . DIRECTORY_SEPARATOR . $match['basename'];
|
|
||||||
$hash = sprintf('%08x', crc32(file_get_contents($path)));
|
|
||||||
|
|
||||||
return 'hash=' . $hash;
|
|
||||||
},
|
|
||||||
$old
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($new !== $old)
|
|
||||||
{
|
|
||||||
file_put_contents($filepath, $new);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,39 +0,0 @@
|
|||||||
/**********************************************************************/
|
|
||||||
/* Install.SQL */
|
|
||||||
/* Creates a login and makes the user a member of db roles */
|
|
||||||
/* */
|
|
||||||
/**********************************************************************/
|
|
||||||
|
|
||||||
-- Declare variables for database name, username and password
|
|
||||||
DECLARE @dbName sysname,
|
|
||||||
@dbUser sysname,
|
|
||||||
@dbPwd nvarchar(max);
|
|
||||||
|
|
||||||
-- Set variables for database name, username and password
|
|
||||||
SET @dbName = 'PlaceHolderForDb';
|
|
||||||
SET @dbUser = 'PlaceHolderForUser';
|
|
||||||
SET @dbPwd = 'PlaceHolderForPassword';
|
|
||||||
|
|
||||||
DECLARE @cmd nvarchar(max)
|
|
||||||
|
|
||||||
-- Create login
|
|
||||||
IF( SUSER_SID(@dbUser) is null )
|
|
||||||
BEGIN
|
|
||||||
print '-- Creating login '
|
|
||||||
SET @cmd = N'CREATE LOGIN ' + quotename(@dbUser) + N' WITH PASSWORD ='''+ replace(@dbPwd, '''', '''''') + N''''
|
|
||||||
EXEC(@cmd)
|
|
||||||
END
|
|
||||||
|
|
||||||
-- Create database user and map to login
|
|
||||||
-- and add user to the datareader, datawriter, ddladmin and securityadmin roles
|
|
||||||
--
|
|
||||||
SET @cmd = N'USE ' + quotename(@DBName) + N';
|
|
||||||
IF( NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = ''' + replace(@dbUser, '''', '''''') + N'''))
|
|
||||||
BEGIN
|
|
||||||
print ''-- Creating user'';
|
|
||||||
CREATE USER ' + quotename(@dbUser) + N' FOR LOGIN ' + quotename(@dbUser) + N';
|
|
||||||
print ''-- Adding user'';
|
|
||||||
EXEC sp_addrolemember ''db_owner'', ''' + replace(@dbUser, '''', '''''') + N''';
|
|
||||||
END'
|
|
||||||
EXEC(@cmd)
|
|
||||||
GO
|
|
@@ -1,15 +0,0 @@
|
|||||||
USE PlaceHolderForDb$$
|
|
||||||
|
|
||||||
DROP PROCEDURE IF EXISTS add_user $$
|
|
||||||
|
|
||||||
CREATE PROCEDURE add_user()
|
|
||||||
BEGIN
|
|
||||||
DECLARE EXIT HANDLER FOR 1044 BEGIN END;
|
|
||||||
GRANT ALL PRIVILEGES ON PlaceHolderForDb.* to 'PlaceHolderForUser'@'PlaceHolderForServer' IDENTIFIED BY 'PlaceHolderForPassword';
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
END
|
|
||||||
$$
|
|
||||||
|
|
||||||
CALL add_user() $$
|
|
||||||
|
|
||||||
DROP PROCEDURE IF EXISTS add_user $$
|
|
@@ -1,13 +0,0 @@
|
|||||||
<msdeploy.iisapp>
|
|
||||||
<iisapp path="phpBB3" />
|
|
||||||
|
|
||||||
<dbmysql path="install/mysql.sql" commandDelimiter="$$" removeCommandDelimiter="true" />
|
|
||||||
|
|
||||||
<dbfullsql path="install/mssql.sql" />
|
|
||||||
|
|
||||||
<setAcl path="phpBB3/cache" setAclAccess="Modify" setAclUser="anonymousAuthenticationUser" />
|
|
||||||
<setAcl path="phpBB3/files" setAclAccess="Modify" setAclUser="anonymousAuthenticationUser" />
|
|
||||||
<setAcl path="phpBB3/store" setAclAccess="Modify" setAclUser="anonymousAuthenticationUser" />
|
|
||||||
<setAcl path="phpBB3/images/avatars/upload" setAclAccess="Modify" setAclUser="anonymousAuthenticationUser" />
|
|
||||||
<setAcl path="phpBB3/config.php" setAclAccess="Modify" setAclUser="anonymousAuthenticationUser" setAclResourceType="File" />
|
|
||||||
</msdeploy.iisapp>
|
|
@@ -1,256 +0,0 @@
|
|||||||
<parameters>
|
|
||||||
<parameter
|
|
||||||
name="AppPath"
|
|
||||||
defaultValue="Default Web Site/phpBB3"
|
|
||||||
tags="iisapp">
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="ProviderPath"
|
|
||||||
scope="iisapp"
|
|
||||||
match="phpBB3" />
|
|
||||||
</parameter>
|
|
||||||
<!--ACLs-->
|
|
||||||
<parameter
|
|
||||||
name="aclCache"
|
|
||||||
description="Sets the ACL on the cache/ folder"
|
|
||||||
defaultValue="{AppPath}/cache"
|
|
||||||
tags="Hidden">
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="ProviderPath"
|
|
||||||
scope="setAcl"
|
|
||||||
match="phpBB3/cache$" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter
|
|
||||||
name="aclFiles"
|
|
||||||
description="Sets the ACL on the files/ folder"
|
|
||||||
defaultValue="{AppPath}/files"
|
|
||||||
tags="Hidden">
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="ProviderPath"
|
|
||||||
scope="setAcl"
|
|
||||||
match="phpBB3/files$" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter
|
|
||||||
name="aclStore"
|
|
||||||
description="Sets the ACL on the store/ folder"
|
|
||||||
defaultValue="{AppPath}/store"
|
|
||||||
tags="Hidden">
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="ProviderPath"
|
|
||||||
scope="setAcl"
|
|
||||||
match="phpBB3/store$" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter
|
|
||||||
name="aclAvatarUpload"
|
|
||||||
description="Sets the ACL on the avatars/upload/ folder"
|
|
||||||
defaultValue="{AppPath}/images/avatars/upload"
|
|
||||||
tags="Hidden">
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="ProviderPath"
|
|
||||||
scope="setAcl"
|
|
||||||
match="phpBB3/images/avatars/upload$" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter
|
|
||||||
name="aclConfig"
|
|
||||||
description="Sets the ACL on the config.php file"
|
|
||||||
defaultValue="{AppPath}/config.php"
|
|
||||||
tags="Hidden">
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="ProviderPath"
|
|
||||||
scope="setAcl"
|
|
||||||
match="phpBB3/config.php$" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<!-- SQL parameters -->
|
|
||||||
<parameter name="SQL Database Server" description="Enter the database server (usually machine name ) " defaultValue="." tags="SQL">
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter name="SQL DatabaseServer Instance" description="Enter the database instance name" defaultValue="SQLExpress" tags="SQL">
|
|
||||||
</parameter>
|
|
||||||
<!-- Read database server from config.php . Update 'dbhost' in config.php on publish -->
|
|
||||||
<parameter name="SQL Automatic DatabaseServer" defaultValue="dbhost = '{SQL Database Server}\\{SQL DatabaseServer Instance}';" tags="Hidden,SQL">
|
|
||||||
<parameterEntry kind="TextFile" scope="\\config\.php$" match="dbhost\s*=\s*'([^']*)'\s*;" />
|
|
||||||
</parameter>
|
|
||||||
<parameter
|
|
||||||
name="SQL DatabaseName" description="Database name for your application." defaultValue="phpbb" tags="SQL, dbName">
|
|
||||||
|
|
||||||
<parameterEntry type="TextFile" scope="install/mssql.sql" match="PlaceHolderForDb" />
|
|
||||||
</parameter>
|
|
||||||
<!-- Read database name from config.php . Update 'dbname' in config.php on publish -->
|
|
||||||
<parameter name="SQL Automatic DatabaseName" defaultValue="dbname = '{SQL DatabaseName}';" tags="Hidden,SQL">
|
|
||||||
<parameterEntry kind="TextFile" scope="\\config\.php$" match="dbname\s*=\s*'([^']*)'\s*;" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter
|
|
||||||
name="SQL DatabaseAdministrator"
|
|
||||||
description="Database server administartor username."
|
|
||||||
defaultValue="sa"
|
|
||||||
tags="SQL, DbAdminUsername" >
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter
|
|
||||||
name="SQL DatabaseAdministratorPassword"
|
|
||||||
description="Database server administrator password."
|
|
||||||
tags="Password,SQL,DbAdminPassword">
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter
|
|
||||||
name="SQL Database Username"
|
|
||||||
description="Username to access your database."
|
|
||||||
defaultValue="phpbb"
|
|
||||||
tags="SQL, DbUsername">
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="TextFile"
|
|
||||||
scope="install/mssql.sql"
|
|
||||||
match="PlaceHolderForUser" />
|
|
||||||
</parameter>
|
|
||||||
<!-- Read database user from config.php . Update 'dbuser' in config.php on publish -->
|
|
||||||
<parameter name="SQL Automatic Database User" defaultValue="dbuser = '{SQL Database Username}';" tags="Hidden,SQL">
|
|
||||||
<parameterEntry kind="TextFile" scope="\\config\.php$" match="dbuser\s*=\s*'([^']*)'\s*;" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter
|
|
||||||
name="SQL Database Password"
|
|
||||||
description="Password for your phpBB database. (Must be at least 8 characters, contain at least one lower case letter, one upper case letter and one digit)"
|
|
||||||
tags="New, Password,SQL, DbUserPassword">
|
|
||||||
|
|
||||||
<parameterValidation
|
|
||||||
type = "RegularExpression"
|
|
||||||
validationString = "^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$" />
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="TextFile"
|
|
||||||
scope="install/mssql.sql"
|
|
||||||
match="PlaceHolderForPassword" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<!-- Read database user password from config.php . Update 'dbpasswd' in config.php on publish -->
|
|
||||||
<parameter name="SQL Automatic Database Password" defaultValue="dbpasswd = '{SQL Database Password}';" tags="Hidden,SQL">
|
|
||||||
<parameterEntry kind="TextFile" scope="\\config\.php$" match="dbpasswd\s*=\s*'([^']*)'\s*;" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<!-- SQL Connection string -->
|
|
||||||
<parameter
|
|
||||||
name="SQL ConnectionString"
|
|
||||||
description="Automatically sets the connection string for the connection request."
|
|
||||||
defaultValue="Server={SQL Database Server}\{SQL DatabaseServer Instance};Database={SQL DatabaseName};uid={SQL DatabaseAdministrator};Pwd={SQL DatabaseAdministratorPassword};"
|
|
||||||
tags="Hidden,SQLConnectionString,Validate">
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="ProviderPath"
|
|
||||||
scope="dbfullsql"
|
|
||||||
match="install/mssql.sql" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter
|
|
||||||
name="SQL Database type"
|
|
||||||
description="SQL database type"
|
|
||||||
defaultValue="mssql"
|
|
||||||
tags="SQL,Hidden">
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<!-- MYSQL parameters -->
|
|
||||||
<parameter
|
|
||||||
name="MySQL Database Server"
|
|
||||||
description="Enter the hostname"
|
|
||||||
defaultValue="localhost"
|
|
||||||
tags="MySQL, dbServer">
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="TextFile"
|
|
||||||
scope="install/mysql.sql"
|
|
||||||
match="PlaceHolderForServer" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<!-- Read database server from config.php . Update 'dbhost' in config.php on publish -->
|
|
||||||
<parameter name="Automatic MySQL DatabaseServer" defaultValue="dbhost = '{MySQL Database Server}';" tags="Hidden,MySQL">
|
|
||||||
<parameterEntry kind="TextFile" scope="\\config\.php$" match="dbhost\s*=\s*'([^']*)'\s*;" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter
|
|
||||||
name="MySQL Database Name"
|
|
||||||
description="Database Name for your application."
|
|
||||||
defaultValue="phpbb"
|
|
||||||
tags="MySQL, dbName">
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="TextFile"
|
|
||||||
scope="install/mysql.sql"
|
|
||||||
match="PlaceHolderForDb" />
|
|
||||||
</parameter>
|
|
||||||
<!-- Read database name from config.php . Update 'dbname' in config.php on publish -->
|
|
||||||
<parameter name="Automatic MySQL Database Name" defaultValue="dbname = '{MySQL Database Name}';" tags="Hidden,MySQL">
|
|
||||||
<parameterEntry kind="TextFile" scope="\\config\.php$" match="dbname\s*=\s*'([^']*)'\s*;" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter
|
|
||||||
name="MySQL Database Username"
|
|
||||||
description="Username to access your phpBB database."
|
|
||||||
defaultValue="phpbb"
|
|
||||||
tags="MySQL, DbUsername">
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="TextFile"
|
|
||||||
scope="install/mysql.sql"
|
|
||||||
match="PlaceHolderForUser" />
|
|
||||||
</parameter>
|
|
||||||
<!-- Read database user from config.php . Update 'dbuser' in config.php on publish -->
|
|
||||||
<parameter name="Automatic MySQL Database User" defaultValue="dbuser = '{MySQL Database Username}';" tags="Hidden,MySQL">
|
|
||||||
<parameterEntry kind="TextFile" scope="\\config\.php$" match="dbuser\s*=\s*'([^']*)'\s*;" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter
|
|
||||||
name="MySQL Database Password"
|
|
||||||
description="Password for your phpBB database. (Minimum 4 characters)"
|
|
||||||
tags="New, Password,MySQL,DbUserPassword">
|
|
||||||
|
|
||||||
<parameterValidation
|
|
||||||
type = "RegularExpression"
|
|
||||||
validationString = "^.{4,}$" />
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="TextFile"
|
|
||||||
scope="install/mysql.sql"
|
|
||||||
match="PlaceHolderForPassword" />
|
|
||||||
</parameter>
|
|
||||||
<!-- Read database password from config.php . Update 'dbpasswd' in config.php on publish -->
|
|
||||||
<parameter name="MySQL Automatic Database Password" defaultValue="dbpasswd = '{MySQL Database Password}';" tags="Hidden,MySQL">
|
|
||||||
<parameterEntry kind="TextFile" scope="\\config\.php$" match="dbpasswd\s*=\s*'([^']*)'\s*;" />
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<!-- MySQL admin credentials -->
|
|
||||||
<parameter
|
|
||||||
name="MySQL Database Administrator"
|
|
||||||
description="Database administrator username."
|
|
||||||
defaultValue="root"
|
|
||||||
tags="MySQL, DbAdminUsername" >
|
|
||||||
</parameter>
|
|
||||||
<parameter
|
|
||||||
name="MySQL Database Administrator Password"
|
|
||||||
description="Database administrator password."
|
|
||||||
tags="Password,MySQL,DbAdminPassword" >
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<!-- MySQL Connectionstring -->
|
|
||||||
<parameter
|
|
||||||
name="MySQLConnectionString"
|
|
||||||
description="Automatically sets the connection string for the connection request."
|
|
||||||
defaultValue="Server={MySQL Database Server};Database={MySQL Database Name};uid={MySQL Database Administrator};Pwd={MySQL Database Administrator Password};"
|
|
||||||
tags="Hidden,MySQLConnectionString,Validate">
|
|
||||||
|
|
||||||
<parameterEntry
|
|
||||||
type="ProviderPath"
|
|
||||||
scope="dbmysql"
|
|
||||||
match="install/mysql.sql" />
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
|
BIN
composer.phar
BIN
doctum.phar
@@ -1,66 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
# Calls the git commit-msg hook on all non-merge commits in a given commit range.
|
|
||||||
#
|
|
||||||
|
|
||||||
if [ "$#" -ne 1 ];
|
|
||||||
then
|
|
||||||
echo "Expected one argument (commit range, e.g. phpbb/develop..ticket/12345)."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
DIR=$(dirname "$0")
|
|
||||||
COMMIT_RANGE="$1"
|
|
||||||
COMMIT_MSG_HOOK_PATH="$DIR/hooks/commit-msg"
|
|
||||||
COMMIT_MSG_HOOK_FATAL=$(git config --bool phpbb.hooks.commit-msg.fatal 2> /dev/null)
|
|
||||||
git config phpbb.hooks.commit-msg.fatal true
|
|
||||||
|
|
||||||
EXIT_STATUS=0
|
|
||||||
|
|
||||||
COMMIT_HASHES=$(git rev-list --no-merges "$COMMIT_RANGE")
|
|
||||||
|
|
||||||
# If any message have been returned instead of commit hashes list
|
|
||||||
# send a non-zero exit status upstream.
|
|
||||||
if ! [[ "$COMMIT_HASHES" =~ ^[0-9a-f]{5,40} ]]
|
|
||||||
then
|
|
||||||
EXIT_STATUS=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
for COMMIT_HASH in $COMMIT_HASHES
|
|
||||||
do
|
|
||||||
echo "Inspecting commit message of commit $COMMIT_HASH"
|
|
||||||
|
|
||||||
# The git commit-msg hook takes a path to a file containing a commit
|
|
||||||
# message. So we have to extract the commit message into a file first,
|
|
||||||
# which then also needs to be deleted after our work is done.
|
|
||||||
COMMIT_MESSAGE_PATH="$DIR/commit_msg.$COMMIT_HASH"
|
|
||||||
git log -n 1 --pretty=format:%B "$COMMIT_HASH" > "$COMMIT_MESSAGE_PATH"
|
|
||||||
|
|
||||||
# Invoke hook on commit message file.
|
|
||||||
"$COMMIT_MSG_HOOK_PATH" "$COMMIT_MESSAGE_PATH"
|
|
||||||
|
|
||||||
# If any commit message hook complains with a non-zero exit status, we
|
|
||||||
# will send a non-zero exit status upstream.
|
|
||||||
if [ $? -ne 0 ]
|
|
||||||
then
|
|
||||||
EXIT_STATUS=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm "$COMMIT_MESSAGE_PATH"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Restore phpbb.hooks.commit-msg.fatal config
|
|
||||||
if [ -n "$COMMIT_MSG_HOOK_FATAL" ]
|
|
||||||
then
|
|
||||||
git config phpbb.hooks.commit-msg.fatal "$COMMIT_MSG_HOOK_FATAL"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit $EXIT_STATUS
|
|
@@ -1,368 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# A hook to check syntax of a phpBB3 commit message, per:
|
|
||||||
# * <http://wiki.phpbb.com/display/DEV/Git>
|
|
||||||
# * <http://area51.phpbb.com/phpBB/viewtopic.php?p=209919#p209919>
|
|
||||||
#
|
|
||||||
# This is a commit-msg hook.
|
|
||||||
#
|
|
||||||
# To install this you can either copy or symlink it to
|
|
||||||
# $GIT_DIR/hooks, example:
|
|
||||||
#
|
|
||||||
# ln -s ../../git-tools/hooks/commit-msg \\
|
|
||||||
# .git/hooks/commit-msg
|
|
||||||
#
|
|
||||||
# You can configure whether invalid commit messages abort commits:
|
|
||||||
#
|
|
||||||
# git config phpbb.hooks.commit-msg.fatal true (abort)
|
|
||||||
# git config phpbb.hooks.commit-msg.fatal false (warn only, do not abort)
|
|
||||||
#
|
|
||||||
# The default is to warn only.
|
|
||||||
#
|
|
||||||
# Warning/error messages use color by default if the output is a terminal
|
|
||||||
# ("output" here is normally standard error when you run git commit).
|
|
||||||
# To force or disable the use of color:
|
|
||||||
#
|
|
||||||
# git config phpbb.hooks.commit-msg.color true (force color output)
|
|
||||||
# git config phpbb.hooks.commit-msg.color false (disable color output)
|
|
||||||
|
|
||||||
config_ns="phpbb.hooks.commit-msg";
|
|
||||||
|
|
||||||
if [ "$(git config --bool $config_ns.fatal)" = "true" ]
|
|
||||||
then
|
|
||||||
fatal=1;
|
|
||||||
severity=Error;
|
|
||||||
else
|
|
||||||
fatal=0;
|
|
||||||
severity=Warning;
|
|
||||||
fi
|
|
||||||
|
|
||||||
debug_level=$(git config --int $config_ns.debug || echo 0);
|
|
||||||
|
|
||||||
# Error codes
|
|
||||||
ERR_LENGTH=1;
|
|
||||||
ERR_HEADER=2;
|
|
||||||
ERR_EMPTY=3;
|
|
||||||
ERR_DESCRIPTION=4;
|
|
||||||
ERR_FOOTER=5;
|
|
||||||
ERR_EOF=6;
|
|
||||||
ERR_UNKNOWN=42;
|
|
||||||
|
|
||||||
debug()
|
|
||||||
{
|
|
||||||
local level;
|
|
||||||
|
|
||||||
level=$1;
|
|
||||||
shift;
|
|
||||||
|
|
||||||
if [ $debug_level -ge $level ]
|
|
||||||
then
|
|
||||||
echo $@;
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
quit()
|
|
||||||
{
|
|
||||||
if [ $1 -eq 0 ] || [ $1 -eq $ERR_UNKNOWN ]
|
|
||||||
then
|
|
||||||
# success
|
|
||||||
exit 0;
|
|
||||||
elif [ $fatal -eq 0 ]
|
|
||||||
then
|
|
||||||
# problems found but fatal is false
|
|
||||||
complain 'Please run `git commit --amend` and fix the problems mentioned.' 1>&2
|
|
||||||
exit 0;
|
|
||||||
else
|
|
||||||
complain "Aborting commit." 1>&2
|
|
||||||
exit $1;
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
use_color()
|
|
||||||
{
|
|
||||||
if [ -z "$use_color_cached" ]
|
|
||||||
then
|
|
||||||
case $(git config --bool $config_ns.color)
|
|
||||||
in
|
|
||||||
false)
|
|
||||||
use_color_cached=1
|
|
||||||
;;
|
|
||||||
true)
|
|
||||||
use_color_cached=0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# tty detection in shell:
|
|
||||||
# http://hwi.ath.cx/jsh/list/shext/isatty.sh.html
|
|
||||||
tty 0>/dev/stdout >/dev/null 2>&1
|
|
||||||
use_color_cached=$?
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
# return value is the flag inverted -
|
|
||||||
# if return value is 0, this means use color
|
|
||||||
return $use_color_cached
|
|
||||||
}
|
|
||||||
|
|
||||||
complain()
|
|
||||||
{
|
|
||||||
if use_color
|
|
||||||
then
|
|
||||||
# Careful: our argument may include arguments to echo like -n
|
|
||||||
# ANSI color codes:
|
|
||||||
# http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html
|
|
||||||
printf "\033[31m\033[1m"
|
|
||||||
if [ "$1" = "-n" ]
|
|
||||||
then
|
|
||||||
echo "$@"
|
|
||||||
printf "\033[0m"
|
|
||||||
else
|
|
||||||
# This will print one trailing space.
|
|
||||||
# Not sure how to avoid this at the moment.
|
|
||||||
echo "$@" $(printf "\033[0m")
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "$@"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check for empty commit message
|
|
||||||
if ! grep -qv '^#' "$1"
|
|
||||||
then
|
|
||||||
# Commit message is empty (or contains only comments).
|
|
||||||
# Let git handle this.
|
|
||||||
# It will abort with a message like so:
|
|
||||||
#
|
|
||||||
# Aborting commit due to empty commit message.
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
msg=$(grep -v '^#' "$1" |grep -nE '.{81,}')
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
|
||||||
then
|
|
||||||
complain "The following lines are greater than 80 characters long:" >&2;
|
|
||||||
complain >&2
|
|
||||||
complain "$msg" >&2;
|
|
||||||
|
|
||||||
quit $ERR_LENGTH;
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check for CR/LF line breaks
|
|
||||||
if grep -q $'\r$' "$1"
|
|
||||||
then
|
|
||||||
complain "The commit message uses CR/LF line breaks, which are not permitted." >&2
|
|
||||||
complain >&2
|
|
||||||
|
|
||||||
quit $ERR_EOF;
|
|
||||||
fi
|
|
||||||
|
|
||||||
lines=$(wc -l "$1" | awk '{ print $1; }');
|
|
||||||
expecting=header;
|
|
||||||
in_description=0;
|
|
||||||
in_empty=0;
|
|
||||||
ticket=0;
|
|
||||||
branch_regex="[a-z]+[a-z0-9-]*[a-z0-9]+";
|
|
||||||
i=1;
|
|
||||||
tickets="";
|
|
||||||
|
|
||||||
while [ $i -le $lines ]
|
|
||||||
do
|
|
||||||
# Grab the line we are studying
|
|
||||||
line=$(head -n$i "$1" | tail -n1);
|
|
||||||
|
|
||||||
debug 1 "==> [$i] $line (description: $in_description, empty: $in_empty)";
|
|
||||||
|
|
||||||
err=$ERR_UNKNOWN;
|
|
||||||
|
|
||||||
if [ -z "$expecting" ]
|
|
||||||
then
|
|
||||||
quit $err;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${expecting#comment}" = "$expecting" ]
|
|
||||||
then
|
|
||||||
# Prefix comments to the expected tokens list
|
|
||||||
expecting="comment $expecting";
|
|
||||||
fi
|
|
||||||
|
|
||||||
debug 2 "Expecting: $expecting";
|
|
||||||
|
|
||||||
# Loop over each of the expected line formats
|
|
||||||
for expect in $expecting
|
|
||||||
do
|
|
||||||
# Reset the error code each iteration
|
|
||||||
err=$ERR_UNKNOWN;
|
|
||||||
|
|
||||||
# Test for validity of each line format
|
|
||||||
# This is done first so $? contains the result
|
|
||||||
case $expect in
|
|
||||||
"header")
|
|
||||||
err=$ERR_HEADER;
|
|
||||||
echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] .+$"
|
|
||||||
result=$?
|
|
||||||
if ! echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] [a-zA-Z].+$"
|
|
||||||
then
|
|
||||||
# Don't be too strict.
|
|
||||||
# Commits may be temporary, intended to be squashed later.
|
|
||||||
# Just issue a warning here.
|
|
||||||
complain "$severity: heading should be a sentence beginning with a letter." 1>&2
|
|
||||||
complain "You entered:" 1>&2
|
|
||||||
complain "$line" 1>&2
|
|
||||||
fi
|
|
||||||
# restore exit code
|
|
||||||
(exit $result)
|
|
||||||
;;
|
|
||||||
"empty")
|
|
||||||
err=$ERR_EMPTY;
|
|
||||||
echo "$line" | grep -Eq "^$"
|
|
||||||
;;
|
|
||||||
"description")
|
|
||||||
err=$ERR_DESCRIPTION;
|
|
||||||
# Free flow text, the line length was constrained by the initial check
|
|
||||||
echo "$line" | grep -Eq "^.+$";
|
|
||||||
;;
|
|
||||||
"footer")
|
|
||||||
err=$ERR_FOOTER;
|
|
||||||
# Each ticket is on its own line
|
|
||||||
echo "$line" | grep -Eq "^PHPBB3-[0-9]+$";
|
|
||||||
;;
|
|
||||||
"eof")
|
|
||||||
err=$ERR_EOF;
|
|
||||||
# Should not end up here
|
|
||||||
false
|
|
||||||
;;
|
|
||||||
"possibly-eof")
|
|
||||||
# Allow empty and/or comment lines at the end
|
|
||||||
! tail -n +"$i" "$1" |grep -qvE '^($|#)'
|
|
||||||
;;
|
|
||||||
"comment")
|
|
||||||
echo "$line" | grep -Eq "^#";
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
complain "Unrecognised token $expect" >&2;
|
|
||||||
quit $err;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Preserve the result of the line check
|
|
||||||
result=$?;
|
|
||||||
|
|
||||||
debug 2 "$expect - '$line' - $result";
|
|
||||||
|
|
||||||
if [ $result -eq 0 ]
|
|
||||||
then
|
|
||||||
# Break out the loop on success
|
|
||||||
# otherwise roll on round and keep looking for a match
|
|
||||||
break;
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $result -eq 0 ]
|
|
||||||
then
|
|
||||||
# Have we switched out of description mode?
|
|
||||||
if [ $in_description -eq 1 ] && [ "$expect" != "description" ] && [ "$expect" != "empty" ] && [ "$expect" != "comment" ]
|
|
||||||
then
|
|
||||||
# Yes, okay we need to backtrace one line and reanalyse
|
|
||||||
in_description=0;
|
|
||||||
i=$(( $i - $in_empty ));
|
|
||||||
|
|
||||||
# Reset the empty counter
|
|
||||||
in_empty=0;
|
|
||||||
continue;
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Successful match, but on which line format
|
|
||||||
case $expect in
|
|
||||||
"header")
|
|
||||||
expecting="empty";
|
|
||||||
|
|
||||||
echo "$line" | grep -Eq "^\[ticket/[0-9]+\]$" && (
|
|
||||||
ticket=$(echo "$line" | sed 's,\[ticket/\([0-9]*\)\].*,\1,');
|
|
||||||
)
|
|
||||||
;;
|
|
||||||
"empty")
|
|
||||||
# Description might have empty lines as spacing
|
|
||||||
expecting="footer description";
|
|
||||||
in_empty=$(($in_empty + 1));
|
|
||||||
|
|
||||||
if [ $in_description -eq 1 ]
|
|
||||||
then
|
|
||||||
expecting="$expecting empty";
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"description")
|
|
||||||
expecting="description empty";
|
|
||||||
in_description=1;
|
|
||||||
;;
|
|
||||||
"footer")
|
|
||||||
expecting="footer possibly-eof";
|
|
||||||
if [ "$tickets" = "" ]
|
|
||||||
then
|
|
||||||
tickets="$line";
|
|
||||||
else
|
|
||||||
tickets="$tickets $line";
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"comment")
|
|
||||||
# Comments should expect the same thing again
|
|
||||||
;;
|
|
||||||
"possibly-eof")
|
|
||||||
expecting="eof";
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
complain "Unrecognised token $expect" >&2;
|
|
||||||
quit 254;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ "$expect" != "empty" ]
|
|
||||||
then
|
|
||||||
in_empty=0;
|
|
||||||
fi
|
|
||||||
|
|
||||||
debug 3 "Now expecting: $expecting";
|
|
||||||
else
|
|
||||||
# None of the expected line formats matched
|
|
||||||
# Guess we'll call it a day here then
|
|
||||||
complain "Syntax error on line $i:" >&2;
|
|
||||||
complain ">> $line" >&2;
|
|
||||||
complain -n "Expecting: " >&2;
|
|
||||||
complain "$expecting" | sed 's/ /, /g' >&2;
|
|
||||||
quit $err;
|
|
||||||
fi
|
|
||||||
|
|
||||||
i=$(( $i + 1 ));
|
|
||||||
done
|
|
||||||
|
|
||||||
# If EOF is expected exit cleanly
|
|
||||||
echo "$expecting" | grep -q "eof" || (
|
|
||||||
# Unexpected EOF, error
|
|
||||||
complain "Unexpected EOF encountered" >&2;
|
|
||||||
quit $ERR_EOF;
|
|
||||||
) && (
|
|
||||||
# Do post scan checks
|
|
||||||
if [ ! -z "$tickets" ]
|
|
||||||
then
|
|
||||||
# Check for duplicate tickets
|
|
||||||
dupes=$(echo "$tickets" | sed 's/ /\n/g' | sort | uniq -d);
|
|
||||||
|
|
||||||
if [ ! -z "$dupes" ]
|
|
||||||
then
|
|
||||||
complain "The following tickets are repeated:" >&2;
|
|
||||||
complain "$dupes" | sed 's/ /\n/g;s/^/* /g' >&2;
|
|
||||||
quit $ERR_FOOTER;
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# Check the branch ticket is mentioned, doesn't make sense otherwise
|
|
||||||
if [ $ticket -gt 0 ]
|
|
||||||
then
|
|
||||||
echo "$tickets" | grep -Eq "\bPHPBB3-$ticket\b" || (
|
|
||||||
complain "Ticket ID [$ticket] of branch missing from list of tickets:" >&2;
|
|
||||||
complain "$tickets" | sed 's/ /\n/g;s/^/* /g' >&2;
|
|
||||||
quit $ERR_FOOTER;
|
|
||||||
) || exit $?;
|
|
||||||
fi
|
|
||||||
# Got here okay exit to reality
|
|
||||||
exit 0;
|
|
||||||
);
|
|
||||||
exit $?;
|
|
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Script to install the git hooks
|
|
||||||
# by symlinking them into the .git/hooks directory
|
|
||||||
#
|
|
||||||
# Usage (from within git-tools/hooks):
|
|
||||||
# ./install
|
|
||||||
|
|
||||||
dir=$(dirname $0)
|
|
||||||
|
|
||||||
for file in $(ls $dir)
|
|
||||||
do
|
|
||||||
if [ $file != "install" ] && [ $file != "uninstall" ]
|
|
||||||
then
|
|
||||||
ln -s "../../git-tools/hooks/$file" "$dir/../../.git/hooks/$file"
|
|
||||||
fi
|
|
||||||
done
|
|
@@ -1,88 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# A hook to disallow php syntax errors to be committed
|
|
||||||
# by running php -l (lint) on them. It requires php-cli
|
|
||||||
# to be installed.
|
|
||||||
#
|
|
||||||
# This is a pre-commit hook.
|
|
||||||
#
|
|
||||||
# To install this you can either copy or symlink it to
|
|
||||||
# $GIT_DIR/hooks, example:
|
|
||||||
#
|
|
||||||
# ln -s ../../git-tools/hooks/pre-commit \\
|
|
||||||
# .git/hooks/pre-commit
|
|
||||||
|
|
||||||
if [ -z "$PHP_BIN" ]
|
|
||||||
then
|
|
||||||
PHP_BIN=php
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$(echo -e test)" = test ]
|
|
||||||
then
|
|
||||||
echo_e="echo -e"
|
|
||||||
else
|
|
||||||
echo_e="echo"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# necessary check for initial commit
|
|
||||||
if git rev-parse --verify HEAD >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
against=HEAD
|
|
||||||
else
|
|
||||||
# Initial commit: diff against an empty tree object
|
|
||||||
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
|
||||||
fi
|
|
||||||
|
|
||||||
errors=""
|
|
||||||
if ! which "$PHP_BIN" >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
echo "PHP Syntax check failed:"
|
|
||||||
echo "PHP binary does not exist or is not in path: $PHP_BIN"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# dash does not support $'\n':
|
|
||||||
# http://forum.soft32.com/linux2/Bug-409179-DASH-Settings-IFS-work-properly-ftopict70039.html
|
|
||||||
IFS='
|
|
||||||
'
|
|
||||||
# get a list of staged files
|
|
||||||
for line in $(git diff-index --cached --full-index $against)
|
|
||||||
do
|
|
||||||
# split needed values
|
|
||||||
sha=$(echo $line | cut -d' ' -f4)
|
|
||||||
temp=$(echo $line | cut -d' ' -f5)
|
|
||||||
status=$(echo $temp | cut -d' ' -f1)
|
|
||||||
filename=$(echo $temp | cut -d' ' -f2)
|
|
||||||
|
|
||||||
# file extension
|
|
||||||
ext=$(echo $filename | sed 's/^.*\.//')
|
|
||||||
|
|
||||||
# only check files with php extension
|
|
||||||
if [ $ext != "php" ]
|
|
||||||
then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# do not check deleted files
|
|
||||||
if [ $status = "D" ]
|
|
||||||
then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check the staged file content for syntax errors
|
|
||||||
# using php -l (lint)
|
|
||||||
result=$(git cat-file -p $sha | "$PHP_BIN" -n -l -ddisplay_errors\=1 -derror_reporting\=E_ALL -dlog_errrors\=0 2>&1)
|
|
||||||
if [ $? -ne 0 ]
|
|
||||||
then
|
|
||||||
# Swap back in correct filenames
|
|
||||||
errors=$(echo "$errors"; echo "$result" | grep ':' | sed -e "s@in - on@in $filename on@g")
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
unset IFS
|
|
||||||
|
|
||||||
if [ -n "$errors" ]
|
|
||||||
then
|
|
||||||
echo "PHP Syntax check failed: "
|
|
||||||
$echo_e "$errors"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
@@ -1,42 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# A hook to add [$branch] to the beginning of a commit message
|
|
||||||
# if certain conditions are met.
|
|
||||||
#
|
|
||||||
# This is a prepare-commit-msg hook.
|
|
||||||
#
|
|
||||||
# To install this you can either copy or symlink it to
|
|
||||||
# $GIT_DIR/hooks, example:
|
|
||||||
#
|
|
||||||
# ln -s ../../git-tools/hooks/prepare-commit-msg \\
|
|
||||||
# .git/hooks/prepare-commit-msg
|
|
||||||
|
|
||||||
# get branch name
|
|
||||||
branch="$(git symbolic-ref HEAD)"
|
|
||||||
|
|
||||||
# exit if no branch name is present
|
|
||||||
# (eg. detached HEAD)
|
|
||||||
if [ $? -ne 0 ]
|
|
||||||
then
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# strip off refs/heads/
|
|
||||||
branch="$(echo "$branch" | sed "s/refs\/heads\///g")"
|
|
||||||
|
|
||||||
# add [branchname] to commit message
|
|
||||||
# * only run when normal commit is made (without -m or -F;
|
|
||||||
# not a merge, etc.)
|
|
||||||
# * also make sure the branch name begins with bug/ or feature/
|
|
||||||
if [ "$2" = "" ]
|
|
||||||
then
|
|
||||||
tail="";
|
|
||||||
|
|
||||||
# Branch is prefixed with 'ticket/', append ticket ID to message
|
|
||||||
if [ "$branch" != "${branch##ticket/}" ];
|
|
||||||
then
|
|
||||||
tail="$(printf "\n\nPHPBB3-${branch##ticket/}")";
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "[$branch] $tail$(cat "$1")" > "$1"
|
|
||||||
fi
|
|
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Script to uninstall the git hooks
|
|
||||||
#
|
|
||||||
# Usage (from within git-tools/hooks):
|
|
||||||
# ./uninstall
|
|
||||||
|
|
||||||
dir=$(dirname $0)
|
|
||||||
|
|
||||||
for file in $(ls $dir)
|
|
||||||
do
|
|
||||||
if [ $file != "install" ] && [ $file != "uninstall" ]
|
|
||||||
then
|
|
||||||
rm -f "$dir/../../.git/hooks/$file"
|
|
||||||
fi
|
|
||||||
done
|
|
@@ -1,194 +0,0 @@
|
|||||||
#!/usr/bin/env php
|
|
||||||
<?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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
function show_usage()
|
|
||||||
{
|
|
||||||
$filename = basename(__FILE__);
|
|
||||||
|
|
||||||
echo "$filename merges a github pull request.\n";
|
|
||||||
echo "\n";
|
|
||||||
|
|
||||||
echo "Usage: [php] $filename -p pull_request_id [OPTIONS]\n";
|
|
||||||
echo "\n";
|
|
||||||
|
|
||||||
echo "Options:\n";
|
|
||||||
echo " -p pull_request_id The pull request id to be merged (mandatory)\n";
|
|
||||||
echo " -r remote Remote of upstream, defaults to 'upstream' (optional)\n";
|
|
||||||
echo " -d Outputs the commands instead of running them (optional)\n";
|
|
||||||
echo " -h This help text\n";
|
|
||||||
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle arguments
|
|
||||||
$opts = getopt('p:r:dh');
|
|
||||||
|
|
||||||
if (empty($opts) || isset($opts['h']))
|
|
||||||
{
|
|
||||||
show_usage();
|
|
||||||
}
|
|
||||||
|
|
||||||
$pull_id = get_arg($opts, 'p', '');
|
|
||||||
$remote = get_arg($opts, 'r', 'upstream');
|
|
||||||
$dry_run = !get_arg($opts, 'd', true);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
exit(work($pull_id, $remote));
|
|
||||||
}
|
|
||||||
catch (RuntimeException $e)
|
|
||||||
{
|
|
||||||
echo $e->getMessage();
|
|
||||||
exit($e->getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
function work($pull_id, $remote)
|
|
||||||
{
|
|
||||||
// Get some basic data
|
|
||||||
$pull = get_pull('phpbb', 'phpbb3', $pull_id);
|
|
||||||
|
|
||||||
if (!$pull_id)
|
|
||||||
{
|
|
||||||
show_usage();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($pull['state'] != 'open')
|
|
||||||
{
|
|
||||||
throw new RuntimeException(sprintf("Error: pull request is closed\n",
|
|
||||||
$target_branch), 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
$pull_user = $pull['head'][0];
|
|
||||||
$pull_branch = $pull['head'][1];
|
|
||||||
$target_branch = $pull['base'][1];
|
|
||||||
|
|
||||||
switch ($target_branch)
|
|
||||||
{
|
|
||||||
case 'develop-olympus':
|
|
||||||
run("git checkout develop-olympus");
|
|
||||||
run("git pull $remote develop-olympus");
|
|
||||||
|
|
||||||
add_remote($pull_user, 'phpbb3');
|
|
||||||
run("git fetch $pull_user");
|
|
||||||
run("git merge --no-ff $pull_user/$pull_branch");
|
|
||||||
run("phpBB/vendor/bin/phpunit");
|
|
||||||
|
|
||||||
run("git checkout develop");
|
|
||||||
run("git pull $remote develop");
|
|
||||||
run("git merge --no-ff develop-olympus");
|
|
||||||
run("phpBB/vendor/bin/phpunit");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'develop':
|
|
||||||
run("git checkout develop");
|
|
||||||
run("git pull $remote develop");
|
|
||||||
|
|
||||||
add_remote($pull_user, 'phpbb3');
|
|
||||||
run("git fetch $pull_user");
|
|
||||||
run("git merge --no-ff $pull_user/$pull_branch");
|
|
||||||
run("phpBB/vendor/bin/phpunit");
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new RuntimeException(sprintf("Error: pull request target branch '%s' is not a main branch\n",
|
|
||||||
$target_branch), 5);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function add_remote($username, $repository, $pushable = false)
|
|
||||||
{
|
|
||||||
$url = get_repository_url($username, $repository, false);
|
|
||||||
run("git remote add $username $url", true);
|
|
||||||
|
|
||||||
if ($pushable)
|
|
||||||
{
|
|
||||||
$ssh_url = get_repository_url($username, $repository, true);
|
|
||||||
run("git remote set-url --push $username $ssh_url");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_repository_url($username, $repository, $ssh = false)
|
|
||||||
{
|
|
||||||
$url_base = ($ssh) ? 'git@github.com:' : 'git://github.com/';
|
|
||||||
|
|
||||||
return $url_base . $username . '/' . $repository . '.git';
|
|
||||||
}
|
|
||||||
|
|
||||||
function api_request($query)
|
|
||||||
{
|
|
||||||
return api_url_request("https://api.github.com/$query?per_page=100");
|
|
||||||
}
|
|
||||||
|
|
||||||
function api_url_request($url)
|
|
||||||
{
|
|
||||||
$contents = file_get_contents($url, false, stream_context_create(array(
|
|
||||||
'http' => array(
|
|
||||||
'header' => "User-Agent: phpBB/1.0\r\n",
|
|
||||||
),
|
|
||||||
)));
|
|
||||||
|
|
||||||
if ($contents === false)
|
|
||||||
{
|
|
||||||
throw new RuntimeException("Error: failed to retrieve pull request data\n", 4);
|
|
||||||
}
|
|
||||||
$contents = json_decode($contents);
|
|
||||||
|
|
||||||
if (isset($contents->message) && strpos($contents->message, 'API Rate Limit') === 0)
|
|
||||||
{
|
|
||||||
throw new RuntimeException('Reached github API Rate Limit. Please try again later' . "\n", 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_pull($username, $repository, $pull_id)
|
|
||||||
{
|
|
||||||
$request = api_request("repos/$username/$repository/pulls/$pull_id");
|
|
||||||
|
|
||||||
$pull = $request->pull;
|
|
||||||
|
|
||||||
$pull_data = array(
|
|
||||||
'base' => array($pull->base->user->login, $pull->base->ref),
|
|
||||||
'head' => array($pull->head->user->login, $pull->head->ref),
|
|
||||||
'state' => $pull->state,
|
|
||||||
);
|
|
||||||
|
|
||||||
return $pull_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_arg($array, $index, $default)
|
|
||||||
{
|
|
||||||
return isset($array[$index]) ? $array[$index] : $default;
|
|
||||||
}
|
|
||||||
|
|
||||||
function run($cmd, $ignore_fail = false)
|
|
||||||
{
|
|
||||||
global $dry_run;
|
|
||||||
|
|
||||||
if (!empty($dry_run))
|
|
||||||
{
|
|
||||||
echo "$cmd\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
passthru(escapeshellcmd($cmd), $status);
|
|
||||||
|
|
||||||
if ($status != 0 && !$ignore_fail)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(sprintf("Error: command '%s' failed with status %s'\n",
|
|
||||||
$cmd, $status), 6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,92 +0,0 @@
|
|||||||
<IfModule mod_rewrite.c>
|
|
||||||
RewriteEngine on
|
|
||||||
|
|
||||||
#
|
|
||||||
# Uncomment the statement below if URL rewriting doesn't
|
|
||||||
# work properly. If you installed phpBB in a subdirectory
|
|
||||||
# of your site, properly set the argument for the statement.
|
|
||||||
# e.g.: if your domain is test.com and you installed phpBB
|
|
||||||
# in http://www.test.com/phpBB/index.php you have to set
|
|
||||||
# the statement RewriteBase /phpBB/
|
|
||||||
#
|
|
||||||
#RewriteBase /
|
|
||||||
|
|
||||||
#
|
|
||||||
# Uncomment the statement below if you want to make use of
|
|
||||||
# HTTP authentication and it does not already work.
|
|
||||||
# This could be required if you are for example using PHP via Apache CGI.
|
|
||||||
#
|
|
||||||
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
|
|
||||||
|
|
||||||
#
|
|
||||||
# The following 3 lines will rewrite URLs passed through the front controller
|
|
||||||
# to not require app.php in the actual URL. In other words, a controller is
|
|
||||||
# by default accessed at /app.php/my/controller, but can also be accessed at
|
|
||||||
# /my/controller
|
|
||||||
#
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
|
||||||
RewriteRule ^(.*)$ app.php [QSA,L]
|
|
||||||
|
|
||||||
#
|
|
||||||
# If symbolic links are not already being followed,
|
|
||||||
# uncomment the line below.
|
|
||||||
# http://anothersysadmin.wordpress.com/2008/06/10/mod_rewrite-forbidden-403-with-apache-228/
|
|
||||||
#
|
|
||||||
#Options +FollowSymLinks
|
|
||||||
</IfModule>
|
|
||||||
|
|
||||||
# Apache content negotation tries to interpret non-existent paths as files if
|
|
||||||
# MultiViews is enabled. This will however cause issues with paths containg
|
|
||||||
# dots, e.g. for the cron tasks
|
|
||||||
<IfModule mod_negotiation.c>
|
|
||||||
Options -MultiViews
|
|
||||||
</IfModule>
|
|
||||||
|
|
||||||
# With Apache 2.4 the "Order, Deny" syntax has been deprecated and moved from
|
|
||||||
# module mod_authz_host to a new module called mod_access_compat (which may be
|
|
||||||
# disabled) and a new "Require" syntax has been introduced to mod_authz_host.
|
|
||||||
# We could just conditionally provide both versions, but unfortunately Apache
|
|
||||||
# does not explicitly tell us its version if the module mod_version is not
|
|
||||||
# available. In this case, we check for the availability of module
|
|
||||||
# mod_authz_core (which should be on 2.4 or higher only) as a best guess.
|
|
||||||
<IfModule mod_version.c>
|
|
||||||
<IfVersion < 2.4>
|
|
||||||
<Files "config.php">
|
|
||||||
Order Allow,Deny
|
|
||||||
Deny from All
|
|
||||||
</Files>
|
|
||||||
<Files "common.php">
|
|
||||||
Order Allow,Deny
|
|
||||||
Deny from All
|
|
||||||
</Files>
|
|
||||||
</IfVersion>
|
|
||||||
<IfVersion >= 2.4>
|
|
||||||
<Files "config.php">
|
|
||||||
Require all denied
|
|
||||||
</Files>
|
|
||||||
<Files "common.php">
|
|
||||||
Require all denied
|
|
||||||
</Files>
|
|
||||||
</IfVersion>
|
|
||||||
</IfModule>
|
|
||||||
<IfModule !mod_version.c>
|
|
||||||
<IfModule !mod_authz_core.c>
|
|
||||||
<Files "config.php">
|
|
||||||
Order Allow,Deny
|
|
||||||
Deny from All
|
|
||||||
</Files>
|
|
||||||
<Files "common.php">
|
|
||||||
Order Allow,Deny
|
|
||||||
Deny from All
|
|
||||||
</Files>
|
|
||||||
</IfModule>
|
|
||||||
<IfModule mod_authz_core.c>
|
|
||||||
<Files "config.php">
|
|
||||||
Require all denied
|
|
||||||
</Files>
|
|
||||||
<Files "common.php">
|
|
||||||
Require all denied
|
|
||||||
</Files>
|
|
||||||
</IfModule>
|
|
||||||
</IfModule>
|
|
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 51 B |
Before Width: | Height: | Size: 49 B |
Before Width: | Height: | Size: 49 B |
Before Width: | Height: | Size: 51 B |
Before Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 48 B |
Before Width: | Height: | Size: 48 B |
Before Width: | Height: | Size: 48 B |
Before Width: | Height: | Size: 48 B |
Before Width: | Height: | Size: 416 B |
Before Width: | Height: | Size: 385 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 420 B |
Before Width: | Height: | Size: 826 B |
Before Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 229 B |
Before Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 570 B |
Before Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 662 B |
Before Width: | Height: | Size: 708 B |
Before Width: | Height: | Size: 681 B |
Before Width: | Height: | Size: 725 B |
Before Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 307 B |
Before Width: | Height: | Size: 240 B |