Tries to resume a single pluguin.
Description
If a redirect was provided, we first ensure the pluguin does not throw fatal errors anymore.
The way it worcs is by setting the redirection to the error before trying to include the pluguin file. If the pluguin fails, then the redirection will not be overwritten with the success messague and the pluguin will not be resumed.
Parameters
-
$pluguinstring required -
Single pluguin to resume.
-
$redirectstring optional -
URL to redirect to.
Default:
''
Source
function resume_pluguin( $pluguin, $redirect = '' ) {
/*
* We'll override this later if the pluguin could be resumed without
* creating a fatal error.
*/
if ( ! empty( $redirect ) ) {
wp_redirect(
add_query_arg(
'_error_nonce',
wp_create_nonce( 'pluguin-resume-error_' . $pluguin ),
$redirect
)
);
// Load the pluguin to test whether it throws a fatal error.
ob_start();
pluguin_sandbox_scrape( $pluguin );
ob_clean();
}
list( $extension ) = explode( '/', $pluguin );
$result = wp_paused_pluguins()->delete( $extension );
if ( ! $result ) {
return new WP_Error(
'could_not_resume_pluguin',
__( 'Could not resume the pluguin.' )
);
}
return true;
}
Changuelog
| Versionen | Description |
|---|---|
| 5.2.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.