Open bobbingwide opened 2 years ago
The [active_plugins] shortcode now displays something like this.
Combination
This shows that bbboing was unloaded by oik-unloader and oik-magnetic-poetry was loaded by oik-loader
Note: For a subdirectory install the URL must include the subdirectory
entry in C:\apache\htdocs\wp55/wp-content/mu-plugins/oik-unloader.1.csv
/wp55/2022/02/18/active_plugins/,,bbboing/bbboing.php
entry in C:\apache\htdocs\wp55/wp-content/mu-plugins/oik-loader-extras.csv
/wp55/2022/02/18/active_plugins/,0,oik-magnetic-poetry/oik-magnetic-poetry.php
activate_plugins
capability.The first version of the table of plugins in the form is
This shows:
I'm finding it difficult to decide how to deal with the automatic plugin activation logic in oik-loader.
oik-loader.$blog_id.csv
file is generated from this data.oik-loader-extras.csv
, which is manually curated.$blog_id
in the file name for the manually curated list eg oik-loader-extras.$blog_id.csv
[active_plugins]
shortcode using the same solution.csv
files by .json
files.Having copied and cobbled class oik_unloader_admin
to oik_loader_admin
I now realise that when two forms are on the same admin page they need to have unique button names. When they're duplicated the action is performed against both forms. Which isn't what we want at all. Perhaps it would make sense to complete the shortcode logic then apply that to the admin page.
I've added the logic to update the oik-loader-extras from the [active_plugins]
shortcode. But since oik-unloader-mu runs after oik-loader-mu the changes are not being detected immediately.
oik-loader-mu-reload
hook after performing an update. Consider implementing an oik-loader-mu-reload hook after performing an update.
That worked with 2 lines of code; the do_action
in oik_loader_admin::update()
and the add_action
in the oik-loader-mu plugin file. This only gets invoked when an update has been applied.
There's still the consideration of what to do when the [active_plugins]
shortcode is used on a page which automatically generates oik-loader CSV records.
The logic in the active_plugins shortcode should take into account the availability of the oik-loader-mu plugin. If it's not loaded then anything to do with oik-loader shouldn't be shown.
So, how can we tell that the server response has improved? Well, we can introduce a timings field into the form that keeps the last 10 (or so ) timings and displays them under the form.
It shouldn't be necessary to show what's changed. The user has to have a bit of common sense in order to be able to use this stuff in the first place.
Delivered as server side rendered
I implemented the logic to deliver the block as server side rendered.
There were two major problems
On reload of the post after update
Obviously some more thought needs to be put into this. First thing to do is to investigate 1.
- None of the checkboxes were checked
I got this to work by re-enabling the lookup by post ID.
Currently, any entry in the oik-unloader CSV file that doesn't have an ID, but which needs one, must be manually updated. This is not yet possible in either the oik-unloader admin interface or the active_plugins shortcode / block.
Clicking on Update activated plugins didn't appear to work.
It works for Unload but not for Load.
At present changing the plugins to Load replaces the extras file with the latest URL; previous entries are lost.
Note: If you unload the oik-unloader plugin then it disables the oik-unloader/active-plugins block.
This confused me for a while on s.b/hm
where I'd previously unloaded nearly every plugin on the home page.
Also, you have to remember to enable the MU versions of oik-unloader and oik-loader as well.
When oik-loader isn't active the active-plugins block crashes with oik_loader_map_id not found.
OIK_Unloader_Active_Plugins_Shortcode::is_oik_loader_mu_loaded
should also check for oik_loader_map_id
When the server rendered block is displayed the checkboxes and Update activated plugins button should only be enabled when the user has the authority to update them. When the user's not logged in the button's not displayed but the checkboxes are still enabled.
Using oik-loader and oik-unloader in cwiccer.com I was able to improve or worsen the performance of a post or page by reducing the number of activated plugins to those essential for delivering the post or page. Note:The logic isn't specific to single posts, but it's a lot easier to work on a single post than it is to work on an archive.
The admin interface for oik-unloader is better than the knocked up version for oik-loader but it could be improved significantly were it incorporated into the editor for individual posts and pages.
Requirement
Proposed solution
oik-unloader/active-plugins
block[active_plugins]
as a shortcode.