Skip to content

Commit bf6b702

Browse files
dunklerfoxjohn-shaffer
authored andcommitted
Add files in Divi's et-cache/ directory to detected vendor files
1 parent ce461fe commit bf6b702

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- [#850](https://github.com/leonstafford/wp2static/issues/850): Fix to write content to disk, even for cache hits when "Use CrawlCache" is ON. @utchy
3131
- [#877](https://github.com/leonstafford/wp2static/issues/877): Detect from web UI was not adding any URLs. @timothylcooke
3232
- [#878](https://github.com/leonstafford/wp2static/issues/878): Fix deletion of old pages when crawl returns 404. @timothylcooke
33+
- [#868](https://github.com/WP2Static/wp2static/pull/868): Detect files in Divi et-cache/ directory when present. @dunklerfox
3334

3435
## WP2Static 7.1.7 (2021-09-04)
3536

src/DetectVendorFiles.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ public static function detect( string $wp_site_url ) : array {
2121
$vendor_cache_dir =
2222
SiteInfo::getPath( 'content' ) . 'cache/';
2323

24+
// cache dir used by Elegant Themes
25+
$et_cache_dir =
26+
SiteInfo::getPath( 'content' ) . 'et-cache/';
27+
2428
if ( is_dir( $vendor_cache_dir ) ) {
2529
$site_url = SiteInfo::getUrl( 'site' );
2630
$content_url = SiteInfo::getUrl( 'content' );
@@ -41,6 +45,26 @@ public static function detect( string $wp_site_url ) : array {
4145
$vendor_files = array_merge( $vendor_files, $vendor_cache_urls );
4246
}
4347

48+
if ( is_dir( $et_cache_dir ) ) {
49+
$site_url = SiteInfo::getUrl( 'site' );
50+
$content_url = SiteInfo::getUrl( 'content' );
51+
52+
// get difference between home and wp-contents URL
53+
$prefix = str_replace(
54+
$site_url,
55+
'/',
56+
$content_url
57+
);
58+
59+
$et_cache_urls = DetectVendorCache::detect(
60+
$et_cache_dir,
61+
SiteInfo::getPath( 'content' ),
62+
$prefix
63+
);
64+
65+
$vendor_files = array_merge( $vendor_files, $et_cache_urls );
66+
}
67+
4468
if ( class_exists( 'Custom_Permalinks' ) ) {
4569
global $wpdb;
4670

0 commit comments

Comments
 (0)