CLI Mode breaks Media Library usability.
-
First off, I am loving this plugin, so thanks for making it!
Unfortunately I just ran into an huge performance issue. Whenever the plugin is activated and in CLI mode (the settings don’t matter!), the media library grinds to a halt and takes 10 or more seconds to show anything.
Here’s what seems to be happening:
The media library calls ‘query-attachments’ to get a list of media to display
query-attachments, somewhere, calls
media_metafor every mediathe IME plugin adds a filter to
media_meta:ime_filter_media_metaHere’s the issue. on every call to
ime_filter_media_metawe get a call toime_mode_valid():function ime_filter_media_meta( $content, $post ) {
global $wp_version;
if ( ! ime_mode_valid() ) {
return $content;
}ime_mode_validcallsime_im_cli_valid:/* Check if mode is valid */
function ime_mode_valid( $mode = null ) {
if ( empty( $mode ) ) {
$mode = ime_get_option( 'mode' );
}
$fn = 'ime_im_' . $mode . '_valid';
return ( ! empty( $mode ) && function_exists( $fn ) && call_user_func( $fn ) );
}This eventually calls
ime_im_cli_check_executablewhich actually executesimagemagickfunction ime_im_cli_check_executable($fullpath) {
if ( ! ime_is_executable($fullpath) || ! function_exists('exec') ) {
return false;
}
@exec( '"' . $fullpath . '" --version', $output );ImageMagick is a heavy program, and it ends up being executed at least dozens of times, doing nothing each time, every time you load a page in the media library.
Suggestions: Set a global var and check just once? I’ve commented out the check for now so I can keep using the plugin until it’s fixed.
Thanks!
The topic ‘CLI Mode breaks Media Library usability.’ is closed to new replies.