本文整理汇总了PHP中eZDateTime::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDateTime::toString方法的具体用法?PHP eZDateTime::toString怎么用?PHP eZDateTime::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDateTime
的用法示例。
在下文中一共展示了eZDateTime::toString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eZDateTime
// Try prepending each of the existing pathPrefixes, to see if one of them matches an existing node
$nodeID = eZURLAliasML::fetchNodeIDByPath($pathPrefixes[$pathPrefixIndex] . $path);
}
if ($nodeID) {
if (!isset($nodeIDHashCounter[$nodeID])) {
$nodeIDHashCounter[$nodeID] = $count;
} else {
$nodeIDHashCounter[$nodeID] += $count;
}
}
}
foreach ($nodeIDHashCounter as $nodeID => $count) {
if (eZContentObjectTreeNode::fetch($nodeID) != null) {
$counter = eZViewCounter::fetch($nodeID);
if ($counter == null) {
$counter = eZViewCounter::create($nodeID);
$counter->setAttribute('count', $count);
$counter->store();
} else {
$counter->increase($count);
}
}
}
$dt = new eZDateTime();
$fh = fopen($updateViewLogPath, "w");
if ($fh) {
fwrite($fh, "# Finished at " . $dt->toString() . "\n" . "# Last updated entry:" . "\n" . $lastLine . "\n");
fclose($fh);
}
$cli->output("Finished at " . $dt->toString() . "\n");
$cli->output("View count have been updated!\n");
示例2: eZDateTime
$scriptFile = $scriptDirectory . '/' . $cronScript;
if (file_exists($scriptFile)) {
break;
}
}
if (file_exists($scriptFile)) {
if ($index > 0) {
$cli->output();
}
if (!$isQuiet) {
$startTime = new eZDateTime();
$cli->output('Running ' . $cli->stylize('emphasize', $scriptFile) . ' at: ' . $startTime->toString(true));
}
eZDebug::addTimingPoint("Script {$scriptFile} starting");
eZRunCronjobs::runScript($cli, $scriptFile);
eZDebug::addTimingPoint("Script {$scriptFile} done");
++$index;
// The transaction check
$transactionCounterCheck = eZDB::checkTransactionCounter();
if (isset($transactionCounterCheck['error'])) {
$cli->error($transactionCounterCheck['error']);
}
if (!$isQuiet) {
$endTime = new eZDateTime();
$cli->output('Completing ' . $cli->stylize('emphasize', $scriptFile) . ' at: ' . $endTime->toString(true));
$elapsedTime = new eZTime($endTime->timeStamp() - $startTime->timeStamp());
$cli->output('Elapsed time: ' . sprintf('%02d:%02d:%02d', $elapsedTime->hour(), $elapsedTime->minute(), $elapsedTime->second()));
}
}
}
$script->shutdown();
示例3: readline
} else {
$action = readline("Remote ID '{$nonUniqueRemoteIDData['remote_id']}' is used for {$nonUniqueRemoteIDData['cnt']} different tree nodes. Do you want to see the details (d) or do you want this inconsistency to be fixed automatically (a) ?");
while (!in_array($action, array('a', 'd'))) {
$action = readline('Invalid option. Type either d for details or a to fix automatically.');
}
}
$treeNodes = eZPersistentObject::fetchObjectList(eZContentObjectTreeNode::definition(), null, array('remote_id' => $nonUniqueRemoteIDData['remote_id']), array('modified_subnode' => 'asc'));
switch ($action) {
case 'd':
$cli->output('');
$cli->output('Select the number of the tree node that you want to keep the current remote ID. The other listed tree nodes will get a new one.');
$cli->output('');
foreach ($treeNodes as $i => $treeNode) {
$nodeID = $treeNode->attribute('node_id');
$dateTime = new eZDateTime($treeNode->attribute('modified_subnode'));
$formattedDateTime = $dateTime->toString(true);
$pathIdentificationString = $treeNode->attribute('path_identification_string');
$cli->output("{$i}) {$pathIdentificationString} (Node ID: {$nodeID}, modified_subnode: {$formattedDateTime} )");
$cli->output('');
}
do {
$skip = readline('Number of nodes that should keep the current remote ID: ');
} while (!array_key_exists($skip, $treeNodes));
break;
case 'a':
default:
$skip = 0;
}
$cli->output('Fixing...');
foreach ($treeNodes as $i => $treeNode) {
if ($i == $skip) {
示例4: eZDateTime
$nodeObject = eZContentObjectTreeNode::fetch($nodeID);
if ($nodeObject != null) {
$counter = eZViewCounter::fetch($nodeID);
if ($counter == null) {
$counter = eZViewCounter::create($nodeID);
}
$counter->increase();
}
}
foreach ($pathArray as $path) {
$nodeID = eZURLAliasML::fetchNodeIDByPath($path);
if ($nodeID) {
$counter = eZViewCounter::fetch($nodeID);
if ($counter == null) {
$counter = eZViewCounter::create($nodeID);
}
$counter->increase();
}
}
$dt = new eZDateTime();
$fh = fopen($updateViewLogPath, "w");
if ($fh) {
fwrite($fh, "# Finished at " . $dt->toString() . "\n");
fwrite($fh, "# Last updated entry:" . "\n");
fwrite($fh, $lastLine . "\n");
fclose($fh);
}
$cli->output("Finished at " . $dt->toString() . "\n");
if (!$isQuiet) {
$cli->output("View count have been updated!\n");
}
示例5: eZDateTime
$logFilePath = '';
$plIni = eZINI::instance('ezperformancelogger.ini');
$logTo = $plIni->variable('GeneralSettings', 'LogMethods');
if (in_array('apache', $logTo) && !in_array('logfile', $logTo)) {
$logFileIni = eZINI::instance('logfile.ini');
$logFilePath = $logFileIni->variable('AccessLogFileSettings', 'StorageDir') . '/' . $logFileIni->variable('AccessLogFileSettings', 'LogFileName');
} else {
if (!in_array('apache', $logTo) && in_array('logfile', $logTo)) {
$logFilePath = $plIni->variable('logfileSettings', 'FileName');
} else {
$cli->error("Cannot decide which log-file to open for reading, please enable either apache-based logging or file-based logging.");
$script->shutdown(1);
}
}
if ($logFilePath != '') {
$cli->output("Parsing file " . $logFilePath);
$storageClass = $plIni->variable('ParsingSettings', 'StorageClass');
$excludeRegexps = $plIni->variable('ParsingSettings', 'ExcludeUrls');
$ok = eZPerfLoggerLogManager::updateStatsFromLogFile($logFilePath, 'eZPerfLoggerApacheLogger', $storageClass, 'updateperfstats.log', $excludeRegexps);
if ($ok === false) {
$cli->output("Error parsing file {$logFilePath}. Please run script in debug mode for more info");
} else {
$cli->output("{$ok['counted']} lines containing data found");
}
}
$dt = new eZDateTime();
$cli->output("Finished at " . $dt->toString() . "\n");
if ($script->verboseOutputLevel() > 0) {
$cli->output("Perf counters have been updated\n");
}
$script->shutdown();
示例6: writeUpdateToken
/**
* Writes a "token file"
* This is useful whenever there are log files which get parse based on cronjobs
* and we have to remember the last line which has been found
*/
protected static function writeUpdateToken($tokenFile, $tokenLine)
{
$sys = eZSys::instance();
$updateViewLogPath = $sys->varDirectory() . "/" . eZPerfLoggerINI::variable('FileSettings', 'LogDir', 'site.ini') . "/" . $tokenFile;
$dt = new eZDateTime();
if (!file_put_contents($updateViewLogPath, "# Finished at " . $dt->toString() . "\n" . "# Last updated entry:" . "\n" . $tokenLine . "\n")) {
eZPerfLoggerDebug::writeError("Could not store last date of perf-log file parsing in {$updateViewLogPath}, double-counting might occur", __METHOD__);
}
}