Build/Test Tools: Use require_once instead of require.

The `sync-stable-blocks.js` file is used to compile the contents of `require-dynamic-blocks.php`, which includes the PHP files required for dynamic Core blocks.

Since these files define PHP functions, `require_once` should be used instead of `require` to guard against fatal errors.

Follow up to [53688].

Props aristath, SergeyBiryukov, desrosj.
Fixes #56738. See #56179.

git-svn-id: https://develop.svn.wordpress.org/trunk@54406 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2022-10-07 01:56:31 +00:00
parent 75a4551107
commit f96d9ade2d

View File

@ -49,8 +49,8 @@ ${ staticBlockFolderNames }
.filter( isDynamic )
.map( toDirectoryName )
.sort()
// To PHP require statement:
.map( dirname => `require ABSPATH . WPINC . '/blocks/${ dirname }.php';` )
// To PHP require_once statement:
.map( dirname => `require_once ABSPATH . WPINC . '/blocks/${ dirname }.php';` )
.join( "\n" );
fs.writeFileSync(