本文整理汇总了PHP中eZDB::checkTransactionCounter方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDB::checkTransactionCounter方法的具体用法?PHP eZDB::checkTransactionCounter怎么用?PHP eZDB::checkTransactionCounter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDB
的用法示例。
在下文中一共展示了eZDB::checkTransactionCounter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
示例2: multipleezjscServerCalls
function multipleezjscServerCalls($calls, $contentType = 'json')
{
$r = array();
foreach ($calls as $key => $call) {
$response = array('error_text' => '', 'content' => '');
if ($call instanceof ezjscServerRouter) {
try {
$response['content'] = $call->call();
} catch (Exception $e) {
$response['error_text'] = $e->getMessage();
}
} else {
$response['error_text'] = 'Not a valid ezjscServerRouter argument: "' . htmlentities($call, ENT_QUOTES) . '"';
}
$r[] = ezjscAjaxContent::autoEncode($response, $contentType);
}
return $r;
}
if ($debugOutput && ($contentType === 'xml' || $contentType === 'xhtml')) {
echo "<!--\r\n";
eZDebug::printReport(false, false);
echo "\r\n-->";
} else {
if ($debugOutput && $contentType === 'json') {
echo "/*\r\n";
eZDebug::printReport(false, false);
echo "\r\n*/";
}
}
eZDB::checkTransactionCounter();
eZExecution::cleanExit();
示例3: redirectTo
/**
* Sets the module to redirect at the end of the execution
*
* @param string $uri the URI to redirect to
*
* @see setRedirectURI(), setExitStatus()
*
* @return void
*/
function redirectTo($uri)
{
$originalURI = $uri;
$uri = preg_replace("#(^.*)(/+)\$#", "\$1", $uri);
if (strlen($originalURI) != 0 and strlen($uri) == 0) {
$uri = '/';
}
$urlComponents = parse_url($uri);
// eZSys::hostname() can contain port if present.
// So parsing it with parse_url() as well to only get host.
$currentHostname = eZSys::hostname();
$currentHostnameParsed = parse_url($currentHostname, PHP_URL_HOST);
$currentHostname = $currentHostnameParsed ? $currentHostnameParsed : $currentHostname;
if (isset($urlComponents['host']) && $urlComponents['host'] !== $currentHostname) {
$allowedHosts = $this->getAllowedRedirectHosts();
if (!isset($allowedHosts[$urlComponents['host']])) {
// Non-authorized host, return only the URI (without host) + query string and fragment if present.
eZDebug::writeError("Redirection requested on non-authorized host '{$urlComponents['host']}'");
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
echo "Redirection requested on non-authorized host";
eZDB::checkTransactionCounter();
eZExecution::cleanExit();
}
}
$this->RedirectURI = $uri;
$this->setExitStatus(self::STATUS_REDIRECT);
}
示例4: 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);
}
}
示例5: redirect
/**
* Performs a redirection
*/
protected function redirect()
{
$GLOBALS['eZRedirection'] = true;
$ini = eZINI::instance();
$automaticRedirect = true;
if ($GLOBALS['eZDebugAllowed'] && ($redirUri = $ini->variable('DebugSettings', 'DebugRedirection')) !== 'disabled') {
if ($redirUri == "enabled") {
$automaticRedirect = false;
} else {
$uri = eZURI::instance(eZSys::requestURI());
$uri->toBeginning();
foreach ($ini->variableArray("DebugSettings", "DebugRedirection") as $redirUri) {
$redirUri = new eZURI($redirUri);
if ($redirUri->matchBase($uri)) {
$automaticRedirect = false;
break;
}
}
}
}
$redirectURI = eZSys::indexDir();
$moduleRedirectUri = $this->module->redirectURI();
if ($ini->variable('URLTranslator', 'Translation') === 'enabled' && eZURLAliasML::urlTranslationEnabledByUri(new eZURI($moduleRedirectUri))) {
$translatedModuleRedirectUri = $moduleRedirectUri;
if (eZURLAliasML::translate($translatedModuleRedirectUri, true)) {
$moduleRedirectUri = $translatedModuleRedirectUri;
if (strlen($moduleRedirectUri) > 0 && $moduleRedirectUri[0] !== '/') {
$moduleRedirectUri = '/' . $moduleRedirectUri;
}
}
}
if (preg_match('#^(\\w+:)|^//#', $moduleRedirectUri)) {
$redirectURI = $moduleRedirectUri;
} else {
$leftSlash = strlen($redirectURI) > 0 && $redirectURI[strlen($redirectURI) - 1] === '/';
$rightSlash = strlen($moduleRedirectUri) > 0 && $moduleRedirectUri[0] === '/';
if (!$leftSlash && !$rightSlash) {
// Both are without a slash, so add one
$moduleRedirectUri = '/' . $moduleRedirectUri;
} else {
if ($leftSlash && $rightSlash) {
// Both are with a slash, so we remove one
$moduleRedirectUri = substr($moduleRedirectUri, 1);
}
}
$redirectURI .= $moduleRedirectUri;
}
eZStaticCache::executeActions();
eZDB::checkTransactionCounter();
if ($automaticRedirect) {
eZHTTPTool::redirect($redirectURI, array(), $this->module->redirectStatus());
} else {
// Make sure any errors or warnings are reported
if ($ini->variable('DebugSettings', 'DisplayDebugWarnings') === 'enabled') {
if (isset($GLOBALS['eZDebugError']) && $GLOBALS['eZDebugError']) {
eZAppendWarningItem(array('error' => array('type' => 'error', 'number' => 1, 'count' => $GLOBALS['eZDebugErrorCount']), 'identifier' => 'ezdebug-first-error', 'text' => ezpI18n::tr('index.php', 'Some errors occurred, see debug for more information.')));
}
if (isset($GLOBALS['eZDebugWarning']) && $GLOBALS['eZDebugWarning']) {
eZAppendWarningItem(array('error' => array('type' => 'warning', 'number' => 1, 'count' => $GLOBALS['eZDebugWarningCount']), 'identifier' => 'ezdebug-first-warning', 'text' => ezpI18n::tr('index.php', 'Some general warnings occured, see debug for more information.')));
}
}
$tpl = eZTemplate::factory();
$tpl->setVariable('site', $this->site);
$tpl->setVariable('warning_list', !empty($this->warningList) ? $this->warningList : false);
$tpl->setVariable('redirect_uri', eZURI::encodeURL($redirectURI));
$templateResult = $tpl->fetch('design:redirect.tpl');
eZDebug::addTimingPoint("Script end");
eZDisplayResult($templateResult);
}
eZExecution::cleanExit();
}
示例6: throwError
/**
* Throws an error message back to the user. This will stop all execution.
*
* @param {String} $str Message to send back to user.
*/
function throwError($str)
{
echo '{"result":null,"id":null,"error":{"errstr":"' . addslashes($str) . '","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}';
eZDB::checkTransactionCounter();
eZExecution::cleanExit();
}
示例7: redirectTo
/**
* Sets the module to redirect at the end of the execution
*
* @param string $uri the URI to redirect to
*
* @see setRedirectURI(), setExitStatus()
*
* @return void
*/
function redirectTo( $uri )
{
$originalURI = $uri;
$uri = preg_replace( "#(^.*)(/+)$#", "\$1", $uri );
if ( strlen( $originalURI ) != 0 and
strlen( $uri ) == 0 )
$uri = '/';
$urlComponents = parse_url( $uri );
if ( isset( $urlComponents['host'] ) && $urlComponents['host'] !== eZSys::hostname() )
{
$allowedHosts = $this->getAllowedRedirectHosts();
if ( !isset( $allowedHosts[$urlComponents['host']] ) )
{
// Non-authorized host, return only the URI (without host) + query string and fragment if present.
eZDebug::writeError( "Redirection requested on non-authorized host '{$urlComponents['host']}'" );
header( $_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden' );
echo "Redirection requested on non-authorized host";
eZDB::checkTransactionCounter();
eZExecution::cleanExit();
}
}
$this->RedirectURI = $uri;
$this->setExitStatus( eZModule::STATUS_REDIRECT );
}