@@ -455,7 +455,7 @@ function rocket_clean_home( $lang = '' ) {
455455
456456 // Delete homepage
457457 if ( $ files = glob ( $ root . '/{index,index-*}.{html,html_gzip} ' , GLOB_BRACE |GLOB_NOSORT ) ) {
458- foreach ( $ files as $ file ) { // no array map to use @
458+ foreach ( $ files as $ file ) { // no array map to use @
459459 @unlink ( $ file );
460460 }
461461 }
@@ -466,6 +466,13 @@ function rocket_clean_home( $lang = '' ) {
466466 rocket_rrmdir ( $ dir );
467467 }
468468 }
469+
470+ // Remove the hidden empty file for mobile detection on NGINX with the Rocket NGINX configuration
471+ if ( $ nginx_mobile_detect_files = glob ( $ root . '/.mobile-active ' , GLOB_BRACE |GLOB_NOSORT ) ) {
472+ foreach ( $ nginx_mobile_detect_files as $ nginx_mobile_detect_file ) { // no array map to use @
473+ @unlink ( $ nginx_mobile_detect_file );
474+ }
475+ }
469476
470477 /**
471478 * Fires after the home cache file was deleted
@@ -760,7 +767,7 @@ function rocket_rrmdir( $dir, $dirs_to_preserve = array() ) {
760767 $ dir = untrailingslashit ( $ dir );
761768
762769 /**
763- * Fires after a file/directory cache was deleted
770+ * Fires before a file/directory cache is deleted
764771 *
765772 * @since 1.1.0
766773 *
@@ -769,6 +776,13 @@ function rocket_rrmdir( $dir, $dirs_to_preserve = array() ) {
769776 */
770777 do_action ( 'before_rocket_rrmdir ' , $ dir , $ dirs_to_preserve );
771778
779+ // Remove the hidden empty file for mobile detection on NGINX with the Rocket NGINX configuration
780+ $ nginx_mobile_detect_file = $ dir . '/.mobile-active ' ;
781+
782+ if ( file_exists ( $ nginx_mobile_detect_file ) ) {
783+ @unlink ( $ nginx_mobile_detect_file );
784+ }
785+
772786 if ( ! is_dir ( $ dir ) ) {
773787 @unlink ( $ dir );
774788 return ;
@@ -795,7 +809,7 @@ function rocket_rrmdir( $dir, $dirs_to_preserve = array() ) {
795809 @rmdir ($ dir );
796810
797811 /**
798- * Fires before a file/directory cache was deleted
812+ * Fires after a file/directory cache was deleted
799813 *
800814 * @since 1.1.0
801815 *
0 commit comments