Opened 5 weeks ago
Closed 5 weeks ago
#65209 closed defect (bug) (fixed)
Connectors: Expose isFileModDisabled flag to connector script module data.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | normal | Version: | 7.0 |
| Component: | General | Keywords: | has-patch dev-reviewed gutenberg-merge |
| Focuses: | Cc: |
Description
Backports PR https://github.com/WordPress/gutenberg/pull/77521.
Makes an enhacement so the connectors screen say if the website has disallowed file modifications.
The connectors admin screen needs to know whether file modifications are permitted (e.g. when DISALLOW_FILE_MODS is set, when the filesystem is not writable, or when the file_mod_allowed filter denies it) so the UI can adapt accordingly — for example, surfacing the appropriate messaging or disabling plugin-install affordances when those operations are not allowed.
Proposed change
Expose a new isFileModDisabled boolean on the connectors script module data, derived from wp_is_file_mod_allowed( 'install_plugins' ):
<?php $data['isFileModDisabled'] = ! wp_is_file_mod_allowed( 'install_plugins' );
Testing
- Load the connectors admin screen and inspect the script module data
payload —
isFileModDisabledshould be present andfalseon a standard install. - Add
define( 'DISALLOW_FILE_MODS', true );towp-config.phpand reload —isFileModDisabledshould now betrue. - Confirm the value also flips when a filter denies the
install_pluginscontext, e.g.:<?php add_filter( 'file_mod_allowed', function ( $allowed, $context ) { return 'install_plugins' === $context ? false : $allowed; }, 10, 2 );
Patch
GitHub PR: [https://github.com/WordPress/wordpress-develop/pull/11779
Change History (8)
This ticket was mentioned in PR #11779 on WordPress/wordpress-develop by @jorgefilipecosta.
5 weeks ago
#1
- Keywords has-patch added
@jorgefilipecosta commented on PR #11779:
5 weeks ago
#2
@jorgefilipecosta is there a trac ticket for this / is this targeted for 7.0?
Hi @jeffpaul, yes it will go with 7.0 it is a backport of https://github.com/WordPress/gutenberg/pull/77521. Ticket is available at https://core.trac.wordpress.org/ticket/65209.
@jorgefilipecosta commented on PR #11779:
5 weeks ago
#3
cc: @t-hamano, @westonruter as reviewers of https://github.com/WordPress/gutenberg/pull/77521 would you be able to review / sign this one. Thank you in advance.
@jorgefilipecosta commented on PR #11779:
5 weeks ago
#4
Thank you @westonruter!
@wildworks commented on PR #11779:
5 weeks ago
#6
This was commited in r62341.
## Summary
isFileModsDisabled(derived fromwp_is_file_mod_allowed( 'install_plugins' )) to the data exposed through thescript_module_data_options-connectors-wp-adminfilter so the connectors UI can react when plugin installs are disabled.Ticket: https://core.trac.wordpress.org/ticket/65209
## Test plan
isFileModsDisabledis present on the script module data with the expected value.define( 'DISALLOW_FILE_MODS', true )) and confirm the value flips totrue.