Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml


Classes:
Keyword

Class TDirectoryCacheDependency

TComponent
   |
   --TCacheDependency
      |
      --TDirectoryCacheDependency

TDirectoryCacheDependency class.

TDirectoryCacheDependency performs dependency checking based on the modification time of the files contained in the specified directory. The directory being checked is specified via Directory.

By default, all files under the specified directory and subdirectories will be checked. If the last modification time of any of them is changed or if different number of files are contained in a directory, the dependency is reported as changed. By specifying RecursiveCheck and RecursiveLevel, one can limit the checking to a certain depth of the subdirectories.

Since: 3.1.0
Author: Qiang Xue <qiang.xue@gmail.com>

Constructor Summary
public
__construct Array
Constructor.

Method Summary
protected  array
generateTimestamps ( string $directory, int $level)
Determines the last modification time for files under the directory.
string
boolean
Performs the actual dependency checking.
boolean
int
void
setDirectory ( string $directory)
void
setRecursiveCheck ( boolean $value)
void
setRecursiveLevel ( int $value)
Sets a value indicating the depth of the subdirectories to be checked.
protected  boolean
validateDirectory ( string $directory)
Checks to see if the specified subdirectory should be checked for dependency.
protected  boolean
validateFile ( string $fileName)
Checks to see if the file should be checked for dependency.
Methods Inherited From TComponent
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()

Constructor Details

__construct

public __construct Array

Constructor.


Method Details

generateTimestamps

protected array generateTimestamps (string $directory , int $level )

Determines the last modification time for files under the directory.

This method may go recursively into subdirectories if RecursiveCheck is set true.

Input
string$directorythe directory name
int$levellevel of the recursion
Output
array list of file modification time indexed by the file path
Exception

getDirectory

public string getDirectory ()

Output
string the directory to be checked
Exception

getHasChanged

public boolean getHasChanged ()

Performs the actual dependency checking.

This method returns true if the directory is changed.

Output
boolean whether the dependency is changed or not.
Exception

getRecursiveCheck

public boolean getRecursiveCheck ()

Output
boolean whether the subdirectories of the directory will also be checked. It defaults to true.
Exception

getRecursiveLevel

public int getRecursiveLevel ()

Output
int the depth of the subdirectories to be checked. It defaults to -1, meaning unlimited depth.
Exception

setDirectory

public void setDirectory (string $directory )

Input
string$directorythe directory to be checked
Output
Exception
throwsTInvalidDataValueException if the directory does not exist

setRecursiveCheck

public void setRecursiveCheck (boolean $value )

Input
boolean$valuewhether the subdirectories of the directory will also be checked.
Output
Exception

setRecursiveLevel

public void setRecursiveLevel (int $value )

Sets a value indicating the depth of the subdirectories to be checked.

This is meaningful only when RecursiveCheck is true.

Input
int$valuethe depth of the subdirectories to be checked. If the value is less than 0, it means unlimited depth. If the value is 0, it means checking the files directly under the specified directory.
Output
Exception

validateDirectory

protected boolean validateDirectory (string $directory )

Checks to see if the specified subdirectory should be checked for dependency.

This method is invoked when dependency of the whole directory is being checked. By default, it always returns true, meaning the subdirectory should be checked. You may override this method to check only certain subdirectories.

Input
string$directorythe name of the subdirectory that may be checked for dependency.
Output
boolean whether this subdirectory should be checked.
Exception

validateFile

protected boolean validateFile (string $fileName )

Checks to see if the file should be checked for dependency.

This method is invoked when dependency of the whole directory is being checked. By default, it always returns true, meaning the file should be checked. You may override this method to check only certain files.

Input
string$fileNamethe name of the file that may be checked for dependency.
Output
boolean whether this file should be checked.
Exception