本文整理汇总了PHP中eZLog::writeStorageLog方法的典型用法代码示例。如果您正苦于以下问题:PHP eZLog::writeStorageLog方法的具体用法?PHP eZLog::writeStorageLog怎么用?PHP eZLog::writeStorageLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZLog
的用法示例。
在下文中一共展示了eZLog::writeStorageLog方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
function store($sub_dir = false, $suffix = false, $mimeData = false)
{
if (!$this->IsTemporary) {
eZDebug::writeError("Cannot store non temporary file: " . $this->Filename, "eZHTTPFile");
return false;
}
$this->IsTemporary = false;
$ini = eZINI::instance();
// $storage_dir = $ini->variable( "FileSettings", "VarDir" ) . '/' . $ini->variable( "FileSettings", "StorageDir" );
$storage_dir = eZSys::storageDirectory();
if ($sub_dir !== false) {
$dir = $storage_dir . "/{$sub_dir}/";
} else {
$dir = $storage_dir . "/";
}
if ($mimeData) {
$dir = $mimeData['dirpath'];
}
if (!$mimeData) {
$dir .= $this->MimeCategory;
}
if (!file_exists($dir)) {
if (!eZDir::mkdir($dir, false, true)) {
return false;
}
}
$suffixString = false;
if ($suffix != false) {
$suffixString = ".{$suffix}";
}
if ($mimeData) {
$dest_name = $mimeData['url'];
} else {
$dest_name = $dir . "/" . md5(basename($this->Filename) . microtime() . mt_rand()) . $suffixString;
}
if (!move_uploaded_file($this->Filename, $dest_name)) {
eZDebug::writeError("Failed moving uploaded file " . $this->Filename . " to destination {$dest_name}");
unlink($dest_name);
$ret = false;
} else {
$ret = true;
$this->Filename = $dest_name;
$perm = $ini->variable("FileSettings", "StorageFilePermissions");
$oldumask = umask(0);
chmod($dest_name, octdec($perm));
umask($oldumask);
// Write log message to storage.log
$storageDir = $dir . "/";
eZLog::writeStorageLog(basename($this->Filename), $storageDir);
}
return $ret;
}
示例2: loadCache
function loadCache($reset = true, $placement = false)
{
eZDebug::accumulatorStart('ini', 'ini_load', 'Load cache');
if ($reset) {
$this->reset();
}
$cachedDir = self::CONFIG_CACHE_DIR;
$inputFileTime = 0;
$fileName = $this->cacheFileName($placement);
$cachedFile = $cachedDir . $fileName;
if ($placement) {
$this->PlacementCacheFile = $cachedFile;
} else {
$this->CacheFile = $cachedFile;
}
$loadCache = false;
if (file_exists($cachedFile)) {
$loadCache = true;
}
$useCache = false;
if ($loadCache) {
$useCache = true;
if (eZINI::isDebugEnabled()) {
eZDebug::writeNotice("Loading cache '{$cachedFile}' for file '" . $this->FileName . "'", __METHOD__);
}
include $cachedFile;
if (!isset($data) || !isset($data['rev']) || $data['rev'] != eZINI::CONFIG_CACHE_REV) {
if (eZINI::isDebugEnabled()) {
eZDebug::writeNotice("Old structure in cache file used, recreating '{$cachedFile}' to new structure", __METHOD__);
}
unset($data);
$this->reset();
$useCache = false;
} else {
if (self::$checkFileMtime === true || self::$checkFileMtime === $this->FileName) {
eZDebug::accumulatorStart('ini_check_mtime', 'ini_load', 'Check MTime');
$currentTime = time();
$cacheCreatedTime = strtotime($data['created']);
$iniFile = $data['file'];
$inputFiles = $data['files'];
foreach ($inputFiles as $inputFile) {
$fileTime = filemtime($inputFile);
if ($currentTime < $fileTime) {
eZDebug::writeError('Input file "' . $inputFile . '" has a timestamp higher then current time, ignoring to avoid infinite recursion!', __METHOD__);
} else {
if ($fileTime === false || $fileTime > $cacheCreatedTime) {
unset($data);
$this->reset();
$useCache = false;
break;
}
}
}
eZDebug::accumulatorStop('ini_check_mtime');
}
}
}
if ($useCache && isset($data)) {
$this->Charset = $data['charset'];
$this->ModifiedBlockValues = array();
if ($placement) {
$this->BlockValuesPlacement = $data['val'];
} else {
$this->BlockValues = $data['val'];
}
unset($data);
} else {
if (!isset($inputFiles)) {
eZDebug::accumulatorStart('ini_find_files', 'ini_load', 'Find INI Files');
$this->findInputFiles($inputFiles, $iniFile);
eZDebug::accumulatorStop('ini_find_files');
if (count($inputFiles) === 0) {
eZDebug::accumulatorStop('ini');
return false;
}
}
eZDebug::accumulatorStart('ini_files_parse', 'ini_load', 'Parse');
$this->parse($inputFiles, $iniFile, false, $placement);
eZDebug::accumulatorStop('ini_files_parse');
eZDebug::accumulatorStart('ini_files_save', 'ini_load', 'Save Cache');
$cacheSaved = $this->saveCache($cachedDir, $cachedFile, $placement ? $this->BlockValuesPlacement : $this->BlockValues, $inputFiles, $iniFile);
eZDebug::accumulatorStop('ini_files_save');
if ($cacheSaved) {
// Write log message to storage.log
eZLog::writeStorageLog($fileName, $cachedDir);
}
}
eZDebug::accumulatorStop('ini');
}
示例3: loadCache
//.........这里部分代码省略.........
$cachedDir = self::CONFIG_CACHE_DIR;
$fileName = $this->cacheFileName( $placement );
$cachedFile = $cachedDir . $fileName;
if ( $placement )
{
$this->PlacementCacheFile = $cachedFile;
}
else
{
$this->CacheFile = $cachedFile;
}
$data = false;// this will contain cache data if cache data is valid
if ( file_exists( $cachedFile ) )
{
if ( self::isDebugEnabled() )
eZDebug::writeNotice( "Loading cache '$cachedFile' for file '" . $this->FileName . "'", __METHOD__ );
include( $cachedFile );
if ( !isset( $data['rev'] ) || $data['rev'] != eZINI::CONFIG_CACHE_REV )
{
if ( self::isDebugEnabled() )
eZDebug::writeNotice( "Old structure in cache file used, recreating '$cachedFile' to new structure", __METHOD__ );
$data = false;
$this->reset();
}
else if ( self::$checkFileMtime === true || self::$checkFileMtime === $this->FileName )
{
eZDebug::accumulatorStart( 'ini_check_mtime', 'Ini load', 'Check MTime' );
$currentTime = time();
$cacheCreatedTime = strtotime( $data['created'] );
$iniFile = $data['file'];// used by findInputFiles further down
$inputFiles = $data['files'];
foreach ( $inputFiles as $inputFile )
{
$fileTime = file_exists( $inputFile ) ? filemtime( $inputFile ) : false;
if ( $fileTime === false )// Refresh cache & input files if file is gone
{
unset( $inputFiles );
$data = false;
$this->reset();
break;
}
else if ( $fileTime > $currentTime )
{
eZDebug::writeError( 'Input file "' . $inputFile . '" has a timestamp higher then current time, ignoring to avoid infinite recursion!', __METHOD__ );
}
else if ( $fileTime > $cacheCreatedTime )// Refresh cache if file has been changed
{
$data = false;
$this->reset();
break;
}
}
eZDebug::accumulatorStop( 'ini_check_mtime' );
}
}
if ( $data )// if we have cache data on this point, use it
{
$this->Charset = $data['charset'];
$this->ModifiedBlockValues = array();
if ( $placement )
$this->BlockValuesPlacement = $data['val'];
else
$this->BlockValues = $data['val'];
unset( $data );
}
else
{
if ( !isset( $inputFiles ) )// use $inputFiles from cache if defined
{
eZDebug::accumulatorStart( 'ini_find_files', 'Ini load', 'Find INI Files' );
$this->findInputFiles( $inputFiles, $iniFile );
eZDebug::accumulatorStop( 'ini_find_files' );
if ( count( $inputFiles ) === 0 )
{
eZDebug::accumulatorStop( 'ini' );
return false;
}
}
eZDebug::accumulatorStart( 'ini_files_parse', 'Ini load', 'Parse' );
$this->parse( $inputFiles, $iniFile, false, $placement );
eZDebug::accumulatorStop( 'ini_files_parse' );
eZDebug::accumulatorStart( 'ini_files_save', 'Ini load', 'Save Cache' );
$cacheSaved = $this->saveCache( $cachedDir, $cachedFile, $placement ? $this->BlockValuesPlacement : $this->BlockValues, $inputFiles, $iniFile );
eZDebug::accumulatorStop( 'ini_files_save' );
if ( $cacheSaved )
{
// Write log message to storage.log
eZLog::writeStorageLog( $fileName, $cachedDir );
}
}
eZDebug::accumulatorStop( 'ini' );
}
示例4: store
function store($atomic = false)
{
if ($this->open($atomic)) {
$this->write("<?php\n");
$this->writeElements();
$this->write("?>\n");
$this->writeChunks();
$this->flushChunks();
$this->close();
if (!$this->ClusteringEnabled) {
$perm = octdec(eZINI::instance()->variable('FileSettings', 'StorageFilePermissions'));
chmod(eZDir::path(array($this->PHPDir, $this->PHPFile)), $perm);
}
// Write log message to storage.log
eZLog::writeStorageLog($this->PHPFile, $this->PHPDir . '/');
return true;
} else {
eZDebug::writeError("Failed to open file '" . $this->PHPDir . '/' . $this->PHPFile . "'", 'eZPHPCreator::store');
return false;
}
}