本文整理汇总了PHP中eZDB::setErrorHandling方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDB::setErrorHandling方法的具体用法?PHP eZDB::setErrorHandling怎么用?PHP eZDB::setErrorHandling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDB
的用法示例。
在下文中一共展示了eZDB::setErrorHandling方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Main method: infinite method that monitors queued objects, and starts
* the publishinbg processes if allowed
*
* @return void
*/
public function run()
{
// use DB exceptions so that errors can be fully handled
eZDB::setErrorHandling( eZDB::ERROR_HANDLING_EXCEPTIONS );
$this->cleanupDeadProcesses();
while ( $this->canProcess )
{
try {
/**
* @var ezpContentPublishingProcess
*/
$publishingItem = call_user_func( array( $this->queueReader, 'next' ) );
if ( $publishingItem !== false )
{
if ( !$this->isSlotAvailable() )
{
$this->out->write( "No slot is available", 'async.log' );
sleep ( 1 );
continue;
}
else
{
$this->out->write( "Processing item #" . $publishingItem->attribute( 'ezcontentobject_version_id' ), 'async.log' );
$pid = $publishingItem->publish();
pcntl_signal( SIGINT, $this->signalHandler );
$this->currentJobs[$pid] = $publishingItem;
// In the event that a signal for this pid was caught before we get here, it will be in our
// signalQueue array
// Process it now as if we'd just received the signal
if( isset( $this->signalQueue[$pid] ) )
{
$this->out->write( "found $pid in the signal queue, processing it now" );
$this->childSignalHandler( SIGCHLD, $pid, $this->signalQueue[$pid] );
unset( $this->signalQueue[$pid] );
}
}
}
else
{
sleep( $this->sleepInterval );
}
} catch ( eZDBException $e ) {
$this->out->write( "Database error #" . $e->getCode() . ": " . $e->getMessage() );
// force the DB connection closed so that it is recreated
try {
$db = eZDB::instance();
$db->close();
$db = null;
eZDB::setInstance( null );
} catch( eZDBException $e ) {
// Do nothing, this will be retried until the DB is back up
}
sleep( 1 );
}
}
}