mirror of
https://github.com/silverstripe/silverstripe-environmentcheck
synced 2024-10-22 17:05:40 +02:00
MINOR Disabled default checks in _config.php, to enable custom ordering in own configuration without modifying the module files. Noted configuration settings in README.
This commit is contained in:
parent
09ba044f5d
commit
5c13c1b7a5
17
README.md
17
README.md
@ -14,6 +14,23 @@ Almost, but not really. Environment checks differ from unit tests in two importa
|
|||||||
* **They test environment specific settings.** Unit tests are designed to use dummy data and mock interfaces to external system. Environment checks check the real systems and data that the given environment is actually connected to.
|
* **They test environment specific settings.** Unit tests are designed to use dummy data and mock interfaces to external system. Environment checks check the real systems and data that the given environment is actually connected to.
|
||||||
* **They can't modify data.** Because these checks will run using production databases, they can't go modifying the data in there. This is the biggest reason why we haven't used the same base class as a unit test for writing environment checks - we wanted to make it impossible to accidentally plug the a unit test into the environment checker!
|
* **They can't modify data.** Because these checks will run using production databases, they can't go modifying the data in there. This is the biggest reason why we haven't used the same base class as a unit test for writing environment checks - we wanted to make it impossible to accidentally plug the a unit test into the environment checker!
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Register checks in your own `_config.php` - see the `_config.php` in this module for some defaults.
|
||||||
|
|
||||||
|
:::php
|
||||||
|
EnvironmentCheckSuite::register('health', 'DatabaseCheck', "Can we connect to the database?");
|
||||||
|
EnvironmentCheckSuite::register('check', 'URLCheck("")', "Is the homepage accessible?");
|
||||||
|
|
||||||
|
## Available checks
|
||||||
|
|
||||||
|
* `DatabaseCheck`: Check that the connection to the database is working, by looking for records in some table. By default, Member will be checked.
|
||||||
|
* `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.
|
||||||
## Adding more checks
|
## Adding more checks
|
||||||
|
|
||||||
To add more checks, you should put additional `EnvironmentCheckSuite::register` calls into your `_config.php`. See the `_config.php` file of this mode for examples.
|
To add more checks, you should put additional `EnvironmentCheckSuite::register` calls into your `_config.php`. See the `_config.php` file of this mode for examples.
|
||||||
|
30
_config.php
30
_config.php
@ -1,23 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// These power dev/health, which can be used by load balancers and other such systems
|
// // These power dev/health, which can be used by load balancers and other such systems
|
||||||
EnvironmentCheckSuite::register('health', 'DatabaseCheck');
|
// EnvironmentCheckSuite::register('health', 'DatabaseCheck');
|
||||||
|
|
||||||
// These power dev/check, which is used for diagnostics and for deployment
|
// // These power dev/check, which is used for diagnostics and for deployment
|
||||||
EnvironmentCheckSuite::register('check', 'DatabaseCheck("Member")', "Is the database accessible?");
|
// EnvironmentCheckSuite::register('check', 'DatabaseCheck("Member")', "Is the database accessible?");
|
||||||
EnvironmentCheckSuite::register('check', 'URLCheck("")', "Is the homepage accessible?");
|
// EnvironmentCheckSuite::register('check', 'URLCheck("")', "Is the homepage accessible?");
|
||||||
|
|
||||||
EnvironmentCheckSuite::register('check', 'HasFunctionCheck("curl_init")', "Does PHP have CURL support?");
|
// EnvironmentCheckSuite::register('check', 'HasFunctionCheck("curl_init")', "Does PHP have CURL support?");
|
||||||
EnvironmentCheckSuite::register('check', 'HasFunctionCheck("imagecreatetruecolor")', "Does PHP have GD2 support?");
|
// EnvironmentCheckSuite::register('check', 'HasFunctionCheck("imagecreatetruecolor")', "Does PHP have GD2 support?");
|
||||||
EnvironmentCheckSuite::register('check', 'HasFunctionCheck("xml_set_object")', "Does PHP have XML support?");
|
// EnvironmentCheckSuite::register('check', 'HasFunctionCheck("xml_set_object")', "Does PHP have XML support?");
|
||||||
EnvironmentCheckSuite::register('check', 'HasFunctionCheck("token_get_all")', "Does PHP have tokenizer support?");
|
// EnvironmentCheckSuite::register('check', 'HasFunctionCheck("token_get_all")', "Does PHP have tokenizer support?");
|
||||||
EnvironmentCheckSuite::register('check', 'HasFunctionCheck("iconv")', "Does PHP have iconv support?");
|
// EnvironmentCheckSuite::register('check', 'HasFunctionCheck("iconv")', "Does PHP have iconv support?");
|
||||||
EnvironmentCheckSuite::register('check', 'HasFunctionCheck("hash")', "Does PHP have hash support?");
|
// EnvironmentCheckSuite::register('check', 'HasFunctionCheck("hash")', "Does PHP have hash support?");
|
||||||
EnvironmentCheckSuite::register('check', 'HasFunctionCheck("session_start")', "Does PHP have session support?");
|
// EnvironmentCheckSuite::register('check', 'HasFunctionCheck("session_start")', "Does PHP have session support?");
|
||||||
EnvironmentCheckSuite::register('check', 'HasClassCheck("DOMDocument")', "Does PHP have DOMDocument support?");
|
// EnvironmentCheckSuite::register('check', 'HasClassCheck("DOMDocument")', "Does PHP have DOMDocument support?");
|
||||||
|
|
||||||
EnvironmentCheckSuite::register('check', 'FileWriteableCheck("assets")', "Is assets/ writeable?");
|
// EnvironmentCheckSuite::register('check', 'FileWriteableCheck("assets")', "Is assets/ writeable?");
|
||||||
EnvironmentCheckSuite::register('check', 'FileWriteableCheck("' . TEMP_FOLDER . '")', "Is the temp folder writeable?");
|
// EnvironmentCheckSuite::register('check', 'FileWriteableCheck("' . TEMP_FOLDER . '")', "Is the temp folder writeable?");
|
||||||
|
|
||||||
Director::addRules(100, array(
|
Director::addRules(100, array(
|
||||||
'dev/health' => 'DevHealth',
|
'dev/health' => 'DevHealth',
|
||||||
|
Loading…
Reference in New Issue
Block a user