Skip to content

Commit

Permalink
Release 3.18.1.1 (#7262)
Browse files Browse the repository at this point in the history
Co-authored-by: WordPress Fan <[email protected]>
  • Loading branch information
Khadreal and wordpressfan authored Jan 30, 2025
1 parent 380d43c commit fe1981d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
4 changes: 4 additions & 0 deletions inc/Engine/Common/Cache/FilesystemCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ public function generate_path( string $url ): string {
* @return bool
*/
public function is_accessible(): bool {
$base_path = $this->get_base_path();
if ( ! $this->filesystem->exists( $base_path ) ) {
rocket_mkdir_p( $base_path, $this->filesystem );
}
$root_path = $this->get_root_path();
if ( ! $this->filesystem->exists( $root_path ) ) {
rocket_mkdir_p( $root_path, $this->filesystem );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* Test class covering \WP_Rocket\Engine\Common\Cache\FilesystemCache::is_accessible
*/
class TestIsAccessible extends TestCase {
class Test_IsAccessible extends TestCase {
protected $root_folder;
protected $filesystem;
protected $filesystemcache;
Expand All @@ -27,17 +27,35 @@ public function set_up() {

/**
* @dataProvider configTestData
* @throws \Exception
*/
public function testShouldReturnAsExpected( $config, $expected ) {
Functions\when('rocket_get_constant')->justReturn($config['root']);
Functions\when('get_current_blog_id')->justReturn( 1 );
Functions\when('rocket_get_constant')->justReturn($config['root']);
Functions\when('get_current_blog_id')->justReturn( 1 );

$this->filesystem->shouldReceive('exists')->with($expected['path'])->andReturn($config['exists']);
if( ! $config['exists']) {
Functions\expect('rocket_mkdir_p')->with($expected['path'], $this->filesystem);
}
$this->filesystem->shouldReceive('is_writable')->with($expected['path'])->andReturn($config['is_writable']);
$base_path = $config['root'] . $this->root_folder;
$root_path = $expected['path'];


$this->filesystem->shouldReceive('exists')
->with($base_path)
->andReturn($config['exists']);

if( ! $config['exists']) {
Functions\expect('rocket_mkdir_p')->with($base_path, $this->filesystem);
}

$this->filesystem->shouldReceive('exists')
->with($root_path)
->andReturn($config['exists']);

if (!$config['exists']) {
Functions\expect('rocket_mkdir_p')
->with($root_path, $this->filesystem);
}

$this->filesystem->shouldReceive('is_writable')->with($root_path)->andReturn($config['is_writable']);

$this->assertSame($expected['output'], $this->filesystemcache->is_accessible());
$this->assertSame($expected['output'], $this->filesystemcache->is_accessible());
}
}
4 changes: 2 additions & 2 deletions wp-rocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WP Rocket
* Plugin URI: https://wp-rocket.me
* Description: The best WordPress performance plugin.
* Version: 3.18.1
* Version: 3.18.1.1
* Requires at least: 5.8
* Requires PHP: 7.3
* Code Name: Iego
Expand All @@ -20,7 +20,7 @@
defined( 'ABSPATH' ) || exit;

// Rocket defines.
define( 'WP_ROCKET_VERSION', '3.18.1' );
define( 'WP_ROCKET_VERSION', '3.18.1.1' );
define( 'WP_ROCKET_WP_VERSION', '5.8' );
define( 'WP_ROCKET_WP_VERSION_TESTED', '6.3.1' );
define( 'WP_ROCKET_PHP_VERSION', '7.3' );
Expand Down

0 comments on commit fe1981d

Please sign in to comment.