コード例 #1
0
ファイル: BuildFile.php プロジェクト: jon9872/zend-framework
 /**
  * Build specified buildfile.
  *
  * @param  string $target
  * @param  array  $args
  * @return void
  */
 public function build(string $target, array $args)
 {
     // If there are any errors reading the env or build files, it might as well happen here.
     $buildFileContents = file_read_contents($envFileName);
     $envFileContents = file_read_contents($envFileName);
     // Create the environment for this build
     $processedEnv = $this->preProcessEnvTemplate($buildFileContents, $envFileContents);
     // Load build environment
     /**
      * The processedEnv string has been processed such that eval()
      * should return an accurate line number if an error is found
      * in the build script.
      */
     eval($processedEnv);
     // Now execute the build script
     $buildEnv = new BUILD_ENV_CLASS();
     $buildEnv->execute($target);
 }
コード例 #2
0
    }
}
// Now we have a file that exists. Not using send_file since it requires
// proper $CFG etc.
// Handle If-Modified-Since
$filedate = filemtime($file);
$ifmodifiedsince = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : false;
if ($ifmodifiedsince && strtotime($ifmodifiedsince) >= $filedate) {
    header('HTTP/1.0 304 Not Modified');
    exit;
}
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $filedate) . ' GMT');
// As I'm not loading config table from DB, this is hardcoded here; expiry
// 4 hours, unless the hacky file reduceimagecache.dat exists in dataroot
if (file_exists($reducefile = $dataroot . '/reduceimagecache.dat')) {
    $lifetime = file_read_contents($reducefile);
} else {
    $lifetime = 4 * 60 * 60;
}
// Send expire headers
header('Cache-Control: max-age=' . $lifetime);
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $lifetime) . ' GMT');
// Type
header('Content-Type: ' . $mimetype);
header('Content-Length: ' . filesize($file));
// Output file
$handle = fopen($file, 'r');
fpassthru($handle);
fclose($handle);
// Slower Moodle-style version follows:
//// Outputs pictures from theme or core pix folder. Only used if $CFG->smartpix is
コード例 #3
0
ファイル: File.php プロジェクト: jon9872/zend-framework
 /**
  * Reads this file into a string and returns it.
  *
  * @throws Zend_Build_Exception
  * @return void
  */
 protected function read()
 {
     $fileName = getPath();
     if (!is_set($fileName) || ${$fileName} == '') {
         $name = DEFAULT_BUILD_FILE_NAME;
     } else {
         trim($fileName);
     }
     // Read contents and store them
     if (!($contents = file_read_contents($fileName))) {
         throw new Zend_Build_Exception("File '{$fileName}' could not be read.");
     }
 }