Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
ffd57694
Commit
ffd57694
authored
Mar 28, 2013
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1688 from Pasvaz/patch-2
Handles Redis password
parents
e8834d76
2144637e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
laravel/redis.php
+20
-2
No files found.
laravel/redis.php
View file @
ffd57694
...
@@ -17,6 +17,13 @@ class Redis {
...
@@ -17,6 +17,13 @@ class Redis {
protected
$port
;
protected
$port
;
/**
/**
* The database password, if present.
*
* @var string
*/
protected
$password
;
/**
* The database number the connection selects on load.
* The database number the connection selects on load.
*
*
* @var int
* @var int
...
@@ -45,10 +52,11 @@ class Redis {
...
@@ -45,10 +52,11 @@ class Redis {
* @param int $database
* @param int $database
* @return void
* @return void
*/
*/
public
function
__construct
(
$host
,
$port
,
$database
=
0
)
public
function
__construct
(
$host
,
$port
,
$
password
=
null
,
$
database
=
0
)
{
{
$this
->
host
=
$host
;
$this
->
host
=
$host
;
$this
->
port
=
$port
;
$this
->
port
=
$port
;
$this
->
password
=
$password
;
$this
->
database
=
$database
;
$this
->
database
=
$database
;
}
}
...
@@ -79,7 +87,12 @@ class Redis {
...
@@ -79,7 +87,12 @@ class Redis {
extract
(
$config
);
extract
(
$config
);
static
::
$databases
[
$name
]
=
new
static
(
$host
,
$port
,
$database
);
if
(
!
isset
(
$password
))
{
$password
=
null
;
}
static
::
$databases
[
$name
]
=
new
static
(
$host
,
$port
,
$password
,
$database
);
}
}
return
static
::
$databases
[
$name
];
return
static
::
$databases
[
$name
];
...
@@ -153,6 +166,11 @@ class Redis {
...
@@ -153,6 +166,11 @@ class Redis {
throw
new
\Exception
(
"Error making Redis connection:
{
$error
}
-
{
$message
}
"
);
throw
new
\Exception
(
"Error making Redis connection:
{
$error
}
-
{
$message
}
"
);
}
}
if
(
$this
->
password
)
{
$this
->
auth
(
$this
->
password
);
}
$this
->
select
(
$this
->
database
);
$this
->
select
(
$this
->
database
);
return
$this
->
connection
;
return
$this
->
connection
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment