Conversation
|
|
||
| ( fsPromises.readdir as jest.Mock ).mockResolvedValue( mockFiles ); | ||
|
|
||
| // Mock fsPromises.stat for canHandle method |
There was a problem hiding this comment.
What do you think about cleaning up these comments as they seem self-explanatory?
katinthehatsite
left a comment
There was a problem hiding this comment.
The functionality looks good and works as expected 👍
From what I understand, the logic that you are removing is now handled by:
private addWpContent(): void {
const categories = (
[ 'uploads', 'plugins', 'themes', 'muPlugins', 'fonts' ] as BackupContentsCategory[]
).filter( ( category ) => this.options.includes[ category ] );
this.emit( ExportEvents.WP_CONTENT_EXPORT_START );
for ( const category of categories ) {
const folderName = category === 'muPlugins' ? 'mu-plugins' : category;
const absolutePath = path.join( this.options.site.path, 'wp-content', folderName );
const archivePath = path.relative( this.options.site.path, absolutePath );
this.archive.directory( absolutePath, archivePath, ( entry ) => {
const fullArchivePath = path.join( archivePath, entry.name );
const isExcluded = this.pathsToExclude.some( ( pathToExclude ) =>
fullArchivePath.startsWith( path.normalize( pathToExclude ) )
);
if (
isExcluded ||
entry.name.includes( '.git' ) ||
entry.name.includes( 'node_modules' )
) {
return false;
}
return entry;
} );
this.emit( ExportEvents.WP_CONTENT_EXPORT_PROGRESS, { directory: absolutePath } );
}
this.emit( ExportEvents.WP_CONTENT_EXPORT_COMPLETE );
}
Is that right?
Great question @katinthehatsite! Let me chime in with an answer. That is absolutely right, before the related changes, this function depended on backupContent.wpcomSites, but after those changes, the |
Yes, reading all the files and saving that list structure was slowly replaced over time. And the last push was when we replaced archive.file with archive.directory on #1448 My assumption is that Antony added the list of files in memory, thinking about future use for it in the progress bar, but that never happened. |

Related issues
Proposed Changes
getBackupContentsandgetSiteFilesfunctions.Testing Instructions
npm startPre-merge Checklist