Skip to content

Commit

Permalink
Merge pull request #168 from stellarwp/1.4.4
Browse files Browse the repository at this point in the history
Version 1.4.4
  • Loading branch information
lucatume committed Aug 15, 2023
2 parents a0cb549 + 247b1f1 commit 7bdc058
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 60 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/publish-wordpress-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ jobs:
packages: write
strategy:
matrix:
wp_version: [ '6.1' ]
php_version: [ '7.4', '8.0', '8.1' ]
wp_version: [ '6.2' ]
php_version: [ '8.0', '8.1', '8.2' ]
include:
# WordPress did not publish any 6.x images for PHP 7.3, use the latest 5.9 patch.
# No WordPress image for version 6.2+ and PHP 7.3: use the latest 5.9 version.
# This version is NOT udpated in the containers/wordpress/Dockerfile for back-compatibility.
- wp_version: '5.9'
php_version: '7.3'
# WordPress did not publish earlier versions of WP for PHP8.2.
# No WordPress image for version 6.2+ and PHP 7.4: use the latest 6.1.1 version.
# See containers/wordpress/Dockerfile for the wp-cli update to version 6.2.
- wp_version: '6.1.1'
php_version: '8.2'
php_version: '7.4'

steps:
- name: Checkout repository
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [1.4.4] - 2023-08-15
* Change - Update base WordPress container from 6.1 to 6.2.
* Change - Add WP CLI to the `wordpress` container as `wp`.

# [1.4.3] - 2023-08-03

* Change - Configure `slic` and `wordpress` containers consistently with `php.ini` configuration file.
Expand Down
11 changes: 11 additions & 0 deletions containers/wordpress/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,14 @@ RUN chmod a+x /usr/local/bin/xdebug-on && \
RUN chmod -R a+rwx /usr/local/etc/php/conf.d
# Use our own ini configuration file to set up some PHP default.
COPY ./php.ini /usr/local/etc/php/conf.d/999-slic.ini

# Install and make wp-cli binary available and executable by all users.
ADD https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar /usr/local/bin/wp
RUN chmod a+rx /usr/local/bin/wp

# No image for WordPress 6.2+ is available for PHP 7.4.
# If PHP_VERSION is 7.4, update WordPress to 6.2 using wp-cli.
# Weird syntax? POSIX compliant sh.
RUN if echo "${PHP_VERSION}" | grep -q '^7.4'; then \
wp --allow-root --path=/usr/src/wordpress core download --version=6.2 --force; \
fi
2 changes: 1 addition & 1 deletion slic.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
] );

$cli_name = 'slic';
const CLI_VERSION = '1.4.3';
const CLI_VERSION = '1.4.4';

// If the run-time option `-q`, for "quiet", is specified, then do not print the header.
if ( in_array( '-q', $argv, true ) || ( in_array( 'exec', $argv, true ) && ! in_array( 'help', $argv, true ) ) ) {
Expand Down
54 changes: 0 additions & 54 deletions src/wordpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,60 +144,6 @@ function ensure_wordpress_installed(): bool {
return true;
}

/**
* Fetch and return WordPress current latest version string.
*
* The result is cached in file for a day.
*
* @return string The current latest version, or `1.0.0` if the information
* could not be retrieved.
*/
function get_wordpress_latest_version(): string {
static $current_latest_version;

if ( $current_latest_version !== null ) {
return $current_latest_version;
}

$cache_file = cache( 'wp_latest_version.txt' );

// Invalidate after a day.
if ( is_readable( $cache_file ) && ( time() - (int) filectime( $cache_file ) ) < 86400 ) {
debug( "Reading latest version string from cache file $cache_file." . PHP_EOL );

$current_latest_version = file_get_contents( $cache_file );

return $current_latest_version;
}

debug( "Fetching latest WordPress version string ..." . PHP_EOL );
$json = file_get_contents( 'https://api.wordpress.org/core/version-check/1.7/' );

if ( $json === false ) {
debug( 'Fetching of WordPress latest version string failed, falling back to 1.0.0.' );

// We could not tell, return something that will trigger a refresh.
return '1.0.0';
}

$decoded = json_decode( $json, true );

if ( $decoded !== false && isset( $decoded['offers'][0]['current'] ) ) {
$current_latest_version = $decoded['offers'][0]['current'];

debug( "Fetched WordPress latest version: $current_latest_version" . PHP_EOL );

file_put_contents( $cache_file, $current_latest_version );

return $current_latest_version;
}

debug( "Fetched latest version response malformed, falling back to 1.0.0" . PHP_EOL );

// We could not tell, return something that will trigger a refresh.
return '1.0.0';
}

/**
* Ensure, failing if not possible, that WordPress is correctly set up, configured and installed.
*
Expand Down

0 comments on commit 7bdc058

Please sign in to comment.