Skip to content

Commit 8befb8e

Browse files
committed
Optimize for cache
1 parent a2382e8 commit 8befb8e

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

install-extensions.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,20 @@ install_tideways_xhprof() {
3838
local url="https://github.com/tideways/php-xhprof-extension/releases/download/v$version/tideways-xhprof-$version-$arch.tar.gz"
3939
local extension="tideways_xhprof"
4040
local tar="$extension.tgz"
41-
local config library
41+
local workdir="vendor/tideways_xhprof"
42+
local library="$PWD/$workdir/tideways_xhprof-$version/tideways_xhprof-$PHP_VERSION$zts.so"
43+
local config
4244
local zts
4345

44-
curl -fL -o "$tar" "$url"
45-
tar -xvf "$tar" -C vendor/tideways_xhprof
46+
if [ ! -f "$library" ]; then
47+
curl -fL -o "$tar" "$url"
48+
mkdir -p "$workdir"
49+
tar -xvf "$tar" -C "$workdir"
50+
fi
4651

4752
zts=$(php --version | grep -q ZTS && echo -zts || :)
48-
library="$PWD/vendor/tideways_xhprof/tideways_xhprof-$version/tideways_xhprof-$PHP_VERSION$zts.so"
49-
config="/etc/php/$PHP_VERSION/cli/conf.d/10-tideways_xhprof.ini"
5053
test -f "$library" || die "Extension not available: $library"
54+
config="/etc/php/$PHP_VERSION/cli/conf.d/10-tideways_xhprof.ini"
5155
echo "extension=$library" > "$config"
5256
has_extension "$extension"
5357
}

0 commit comments

Comments
 (0)