Skip to content

Commit

Permalink
Switch Database and Cache libraries from login to username
Browse files Browse the repository at this point in the history
This unifies the name we give to the `username` key across all classes within CakePHP.
  • Loading branch information
josegonzalez committed Oct 13, 2014
1 parent 393e69e commit 900322e
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions src/Cache/Engine/MemcachedEngine.php
Expand Up @@ -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.
Expand All @@ -67,7 +67,7 @@ class MemcachedEngine extends CacheEngine {
'compress' => false,
'duration' => 3600,
'groups' => [],
'login' => null,
'username' => null,
'password' => null,
'persistent' => false,
'prefix' => 'cake_',
Expand Down Expand Up @@ -147,14 +147,14 @@ public function init(array $config = []) {
}
}

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']
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Connection.php
Expand Up @@ -661,7 +661,7 @@ protected function _newLogger(StatementInterface $statement) {
public function __debugInfo() {
$secrets = [
'password' => '*****',
'login' => '*****',
'username' => '*****',
'host' => '*****',
'database' => '*****',
'port' => '*****',
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Driver/Mysql.php
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Driver/PDODriverTrait.php
Expand Up @@ -38,7 +38,7 @@ trait PDODriverTrait {
protected function _connect(array $config) {
$connection = new PDO(
$config['dsn'],
$config['login'],
$config['username'],
$config['password'],
$config['flags']
);
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Driver/Postgres.php
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Driver/Sqlite.php
Expand Up @@ -31,7 +31,7 @@ class Sqlite extends \Cake\Database\Driver {
*/
protected $_baseConfig = [
'persistent' => false,
'login' => null,
'username' => null,
'password' => null,
'database' => ':memory:',
'encoding' => 'utf8',
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Driver/Sqlserver.php
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Cache/Engine/MemcachedEngineTest.php
Expand Up @@ -111,7 +111,7 @@ public function testConfig() {
'servers' => array('127.0.0.1'),
'persistent' => false,
'compress' => false,
'login' => null,
'username' => null,
'password' => null,
'groups' => array(),
'serialize' => 'php',
Expand Down Expand Up @@ -356,7 +356,7 @@ public function testSaslAuthException() {
'engine' => 'Memcached',
'servers' => array('127.0.0.1:11211'),
'persistent' => false,
'login' => 'test',
'username' => 'test',
'password' => 'password'
);

Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Database/Driver/MysqlTest.php
Expand Up @@ -48,7 +48,7 @@ public function testConnectionConfigDefault() {
$expected = [
'persistent' => true,
'host' => 'localhost',
'login' => 'root',
'username' => 'root',
'password' => '',
'database' => 'cake',
'port' => '3306',
Expand Down Expand Up @@ -79,7 +79,7 @@ public function testConnectionConfigCustom() {
'persistent' => false,
'host' => 'foo',
'database' => 'bar',
'login' => 'user',
'username' => 'user',
'password' => 'pass',
'port' => 3440,
'flags' => [1 => true, 2 => false],
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Database/Driver/PostgresTest.php
Expand Up @@ -36,7 +36,7 @@ public function testConnectionConfigDefault() {
$expected = [
'persistent' => true,
'host' => 'localhost',
'login' => 'root',
'username' => 'root',
'password' => '',
'database' => 'cake',
'schema' => 'public',
Expand Down Expand Up @@ -84,7 +84,7 @@ public function testConnectionConfigCustom() {
'persistent' => false,
'host' => 'foo',
'database' => 'bar',
'login' => 'user',
'username' => 'user',
'password' => 'pass',
'port' => 3440,
'flags' => [1 => true, 2 => false],
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Database/Driver/SqliteTest.php
Expand Up @@ -36,7 +36,7 @@ public function testConnectionConfigDefault() {
'persistent' => false,
'database' => ':memory:',
'encoding' => 'utf8',
'login' => null,
'username' => null,
'password' => null,
'flags' => [],
'init' => [],
Expand Down Expand Up @@ -73,7 +73,7 @@ public function testConnectionConfigCustom() {
);

$expected = $config;
$expected += ['login' => null, 'password' => null];
$expected += ['username' => null, 'password' => null];
$expected['dsn'] = 'sqlite:bar.db';
$expected['flags'] += [
PDO::ATTR_PERSISTENT => true,
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Database/Driver/SqlserverTest.php
Expand Up @@ -44,7 +44,7 @@ public function testConnectionConfigCustom() {
$config = [
'persistent' => false,
'host' => 'foo',
'login' => 'Administrator',
'username' => 'Administrator',
'password' => 'blablabla',
'database' => 'bar',
'encoding' => 'a-language',
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Expand Up @@ -107,7 +107,7 @@
'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'
]);
Expand Down

0 comments on commit 900322e

Please sign in to comment.