mirror of
https://github.com/silverstripe/silverstripe-installer
synced 2024-10-22 17:05:33 +02:00
ENHANCEMENT #4742 Set lower timeout for mysql_connect to avoid long timeouts when mysql_connect can't find a MySQL server locally during SS install, and only do certain MySQL checks if the server can be found, greatly improving install performance
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/branches/2.4@93106 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
e285f5af85
commit
cb4359feff
60
install.php
60
install.php
@ -15,6 +15,9 @@
|
|||||||
* It's also PHP4 syntax compatable
|
* It's also PHP4 syntax compatable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// speed up mysql_connect timeout if the server can't be found
|
||||||
|
ini_set('mysql.connect_timeout', 5);
|
||||||
|
|
||||||
ini_set('max_execution_time', 0);
|
ini_set('max_execution_time', 0);
|
||||||
error_reporting(E_ALL ^ E_NOTICE);
|
error_reporting(E_ALL ^ E_NOTICE);
|
||||||
session_start();
|
session_start();
|
||||||
@ -148,16 +151,55 @@ class InstallRequirements {
|
|||||||
* Just check that the database configuration is okay
|
* Just check that the database configuration is okay
|
||||||
*/
|
*/
|
||||||
function checkdatabase($databaseConfig) {
|
function checkdatabase($databaseConfig) {
|
||||||
if($this->requireFunction('mysql_connect', array("PHP Configuration", "MySQL support", "MySQL support not included in PHP."))) {
|
if($this->requireFunction(
|
||||||
$this->requireMySQLServer($databaseConfig['server'], array("MySQL Configuration", "Does the server exist",
|
'mysql_connect',
|
||||||
"I couldn't find a MySQL server on '$databaseConfig[server]'", $databaseConfig['server']));
|
array(
|
||||||
if($this->requireMysqlConnection($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'],
|
"PHP Configuration",
|
||||||
array("MySQL Configuration", "Are the access credentials correct", "That username/password doesn't work"))) {
|
"MySQL support",
|
||||||
@$this->requireMySQLVersion("4.1", array("MySQL Configuration", "MySQL version at least 4.1", "MySQL version 4.1 is required, you only have ", "MySQL " . mysql_get_server_info()));
|
"MySQL support not included in PHP.")
|
||||||
}
|
)
|
||||||
$this->requireDatabaseOrCreatePermissions($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'],
|
) {
|
||||||
array("MySQL Configuration", "Can I access/create the database", "I can't create new databases and the database '$databaseConfig[database]' doesn't exist"));
|
if($this->requireMySQLServer(
|
||||||
|
$databaseConfig['server'],
|
||||||
|
array(
|
||||||
|
"MySQL Configuration",
|
||||||
|
"Does the server exist",
|
||||||
|
"I couldn't find a MySQL server on '$databaseConfig[server]'", $databaseConfig['server']
|
||||||
|
)
|
||||||
|
)) {
|
||||||
|
if($this->requireMysqlConnection(
|
||||||
|
$databaseConfig['server'],
|
||||||
|
$databaseConfig['username'],
|
||||||
|
$databaseConfig['password'],
|
||||||
|
array(
|
||||||
|
"MySQL Configuration",
|
||||||
|
"Are the access credentials correct",
|
||||||
|
"That username/password doesn't work"
|
||||||
|
)
|
||||||
|
)) {
|
||||||
|
@$this->requireMySQLVersion(
|
||||||
|
"4.1",
|
||||||
|
array(
|
||||||
|
"MySQL Configuration",
|
||||||
|
"MySQL version at least 4.1",
|
||||||
|
"MySQL version 4.1 is required, you only have ",
|
||||||
|
"MySQL " . mysql_get_server_info()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$this->requireDatabaseOrCreatePermissions(
|
||||||
|
$databaseConfig['server'],
|
||||||
|
$databaseConfig['username'],
|
||||||
|
$databaseConfig['password'],
|
||||||
|
$databaseConfig['database'],
|
||||||
|
array(
|
||||||
|
"MySQL Configuration",
|
||||||
|
"Can I access/create the database",
|
||||||
|
"I can't create new databases and the database '$databaseConfig[database]' doesn't exist"
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user