Skip to content

Commit

Permalink
Merge pull request #83 from runcommand/set-when-public-api
Browse files Browse the repository at this point in the history
Introduce `set_when()` as a public API for setting when check runs
  • Loading branch information
danielbachhuber authored Nov 15, 2016
2 parents e696276 + c1b0e06 commit 5b003db
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions inc/checks/class-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ public function get_when() {
return $this->_when;
}

/**
* Set when the check is expected to run.
*
* @param string $when
*/
public function set_when( $when ) {
$this->_when = $when;
}

/**
* Set the status of the check.
*
Expand Down
5 changes: 4 additions & 1 deletion inc/checks/class-core-verify-checksums.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
*/
class Core_Verify_Checksums extends Check {

protected $when = 'before_wp_load';
public function __construct( $options = array() ) {
parent::__construct( $options );
$this->set_when( 'before_wp_load' );
}

public function run() {
$ret = WP_CLI::launch_self( 'core verify-checksums', array(), array(), false, true );
Expand Down
2 changes: 1 addition & 1 deletion inc/checks/class-file.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
abstract class File extends Check {

/**
* File checks are run as a group
* File checks are run as their own group.
*/
protected $_when = false;

Expand Down

0 comments on commit 5b003db

Please sign in to comment.