Skip to content

Commit 15c74ac

Browse files
committed
Remove PHP 5.3-specific action compatibility code
1 parent ff1ff39 commit 15c74ac

3 files changed

Lines changed: 2 additions & 25 deletions

File tree

bin/entrypoint.sh

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,9 @@ else
6464
PHPDOC_VERSION_NO_PREFIX=${PHPDOC_VERSION#v}
6565
CACHED_PHPDOC_TAR_GZ_PATH="$PHPDOC_CACHE_PATH/phpDocumentor-${PHPDOC_VERSION_NO_PREFIX}.tgz"
6666
CACHED_PHPDOC_PHAR_PATH="$PHPDOC_CACHE_PATH/phpDocumentor-${PHPDOC_VERSION_NO_PREFIX}.phar"
67-
CACHED_PHPDOC_BIN_PATH="$PHPDOC_CACHE_PATH/phpDocumentor-${PHPDOC_VERSION_NO_PREFIX}/bin/phpdoc"
6867
PHPDOC_TAR_GZ_URL="https://github.com/phpDocumentor/phpDocumentor/releases/download/v${PHPDOC_VERSION_NO_PREFIX}/phpDocumentor-${PHPDOC_VERSION_NO_PREFIX}.tgz"
6968
PHPDOC_PHAR_URL="https://github.com/phpDocumentor/phpDocumentor/releases/download/v${PHPDOC_VERSION_NO_PREFIX}/phpDocumentor.phar"
7069

71-
if ! php -r 'exit(extension_loaded("zlib") ? 0 : 1);'; then
72-
if [[ -f "$CACHED_PHPDOC_BIN_PATH" ]]; then
73-
PHPDOC_COMMAND=(php "$CACHED_PHPDOC_BIN_PATH")
74-
PHPDOC_COMMAND_SET=1
75-
elif [[ -f "$CACHED_PHPDOC_PHAR_PATH" ]]; then
76-
cp "$CACHED_PHPDOC_PHAR_PATH" "$PHPDOC_PHAR_PATH"
77-
PHPDOC_COMMAND=(php "$PHPDOC_PHAR_PATH" run)
78-
PHPDOC_COMMAND_SET=1
79-
else
80-
download_file "$PHPDOC_PHAR_URL" "$PHPDOC_PHAR_PATH"
81-
PHPDOC_COMMAND=(php "$PHPDOC_PHAR_PATH" run)
82-
PHPDOC_COMMAND_SET=1
83-
fi
84-
fi
85-
8670
if [[ "$PHPDOC_COMMAND_SET" -eq 0 ]] && [[ -f "$CACHED_PHPDOC_TAR_GZ_PATH" ]]; then
8771
cp "$CACHED_PHPDOC_TAR_GZ_PATH" "$PHPDOC_TAR_GZ_PATH"
8872
elif [[ "$PHPDOC_COMMAND_SET" -eq 0 ]] && ! download_file "$PHPDOC_TAR_GZ_URL" "$PHPDOC_TAR_GZ_PATH"; then

bin/setup-phpdoc-md.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44

55
TARGET_DIR=${1:-/opt/phpdoc-md}
66
COMPOSER_HOME_DIR=${2:-/tmp/composer}
7-
PHPDOC_MD_REF=${3:-0.1.1}
7+
PHPDOC_MD_REF=${3:-0.2.0}
88

99
GIT_SSH_OPTIONS="ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -o ConnectTimeout=5"
1010

@@ -14,7 +14,7 @@ fi
1414

1515
php -r '$composer = json_decode(file_get_contents($argv[1]), true); unset($composer["require-dev"]); file_put_contents($argv[1], json_encode($composer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL);' "$TARGET_DIR/composer.json"
1616

17-
COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_HOME="$COMPOSER_HOME_DIR" composer config --global platform.php 5.3.3
17+
COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_HOME="$COMPOSER_HOME_DIR" composer config --global platform.php 5.4.0
1818
COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_HOME="$COMPOSER_HOME_DIR" composer install \
1919
--working-dir="$TARGET_DIR" \
2020
--no-dev \

bin/setup-phpdocumentor-cache.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,8 @@ PHPDOC_TAR_GZ_URL="https://github.com/phpDocumentor/phpDocumentor/releases/downl
99
PHPDOC_PHAR_URL="https://github.com/phpDocumentor/phpDocumentor/releases/download/v${PHPDOC_VERSION_NO_PREFIX}/phpDocumentor.phar"
1010
TARGET_FILE="${TARGET_DIR}/phpDocumentor-${PHPDOC_VERSION_NO_PREFIX}.tgz"
1111
PHAR_TARGET_FILE="${TARGET_DIR}/phpDocumentor-${PHPDOC_VERSION_NO_PREFIX}.phar"
12-
EXTRACTED_ROOT="${TARGET_DIR}/phpDocumentor-${PHPDOC_VERSION_NO_PREFIX}"
13-
XML_WRITER_PATH="${EXTRACTED_ROOT}/src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php"
1412

1513
mkdir -p "$TARGET_DIR"
1614

1715
php -r '$url = isset($argv[1]) ? $argv[1] : null; $target = isset($argv[2]) ? $argv[2] : null; if (!$url || !$target) { fwrite(STDERR, "Missing download arguments\n"); exit(1); } $data = @file_get_contents($url); if ($data === false) { fwrite(STDERR, "Unable to download file: $url\n"); exit(1); } if (@file_put_contents($target, $data) === false) { fwrite(STDERR, "Unable to write file: $target\n"); exit(1); }' "$PHPDOC_TAR_GZ_URL" "$TARGET_FILE"
1816
php -r '$url = isset($argv[1]) ? $argv[1] : null; $target = isset($argv[2]) ? $argv[2] : null; if (!$url || !$target) { fwrite(STDERR, "Missing download arguments\n"); exit(1); } $data = @file_get_contents($url); if ($data === false) { fwrite(STDERR, "Unable to download file: $url\n"); exit(1); } if (@file_put_contents($target, $data) === false) { fwrite(STDERR, "Unable to write file: $target\n"); exit(1); }' "$PHPDOC_PHAR_URL" "$PHAR_TARGET_FILE"
19-
20-
rm -rf "$EXTRACTED_ROOT"
21-
php -r '$archive = isset($argv[1]) ? $argv[1] : null; $target = isset($argv[2]) ? $argv[2] : null; if (!$archive || !$target) { fwrite(STDERR, "Missing extract arguments\n"); exit(1); } if (!is_dir(dirname($target)) && !mkdir(dirname($target), 0777, true)) { fwrite(STDERR, "Unable to create target parent directory\n"); exit(1); } $root = dirname($target); $tarPath = preg_replace("/\\.tgz$/", ".tar", $archive); if ($tarPath === null) { fwrite(STDERR, "Unable to derive tar path\n"); exit(1); } try { if (!file_exists($tarPath)) { $tgz = new PharData($archive); $tgz->decompress(); } $tar = new PharData($tarPath); $tar->extractTo($root, null, true); } catch (Exception $e) { fwrite(STDERR, "Unable to extract phpDocumentor archive: " . $e->getMessage() . "\n"); exit(1); }' "$TARGET_FILE" "$EXTRACTED_ROOT"
22-
23-
php -r '$path = isset($argv[1]) ? $argv[1] : null; if (!$path || !file_exists($path)) { fwrite(STDERR, "Xml writer file not found: " . ($path ?: "null") . "\n"); exit(1); } $content = file_get_contents($path); if ($content === false) { fwrite(STDERR, "Unable to read xml writer file\n"); exit(1); } $needle = '\''base64_encode(gzcompress($file->getSource()))'\''; $replacement = '\''(function_exists("gzcompress") ? base64_encode(gzcompress($file->getSource())) : "")'\''; $updated = str_replace($needle, $replacement, $content, $count); if ($count < 1) { fwrite(STDERR, "Unable to patch xml writer for missing zlib support\n"); exit(1); } if (file_put_contents($path, $updated) === false) { fwrite(STDERR, "Unable to write patched xml writer file\n"); exit(1); }' "$XML_WRITER_PATH"

0 commit comments

Comments
 (0)