本文整理汇总了PHP中eZDebug::writeError方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDebug::writeError方法的具体用法?PHP eZDebug::writeError怎么用?PHP eZDebug::writeError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDebug
的用法示例。
在下文中一共展示了eZDebug::writeError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($process, $event)
{
// get object being published
$parameters = $process->attribute('parameter_list');
$objectID = $parameters['object_id'];
eZDebug::writeDebug('Update object state for object: ' . $objectID);
$object = eZContentObject::fetch($objectID);
$state_before = $event->attribute('state_before');
$state_after = $event->attribute('state_after');
if ($object == null) {
eZDebug::writeError('Update object state failed for inexisting object: ' . $objectID, __METHOD__);
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
if ($state_before == null || $state_after == null) {
eZDebug::writeError('Update object state failed: badly configured states', __METHOD__);
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
$currentStateIDArray = $object->attribute('state_id_array');
if (in_array($state_before->attribute('id'), $currentStateIDArray)) {
$canAssignStateIDList = $object->attribute('allowed_assign_state_id_list');
if (!in_array($state_after->attribute('id'), $canAssignStateIDList)) {
eZDebug::writeWarning("Not enough rights to assign state to object {$objectID}: " . $state_after->attribute('id'), __METHOD__);
} else {
eZDebug::writeDebug('Changing object state from ' . $state_before->attribute('name') . ' to ' . $state_after->attribute('name'), __METHOD__);
if (eZOperationHandler::operationIsAvailable('content_updateobjectstate')) {
$operationResult = eZOperationHandler::execute('content', 'updateobjectstate', array('object_id' => $objectID, 'state_id_list' => array($state_after->attribute('id'))));
} else {
eZContentOperationCollection::updateObjectState($objectID, array($state_after->attribute('id')));
}
}
}
return eZWorkflowType::STATUS_ACCEPTED;
}
示例2: attribute
function attribute( $attr )
{
switch ( $attr )
{
case "workflow_event_id" :
{
return $this->WorkflowEventID;
}break;
case "workflow_event_version" :
{
return $this->WorkflowEventVersion;
}break;
case "entry_list" :
{
return $this->Entries;
}break;
case 'classattribute_id_list' :
{
return $this->classAttributeIDList();
}
default :
{
eZDebug::writeError( "Attribute '$attr' does not exist", __METHOD__ );
return null;
}break;
}
}
示例3: execute
public function execute($process, $event)
{
$params = $process->attribute('parameter_list');
$object_id = $params['object_id'];
$object = eZContentObject::fetch($object_id);
if (!is_object($object)) {
eZDebug::writeError("Unable to fetch object: '{$object_id}'", __METHOD__);
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
// current parent node(s)
$parentNodeIds = $object->attribute('parent_nodes');
$checkedObjs = array();
foreach ($parentNodeIds as $parentNodeId) {
//eZDebug::writeDebug( "Checking parent node: " . $parentNodeId, __METHOD__ );
$parentNode = eZContentObjectTreeNode::fetch($parentNodeId);
$parentObj = $parentNode->attribute('object');
if (!in_array($parentObj->attribute('id'), $checkedObjs)) {
//eZDebug::writeDebug( "Checking all nodes of parent obj: " . $parentObj->attribute( 'id' ), __METHOD__ );
foreach ($parentObj->attribute('assigned_nodes') as $node) {
if (!in_array($node->attribute('node_id'), $parentNodeIds)) {
//eZDebug::writeDebug( "Found a node which is not parent of current obj: " . $node->attribute( 'node_id' ), __METHOD__ );
// the current obj has no node which is children of the given node of one of its parent objects
$operationResult = eZOperationHandler::execute('content', 'addlocation', array('node_id' => $object->attribute('main_node_id'), 'object_id' => $object->attribute('id'), 'select_node_id_array' => array($node->attribute('node_id'))), null, true);
if ($operationResult == null || $operationResult['status'] != true) {
eZDebug::writeError("Unable to add new location to object: " . $object->attribute('id'), __METHOD__);
}
} else {
//eZDebug::writeDebug( "Found a node which is already parent of current obj: " . $node->attribute( 'node_id' ), __METHOD__ );
}
}
}
$checkedObjs[] = $parentObj->attribute('id');
}
return eZWorkflowType::STATUS_ACCEPTED;
}
示例4: sendMail
function sendMail(eZMail $mail)
{
$ini = eZINI::instance();
$parameters = array();
$parameters['host'] = $ini->variable('MailSettings', 'TransportServer');
$parameters['helo'] = $ini->variable('MailSettings', 'SenderHost');
$parameters['port'] = $ini->variable('MailSettings', 'TransportPort');
$parameters['connectionType'] = $ini->variable('MailSettings', 'TransportConnectionType');
$user = $ini->variable('MailSettings', 'TransportUser');
$password = $ini->variable('MailSettings', 'TransportPassword');
if ($user and $password) {
$parameters['auth'] = true;
$parameters['user'] = $user;
$parameters['pass'] = $password;
}
/* If email sender hasn't been specified or is empty
* we substitute it with either MailSettings.EmailSender or AdminEmail.
*/
if (!$mail->senderText()) {
$emailSender = $ini->variable('MailSettings', 'EmailSender');
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
eZMail::extractEmail($emailSender, $emailSenderAddress, $emailSenderName);
if (!eZMail::validate($emailSenderAddress)) {
$emailSender = false;
}
if ($emailSender) {
$mail->setSenderText($emailSender);
}
}
$excludeHeaders = $ini->variable('MailSettings', 'ExcludeHeaders');
if (count($excludeHeaders) > 0) {
$mail->Mail->appendExcludeHeaders($excludeHeaders);
}
$options = new ezcMailSmtpTransportOptions();
if ($parameters['connectionType']) {
$options->connectionType = $parameters['connectionType'];
}
$smtp = new ezcMailSmtpTransport($parameters['host'], $user, $password, $parameters['port'], $options);
// If in debug mode, send to debug email address and nothing else
if ($ini->variable('MailSettings', 'DebugSending') == 'enabled') {
$mail->Mail->to = array(new ezcMailAddress($ini->variable('MailSettings', 'DebugReceiverEmail')));
$mail->Mail->cc = array();
$mail->Mail->bcc = array();
}
// send() from ezcMailSmtpTransport doesn't return anything (it uses exceptions in case
// something goes bad)
try {
eZPerfLogger::accumulatorStart('mail_sent');
$smtp->send($mail->Mail);
eZPerfLogger::accumulatorStop('mail_sent');
} catch (ezcMailException $e) {
eZPerfLogger::accumulatorStop('mail_send');
eZDebug::writeError($e->getMessage(), __METHOD__);
return false;
}
// return true in case of no exceptions
return true;
}
示例5: solrMetaDataExists
private function solrMetaDataExists( $contentObjectID=0, $attributeIdentifier='', $subattr='' )
{
try
{
$contentObject = eZContentObject::fetch( $contentObjectID );
$dataMap = $contentObject->dataMap();
if ( array_key_exists( $attributeIdentifier, $dataMap ) )
{
$contentObjectAttribute = $dataMap[$attributeIdentifier];
$eZType = eZDataType::create( solrMetaDataType::DATA_TYPE_STRING );
$value = $eZType->getValue( $contentObjectAttribute->ID, $subattr );
return ( ! empty( $value ) );
}
else
{
eZDebug::writeError( 'Object '.$contentObjectID.' has no attribute '.$attributeIdentifier, 'solrMetaDataExists Error' );
}
return false;
}
catch ( Exception $e )
{
eZDebug::writeError( $e, 'solrMetaDataExists Exception' );
return false;
}
}
示例6: read
static function read($filename, $returnArray = false)
{
$fd = @fopen($filename, 'rb');
if ($fd) {
$buf = fread($fd, 100);
fclose($fd);
if (preg_match('#^<\\?' . "php#", $buf)) {
include $filename;
if ($returnArray) {
$params = array();
if (isset($schema)) {
$params['schema'] = $schema;
}
if (isset($data)) {
$params['data'] = $data;
}
return $params;
} else {
return $schema;
}
} else {
if (preg_match('#a:[0-9]+:{#', $buf)) {
return unserialize(file_get_contents($filename));
} else {
eZDebug::writeError("Unknown format for file {$filename}");
return false;
}
}
}
return false;
}
示例7: getTimeline
public function getTimeline($pageID = false, $limit = 20, $type = 'feed')
{
$result = array('result' => array());
$accumulator = $this->debugAccumulatorGroup . '_facebook_timeline';
eZDebug::accumulatorStart($accumulator, $this->debugAccumulatorGroup, 'timeline');
$cacheFileHandler = $this->getCacheFileHandler('_timeline', array($pageID, $limit, $type));
try {
if ($this->isCacheExpired($cacheFileHandler)) {
eZDebug::writeDebug(array('page_id' => $pageID, 'limit' => $limit), self::$debugMessagesGroup);
$response = $this->API->api(($pageID === false ? 'me/home' : '/' . $pageID) . '/' . $type, array('access_token' => $this->acessToken, 'limit' => $limit));
$messages = array();
$currentTime = time();
foreach ($response['data'] as $message) {
$createdAt = strtotime($message['created_time']);
$message['created_ago'] = self::getCreatedAgoString($createdAt, $currentTime);
$message['created_timestamp'] = $createdAt;
if (isset($message['message'])) {
$message['message'] = self::fixMessageLinks($message['message']);
}
$messages[] = $message;
}
$cacheFileHandler->fileStoreContents($cacheFileHandler->filePath, serialize($messages));
} else {
$messages = unserialize($cacheFileHandler->fetchContents());
}
eZDebug::accumulatorStop($accumulator);
$result['result'] = $messages;
return $result;
} catch (Exception $e) {
eZDebug::accumulatorStop($accumulator);
eZDebug::writeError($e->getMessage(), self::$debugMessagesGroup);
return $result;
}
}
示例8: handleFileDownload
function handleFileDownload($contentObject, $contentObjectAttribute, $type, $fileInfo)
{
$fileName = $fileInfo['filepath'];
$file = eZClusterFileHandler::instance($fileName);
if ($fileName != "" and $file->exists()) {
$fileSize = $file->size();
if (isset($_SERVER['HTTP_RANGE']) && preg_match("/^bytes=(\\d+)-(\\d+)?\$/", trim($_SERVER['HTTP_RANGE']), $matches)) {
$fileOffset = $matches[1];
$contentLength = isset($matches[2]) ? $matches[2] - $matches[1] + 1 : $fileSize - $matches[1];
} else {
$fileOffset = 0;
$contentLength = $fileSize;
}
// Figure out the time of last modification of the file right way to get the file mtime ... the
$fileModificationTime = $file->mtime();
// stop output buffering, and stop the session so that browsing can be continued while downloading
eZSession::stop();
ob_end_clean();
eZFile::downloadHeaders($fileName, self::dispositionType($fileInfo['mime_type']) === 'attachment', false, $fileOffset, $contentLength, $fileSize);
try {
$file->passthrough($fileOffset, $contentLength);
} catch (eZClusterFileHandlerNotFoundException $e) {
eZDebug::writeError($e->getMessage, __METHOD__);
header($_SERVER["SERVER_PROTOCOL"] . ' 500 Internal Server Error');
} catch (eZClusterFileHandlerGeneralException $e) {
eZDebug::writeError($e->getMessage, __METHOD__);
header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
}
eZExecution::cleanExit();
}
return eZBinaryFileHandler::RESULT_UNAVAILABLE;
}
示例9: continueWorkflow
static function continueWorkflow($workflowProcessID)
{
$operationResult = null;
$theProcess = eZWorkflowProcess::fetch($workflowProcessID);
if ($theProcess != null) {
//restore memento and run it
$bodyMemento = eZOperationMemento::fetchChild($theProcess->attribute('memento_key'));
if ($bodyMemento === null) {
eZDebug::writeError($bodyMemento, "Empty body memento in workflow.php");
return $operationResult;
}
$bodyMementoData = $bodyMemento->data();
$mainMemento = $bodyMemento->attribute('main_memento');
if (!$mainMemento) {
return $operationResult;
}
$mementoData = $bodyMemento->data();
$mainMementoData = $mainMemento->data();
$mementoData['main_memento'] = $mainMemento;
$mementoData['skip_trigger'] = false;
$mementoData['memento_key'] = $theProcess->attribute('memento_key');
$bodyMemento->remove();
$operationParameters = array();
if (isset($mementoData['parameters'])) {
$operationParameters = $mementoData['parameters'];
}
$operationResult = eZOperationHandler::execute($mementoData['module_name'], $mementoData['operation_name'], $operationParameters, $mementoData);
}
return $operationResult;
}
示例10: attribute
/**
* Returns the specified attribute
*
* @param string $name
* @return mixed
*/
function attribute($name)
{
switch ($name) {
case 'tags':
return $this->tags();
break;
case 'tag_ids':
return $this->IDArray;
break;
case 'id_string':
return $this->idString();
break;
case 'keyword_string':
return $this->keywordString();
break;
case 'meta_keyword_string':
return $this->keywordString(", ");
break;
case 'parent_string':
return $this->parentString();
break;
default:
eZDebug::writeError("Attribute '{$name}' does not exist", "eZTags::attribute");
return null;
break;
}
}
示例11: sendMail
function sendMail(ezcMail $mail)
{
$ini = eZINI::instance();
$parameters = array();
$parameters['host'] = $ini->variable('MailSettings', 'TransportServer');
$parameters['helo'] = $ini->variable('MailSettings', 'TransportServer');
$parameters['port'] = $ini->variable('MailSettings', 'TransportPort');
$parameters['connectionType'] = $ini->variable('MailSettings', 'TransportConnectionType');
$user = $ini->variable('MailSettings', 'TransportUser');
$password = $ini->variable('MailSettings', 'TransportPassword');
if ($user and $password) {
$parameters['auth'] = true;
$parameters['user'] = $user;
$parameters['pass'] = $password;
}
$options = new ezcMailSmtpTransportOptions();
if ($parameters['connectionType']) {
$options->connectionType = $parameters['connectionType'];
}
$smtp = new ezcMailSmtpTransport($parameters['host'], $user, $password, $parameters['port'], $options);
try {
$smtp->send($mail);
return true;
} catch (ezcMailException $e) {
eZDebug::writeError("Error sending SMTP mail: " . $e->getMessage(), 'eZSMTPTransport::sendMail');
echo "SMTP ERROR: " . $e->getMessage();
return false;
}
return false;
}
示例12: install
function install($package, $installType, $parameters, $name, $os, $filename, $subdirectory, $content, &$installParameters, &$installData)
{
$path = $package->path();
$databaseType = false;
if (isset($parameters['database-type'])) {
$databaseType = $parameters['database-type'];
}
$path .= '/' . eZDBPackageHandler::sqlDirectory();
if ($databaseType) {
$path .= '/' . $databaseType;
}
if (file_exists($path)) {
$db = eZDB::instance();
$canInsert = true;
if ($databaseType and $databaseType != $db->databaseName()) {
$canInsert = false;
}
if ($canInsert) {
eZDebug::writeDebug("Installing SQL file {$path}/{$filename}");
$db->insertFile($path, $filename, false);
return true;
} else {
eZDebug::writeDebug("Skipping SQL file {$path}/{$filename}");
}
} else {
eZDebug::writeError("Could not find SQL file {$path}/{$filename}");
}
return false;
}
示例13: attribute
function attribute($name)
{
switch ($name) {
case 'input_xml':
return $this->inputXML();
break;
case 'edit_template_name':
return $this->editTemplateName();
break;
case 'information_template_name':
return $this->informationTemplateName();
break;
case 'aliased_type':
eZDebug::writeWarning("'aliased_type' is deprecated as of 4.1 and not in use anymore, meaning it will always return false.", __METHOD__);
return $this->AliasedType;
break;
case 'aliased_handler':
if ($this->AliasedHandler === null) {
$this->AliasedHandler = eZXMLText::inputHandler($this->XMLData, $this->AliasedType, false, $this->ContentObjectAttribute);
}
return $this->AliasedHandler;
break;
default:
eZDebug::writeError("Attribute '{$name}' does not exist", __METHOD__);
return null;
break;
}
}
示例14: attribute
function attribute($attr)
{
switch ($attr) {
case 'error_count':
return count($this->ErrorList);
break;
case 'error_list':
return $this->ErrorList;
break;
case 'warning_count':
return count($this->WarningList);
break;
case 'warning_list':
return $this->WarningList;
break;
case 'step_template':
return $this->stepTemplate();
break;
case 'variable_list':
return $this->variableList();
break;
case 'url':
return $this->WizardURL;
break;
default:
eZDebug::writeError("Attribute '{$attr}' does not exist", __METHOD__);
return null;
break;
}
}
示例15: create
static function create( $name, $command, $userID = false )
{
if ( trim( $name ) == '' )
{
eZDebug::writeError( 'Empty name. You must supply a valid script name string.', 'ezscriptmonitor' );
return false;
}
if ( trim( $command ) == '' )
{
eZDebug::writeError( 'Empty command. You must supply a valid command string.', 'ezscriptmonitor' );
return false;
}
if ( !$userID )
{
$userID = eZUser::currentUserID();
}
$scriptMonitorIni = eZINI::instance( 'ezscriptmonitor.ini' );
$scriptSiteAccess = $scriptMonitorIni->variable( 'GeneralSettings', 'ScriptSiteAccess' );
$command = str_replace( self::SCRIPT_NAME_STRING, $name, $command );
$command = str_replace( self::SITE_ACCESS_STRING, $scriptSiteAccess, $command );
// Negative progress means not started yet
return new self( array( 'name' => $name,
'command' => $command,
'last_report_timestamp' => time(),
'progress' => -1,
'user_id' => $userID ) );
}