Browse Source

Switch Database and Cache libraries from `login` to `username`

This unifies the name we give to the `username` key across all classes within CakePHP.
Jose Diaz-Gonzalez 11 years ago
parent
commit
900322e2ab

+ 4 - 4
src/Cache/Engine/MemcachedEngine.php

@@ -45,7 +45,7 @@ class MemcachedEngine extends CacheEngine {
  * - `duration` Specify how long items in this cache configuration last.
  * - `groups` List of groups or 'tags' associated to every key stored in this config.
  *    handy for deleting a complete group from cache.
- * - `login` Login to access the Memcache server
+ * - `username` Login to access the Memcache server
  * - `password` Password to access the Memcache server
  * - `persistent` The name of the persistent connection. All configurations using
  *    the same persistent value will share a single underlying connection.
@@ -67,7 +67,7 @@ class MemcachedEngine extends CacheEngine {
 		'compress' => false,
 		'duration' => 3600,
 		'groups' => [],
-		'login' => null,
+		'username' => null,
 		'password' => null,
 		'persistent' => false,
 		'prefix' => 'cake_',
@@ -147,14 +147,14 @@ class MemcachedEngine extends CacheEngine {
 			}
 		}
 
-		if ($this->_config['login'] !== null && $this->_config['password'] !== null) {
+		if ($this->_config['username'] !== null && $this->_config['password'] !== null) {
 			if (!method_exists($this->_Memcached, 'setSaslAuthData')) {
 				throw new InvalidArgumentException(
 					'Memcached extension is not build with SASL support'
 				);
 			}
 			$this->_Memcached->setSaslAuthData(
-				$this->_config['login'],
+				$this->_config['username'],
 				$this->_config['password']
 			);
 		}

+ 1 - 1
src/Database/Connection.php

@@ -661,7 +661,7 @@ class Connection {
 	public function __debugInfo() {
 		$secrets = [
 			'password' => '*****',
-			'login' => '*****',
+			'username' => '*****',
 			'host' => '*****',
 			'database' => '*****',
 			'port' => '*****',

+ 1 - 1
src/Database/Driver/Mysql.php

@@ -30,7 +30,7 @@ class Mysql extends \Cake\Database\Driver {
 	protected $_baseConfig = [
 		'persistent' => true,
 		'host' => 'localhost',
-		'login' => 'root',
+		'username' => 'root',
 		'password' => '',
 		'database' => 'cake',
 		'port' => '3306',

+ 1 - 1
src/Database/Driver/PDODriverTrait.php

@@ -38,7 +38,7 @@ trait PDODriverTrait {
 	protected function _connect(array $config) {
 		$connection = new PDO(
 			$config['dsn'],
-			$config['login'],
+			$config['username'],
 			$config['password'],
 			$config['flags']
 		);

+ 1 - 1
src/Database/Driver/Postgres.php

@@ -30,7 +30,7 @@ class Postgres extends \Cake\Database\Driver {
 	protected $_baseConfig = [
 		'persistent' => true,
 		'host' => 'localhost',
-		'login' => 'root',
+		'username' => 'root',
 		'password' => '',
 		'database' => 'cake',
 		'schema' => 'public',

+ 1 - 1
src/Database/Driver/Sqlite.php

@@ -31,7 +31,7 @@ class Sqlite extends \Cake\Database\Driver {
  */
 	protected $_baseConfig = [
 		'persistent' => false,
-		'login' => null,
+		'username' => null,
 		'password' => null,
 		'database' => ':memory:',
 		'encoding' => 'utf8',

+ 1 - 1
src/Database/Driver/Sqlserver.php

@@ -34,7 +34,7 @@ class Sqlserver extends \Cake\Database\Driver {
 	protected $_baseConfig = [
 		'persistent' => false,
 		'host' => 'localhost\SQLEXPRESS',
-		'login' => '',
+		'username' => '',
 		'password' => '',
 		'database' => 'cake',
 		'encoding' => PDO::SQLSRV_ENCODING_UTF8,

+ 2 - 2
tests/TestCase/Cache/Engine/MemcachedEngineTest.php

@@ -111,7 +111,7 @@ class MemcachedEngineTest extends TestCase {
 			'servers' => array('127.0.0.1'),
 			'persistent' => false,
 			'compress' => false,
-			'login' => null,
+			'username' => null,
 			'password' => null,
 			'groups' => array(),
 			'serialize' => 'php',
@@ -356,7 +356,7 @@ class MemcachedEngineTest extends TestCase {
 			'engine' => 'Memcached',
 			'servers' => array('127.0.0.1:11211'),
 			'persistent' => false,
-			'login' => 'test',
+			'username' => 'test',
 			'password' => 'password'
 		);
 

+ 2 - 2
tests/TestCase/Database/Driver/MysqlTest.php

@@ -48,7 +48,7 @@ class MysqlTest extends TestCase {
 		$expected = [
 			'persistent' => true,
 			'host' => 'localhost',
-			'login' => 'root',
+			'username' => 'root',
 			'password' => '',
 			'database' => 'cake',
 			'port' => '3306',
@@ -79,7 +79,7 @@ class MysqlTest extends TestCase {
 			'persistent' => false,
 			'host' => 'foo',
 			'database' => 'bar',
-			'login' => 'user',
+			'username' => 'user',
 			'password' => 'pass',
 			'port' => 3440,
 			'flags' => [1 => true, 2 => false],

+ 2 - 2
tests/TestCase/Database/Driver/PostgresTest.php

@@ -36,7 +36,7 @@ class PostgresTest extends \Cake\TestSuite\TestCase {
 		$expected = [
 			'persistent' => true,
 			'host' => 'localhost',
-			'login' => 'root',
+			'username' => 'root',
 			'password' => '',
 			'database' => 'cake',
 			'schema' => 'public',
@@ -84,7 +84,7 @@ class PostgresTest extends \Cake\TestSuite\TestCase {
 			'persistent' => false,
 			'host' => 'foo',
 			'database' => 'bar',
-			'login' => 'user',
+			'username' => 'user',
 			'password' => 'pass',
 			'port' => 3440,
 			'flags' => [1 => true, 2 => false],

+ 2 - 2
tests/TestCase/Database/Driver/SqliteTest.php

@@ -36,7 +36,7 @@ class SqliteTest extends TestCase {
 			'persistent' => false,
 			'database' => ':memory:',
 			'encoding' => 'utf8',
-			'login' => null,
+			'username' => null,
 			'password' => null,
 			'flags' => [],
 			'init' => [],
@@ -73,7 +73,7 @@ class SqliteTest extends TestCase {
 		);
 
 		$expected = $config;
-		$expected += ['login' => null, 'password' => null];
+		$expected += ['username' => null, 'password' => null];
 		$expected['dsn'] = 'sqlite:bar.db';
 		$expected['flags'] += [
 			PDO::ATTR_PERSISTENT => true,

+ 1 - 1
tests/TestCase/Database/Driver/SqlserverTest.php

@@ -44,7 +44,7 @@ class SqlserverTest extends \Cake\TestSuite\TestCase {
 		$config = [
 			'persistent' => false,
 			'host' => 'foo',
-			'login' => 'Administrator',
+			'username' => 'Administrator',
 			'password' => 'blablabla',
 			'database' => 'bar',
 			'encoding' => 'a-language',

+ 1 - 1
tests/bootstrap.php

@@ -107,7 +107,7 @@ ConnectionManager::config('test', [
 	'driver' => getenv('db_class'),
 	'dsn' => getenv('db_dsn'),
 	'database' => getenv('db_database'),
-	'login' => getenv('db_login'),
+	'username' => getenv('db_login'),
 	'password' => getenv('db_password'),
 	'timezone' => 'UTC'
 ]);