Skip to content

Commit 9bec038

Browse files
swissspidyCopilot
andauthored
Update src/Context/FeatureContext.php
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f2d2d93 commit 9bec038

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

src/Context/FeatureContext.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,34 @@ public function install_wp( $subdir = '', $version = '' ): void {
16171617
$install_cache_is_valid = is_dir( $install_cache_path )
16181618
&& ( 'sqlite' !== self::$db_type || file_exists( "{$install_cache_path}.sqlite" ) );
16191619

1620+
if ( ! $install_cache_is_valid && file_exists( $install_cache_path ) ) {
1621+
if ( is_dir( $install_cache_path ) ) {
1622+
$iterator = new \RecursiveIteratorIterator(
1623+
new \RecursiveDirectoryIterator( $install_cache_path, \FilesystemIterator::SKIP_DOTS ),
1624+
\RecursiveIteratorIterator::CHILD_FIRST
1625+
);
1626+
foreach ( $iterator as $fileinfo ) {
1627+
if ( $fileinfo->isDir() ) {
1628+
rmdir( $fileinfo->getPathname() );
1629+
} else {
1630+
unlink( $fileinfo->getPathname() );
1631+
}
1632+
}
1633+
rmdir( $install_cache_path );
1634+
} else {
1635+
unlink( $install_cache_path );
1636+
}
1637+
1638+
$sqlite_cache = "{$install_cache_path}.sqlite";
1639+
if ( file_exists( $sqlite_cache ) && is_file( $sqlite_cache ) ) {
1640+
unlink( $sqlite_cache );
1641+
}
1642+
1643+
$sql_cache = "{$install_cache_path}.sql";
1644+
if ( file_exists( $sql_cache ) && is_file( $sql_cache ) ) {
1645+
unlink( $sql_cache );
1646+
}
1647+
}
16201648
if ( $install_cache_is_valid ) {
16211649
self::copy_dir( $install_cache_path, $run_dir );
16221650

0 commit comments

Comments
 (0)