diff --git a/admin/cli/install.php b/admin/cli/install.php index cfc8ea0f01ae2..5c68d52188037 100644 --- a/admin/cli/install.php +++ b/admin/cli/install.php @@ -215,6 +215,7 @@ //Database types $databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'), + 'auroramysql' => moodle_database::get_driver_instance('auroramysql', 'native'), 'mariadb'=> moodle_database::get_driver_instance('mariadb', 'native'), 'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'), 'oci' => moodle_database::get_driver_instance('oci', 'native'), diff --git a/install.php b/install.php index 973f8334e0c54..82c5e350b86f4 100644 --- a/install.php +++ b/install.php @@ -493,6 +493,7 @@ get_string('databasetypesub', 'install')); $databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'), + 'auroramysql' => moodle_database::get_driver_instance('auroramysql', 'native'), 'mariadb'=> moodle_database::get_driver_instance('mariadb', 'native'), 'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'), 'oci' => moodle_database::get_driver_instance('oci', 'native'), diff --git a/lang/en/install.php b/lang/en/install.php index 047c1cb6470e4..681807f7a0287 100644 --- a/lang/en/install.php +++ b/lang/en/install.php @@ -169,6 +169,12 @@ (you will see errors when you look at pages) so you\'ll have to remove the .htaccess file.

'; $string['mysqliextensionisnotpresentinphp'] = 'PHP has not been properly configured with the MySQLi extension for it to communicate with MySQL. Please check your php.ini file or recompile PHP.'; +$string['nativeauroramysql'] = 'Aurora MySQL (native/auroramysql)'; +$string['nativeauroramysqlhelp'] = '

The database is where most of the Moodle settings and data are stored and must be configured here.

+

The database name, username, and password are required fields; table prefix is optional.

+

The database name may contain only alphanumeric characters, dollar ($) and underscore (_).

+

If the database currently does not exist, and the user you specify has permission, Moodle will attempt to create a new database with the correct permissions and settings.

+

This driver is not compatible with legacy MyISAM engine.

'; $string['nativemariadb'] = 'MariaDB (native/mariadb)'; $string['nativemariadbhelp'] = '

The database is where most of the Moodle settings and data are stored and must be configured here.

The database name, username, and password are required fields; table prefix is optional.

diff --git a/lib/dml/auroramysql_native_moodle_database.php b/lib/dml/auroramysql_native_moodle_database.php new file mode 100644 index 0000000000000..3000913847ace --- /dev/null +++ b/lib/dml/auroramysql_native_moodle_database.php @@ -0,0 +1,99 @@ +. + +/** + * Native Aurora MySQL class representing moodle database interface. + * + * @package core_dml + * @copyright 2020 Lafayette College ITS + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +require_once(__DIR__.'/moodle_database.php'); +require_once(__DIR__.'/mysqli_native_moodle_database.php'); +require_once(__DIR__.'/mysqli_native_moodle_recordset.php'); +require_once(__DIR__.'/mysqli_native_moodle_temptables.php'); + +/** + * Native Aurora MySQL class representing moodle database interface. + * + * @package core_dml + * @copyright 2020 Lafayette College ITS + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class auroramysql_native_moodle_database extends mysqli_native_moodle_database { + + /** @var bool is compressed row format supported cache */ + protected $compressedrowformatsupported = false; + + /** + * Returns localised database type name. + * + * Returns localised database type name. Can be used before connect(). + * @return string + */ + public function get_name(): ?string { + return get_string('nativeauroramysql', 'install'); + } + + /** + * Returns localised database configuration help. + * + * Returns localised database configuration help. Can be used before connect(). + * @return string + */ + public function get_configuration_help(): ?string { + return get_string('nativeauroramysql', 'install'); + } + + /** + * Returns the database vendor. + * + * Returns the database vendor. Can be used before connect(). + * @return string The db vendor name, usually the same as db family name. + */ + public function get_dbvendor(): ?string { + return 'mysql'; + } + + /** + * Returns more specific database driver type + * + * Returns more specific database driver type. Can be used before connect(). + * @return string db type mysqli, pgsql, oci, mssql, sqlsrv + */ + protected function get_dbtype(): ?string { + return 'auroramysql'; + } + + /** + * It is time to require transactions everywhere. + * + * MyISAM is NOT supported! + * + * @return bool + */ + protected function transactions_supported(): ?bool { + if ($this->external) { + return parent::transactions_supported(); + } + return true; + } + + +}