-
Notifications
You must be signed in to change notification settings - Fork 83
Closed
Labels
InfrastructureIssues for the overall plugin infrastructureIssues for the overall plugin infrastructure[Type] EnhancementA suggestion for improvement of an existing featureA suggestion for improvement of an existing feature
Milestone
Description
Description
The Abstract_Check_Runner class will contain common logic used to run Checks across both CLI and AJAX. The abstract class will be used to build out the following runner classes:
Acceptance Criteria
- A new
Abstract_Check_Runnerclass will exist inincludes/Checker. - The class will implement the
Check_Runnerinterface. - The class has a protected
$checksproperty. - The class has a protected
$checks_to_runproperty. - The class has an abstract
is_plugin_check()method. - The class has an abstract protected
setup_checks()method. - The class contains a
prepare()method.- The
prepare()method accepts no parameters. - The
prepare()method is used to run any universal preparations early in the WordPress load.- The array of
$checks_to_runarray is passed to therequires_universal_preparations()method (Create Abstract_Check_Runner class #63). - If the method returns true the
Universal_Runtime_Preparationwill be used. - The prepare method will instantiate the
Universal_Runtime_Preparation(Create a Universal_Runtime_Preparation #61) and call theprepare()method. - The cleanup function returned by the
prepare()method is then returned.
- The array of
- The
- The class has a protected
requires_universal_preparations( array $checks )method.- The method accepts an array of Check instances that will be run.
- The method loops over the Check instances and tests to see if any Checks implement the
Runtime_Checkinterface. - If any Check implements the
Runtime_Checkinterface, the method returnstrue, if not, the method returnsfalse.
- The class implements a private
get_shared_preparations( array $checks )method.- The method accepts an array of Check instances that will be run.
- The method assigns an empty array to a
$preparationsvariable. - The method loops of the Check instants and tests for Checks that implement the
With_Shared_Preparationsinterface. - If the Check implements the
With_Shared_Preparationsinterface, the Checksget_shared_preparationsmethod is called to return an array of preparations. - The preparations returned are checked for any duplicates by evaluating the preparation name and the array of constructor arguments to see if these match any existing shared preparations in the
$preparationsarray. - These preparations are merged into the
$preparationsvariable and returned by the method.
- The class implements the
run()method.- The
runmethod will gather the Check instances from$this->checks->get_checks()using the requested checks in the$checks_to_runproperty. - The
get_shared_preparationsis called passing the$checks_to_runarray. The returned shared preparations are then looped over calling each preparationsprepare()method. The preparations cleanup functions are then stored to a$cleanupsvariable. - The Checks are then run by passing the
$checks_to_runarray is then passed to$this->checks->run_checks()and theCheck_Resultsinstanced returned stored as a variable. - If the
get_shared_preparationspreparations where prepared the$cleanupsfunctions returned are called. - The
runmethod returns the$check_resultsinstance.
- The
Metadata
Metadata
Assignees
Labels
InfrastructureIssues for the overall plugin infrastructureIssues for the overall plugin infrastructure[Type] EnhancementA suggestion for improvement of an existing featureA suggestion for improvement of an existing feature