Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • It works, thanks!

    Yes, it works.


    I just updated to the latest version of the plugin, but I can’t empty the cache any more.
    I receive this error: PHP Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(/tmp/opcache): failed to open dir: No such file or directory in /var/www/[…]/wp-content/plugins/flush-opcache/flush-opcache.php:288

    I beleive this is because I don’t use file cache, and the new version of the plugin does not handle this situation. I tried to create the folder /tmp/opcache (with correct permissions), but the error persists.

    It would be nice to fix this bug, because it pretty much renders useless this plugin for those who have only memory cache.


    PHP version:
    PHP 7.0.19-1 (cli) (built: May 11 2017 14:04:47) ( NTS )
    Copyright (c) 1997-2017 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.19-1, Copyright (c) 1999-2017, by Zend Technologies

    • This reply was modified 2 years, 6 months ago by joe2night.

    The slowdown is caused by the plugin generating images.
    Once the images are generated (during the first page load), it should not cause slowdown any more.
    If it still causes, it means, that it’s regenerating the images on every page load.
    Without the fix, it could happen if one used an array of pixel dimensions for image size, and not a string named size. With the fix it shoud not happen any more.
    If it still happens, maybe there are file permission problems? Or the memory is not enough to resize the images?

    Here is a fix. You must open the plugin file, and replace the line:

    $imagePath = preg_replace( '/^(.*)\.' . $imageExt . '$/', sprintf( '$1-%sx%s.%s', $size[0], $size[1], $imageExt ) , $imagePath );

    with this:

    $original_size = getimagesize($imagePath);
    			$sizes = image_resize_dimensions($original_size[0], $original_size[1], $size[0], $size[1], true);
    			if(empty($sizes)) {
    				$imagePath = preg_replace( '/^(.*)\.' . $imageExt . '$/', sprintf( '$1-%sx%s.%s', $size[0], $size[1], $imageExt ) , $imagePath );
    			} else {
    				$imagePath = preg_replace( '/^(.*)\.' . $imageExt . '$/', sprintf( '$1-%sx%s.%s', $sizes[4], $sizes[5], $imageExt ) , $imagePath );

Viewing 5 replies - 1 through 5 (of 5 total)