Skip to content

Exclude the database folder and db.php file when pushing a site - #2089

Merged
sejas merged 5 commits into
trunkfrom
fix/stu-1009-exclude-database-and-db-php-files-on-push
Nov 19, 2025
Merged

Exclude the database folder and db.php file when pushing a site#2089
sejas merged 5 commits into
trunkfrom
fix/stu-1009-exclude-database-and-db-php-files-on-push

Conversation

@sejas

@sejas sejas commented Nov 18, 2025

Copy link
Copy Markdown
Member

Related issues

Proposed Changes

  • Database folder and db.php were included when pushing the whole site after we enabled the selective push. This PR excludes them.
  • Also exclude debug.log file
  • Add tests to avoid including these files in the future

Testing Instructions

  • Checkout this branch and apply this diff to produce an archive you can easily review:
diff --git a/src/ipc-handlers.ts b/src/ipc-handlers.ts
index 2222476e..a1054304 100644
--- a/src/ipc-handlers.ts
+++ b/src/ipc-handlers.ts
@@ -794,6 +794,9 @@ export async function exportSiteForPush(
 		const stats = fs.statSync( archivePath );
 		return { archivePath, archiveSizeInBytes: stats.size };
 	} finally {
+		const destCopyPath = `${ TEMP_DIR }site_${ id }_${ new Date().getTime() }.tar.gz`;
+		fs.copyFileSync( archivePath, destCopyPath );
+		shell.showItemInFolder( destCopyPath );
 		SYNC_ABORT_CONTROLLERS.delete( operationId );
 	}
 }
@@ -826,6 +829,8 @@ export async function pushArchive(
 		formData.push( [ 'options', optionsToSync.join( ',' ) ] );
 	}
 
+	return { success: true };
 	try {
 		await wpcom.req.post( {
 			path: `/sites/${ remoteSiteId }/studio-app/sync/import`,
  • Run npm start
  • Go to the sync tab and push your Studio site selecting both checkboxes (database and all files and folders)
  • Observe that the finder opens a tar.gz
  • Unzip the file
  • Observe its contents
  • Confirm the archive didn't include the database folder nor the db.php file.
Before After
Screenshot 2025-11-18 at 18 48 41 Screenshot 2025-11-18 at 19 32 44

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@sejas sejas self-assigned this Nov 18, 2025
@sejas
sejas requested a review from a team November 18, 2025 19:38
@sejas sejas changed the title Exclude database folder and db.php file Nov 18, 2025
@github-actions

github-actions Bot commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

📊 Performance Test Results

Comparing de6e704 vs trunk

site-editor

Metric trunk de6e704 Diff Change
load 12806.00 ms 10584.00 ms -2222.00 ms 🟢 -17.4%

site-startup

Metric trunk de6e704 Diff Change
siteCreation 28350.00 ms 24436.00 ms -3914.00 ms 🟢 -13.8%
siteStartup 11008.00 ms 10012.00 ms -996.00 ms 🟢 -9.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

@ivan-ottinger ivan-ottinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good and I can confirm they fix the issue. 👌🏼 DB-related files are no longer included in the export:

Image

Checkout this branch and apply this diff to produce an archive you can easily review:

Thank you for including this diff. It made the testing quick and easy!

'wp-content/mu-plugins/0-sqlite-command.php',
];

private isExcludedPath( pathToCheck: string ) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactor. I find the code more readable now.

@sejas
sejas merged commit 2f050a4 into trunk Nov 19, 2025
12 checks passed
@sejas
sejas deleted the fix/stu-1009-exclude-database-and-db-php-files-on-push branch November 19, 2025 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants