Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 23 additions & 14 deletions apps/cli/lib/dependency-management/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,20 +205,29 @@ async function copyBundledAiInstructions() {
}

async function copyBundledPhpMyAdmin() {
await copySourceDirectoryIfNewerOrMissing( {
sourceDirectoryPath: path.join( getWpFilesPath(), 'phpmyadmin' ),
targetDirectoryPath: getPhpMyAdminPath(),
readSourceVersion: async () => {
const composerFilePath = path.join( getWpFilesPath(), 'phpmyadmin', 'composer.json' );
const composerFile = JSON.parse( fs.readFileSync( composerFilePath, 'utf8' ) );
return semver.coerce( composerFile.version );
},
readTargetVersion: async () => {
const composerFilePath = path.join( getPhpMyAdminPath(), 'composer.json' );
const composerFile = JSON.parse( fs.readFileSync( composerFilePath, 'utf8' ) );
return semver.coerce( composerFile.version );
},
} );
const sourcePhpMyAdminPath = path.join( getWpFilesPath(), 'phpmyadmin' );
if ( ! fs.existsSync( sourcePhpMyAdminPath ) ) {
return;
}

// phpMyAdmin's composer.json version rarely changes, but Studio injects
// Playground-specific files (e.g. DbiMysqli.php) at build time that do.
// Compare by size and mtime so those updates land across releases.
const targetPhpMyAdminPath = getPhpMyAdminPath();
const isSourceDirectoryDifferent = await areDirectoriesDifferentBySizeAndMtime(
sourcePhpMyAdminPath,
targetPhpMyAdminPath
);
if ( ! isSourceDirectoryDifferent ) {
return;
}

try {
await fs.promises.rm( targetPhpMyAdminPath, { recursive: true, force: true } );
} catch {
// Do nothing if the target directory is missing or corrupted
}
await recursiveCopyDirectory( sourcePhpMyAdminPath, targetPhpMyAdminPath );
}

async function copyBundledLanguagePacks() {
Expand Down
Loading