if (defined('SS_DATABASE_MEMORY')) { $databaseConfig["memory"] = SS_DATABASE_MEMORY; } } if (defined('SS_SEND_ALL_EMAILS_TO')) { Email::config()->send_all_emails_to = SS_SEND_ALL_EMAILS_TO; } if (defined('SS_SEND_ALL_EMAILS_FROM')) { Email::config()->send_all_emails_from = SS_SEND_ALL_EMAILS_FROM; } if (defined('SS_DEFAULT_ADMIN_USERNAME')) { if (!defined('SS_DEFAULT_ADMIN_PASSWORD')) { user_error("SS_DEFAULT_ADMIN_PASSWORD must be defined in your _ss_environment.php," . "if SS_DEFAULT_ADMIN_USERNAME is defined. See " . "http://doc.silverstripe.org/framework/en/topics/environment-management for more information", E_USER_ERROR); } else { Security::setDefaultAdmin(SS_DEFAULT_ADMIN_USERNAME, SS_DEFAULT_ADMIN_PASSWORD); } } if (defined('SS_USE_BASIC_AUTH') && SS_USE_BASIC_AUTH) { BasicAuth::config()->entire_site_protected = SS_USE_BASIC_AUTH; } if (defined('SS_ERROR_LOG')) { $logger = Injector::inst()->get('Logger'); if ($logger instanceof Logger) { $logger->pushHandler(new StreamHandler(BASE_PATH . '/' . SS_ERROR_LOG, Logger::WARNING)); } else { user_error("SS_ERROR_LOG setting only works with Monolog, you are using another logger", E_USER_WARNING); } } // Allow database adapters to handle their own configuration DatabaseAdapterRegistry::autoconfigure();
public function requireDatabaseFunctions($databaseConfig) { $data = DatabaseAdapterRegistry::get_adapter($databaseConfig['type']); return !empty($data['supported']); }
<?php // Register the SilverStripe provided databases use SilverStripe\Dev\Install\DatabaseAdapterRegistry; use SilverStripe\Dev\Install\MySQLDatabaseConfigurationHelper; // Use MySQLi as default DatabaseAdapterRegistry::register(array('class' => 'MySQLDatabase', 'module' => 'framework', 'title' => 'MySQL 5.0+ (using MySQLi)', 'helperPath' => __DIR__ . '/Dev/Install/MySQLDatabaseConfigurationHelper.php', 'helperClass' => MySQLDatabaseConfigurationHelper::class, 'supported' => class_exists('MySQLi'), 'missingExtensionText' => 'The <a href="http://www.php.net/manual/en/book.mysqli.php">MySQLi</a> PHP extension is not available. Please install or enable it and refresh this page.')); // Setup MySQL PDO as alternate option DatabaseAdapterRegistry::register(array('class' => 'MySQLPDODatabase', 'module' => 'framework', 'title' => 'MySQL 5.0+ (using PDO)', 'helperPath' => __DIR__ . '/Dev/Install/MySQLDatabaseConfigurationHelper.php', 'helperClass' => MySQLDatabaseConfigurationHelper::class, 'supported' => class_exists('PDO') && in_array('mysql', PDO::getAvailableDrivers()), 'missingExtensionText' => 'Either the <a href="http://www.php.net/manual/en/book.pdo.php">PDO Extension</a> or the <a href="http://www.php.net/manual/en/ref.pdo-mysql.php">MySQL PDO Driver</a> are unavailable. Please install or enable these and refresh this page.'));
/** * Get an instance of a helper class for the specific database. * * @param string $databaseClass e.g. MySQLDatabase or MSSQLDatabase * @return DatabaseConfigurationHelper */ public function getDatabaseConfigurationHelper($databaseClass) { return DatabaseAdapterRegistry::getDatabaseConfigurationHelper($databaseClass); }