MDL-19711 dml: Enable use of readonly slave database handles
authorSrdjan <srdjan@catalyst.net.nz>
Thu, 7 May 2020 04:14:29 +0000 (14:14 +1000)
committerSrdjan <srdjan@catalyst.net.nz>
Tue, 19 May 2020 01:50:42 +0000 (11:50 +1000)
commit46cfde3d9501f22304390bfe32d96d023c2b0fe4
treee5199eb115da34e4f57b64294037e087364080a6
parentd85118369d2bdc0993db96e0624b1e7e06036cc6
MDL-19711 dml: Enable use of readonly slave database handles

Implemented with moodle_read_slave_trait

Functionality is triggered by supplying config dboption['readonly'].
See config-dist.php for more info on supported dboptions.

pgsql and mysqli drivers are using this feature. Also added support for
connection timeout for these two drivers.
19 files changed:
config-dist.php
lib/dml/moodle_database.php
lib/dml/moodle_read_slave_trait.php [new file with mode: 0644]
lib/dml/mysqli_native_moodle_database.php
lib/dml/pgsql_native_moodle_database.php
lib/dml/tests/dml_mysqli_read_slave_test.php [new file with mode: 0644]
lib/dml/tests/dml_pgsql_read_slave_test.php [new file with mode: 0644]
lib/dml/tests/dml_read_slave_test.php [new file with mode: 0644]
lib/dml/tests/dml_test.php
lib/dml/tests/fixtures/read_slave_moodle_database.php [new file with mode: 0644]
lib/dml/tests/fixtures/read_slave_moodle_database_mock_mysqli.php [new file with mode: 0644]
lib/dml/tests/fixtures/read_slave_moodle_database_mock_pgsql.php [new file with mode: 0644]
lib/dml/tests/fixtures/read_slave_moodle_database_special.php [new file with mode: 0644]
lib/dml/tests/fixtures/read_slave_moodle_database_table_names.php [new file with mode: 0644]
lib/dml/tests/fixtures/read_slave_moodle_recordset_special.php [new file with mode: 0644]
lib/dml/tests/fixtures/test_moodle_database.php [new file with mode: 0644]
lib/dml/tests/fixtures/test_moodle_read_slave_trait.php [new file with mode: 0644]
lib/dml/tests/fixtures/test_sql_generator.php [new file with mode: 0644]
lib/moodlelib.php