query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery "DELETE FROM {$wpdb->options} WHERE option_name LIKE '\_transient\_modulary\_export\_%' OR option_name LIKE '\_transient\_timeout\_modulary\_export\_%'" ); // Background export files (Export\Job): one folder per job, flat files only. wp_clear_scheduled_hook( 'modulary_export_sweep_jobs' ); $modulary_export_uploads = wp_upload_dir( null, false ); $modulary_export_jobs = untrailingslashit( (string) $modulary_export_uploads['basedir'] ) . '/modulary-export'; if ( is_dir( $modulary_export_jobs ) ) { foreach ( (array) scandir( $modulary_export_jobs ) as $modulary_export_name ) { $modulary_export_path = $modulary_export_jobs . '/' . $modulary_export_name; if ( 1 === preg_match( '/^[0-9a-f]{32}$/', (string) $modulary_export_name ) && is_dir( $modulary_export_path ) ) { foreach ( (array) scandir( $modulary_export_path ) as $modulary_export_file ) { if ( is_file( $modulary_export_path . '/' . $modulary_export_file ) ) { wp_delete_file( $modulary_export_path . '/' . $modulary_export_file ); } } rmdir( $modulary_export_path ); // phpcs:ignore WordPress.WP.AlternativeFunctions } elseif ( is_file( $modulary_export_path ) ) { wp_delete_file( $modulary_export_path ); } } rmdir( $modulary_export_jobs ); // phpcs:ignore WordPress.WP.AlternativeFunctions }