1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 09:44:38 +02:00

Add support for multiple randomly selected DB readers (config.php file updates)

This commit is contained in:
Ryan Cramer
2021-04-19 09:48:04 -04:00
parent fb0e7f2ecf
commit 7f91cad42f
2 changed files with 14 additions and 1 deletions

View File

@@ -1229,6 +1229,14 @@ $config->dbStripMB4 = false;
* if($config->requestMethod('GET') && !$config->requestPath($skipPaths)) { * if($config->requestMethod('GET') && !$config->requestPath($skipPaths)) {
* $config->dbReader = [ 'host' => 'readonly.mydb.domain.com' ]; * $config->dbReader = [ 'host' => 'readonly.mydb.domain.com' ];
* } * }
*
* // to have PW randomly select from multiple DB readers, nest the arrays (3.0.176+)
* // if a connection fails, PW will try another randomly till it finds one that works
* $config->dbReader = [
* [ 'host' => 'mydb1.domain.com' ],
* [ 'host' => 'mydb2.domain.com' ],
* [ 'host' => 'mydb3.domain.com' ],
* ];
* ~~~~~ * ~~~~~
* *
* @var array * @var array

View File

@@ -2829,6 +2829,9 @@ class Modules extends WireArray {
* - `useNavJSON` (bool): whether the Process module provides JSON navigation * - `useNavJSON` (bool): whether the Process module provides JSON navigation
* - `permissionMethod` (string|callable): method to call to determine permission * - `permissionMethod` (string|callable): method to call to determine permission
* - `page` (array): definition of page to create for Process module * - `page` (array): definition of page to create for Process module
*
* On error, an `error` index in returned array contains error message. You can also identify errors
* such as a non-existing module by the returned module info having an `id` index of `0`
* *
* ~~~~~ * ~~~~~
* // example of getting module info * // example of getting module info
@@ -2849,7 +2852,9 @@ class Modules extends WireArray {
* - `verbose` (bool): Makes the info also include verbose properties, which are otherwise blank. (default=false) * - `verbose` (bool): Makes the info also include verbose properties, which are otherwise blank. (default=false)
* - `minify` (bool): Remove non-applicable and properties that match defaults? (default=false, or true when getting `all`) * - `minify` (bool): Remove non-applicable and properties that match defaults? (default=false, or true when getting `all`)
* - `noCache` (bool): prevents use of cache to retrieve the module info. (default=false) * - `noCache` (bool): prevents use of cache to retrieve the module info. (default=false)
* @return array Associative array of module information * @return array Associative array of module information.
* - On error, an `error` index is also populated with an error message.
* - When requesting a module that does not exist its `id` value will be `0` and its `name` will be blank.
* @see Modules::getModuleInfoVerbose() * @see Modules::getModuleInfoVerbose()
* @todo move all getModuleInfo methods to their own ModuleInfo class and break this method down further. * @todo move all getModuleInfo methods to their own ModuleInfo class and break this method down further.
* *