[wp-trac] [WordPress Trac] #44492: Add new build:dev task which symlinks all files that can be symlinked
WordPress Trac
noreply at wordpress.org
Sun Jul 8 23:53:31 UTC 2018
#44492: Add new build:dev task which symlinks all files that can be symlinked
------------------------------+---------------------
Reporter: omarreiss | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 5.0
Component: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: needs-testing | Focuses:
------------------------------+---------------------
Comment (by SergeyBiryukov):
Found an issue with the approach: when using symlinks, `wp-load.php` is
included from the `src/` directory, which means `ABSPATH` also points to
`src/`, leading to a warning in the admin:
> `WARNING: S:\home\wordpress.test\develop\src\wp-
includes\formatting.php:5434 - readfile(S:\home\wordpress.test\develop\src
/wp-includes/js/wp-emoji-loader.js): failed to open stream: No such file
or directory`
The warning comes from `_print_emoji_detection_script()`:
{{{
<?php readfile( ABSPATH . WPINC . '/js/wp-emoji-loader.js' ); ?>
}}}
At a glance, these functions are also affected:
* `rich_edit_exists()`:
{{{
$wp_rich_edit_exists = file_exists( ABSPATH . WPINC .
'/js/tinymce/tinymce.js' );
}}}
* `get_post_embed_html()`:
{{{
$output .= file_get_contents( ABSPATH . WPINC . '/js/wp-embed.js' );
}}}
* `print_embed_scripts()`:
{{{
readfile( ABSPATH . WPINC . '/js/wp-embed-template.js' );
}}}
`ABSPATH` is set as:
{{{
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}
}}}
Apparently `__FILE__` always resolves symlinks.
`$_SERVER['SCRIPT_FILENAME']` could help, but it points to the main script
(e.g. `wp-admin/index.php`), not the currently included file, so `dirname(
$_SERVER['SCRIPT_FILENAME'] )` does not give the correct path.
Creating a `wp-config.php` file in the `build/` directory does not help
either, it's simply ignored.
Patching `wp-load.php` is the only workaround I can think of at the
moment:
{{{
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', preg_replace( '#src$#', 'build', dirname(
__FILE__ ) ) . '/' );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44492#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list