aboutsummaryrefslogtreecommitdiff
blob: 6899373c1ea2644da49066d97f9e72aeadca9881 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/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
NOTESTS=$3
root="$4"
path="${root}phpBB/"

if [ "$NOTESTS" == '1' ]
then
	# 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
fi