class DeployFlushDiscoverer implements FlushDiscoverer (View source)

Checks whether a filesystem resource has been changed since the manifest generation

For this discoverer to get activated you should define SS_FLUSH_ON_DEPLOY variable

  • if the environment variable SS_FLUSH_ON_DEPLOY undefined or false, then does nothing
  • if SS_FLUSH_ON_DEPLOY is true, then checks FILE modification time
  • otherwise takes {BASE_PATH/SS_FLUSH_ON_DEPLOY} as the resource to check

Examples:

  • SS_FLUSH_ON_DEPLOY="" would check the BASE_PATH folder for modifications (not the files within)
  • SS_FLUSH_ON_DEPLOY=true would check BASE_PATH/vendor/silverstripe/framework/src/Core/Startup/DeployFlushDiscoverer.php file modification
  • SS_FLUSH_ON_DEPLOY=false disable filesystem checks
  • SS_FLUSH_ON_DEPLOY="public/index.php" checks BASE_PATH/public/index.php file modification time

Properties

protected Kernel $kernel

Active kernel

Methods

public
__construct(Kernel $kernel)

No description

protected
int|null
getCacheTimestamp()

Returns the timestamp of the manifest generation or null if no cache has been found (or couldn't read the cache)

protected
string|null
getDeployResource()

Returns the resource to be checked for deployment

protected
int
getDeployTimestamp(string $resource)

Returns the resource modification timestamp

public
null|bool
shouldFlush()

Returns true if the deploy timestamp greater than the cache generation timestamp

Details

__construct(Kernel $kernel)

No description

Parameters

Kernel $kernel

protected int|null getCacheTimestamp()

Returns the timestamp of the manifest generation or null if no cache has been found (or couldn't read the cache)

Return Value

int|null

unix timestamp

protected string|null getDeployResource()

Returns the resource to be checked for deployment

  • if the environment variable SS_FLUSH_ON_DEPLOY undefined or false, then returns null
  • if SS_FLUSH_ON_DEPLOY is true, then takes FILE as the resource to check
  • otherwise takes {BASE_PATH/SS_FLUSH_ON_DEPLOY} as the resource to check

Return Value

string|null

returns the resource path or null if not set

protected int getDeployTimestamp(string $resource)

Returns the resource modification timestamp

Parameters

string $resource

Path to the filesystem

Return Value

int

null|bool shouldFlush()

Returns true if the deploy timestamp greater than the cache generation timestamp

{@inheritdoc}

Return Value

null|bool

null if don't care or bool to force or prevent flush