parse( $GLOBALS['argv'] ?? array() ); $px320_profile = $px320_options['profile']; $px320_root = realpath( $px320_options['root'] ); if ( false === $px320_root || ! is_dir( $px320_root ) || ! is_file( $px320_root . '/wp-load.php' ) ) { throw new InvalidArgumentException( 'invalid_wordpress_root' ); } // The standalone collector identifies only the verified WordPress root. It // deliberately does not infer the location of a customized content directory, // bootstrap WordPress, or read wp-config.php. $px320_paths = new WordPressPathProvider( array( 'wordpress_root' => $px320_root, 'content_root' => '', 'plugins_root' => '', 'mu_plugins_root' => '', 'uploads_root' => '', 'theme_roots' => array(), ) ); $px320_contract = new StandaloneServerArtifact( $px320_paths ); $px320_preflight = $px320_contract->read_preflight( $px320_options['preflight'] ); $px320_observations = ( new ServerObservationCollector( null, true, $px320_paths ) )->collect( $px320_profile ); $px320_artifact = $px320_contract->create( $px320_preflight, $px320_observations ); // WordPress is intentionally not loaded in the standalone process. // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode $px320_json = json_encode( $px320_artifact, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR ) . "\n"; ( new PrivateJsonWriter( $px320_paths ) )->write( $px320_options['output'], $px320_json ); // Standalone CLI output is a terminal stream, not a WordPress file. // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fwrite fwrite( STDOUT, "Private server artifact created locally. No network request was made.\n" ); } catch ( Throwable $px320_exception ) { // Standalone CLI output is a terminal stream, not a WordPress file. // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fwrite fwrite( STDERR, "The standalone server artifact could not be created. No network request was made.\n" ); exit( 1 ); } } )(); exit; }