Add BinaryExistsCheck
This commit is contained in:
parent
1cda4e0afc
commit
fa2ed06ccf
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @package environmentcheck
|
||||
*/
|
||||
|
||||
class BinaryExistsCheck implements EnvironmentCheck {
|
||||
|
||||
protected $binary;
|
||||
|
||||
function __construct($binary = "Member") {
|
||||
$this->binary = $binary;
|
||||
}
|
||||
|
||||
function check() {
|
||||
$command = (PHP_OS == 'WINNT') ? 'where' : 'which';
|
||||
$binary = $this->binary;
|
||||
|
||||
$process = proc_open(
|
||||
"$command $binary",
|
||||
array(
|
||||
0 => array("pipe", "r"),
|
||||
1 => array("pipe", "w"),
|
||||
2 => array("pipe", "w"),
|
||||
),
|
||||
$pipes
|
||||
);
|
||||
|
||||
if ($process !== false) {
|
||||
$stdout = stream_get_contents($pipes[1]);
|
||||
$stderr = stream_get_contents($pipes[2]);
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
proc_close($process);
|
||||
|
||||
if($stdout != '') {
|
||||
return array(EnvironmentCheck::OK, '');
|
||||
}
|
||||
}
|
||||
|
||||
return array(EnvironmentCheck::ERROR, 'Could not execute '. $this->binary . ' in ');
|
||||
}
|
||||
}
|
|
@ -3,8 +3,11 @@
|
|||
/**
|
||||
* Check that the connection to the database is working, by ensuring that the table exists and that
|
||||
* the table contains some records.
|
||||
*
|
||||
* @package environmentcheck
|
||||
*/
|
||||
class DatabaseCheck implements EnvironmentCheck {
|
||||
|
||||
protected $checkTable;
|
||||
|
||||
/**
|
||||
|
|
19
readme.md
19
readme.md
|
@ -81,19 +81,20 @@ EnvironmentCheckSuite:
|
|||
|
||||
## Available checks
|
||||
|
||||
* `DatabaseCheck`: Check that the connection to the database is working, by ensuring that the table exists and that the table contain some records.
|
||||
* `DatabaseCheck`: Check that the connection to the database is working, by ensuring that the table exists and that
|
||||
the table contain some records.
|
||||
* `URLCheck`: Check that a given URL is functioning, by default, the homepage.
|
||||
* `HasFunctionCheck`: Check that the given function exists.
|
||||
This can be used to check that PHP modules or features are installed.
|
||||
* `HasClassCheck`: Check that the given class exists.
|
||||
This can be used to check that PHP modules or features are installed.
|
||||
* `FileWriteableCheck`: Check that the given file is writeable.
|
||||
* `FileAgeCheck`: Checks for the maximum age of one or more files or folders.
|
||||
Useful for files which should be frequently auto-generated,
|
||||
like static caches, as well as for backup files and folders.
|
||||
* `HasFunctionCheck`: Check that the given function exists. This can be used to check that PHP modules or features
|
||||
are installed.
|
||||
* `HasClassCheck`: Check that the given class exists. This can be used to check that PHP modules or features are
|
||||
installed.
|
||||
* `FileWriteableCheck`: Check that the given file is writable.
|
||||
* `FileAgeCheck`: Checks for the maximum age of one or more files or folders. Useful for files which should be
|
||||
frequently auto-generated, like static caches, as well as for backup files and folders.
|
||||
* `ExternalURLCheck`: Checks that one or more URLs are reachable via HTTP.
|
||||
* `SMTPConnectCheck`: Checks if the SMTP connection configured through PHP.ini works as expected.
|
||||
* `SolrIndexCheck`: Checks if the Solr cores of given class are available.
|
||||
* `BinaryExistsCheck`: Checks if a binary is available on the server
|
||||
|
||||
## Authentication
|
||||
|
||||
|
|
Loading…
Reference in New Issue