Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
6519da3c
Commit
6519da3c
authored
Apr 03, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reverted back the previous changes, and fixed ChainedDependency.
parent
29ec4b63
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
32 deletions
+35
-32
ChainedDependency.php
framework/caching/ChainedDependency.php
+6
-14
DbDependency.php
framework/caching/DbDependency.php
+10
-8
ExpressionDependency.php
framework/caching/ExpressionDependency.php
+12
-1
FileDependency.php
framework/caching/FileDependency.php
+7
-9
No files found.
framework/caching/ChainedDependency.php
View file @
6519da3c
...
@@ -22,11 +22,10 @@ namespace yii\caching;
...
@@ -22,11 +22,10 @@ namespace yii\caching;
class
ChainedDependency
extends
Dependency
class
ChainedDependency
extends
Dependency
{
{
/**
/**
* @var array list of dependencies that this dependency is composed of.
* @var Dependency[] list of dependencies that this dependency is composed of.
* Each array element should be a dependency object or a configuration array
* Each array element must be a dependency object.
* that can be used to create a dependency object via [[\Yii::createObject()]].
*/
*/
public
$dependencies
=
array
()
;
public
$dependencies
;
/**
/**
* @var boolean whether this dependency is depending on every dependency in [[dependencies]].
* @var boolean whether this dependency is depending on every dependency in [[dependencies]].
* Defaults to true, meaning if any of the dependencies has changed, this dependency is considered changed.
* Defaults to true, meaning if any of the dependencies has changed, this dependency is considered changed.
...
@@ -37,9 +36,8 @@ class ChainedDependency extends Dependency
...
@@ -37,9 +36,8 @@ class ChainedDependency extends Dependency
/**
/**
* Constructor.
* Constructor.
* @param array $dependencies list of dependencies that this dependency is composed of.
* @param Dependency[] $dependencies list of dependencies that this dependency is composed of.
* Each array element should be a dependency object or a configuration array
* Each array element should be a dependency object.
* that can be used to create a dependency object via [[\Yii::createObject()]].
* @param array $config name-value pairs that will be used to initialize the object properties
* @param array $config name-value pairs that will be used to initialize the object properties
*/
*/
public
function
__construct
(
$dependencies
=
array
(),
$config
=
array
())
public
function
__construct
(
$dependencies
=
array
(),
$config
=
array
())
...
@@ -54,9 +52,6 @@ class ChainedDependency extends Dependency
...
@@ -54,9 +52,6 @@ class ChainedDependency extends Dependency
public
function
evaluateDependency
()
public
function
evaluateDependency
()
{
{
foreach
(
$this
->
dependencies
as
$dependency
)
{
foreach
(
$this
->
dependencies
as
$dependency
)
{
if
(
!
$dependency
instanceof
Dependency
)
{
$dependency
=
\Yii
::
createObject
(
$dependency
);
}
$dependency
->
evaluateDependency
();
$dependency
->
evaluateDependency
();
}
}
}
}
...
@@ -79,10 +74,7 @@ class ChainedDependency extends Dependency
...
@@ -79,10 +74,7 @@ class ChainedDependency extends Dependency
*/
*/
public
function
getHasChanged
()
public
function
getHasChanged
()
{
{
foreach
(
$this
->
dependencies
as
$i
=>
$dependency
)
{
foreach
(
$this
->
dependencies
as
$dependency
)
{
if
(
!
$dependency
instanceof
Dependency
)
{
$this
->
dependencies
[
$i
]
=
$dependency
=
\Yii
::
createObject
(
$dependency
);
}
if
(
$this
->
dependOnAll
&&
$dependency
->
getHasChanged
())
{
if
(
$this
->
dependOnAll
&&
$dependency
->
getHasChanged
())
{
return
true
;
return
true
;
}
elseif
(
!
$this
->
dependOnAll
&&
!
$dependency
->
getHasChanged
())
{
}
elseif
(
!
$this
->
dependOnAll
&&
!
$dependency
->
getHasChanged
())
{
...
...
framework/caching/DbDependency.php
View file @
6519da3c
...
@@ -28,23 +28,25 @@ class DbDependency extends Dependency
...
@@ -28,23 +28,25 @@ class DbDependency extends Dependency
public
$db
=
'db'
;
public
$db
=
'db'
;
/**
/**
* @var string the SQL query whose result is used to determine if the dependency has been changed.
* @var string the SQL query whose result is used to determine if the dependency has been changed.
* Only the first row of the query result will be used. This property must be always set, otherwise
* Only the first row of the query result will be used.
* an exception would be raised.
*/
*/
public
$sql
;
public
$sql
;
/**
/**
* @var array the parameters (name=>value) to be bound to the SQL statement specified by [[sql]].
* @var array the parameters (name=>value) to be bound to the SQL statement specified by [[sql]].
*/
*/
public
$params
=
array
()
;
public
$params
;
/**
/**
* Initializes the database dependency object.
* Constructor.
* @param string $sql the SQL query whose result is used to determine if the dependency has been changed.
* @param array $params the parameters (name=>value) to be bound to the SQL statement specified by [[sql]].
* @param array $config name-value pairs that will be used to initialize the object properties
*/
*/
public
function
init
(
)
public
function
__construct
(
$sql
,
$params
=
array
(),
$config
=
array
()
)
{
{
if
(
$this
->
sql
===
null
)
{
$this
->
sql
=
$sql
;
throw
new
InvalidConfigException
(
'DbDependency::sql must be set.'
)
;
$this
->
params
=
$params
;
}
parent
::
__construct
(
$config
);
}
}
/**
/**
...
...
framework/caching/ExpressionDependency.php
View file @
6519da3c
...
@@ -22,7 +22,18 @@ class ExpressionDependency extends Dependency
...
@@ -22,7 +22,18 @@ class ExpressionDependency extends Dependency
/**
/**
* @var string the PHP expression whose result is used to determine the dependency.
* @var string the PHP expression whose result is used to determine the dependency.
*/
*/
public
$expression
=
'true'
;
public
$expression
;
/**
* Constructor.
* @param string $expression the PHP expression whose result is used to determine the dependency.
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public
function
__construct
(
$expression
=
'true'
,
$config
=
array
())
{
$this
->
expression
=
$expression
;
parent
::
__construct
(
$config
);
}
/**
/**
* Generates the data needed to determine if dependency has been changed.
* Generates the data needed to determine if dependency has been changed.
...
...
framework/caching/FileDependency.php
View file @
6519da3c
...
@@ -7,8 +7,6 @@
...
@@ -7,8 +7,6 @@
namespace
yii\caching
;
namespace
yii\caching
;
use
yii\base\InvalidConfigException
;
/**
/**
* FileDependency represents a dependency based on a file's last modification time.
* FileDependency represents a dependency based on a file's last modification time.
*
*
...
@@ -22,19 +20,19 @@ class FileDependency extends Dependency
...
@@ -22,19 +20,19 @@ class FileDependency extends Dependency
{
{
/**
/**
* @var string the name of the file whose last modification time is used to
* @var string the name of the file whose last modification time is used to
* check if the dependency has been changed. This property must be always set,
* check if the dependency has been changed.
* otherwise an exception would be raised.
*/
*/
public
$fileName
;
public
$fileName
;
/**
/**
* Initializes the database dependency object.
* Constructor.
* @param string $fileName name of the file whose change is to be checked.
* @param array $config name-value pairs that will be used to initialize the object properties
*/
*/
public
function
init
(
)
public
function
__construct
(
$fileName
=
null
,
$config
=
array
()
)
{
{
if
(
$this
->
file
===
null
)
{
$this
->
fileName
=
$fileName
;
throw
new
InvalidConfigException
(
'FileDependency::fileName must be set.'
);
parent
::
__construct
(
$config
);
}
}
}
/**
/**
...
...
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