problems with content cache in WordPress
Hello,
I have H5P Version 1.15.6 installed as plugin in WordPress 6.6.1 using the German translation.
I observe problems with the library content cache. In the admin interface, H5P reports that "3 contents need to get their cache rebuilt".
Clicking on "Rebuild cache" indicates activity ("spinning" symbol), and files are created in wp-content/uploads/h5p/temp.
There are a couple of large mp4 video files that are used in "Advent calendar (beta) 0.2.5".
I had the process running for a couple of hours over night, but the symbol kept spinning, but no new files have been created.
Meanwhile, I am rebuilding the cash in Google chrome with the control panel.
There is an error code 500 for the call to admin-ajax.php for h5p_rebuild_cache:
XHR failed loading: POST "http://DOMAIN.NAME/wp-admin/admin-ajax.php?action=h5p_rebuild_cache" jquery.js?ver=1.15.6:4
At the same time, the process keeps calling admin-ajax.php for now more than 90 times
XHR finished loading: POST "http://DOMAIN.NAME/wp-admin/admin-ajax.php" load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.1.1:2
Is this a known problem?
Is there another way to rebuild the cache?
Thanks
Markus
otacke
Mon, 01/16/2023 - 19:32
Permalink
Hi!I don't think this is a
Hi!
I don't think this is a known issue, and a 500 HTTP error indicates some issue on the server - which usually means some configuration issue. For instance, you're describing a URL using http instead of it's secure protocol cousin https. Have you checked that all the URL settings in WordPress are correct and/or that the server is configured to automatically use https if http is used?
Best,
Oliver
mgrassl
Mon, 01/16/2023 - 19:54
Permalink
Thanks for the reply.The
Thanks for the reply.
The WordPress installation is in a subdomain, and the ISP does not provide certificates for subdomains.
Nonetheless, I would not expect this to be an issue related to using http instead of https.
It appears as if only the action=h5p_rebuild_cache would cause some problem resulting on code 500.
I have not found much information in the logfiles, but the message
End of script output before headers: admin-ajax.php
I have increased max_execution_time for PHP, and memory_limit for PHP is 512 M.
Apparently something fails in the action h5p_rebuild_cache, but I don't know the reason and how to fix it.
I found a related related problem report for Drupal at https://www.drupal.org/project/h5p/issues/2780435 but that is rather old.
Markus
otacke
Mon, 01/16/2023 - 20:24
Permalink
Could you potentially
Could you potentially set
in your config file and then try again? That should add some information from WordPress' side. The debug info will be written in a file named debug.log in your wp-content directory if I am not mistaken.
Cheers,
Oliver
mgrassl
Mon, 01/16/2023 - 22:38
Permalink
Workaround: modifying/fixing
Workaround: modifying/fixing directly the database
I had already enabled debugging in wp-config.php, but there were no error messages.
public function ajax_rebuild_cache() { global $wpdb; if ($_SERVER['REQUEST_METHOD'] !== 'POST') { exit; // POST is required } $plugin = H5P_Plugin::get_instance(); $core = $plugin->get_h5p_instance('core'); // Do as many as we can in five seconds. $start = microtime(TRUE); $contents = $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}h5p_contents WHERE filtered = ''" ); $done = 0; foreach($contents as $content) { $content = $core->loadContent($content->id); $core->filterParameters($content); $done++; if ((microtime(TRUE) - $start) > 5) { break; } } print (count($contents) - $done); exit; }I did some debugging using error_log of PHP in the function ajax_rebuild_cache in the file wp-content/plugins/h5p/admin/class-h5p-library-admin.php
It turned out that the call of
$core->filterParameters($content);did not return to the script, but I was not able to identify the cause.
Using the data from the additional debugging output and looking at the database with phpMyAdmin, I have identified the entry in the table PREFIX_hp5_content which had a empty columns filtered and slug which might have caused the problem.
As the user reported, that content was related to the library Advent Calendar (beta) version 0.2.5.
I have worked around the problem directly using phpMyAdmin, but suspect that there is a problem in the said library, or some problem with the implementation of filterParameters in the file wp-content/plugins/h5p/h5p-php-library/h5p.classes.php -- but I have stopped debugging at this point.
Markus
otacke
Tue, 01/17/2023 - 00:05
Permalink
An empty column for "filtered
An empty column for "filtered" should not be an issue, because H5P would re-create it when you open the content. Not sure about the slug.
Content types do nothing related to the cache or any lower level stuff. They pass their parameters to H5P core when they are validated (and filtered) by H5P core before saving them - that's exactly what the "filtered" column is for. It's the potentially stripped version of the "parameters". I am not ruling out some problem with the parameters, but I don't think that Advent Calendar can do something here.
Cheers,
Oliver