diff --git a/packages/wp-now/README.md b/packages/wp-now/README.md index 8d8dbd86f9..3a4be70a61 100644 --- a/packages/wp-now/README.md +++ b/packages/wp-now/README.md @@ -55,7 +55,7 @@ wp-now php my-file.php - `--port=`: the port number on which the server will listen. This is optional and if not provided, it will pick an open port number automatically. The default port number is set to `8881`(example of usage: `--port=3000`); - `--wp=`: the version of WordPress to use. This is optional and if not provided, it will use a default version. The default version is set to the [latest WordPress version](https://wordpress.org/download/releases/)(example usage: `--wp=5.8`) -Of these, `wp-now php` currently supports the `--path=`, `--php=`, and `--wp=` arguments. +Of these, `wp-now php` currently supports the `--path=` and `--php=` arguments. ## Technical Details diff --git a/packages/wp-now/src/execute-php-file.ts b/packages/wp-now/src/execute-php-file.ts index 9fba79a7ab..130569bf4c 100644 --- a/packages/wp-now/src/execute-php-file.ts +++ b/packages/wp-now/src/execute-php-file.ts @@ -4,9 +4,6 @@ import startWPNow from './wp-now'; import { WPNowOptions } from './config'; import { disableOutput } from './output'; -const VFS_TMP_PATH = '/vfs-wp-now-tmp'; -const VFS_PHP_FILE = path.join(VFS_TMP_PATH, 'parent.php'); - /** * * Execute a PHP file given its path. For non index mode it loads WordPress context. @@ -22,7 +19,7 @@ export async function executePHPFile( options: WPNowOptions = {} ) { disableOutput(); - const { phpInstances, options: wpNowOptions } = await startWPNow({ + const { phpInstances } = await startWPNow({ ...options, numberOfPhpInstances: 2, }); @@ -34,24 +31,9 @@ export async function executePHPFile( throw new Error(`Could not open input file: ${absoluteFilePath}`); } - let fileToExecute = absoluteFilePath; - if (wpNowOptions.mode !== 'index') { - // Load WordPress context for non index mode. - php.mkdirTree(VFS_TMP_PATH); - php.writeFile( - VFS_PHP_FILE, - ` { commonParameters(yargs); + yargs.option('wp', { + describe: "WordPress version to use: e.g. '--wp=6.2'", + type: 'string', + }); yargs.option('port', { describe: 'Server port', type: 'number', @@ -101,7 +101,6 @@ export async function runCli() { const options = await getWpNowConfig({ path: argv.path as string, php: argv.php as SupportedPHPVersion, - wp: argv.wp as string, }); await executePHPFile(argv.file as string, options); process.exit(0);