aboutsummaryrefslogtreecommitdiffstats
path: root/travis/check-executable-files.sh
blob: a5d4ded7e1c838b560cfb2adc1676fb48f7e47db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/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


DB=$1
TRAVIS_PHP_VERSION=$2
path="$3"

if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
then
	# Get the list of the executables files under a given path
	# The part "-name 'develop' -o -name 'vendor'" defines a set
	# of ignored directories.
	# The part "-path '*/bin/phpbbcli.php' -o -name 'composer.phar'"
	# defines a whitelist.

	executables_files=$( 							\
		find ${path}								\
			'('										\
				'('									\
					-name 'develop' -o				\
					-name 'vendor'					\
				')'									\
				-a -type d -prune -a -type f		\
			')'										\
			-o '('									\
				-not '('							\
					-path '*/bin/phpbbcli.php' -o	\
					-name 'composer.phar'			\
				')'									\
			-a '('									\
				-perm 755 -a						\
				-type f								\
			')'										\
		')'											\
	)

	if [ "$executables_files" != '' ]
	then
	  echo "$executables_files MUST NOT be executable.";
	  exit 1;
	fi
fi