本文整理汇总了PHP中eZSys::varDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSys::varDirectory方法的具体用法?PHP eZSys::varDirectory怎么用?PHP eZSys::varDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZSys
的用法示例。
在下文中一共展示了eZSys::varDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMail
function sendMail(ezcMail $mail)
{
$separator = "/";
$mail->appendExcludeHeaders(array('to', 'subject'));
$headers = rtrim($mail->generateHeaders());
// rtrim removes the linebreak at the end, mail doesn't want it.
if (count($mail->to) + count($mail->cc) + count($mail->bcc) < 1) {
throw new ezcMailTransportException('No recipient addresses found in message header.');
}
$additionalParameters = "";
if (isset($mail->returnPath)) {
$additionalParameters = "-f{$mail->returnPath->email}";
}
$sys = eZSys::instance();
$fname = time() . '-' . rand() . '.mail';
$qdir = eZSys::siteDir() . eZSys::varDirectory() . $separator . 'mailq';
$data = $headers . ezcMailTools::lineBreak();
$data .= ezcMailTools::lineBreak();
$data .= $mail->generateBody();
$data = preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $data);
$success = eZFile::create($fname, $qdir, $data);
if ($success === false) {
throw new ezcMailTransportException('The email could not be sent by sendmail');
}
}
示例2: getStore
function getStore()
{
$varDirPath = realpath(eZSys::varDirectory());
$store_path = $varDirPath . eZSys::fileSeparator() . 'openid_consumer';
if (!file_exists($store_path) && !mkdir($store_path)) {
//throw error
exit(0);
}
$store = new Auth_OpenID_FileStore($store_path);
return $store;
}
示例3: getTmpDir
/**
* tmp dir for mail parser
* ezvardir / cjw_newsletter/tmp/
* @return string dirname
*/
public function getTmpDir($createDirIfNotExists = true)
{
$varDir = eZSys::varDirectory();
// $dir = $varDir . "/cjw_newsletter/tmp/";
$dir = eZDir::path(array($varDir, 'cjw_newsletter', 'tmp'));
$fileSep = eZSys::fileSeparator();
$filePath = $dir . $fileSep;
if ($createDirIfNotExists === true) {
if (!file_exists($filePath)) {
eZDir::mkdir($filePath, false, true);
}
}
return $filePath;
}
示例4: appendLogEntry
/**
* Logs the string $logString to the logfile webservices.log
* in the current log directory (usually var/log).
* If logging is disabled, nothing is done.
*
* In dev mode, also writes to the eZP logs to ease debugging (this happens
* regardless of the logging level set for the extension itself)
*/
static function appendLogEntry($logString, $debuglevel)
{
$ini = eZINI::instance('site.ini');
if ($ini->variable('DebugSettings', 'DebugOutput') == 'enabled' && $ini->variable('TemplateSettings', 'DevelopmentMode') == 'enabled') {
switch ($debuglevel) {
case 'info':
case 'notice':
eZDebug::writeNotice($logString, 'ggwebservices');
break;
case 'debug':
eZDebug::writeDebug($logString, 'ggwebservices');
break;
case 'warning':
eZDebug::writeWarning($logString, 'ggwebservices');
break;
case 'error':
case 'critical':
eZDebug::writeError($logString, 'ggwebservices');
break;
}
}
if (!self::isLoggingEnabled($debuglevel)) {
return false;
}
$varDir = eZSys::varDirectory();
$logDir = 'log';
$logName = 'webservices.log';
$fileName = $varDir . '/' . $logDir . '/' . $logName;
if (!file_exists($varDir . '/' . $logDir)) {
//include_once( 'lib/ezfile/classes/ezdir.php' );
eZDir::mkdir($varDir . '/' . $logDir, 0775, true);
}
if ($logFile = fopen($fileName, 'a')) {
$nowTime = date("Y-m-d H:i:s : ");
$text = $nowTime . $logString;
/*if ( $label )
$text .= ' [' . $label . ']';*/
fwrite($logFile, $text . "\n");
fclose($logFile);
}
}
示例5: __construct
/**
* Constructs an empty CjwNewsletterLog instance
*
* This constructor is private as this class should be used as a
* singleton. Use the getInstance() method instead to get an ezcLog instance.
*
* @param boolean $isCliMode
* @return void
*/
protected function __construct($isCliMode = false)
{
if ($isCliMode === true) {
$this->isCliMode = true;
}
$this->reset();
$log = $this;
// "var/log"
$ini = eZINI::instance();
$varDir = eZSys::varDirectory();
$iniLogDir = $ini->variable('FileSettings', 'LogDir');
$permissions = octdec($ini->variable('FileSettings', 'LogFilePermissions'));
$logDir = eZDir::path(array($varDir, $iniLogDir));
$logNamePostfix = '';
// Debug enabled
$cjwNewsletterIni = eZINI::instance('cjw_newsletter.ini');
if ($cjwNewsletterIni->variable('DebugSettings', 'Debug') == 'enabled') {
$this->debug = true;
}
if ($isCliMode === true) {
$logNamePostfix = 'cli_';
}
// Create the writers
$generalFilename = "cjw_newsletter_" . $logNamePostfix . "general.log";
$errorFilename = "cjw_newsletter_" . $logNamePostfix . "error.log";
$writeAll = new ezcLogUnixFileWriter($logDir, $generalFilename);
$writeErrors = new ezcLogUnixFileWriter($logDir, $errorFilename);
// Check file permissions
foreach (array($generalFilename, $errorFilename) as $file) {
$path = eZDir::path(array($logDir, $file));
if (substr(decoct(fileperms($path)), 2) !== $permissions) {
@chmod($path, $permissions);
}
}
$errorFilter = new ezcLogFilter();
$errorFilter->severity = ezcLog::ERROR;
$log->getMapper()->appendRule(new ezcLogFilterRule($errorFilter, $writeErrors, true));
$log->getMapper()->appendRule(new ezcLogFilterRule(new ezcLogFilter(), $writeAll, true));
}
示例6: printReport
static function printReport($newWindow = false, $as_html = true, $returnReport = false, $allowedDebugLevels = false, $useAccumulators = true, $useTiming = true, $useIncludedFiles = false)
{
if (!eZDebug::isDebugEnabled()) {
return null;
}
$debug = eZDebug::instance();
$report = $debug->printReportInternal($as_html, $returnReport & $newWindow, $allowedDebugLevels, $useAccumulators, $useTiming, $useIncludedFiles);
if ($newWindow == true) {
$debugFilePath = eZDir::path(array(eZSys::varDirectory(), 'cache', 'debug.html'));
$debugFileURL = $debugFilePath;
eZURI::transformURI($debugFileURL, true);
print "\n<SCRIPT LANGUAGE='JavaScript'>\n<!-- hide this script from old browsers\n\nfunction showDebug()\n{\n var debugWindow;\n\n if (navigator.appName == \"Microsoft Internet Explorer\")\n {\n //Microsoft Internet Explorer\n debugWindow = window.open( '{$debugFileURL}', 'ezdebug', 'width=500,height=550,status,scrollbars,resizable,screenX=0,screenY=20,left=20,top=40');\n debugWindow.document.close();\n debugWindow.location.reload();\n }\n else if (navigator.appName == \"Opera\")\n {\n //Opera\n debugWindow = window.open( '', 'ezdebug', 'width=500,height=550,status,scrollbars,resizable,screenX=0,screenY=20,left=20,top=40');\n debugWindow.location.href=\"{$debugFileURL}\";\n debugWindow.navigate(\"{$debugFileURL}\");\n }\n else\n {\n //Mozilla, Firefox, etc.\n debugWindow = window.open( '', 'ezdebug', 'width=500,height=550,status,scrollbars,resizable,screenX=0,screenY=20,left=20,top=40');\n debugWindow.document.location.href=\"{$debugFileURL}\";\n };\n}\n\nshowDebug();\n\n// done hiding from old browsers -->\n</SCRIPT>\n";
$header = "<html><head><title>eZ debug</title></head><body>";
$footer = "</body></html>";
$fp = fopen($debugFilePath, "w+");
fwrite($fp, $header);
fwrite($fp, $report);
fwrite($fp, $footer);
fclose($fp);
} else {
if ($returnReport) {
return $report;
}
}
return null;
}
示例7: cacheDirectory
static function cacheDirectory()
{
$ini = eZINI::instance();
$cacheDir = $ini->variable('FileSettings', 'CacheDir');
if ($cacheDir[0] == "/") {
return eZDir::path(array($cacheDir));
} else {
return eZDir::path(array(eZSys::varDirectory(), $cacheDir));
}
}
示例8: printReport
static function printReport($newWindow = false, $as_html = true, $returnReport = false, $allowedDebugLevels = false, $useAccumulators = true, $useTiming = true, $useIncludedFiles = false)
{
if (!self::isDebugEnabled()) {
return null;
}
$debug = self::instance();
$report = $debug->printReportInternal($as_html, $returnReport & $newWindow, $allowedDebugLevels, $useAccumulators, $useTiming, $useIncludedFiles);
if ($newWindow == true) {
$debugFilePath = eZDir::path(array(eZSys::varDirectory(), 'cache', 'debug.html'));
$debugFileURL = $debugFilePath;
eZURI::transformURI($debugFileURL, true);
print "\n<script type='text/javascript'>\n<!--\n\n(function()\n{\n var debugWindow;\n\n if (navigator.appName == \"Microsoft Internet Explorer\")\n {\n //Microsoft Internet Explorer\n debugWindow = window.open( '{$debugFileURL}', 'ezdebug', 'width=500,height=550,status,scrollbars,resizable,screenX=0,screenY=20,left=20,top=40');\n debugWindow.document.close();\n debugWindow.location.reload();\n }\n else if (navigator.appName == \"Opera\")\n {\n //Opera\n debugWindow = window.open( '', 'ezdebug', 'width=500,height=550,status,scrollbars,resizable,screenX=0,screenY=20,left=20,top=40');\n debugWindow.location.href=\"{$debugFileURL}\";\n debugWindow.navigate(\"{$debugFileURL}\");\n }\n else\n {\n //Mozilla, Firefox, etc.\n debugWindow = window.open( '', 'ezdebug', 'width=500,height=550,status,scrollbars,resizable,screenX=0,screenY=20,left=20,top=40');\n debugWindow.document.location.href=\"{$debugFileURL}\";\n };\n})();\n\n// -->\n</script>\n";
$header = "<!DOCTYPE html><html><head><title>eZ debug</title></head><body>";
$footer = "</body></html>";
$fullPage = ezpEvent::getInstance()->filter('response/output', $header . $report . $footer);
file_put_contents($debugFilePath, $fullPage);
} else {
if ($returnReport) {
return $report;
}
}
return null;
}
示例9: virtualInfoFileName
static function virtualInfoFileName()
{
$infoFile = eZSys::varDirectory() . '/webdav/root/info.txt';
return $infoFile;
}
示例10: ksort
<?php
/**
* Create a graph of files-per-minute by analyzing storage.log
*
* @author G. Giunta
* @copyright (C) G. Giunta 2008-2016
* @license Licensed under GNU General Public License v2.0. See file license.txt
*
* @todo add support for user-selected start and end date
* @todo support coarser intervals than 60 secs
* @todo
*/
$errormsg = "";
// nb: this dir is calculated the same way as ezlog does
$logfile = eZSys::varDirectory() . '/' . $ini->variable('FileSettings', 'LogDir') . '/storage.log';
// but storage log also is in var/log (created I think before siteaccess settings are loaded)
$logfile2 = 'var/log/storage.log';
if ($Params['viewmode'] == 'json') {
if (!is_file($logfile) && !is_file($logfile2)) {
/// @todo return a 404 error?
}
$data = ezLogsGrapher::asum(ezLogsGrapher::parseLog($logfile, $scale), ezLogsGrapher::parseLog($logfile2, $scale));
ksort($data);
$mtime = @filemtime($logfile);
$mtime2 = @filemtime($logfile2);
$mdate = gmdate('D, d M Y H:i:s', $mtime > $mtime2 ? $mtime : $mtime2) . ' GMT';
header('Content-Type: application/json');
header("Last-Modified: {$mdate}");
echo json_encode($data);
eZExecution::cleanExit();
示例11: createFile
function createFile($message)
{
$sys = eZSys::instance();
$lineBreak = $sys->osType() == 'win32' ? "\r\n" : "\n";
$separator = $sys->osType() == 'win32' ? "\\" : "/";
$fname = time() . '-' . rand() . '.sms';
$qdir = eZSys::siteDir() . eZSys::varDirectory() . $separator . 'mailq';
$data = $message;
$data = preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $data);
// echo 'eZFile::create('.$fname.', '.$qdir.', '.$data.');';
eZFile::create($fname, $qdir, $data);
}
示例12: array
'use-modules' => true,
'use-extensions' => true,
'debug-output' => false,
) );
$script->startup();
$script->initialize();
$cli = eZCLI::instance();
$options = $script->getOptions('[remove]', '', array(
'remove' => 'Remove old files else copy. Use remove option in a second pass'
));
$remove = isset($options['remove']) && $options['remove'] == true;
$varDir = eZSys::varDirectory();
$newStaticDir = StaticData::directory();
$fileUtils = eZClusterFileHandler::instance( $path );
if( $fileUtils->requiresClusterizing() ) {
$dfsBackend = new eZDFSFileHandlerDFSBackend();
$mountPoint = $dfsBackend->getMountPoint();
$varDir = eZDir::path(array($mountPoint, $varDir));
$newStaticDir = eZDir::path(array($mountPoint, $newStaticDir));
}
$clusterList = ClusterTool::globCluster();
$oldStaticDir = eZDir::path(array($varDir, 'static-data'));
$applicationList = array();
$rows = ApplicationObject::fetchObjectList(ApplicationObject::definition(), array('identifier'), null, null, null, false);
示例13: Exception
$exporter = new $availableExporters[$options['exporter']]();
// Check formatter validity
if (!isset($options['formatter'])) {
$options['formatter'] = 'disquswxr';
} else {
if (!isset($availableFormatters[$options['formatter']])) {
throw new Exception("Invalid formatter '{$options['formatter']}'. Valid formatters are: " . implode(', ', array_keys($availableFormatters)));
}
}
$formatter = new $availableFormatters[$options['formatter']]();
// Now export
$cli->notice("Now exporting with {$exporter->getName()} exporter and {$formatter->getName()} formatter...");
$processor = new ExportProcessor($exporter, $formatter);
$processor->export();
// Rendering or splitting ?
$exportDir = eZSys::varDirectory();
$exportBaseFilename = 'comments-export';
$exportFormat = $processor->getExportFormat();
if (isset($options['split'])) {
$cli->notice('Now splitting final file.');
$splittedData = $processor->split();
$cli->notice('Total size before splitting is ' . number_format($splittedData->totalSize / 1024 / 1024, 2) . 'M');
foreach ($splittedData->stringArray as $i => $data) {
$filename = "{$exportBaseFilename}.{$i}.{$exportFormat}";
$cli->notice("Now rendering {$exportDir}/{$filename}");
eZFile::create("{$filename}", $exportDir, $data, true);
}
} else {
$cli->notice("Now rendering to {$exportDir}/{$exportBaseFilename}.{$exportFormat}");
eZFile::create("{$exportBaseFilename}.{$exportFormat}", $exportDir, $processor->render(), true);
}
示例14: logDirectory
/**
* @return the directory used for storing log files.
*/
private function logDirectory()
{
$ini = eZINI::instance();
$logDir = $ini->variable('FileSettings', 'LogDir');
if ($logDir[0] == "/") {
return eZDir::path(array($logDir));
} else {
return eZDir::path(array(eZSys::varDirectory(), $logDir));
}
}
示例15: md5
$visitDate = $visits[$visitAnswer];
// 2 - get xmls
$hash = md5( serialize( array(
'type' => $nlType,
'frequency' => $nlFrequency,
'customer_type' => false,
'specialty' => false,
'publisher_folder' => false,
) ).$clusterIdentifier );
$dfsBackend = new eZDFSFileHandlerDFSBackend();
$mountPoint = $dfsBackend->getMountPoint();
$lastFile = false;
foreach( glob( $mountPoint.eZSys::varDirectory()."/rssCache/".$hash.'.xml.2*') as $file )
{
preg_match( '#\.(?P<rssYear>[0-9]{4})(?P<rssMonth>[0-9]{2})(?P<rssDay>[0-9]{2})_(?P<rssHour>[0-9]{2})(?P<rssMinutes>[0-9]{2})\.log$#', $file, $m );
$rssDate = mktime( $m['rssHour'], $m['rssMinutes'], 0, $m['rssMonth'], $m['rssDay'], $m['rssYear'] );
if ( $rssDate > $visitDate )
break;
$lastFile = $file;
}
$cli->cli->output( "\nLast generated file before Creator Mail's visit:" );
$cli->cli->output( $lastFile );
$script->shutdown( 0 );