Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MINOR Removed return of connection and changed variables to conincide…

… with r98795 (from r98800)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102804 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit e89e377cb6b450b8978d67c539883888fe886f46 1 parent c1dc70b
@chillu chillu authored
Showing with 20 additions and 23 deletions.
  1. +20 −23 dev/install/MySQLDatabaseConfigurationHelper.php
View
43 dev/install/MySQLDatabaseConfigurationHelper.php
@@ -23,42 +23,39 @@ public function requireDatabaseFunctions($databaseConfig) {
/**
* Ensure that the database server exists.
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
- * @return array Result - e.g. array('okay' => true, 'error' => 'details of error')
+ * @return array Result - e.g. array('success' => true, 'error' => 'details of error')
*/
public function requireDatabaseServer($databaseConfig) {
- $okay = false;
+ $success = false;
$conn = @mysql_connect($databaseConfig['server'], null, null);
if($conn || mysql_errno() < 2000) {
- $okay = true;
+ $success = true;
} else {
- $okay = false;
+ $success = false;
$error = mysql_error();
}
return array(
- 'okay' => $okay,
+ 'success' => $success,
'error' => $error
);
}
/**
* Ensure a database connection is possible using credentials provided.
- * The established connection resource is returned with the results as well.
- *
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
- * @return array Result - e.g. array('okay' => true, 'connection' => mysql link, 'error' => 'details of error')
+ * @return array Result - e.g. array('success' => true, 'error' => 'details of error')
*/
public function requireDatabaseConnection($databaseConfig) {
- $okay = false;
+ $success = false;
$conn = @mysql_connect($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password']);
if($conn) {
- $okay = true;
+ $success = true;
} else {
- $okay = false;
+ $success = false;
$error = mysql_error();
}
return array(
- 'okay' => $okay,
- 'connection' => $conn,
+ 'success' => $success,
'error' => $error
);
}
@@ -68,26 +65,26 @@ public function requireDatabaseConnection($databaseConfig) {
* or be able to create one if it doesn't exist.
*
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
- * @return array Result - e.g. array('okay' => true, 'existsAlready' => 'true')
+ * @return array Result - e.g. array('success' => true, 'alreadyExists' => 'true')
*/
public function requireDatabaseOrCreatePermissions($databaseConfig) {
- $okay = false;
- $existsAlready = false;
+ $success = false;
+ $alreadyExists = false;
$conn = @mysql_connect($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password']);
if(@mysql_select_db($databaseConfig['database'], $conn)) {
- $okay = true;
- $existsAlready = true;
+ $success = true;
+ $alreadyExists = true;
} else {
if(@mysql_query("CREATE DATABASE testing123", $conn)) {
mysql_query("DROP DATABASE testing123", $conn);
- $okay = true;
- $existsAlready = false;
+ $success = true;
+ $alreadyExists = false;
}
}
return array(
- 'okay' => $okay,
- 'existsAlready' => $existsAlready
+ 'success' => $success,
+ 'alreadyExists' => $alreadyExists
);
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.