Skip to content

Commit 040c3b1

Browse files
committed
Merge pull request #34 from loadsys/f/tmp-dir-permissions
Initial work on a script to ensure PHP's tmp dir is created and has prop...
2 parents bbf4bd0 + 1ea8517 commit 040c3b1

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"set-owner",
5858
"symlink-cake-core",
5959
"template",
60+
"tmp-dir-permissions",
6061
"update",
6162
"updatewritedirs",
6263
"writedirs"

tmp-dir-permissions

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
#---------------------------------------------------------------------
4+
usage ()
5+
{
6+
cat <<EOT
7+
8+
${0##*/}
9+
Ensures the PHP temp directory provided on the command line is
10+
created and has writeable permissions. MUST BE RUN AS ROOT,
11+
typically via cron.
12+
13+
Usage:
14+
bin/${0##*/}
15+
16+
17+
EOT
18+
19+
exit 0
20+
}
21+
if [ "$1" = '-h' ]; then
22+
usage
23+
fi
24+
25+
if [ -z "$1" ]; then
26+
echo '!! Must provide a path to the PHP temp directory as first argument.'
27+
exit 1
28+
fi
29+
30+
PHP_TMP_DIR="$1"
31+
32+
if [ ! -d "$PHP_TMP_DIR" ]; then
33+
mkdir -p "$PHP_TMP_DIR"
34+
fi
35+
36+
chmod -R a+rwx "$PHP_TMP_DIR"
37+
chmod +t "$PHP_TMP_DIR"

0 commit comments

Comments
 (0)