本文整理汇总了PHP中eZExecution::cleanup方法的典型用法代码示例。如果您正苦于以下问题:PHP eZExecution::cleanup方法的具体用法?PHP eZExecution::cleanup怎么用?PHP eZExecution::cleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZExecution
的用法示例。
在下文中一共展示了eZExecution::cleanup方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exitWithInternalError
function exitWithInternalError()
{
header( $_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error' );
eZExecution::cleanup();
eZExecution::setCleanExit();
}
示例2: defaultExceptionHandler
/**
* Installs the default Exception handler
*
* @params Exception the exception
* @return void
*/
static public function defaultExceptionHandler( Exception $e )
{
if( PHP_SAPI != 'cli' )
{
header( 'HTTP/1.x 500 Internal Server Error' );
header( 'Content-Type: text/html' );
echo "An unexpected error has occurred. Please contact the webmaster.<br />";
if( eZDebug::isDebugEnabled() )
{
echo $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine();
}
}
else
{
$cli = eZCLI::instance();
$cli->error( "An unexpected error has occurred. Please contact the webmaster.");
if( eZDebug::isDebugEnabled() )
{
$cli->error( $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() );
}
}
eZLog::write( 'Unexpected error, the message was : ' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine(), 'error.log' );
eZExecution::cleanup();
eZExecution::setCleanExit();
exit( 1 );
}
示例3: shutdown
/**
* Runs the shutdown process
*/
protected function shutdown($reInitialize = true)
{
eZExecution::cleanup();
eZExecution::setCleanExit();
eZExpiryHandler::shutdown();
if ($reInitialize) {
$this->isInitialized = false;
}
}
示例4: reportError
/**
* This is called whenever an error occurs in one of the database handlers.
*
* If a transaction is active it will be invalidated as well.
*
* @access protected
* @throws eZDBException
*/
function reportError()
{
// If we have a running transaction we must mark as invalid
// in which case a call to commit() will perform a rollback
if ($this->TransactionCounter > 0) {
$this->invalidateTransaction();
// This is the unique ID for this incidence which will also be placed in the error logs.
$transID = 'TRANSID-' . md5(time() . mt_rand());
eZDebug::writeError('Transaction in progress failed due to DB error, transaction was rollbacked. Transaction ID is ' . $transID . '.', 'eZDBInterface::commit ' . $transID);
$this->rollback();
if ($this->errorHandling == eZDB::ERROR_HANDLING_EXCEPTIONS) {
throw new eZDBException($this->ErrorMessage, $this->ErrorNumber);
} else {
// Stop execution immediately while allowing other systems (session etc.) to cleanup
eZExecution::cleanup();
eZExecution::setCleanExit();
// Give some feedback, and also possibly show the debug output
eZDebug::setHandleType(eZDebug::HANDLE_NONE);
$ini = eZINI::instance();
$adminEmail = $ini->variable('MailSettings', 'AdminEmail');
if (!eZSys::isShellExecution()) {
if (!headers_sent()) {
header("HTTP/1.1 500 Internal Server Error");
}
$site = eZSys::serverVariable('HTTP_HOST');
$uri = eZSys::serverVariable('REQUEST_URI');
print "<div class=\"fatal-error\" style=\"";
print 'margin: 0.5em 0 1em 0; ' . 'padding: 0.25em 1em 0.75em 1em;' . 'border: 4px solid #000000;' . 'background-color: #f8f8f4;' . 'border-color: #f95038;" >';
print "<b>Fatal error</b>: A database transaction in eZ Publish failed.<br/>";
print "<p>";
print "The current execution was stopped to prevent further problems.<br/>\n" . "You should contact the <a href=\"mailto:{$adminEmail}?subject=Transaction failed on {$site} and URI {$uri} with ID {$transID}\">System Administrator</a> of this site with the information on this page.<br/>\n" . "The current transaction ID is <b>{$transID}</b> and has been logged.<br/>\n" . "Please include the transaction ID and the current URL when contacting the system administrator.<br/>\n";
print "</p>";
print "</div>";
$templateResult = null;
if (function_exists('eZDisplayResult')) {
eZDisplayResult($templateResult);
}
} else {
fputs(STDERR, "Fatal error: A database transaction in eZ Publish failed.\n");
fputs(STDERR, "\n");
fputs(STDERR, "The current execution was stopped to prevent further problems.\n" . "You should contact the System Administrator ({$adminEmail}) of this site.\n" . "The current transaction ID is {$transID} and has been logged.\n" . "Please include the transaction ID and the name of the current script when contacting the system administrator.\n");
fputs(STDERR, "\n");
fputs(STDERR, eZDebug::printReport(false, false, true));
}
// PHP execution stops here
exit(1);
}
}
}
示例5: urlencode
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of version 2.0 of the GNU General
// Public License along with this program; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
// MA 02110-1301, USA.
//
//
// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
//
$http = eZHTTPTool::instance();
if ($Params['ObjectID']) {
$objectID = $Params['ObjectID'];
}
if ($http->hasPostVariable("ObjectID")) {
$objectID = $http->postVariable("ObjectID");
}
if (is_numeric($objectID)) {
$object = eZContentObject::fetch($objectID);
if ($object) {
$tpl = eZTemplate::factory();
$template = "design:parts/flash_player_embed_code.tpl";
$tpl->setVariable('object', $object);
$body = $tpl->fetch($template);
print "&result=" . urlencode(trim($body));
}
}
eZExecution::cleanup();
eZExecution::setCleanExit();
exit;
示例6: shutdown
function shutdown($exitCode = false, $exitText = false)
{
$cli = eZCLI::instance();
if (class_exists('eZDB') and eZDB::hasInstance()) {
$db = eZDB::instance(false, array('show_errors' => false));
// Perform transaction check
$transactionCounterCheck = eZDB::checkTransactionCounter();
if (isset($transactionCounterCheck['error'])) {
$cli->error($transactionCounterCheck['error']);
}
if ($this->UseSession and $db->isConnected()) {
eZUser::logoutCurrent();
eZSession::remove();
}
}
$webOutput = $cli->isWebOutput();
if ($this->UseDebugOutput or eZDebug::isDebugEnabled()) {
if ($this->DebugMessage) {
fputs(STDERR, $this->DebugMessage);
}
fputs(STDERR, eZDebug::printReport(false, $webOutput, true, $this->AllowedDebugLevels, $this->UseDebugAccumulators, $this->UseDebugTimingPoints, $this->UseIncludeFiles));
}
eZExecution::cleanup();
eZExecution::setCleanExit();
$this->setIsInitialized(false);
if ($exitCode !== false) {
$this->ExitCode = $exitCode;
}
if ($this->ExitCode !== false) {
if ($exitText !== false) {
$cli->output($exitText);
}
exit($this->ExitCode);
}
}
示例7: exitWithInternalError
/**
* Handles an internal error.
* If not using exceptions, will return an ezpKernelResult object with JSON encoded message.
*
* @param string $errorMessage
* @param int $errorCode
* @return ezpKernelResult
*
* @throws RuntimeException
* @throws ezpAccessDenied
*
* @see setUseExceptions()
*/
protected function exitWithInternalError($errorMessage, $errorCode = 500)
{
if (eZModule::$useExceptions) {
switch ($errorCode) {
case 403:
throw new ezpAccessDenied($errorMessage);
case 500:
default:
throw new RuntimeException($errorMessage, $errorCode);
}
} else {
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
eZExecution::cleanup();
eZExecution::setCleanExit();
return new ezpKernelResult(json_encode(array('error' => $errorMessage, 'code' => $errorCode)));
}
}
示例8: soft_redirect
public static function soft_redirect( $string )
{
if ( !headers_sent() )
{
header('Location: '.$string);
eZExecution::cleanup();
eZExecution::setCleanExit();
exit();
return '';
}
return '';
}