@@ -26,19 +26,28 @@ export class DefaultExporter extends EventEmitter implements Exporter {
2626 private archiveBuilder ! : archiver . Archiver ;
2727 private backup : BackupContents ;
2828 private readonly options : ExportOptions ;
29- private readonly pathsToExclude = [
30- 'wp-content/mu-plugins/sqlite-database-integration' ,
31- 'wp-content/mu-plugins/0-allowed-redirect-hosts.php' ,
32- 'wp-content/mu-plugins/0-check-theme-availability.php' ,
33- 'wp-content/mu-plugins/0-deactivate-jetpack-modules.php' ,
34- 'wp-content/mu-plugins/0-dns-functions.php' ,
35- 'wp-content/mu-plugins/0-permalinks.php' ,
36- 'wp-content/mu-plugins/0-wp-config-constants-polyfill.php' ,
37- 'wp-content/mu-plugins/0-sqlite.php' ,
38- 'wp-content/mu-plugins/0-thumbnails.php' ,
39- 'wp-content/mu-plugins/0-https-for-reverse-proxy.php' ,
40- 'wp-content/mu-plugins/0-sqlite-command.php' ,
41- ] ;
29+
30+ private isExcludedPath ( pathToCheck : string ) {
31+ const pathsToExclude = [
32+ 'wp-content/mu-plugins/sqlite-database-integration' ,
33+ 'wp-content/database' ,
34+ 'wp-content/db.php' ,
35+ 'wp-content/debug.log' ,
36+ 'wp-content/mu-plugins/0-allowed-redirect-hosts.php' ,
37+ 'wp-content/mu-plugins/0-check-theme-availability.php' ,
38+ 'wp-content/mu-plugins/0-deactivate-jetpack-modules.php' ,
39+ 'wp-content/mu-plugins/0-dns-functions.php' ,
40+ 'wp-content/mu-plugins/0-permalinks.php' ,
41+ 'wp-content/mu-plugins/0-wp-config-constants-polyfill.php' ,
42+ 'wp-content/mu-plugins/0-sqlite.php' ,
43+ 'wp-content/mu-plugins/0-thumbnails.php' ,
44+ 'wp-content/mu-plugins/0-https-for-reverse-proxy.php' ,
45+ 'wp-content/mu-plugins/0-sqlite-command.php' ,
46+ ] ;
47+ return pathsToExclude . some ( ( pathToExclude ) =>
48+ pathToCheck . startsWith ( path . normalize ( pathToExclude ) )
49+ ) ;
50+ }
4251
4352 constructor ( options : ExportOptions ) {
4453 super ( ) ;
@@ -177,11 +186,8 @@ export class DefaultExporter extends EventEmitter implements Exporter {
177186 if ( stat . isDirectory ( ) ) {
178187 this . archiveBuilder . directory ( fullPath , archivePath , ( entry ) => {
179188 const fullArchivePath = path . join ( archivePath , entry . name ) ;
180- const isExcluded = this . pathsToExclude . some ( ( pathToExclude ) =>
181- fullArchivePath . startsWith ( path . normalize ( pathToExclude ) )
182- ) ;
183189 if (
184- isExcluded ||
190+ this . isExcludedPath ( fullArchivePath ) ||
185191 entry . name . includes ( '.git' ) ||
186192 entry . name . includes ( 'node_modules' ) ||
187193 entry . name . includes ( 'cache' )
@@ -191,6 +197,9 @@ export class DefaultExporter extends EventEmitter implements Exporter {
191197 return entry ;
192198 } ) ;
193199 } else {
200+ if ( this . isExcludedPath ( archivePath ) ) {
201+ continue ;
202+ }
194203 this . archiveBuilder . file ( fullPath , { name : archivePath } ) ;
195204 }
196205 }
0 commit comments