Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PEAR.php

function PEAR::getSourceDateEpoch

Get SOURCE_DATE_EPOCH environment variable See https://reproducible-builds.org/specs/source-date-epoch/

@access public

Return value

int

File

vendor/pear/pear-core-minimal/src/PEAR.php, line 779

Class

PEAR
Base class for other PEAR classes. Provides rudimentary emulation of destructors.

Code

static function getSourceDateEpoch() {
    if ($source_date_epoch = getenv('SOURCE_DATE_EPOCH')) {
        if (preg_match('/^\\d+$/', $source_date_epoch)) {
            return (int) $source_date_epoch;
        }
        else {
            //  "If the value is malformed, the build process SHOULD exit with a non-zero error code."
            self::raiseError("Invalid SOURCE_DATE_EPOCH: {$source_date_epoch}");
            exit(1);
        }
    }
    else {
        return time();
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal