Revisions: Set PHP time limit when generating revision diffs vis Ajax.

This aims to avoid hanging PHP processes if a plugin inadvertently attempts to request a large number of revision diffs.

Follow-up to [24520], [24707], [59039].

Props madpeter, lovesoni1999, debarghyabanerjee, pbearne, desrosj, SergeyBiryukov.
Fixes #49291.

git-svn-id: https://develop.svn.wordpress.org/trunk@59288 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2024-10-24 23:58:02 +00:00
parent de38e8eeec
commit 6bdf0519a1

View File

@ -3556,9 +3556,9 @@ function wp_ajax_get_revision_diffs() {
$return = array();
// Removes the script timeout limit by setting it to 0 allowing ample time for diff UI setup.
if ( function_exists( 'set_time_limit' ) ) {
set_time_limit( 0 );
// Increase the script timeout limit to allow ample time for diff UI setup.
set_time_limit( 5 * MINUTE_IN_SECONDS );
}
foreach ( $_REQUEST['compare'] as $compare_key ) {