• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP eZDebugSetting类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中eZDebugSetting的典型用法代码示例。如果您正苦于以下问题:PHP eZDebugSetting类的具体用法?PHP eZDebugSetting怎么用?PHP eZDebugSetting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了eZDebugSetting类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: run

 function run($url = '', $args = array())
 {
     if (empty($url)) {
         return '';
     }
     $args = array_merge($this->embed_defaults, $args);
     foreach ($this->handlers as $handler) {
         if (in_array('OCCustomEmbedHandlerInterface', class_implements($handler))) {
             if ($regex = call_user_func(array($handler, 'regex'))) {
                 if (preg_match($regex, $url, $matches)) {
                     if (false !== ($result = call_user_func(array($handler, 'callback'), $matches, $url, $args))) {
                         eZDebugSetting::writeNotice('ocembed', 'Autoembed has found url "' . $url . '" in ' . $handler, __METHOD__);
                         return $result;
                     }
                 }
             }
         }
     }
     $oembed = new OCoEmbed();
     $result = $oembed->get_html($url, $args);
     if ($result) {
         eZDebugSetting::writeNotice('ocembed', 'Autoembed has found url "' . $url . '" in a OEmbed provider', __METHOD__);
         if (!eZINI::instance('ocembed.ini')->hasVariable('Settings', 'DisableFixHttps')) {
             $result = str_replace('http://', '//', $result);
         }
         return $result;
     }
     // Still unknown
     eZDebugSetting::writeNotice('ocembed', 'Autoembed did not find url "' . $url . '"', __METHOD__);
     return array($this->maybe_make_link($url));
 }
开发者ID:rantoniazzi,项目名称:ocembed,代码行数:31,代码来源:ocembed.php


示例2: reportWarning

 /**
  * Show tidy warning
  */
 private function reportWarning()
 {
     $warning = tidy_get_error_buffer($this->tidy);
     if (!empty($warning)) {
         eZDebugSetting::writeWarning("extension-eztidy", "{$warning}", 'eZTidy::tidyCleaner()');
     }
 }
开发者ID:philandteds,项目名称:eztidy,代码行数:10,代码来源:eztidy.php


示例3: cleanupEmptyDirectories

 /**
  * Goes trough the directory path and removes empty directories, starting at
  * the leaf and deleting down until a non empty directory is reached.
  * If the path is not a directory, nothing will happen.
  *
  * @param string $path
  */
 public static function cleanupEmptyDirectories($path)
 {
     $dirpath = eZDir::dirpath($path);
     eZDebugSetting::writeDebug('kernel-clustering', "eZClusterFileHandler::cleanupEmptyDirectories( '{$dirpath}' )");
     if (is_dir($dirpath)) {
         eZDir::cleanupEmptyDirectories($dirpath);
     }
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:15,代码来源:ezclusterfilehandler.php


示例4: search

 function search($searchText, $params = array(), $searchTypes = array())
 {
     eZDebug::createAccumulator('Search', 'eZ Find');
     eZDebug::accumulatorStart('Search');
     $error = 'Server not running';
     $asObjects = isset($params['AsObjects']) ? $params['AsObjects'] : true;
     //distributed search: fields to return can be specified in 2 parameters
     $params['FieldsToReturn'] = isset($params['FieldsToReturn']) ? $params['FieldsToReturn'] : array();
     if (isset($params['DistributedSearch']['returnfields'])) {
         $params['FieldsToReturn'] = array_merge($params['FieldsToReturn'], $params['DistributedSearch']['returnfields']);
     }
     $coreToUse = null;
     $shardQueryPart = null;
     if ($this->UseMultiLanguageCores === true) {
         $languages = $this->SiteINI->variable('RegionalSettings', 'SiteLanguageList');
         if (array_key_exists($languages[0], $this->SolrLanguageShards)) {
             $coreToUse = $this->SolrLanguageShards[$languages[0]];
             if ($this->FindINI->variable('LanguageSearch', 'SearchMainLanguageOnly') != 'enabled') {
                 $shardQueryPart = array('shards' => implode(',', $this->SolrLanguageShardURIs));
             }
         }
         //eZDebug::writeNotice( $languages, __METHOD__ . ' languages' );
         eZDebug::writeNotice($shardQueryPart, __METHOD__ . ' shards');
         //eZDebug::writeNotice( $this->SolrLanguageShardURIs, __METHOD__ . ' this languagesharduris' );
     } else {
         $coreToUse = $this->Solr;
     }
     if ($this->SiteINI->variable('SearchSettings', 'AllowEmptySearch') == 'disabled' && trim($searchText) == '') {
         $error = 'Empty search is not allowed.';
         eZDebug::writeNotice($error, __METHOD__);
         $resultArray = null;
     } else {
         eZDebug::createAccumulator('Query build', 'eZ Find');
         eZDebug::accumulatorStart('Query build');
         $queryBuilder = new ezfeZPSolrQueryBuilder($this);
         $queryParams = $queryBuilder->buildSearch($searchText, $params, $searchTypes);
         if (!$shardQueryPart == null) {
             $queryParams = array_merge($shardQueryPart, $queryParams);
         }
         eZDebug::accumulatorStop('Query build');
         eZDebugSetting::writeDebug('extension-ezfind-query', $queryParams, 'Final query parameters sent to Solr backend');
         eZDebug::createAccumulator('Engine time', 'eZ Find');
         eZDebug::accumulatorStart('Engine time');
         $resultArray = $coreToUse->rawSearch($queryParams);
         eZDebug::accumulatorStop('Engine time');
     }
     if ($resultArray) {
         $searchCount = $resultArray['response']['numFound'];
         $objectRes = $this->buildResultObjects($resultArray, $searchCount, $asObjects, $params);
         $stopWordArray = array();
         eZDebug::accumulatorStop('Search');
         return array('SearchResult' => $objectRes, 'SearchCount' => $searchCount, 'StopWordArray' => $stopWordArray, 'SearchExtras' => new ezfSearchResultInfo($resultArray));
     } else {
         eZDebug::accumulatorStop('Search');
         return array('SearchResult' => false, 'SearchCount' => 0, 'StopWordArray' => array(), 'SearchExtras' => new ezfSearchResultInfo(array('error' => ezpI18n::tr('ezfind', $error))));
     }
 }
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:57,代码来源:ocsolr.php


示例5: modify

 function modify(&$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     switch ($operatorName) {
         case 'tidy_output':
             eZDebugSetting::writeNotice("extension-eztidy", "Use 'tidy_output' template operator", "eZTidy::tidyCleaner()");
             $tidy = eZTidy::instance('OutputFilter');
             $operatorValue = $tidy->tidyCleaner($operatorValue);
             break;
     }
 }
开发者ID:stevoland,项目名称:ez_sbase,代码行数:10,代码来源:tidyoutputoperator.php


示例6: execute

    function execute( $process, $event )
    {
        $parameters = $process->attribute( 'parameter_list' );
        $object = eZContentObject::fetch( $parameters['object_id'] );

        if ( !$object )
        {
            eZDebugSetting::writeError( 'kernel-workflow-waituntildate','The object with ID '.$parameters['object_id'].' does not exist.', 'eZApproveType::execute() object is unavailable' );
            return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
        }

        $version = $object->version( $parameters['version'] );
        $objectAttributes = $version->attribute( 'contentobject_attributes' );
        $waitUntilDateObject = $this->workflowEventContent( $event );
        $waitUntilDateEntryList = $waitUntilDateObject->attribute( 'classattribute_id_list' );
        $modifyPublishDate = $event->attribute( 'data_int1' );

        foreach ( array_keys( $objectAttributes ) as $key )
        {
            $objectAttribute = $objectAttributes[$key];
            $contentClassAttributeID = $objectAttribute->attribute( 'contentclassattribute_id' );
            if ( in_array( $objectAttribute->attribute( 'contentclassattribute_id' ), $waitUntilDateEntryList ) )
            {
                $dateTime = $objectAttribute->attribute( 'content' );
                if ( $dateTime instanceof eZDateTime or
                     $dateTime instanceof eZTime or
                     $dateTime instanceof eZDate )
                {
                    if ( time() < $dateTime->timeStamp() )
                    {
                        $this->setInformation( "Event delayed until " . $dateTime->toString( true ) );
                        $this->setActivationDate( $dateTime->timeStamp() );
                        return eZWorkflowType::STATUS_DEFERRED_TO_CRON_REPEAT;
                    }
                    else if ( $dateTime->isValid() and $modifyPublishDate )
                    {
                        $object->setAttribute( 'published', $dateTime->timeStamp() );
                        $object->store();
                    }
                    else
                    {
                        return eZWorkflowType::STATUS_ACCEPTED;
//                        return eZWorkflowType::STATUS_WORKFLOW_DONE;
                    }
                }
                else
                {
                    return eZWorkflowType::STATUS_ACCEPTED;
//                   return eZWorkflowType::STATUS_WORKFLOW_DONE;
                }
            }
        }
        return eZWorkflowType::STATUS_ACCEPTED;
//        return eZWorkflowType::STATUS_WORKFLOW_DONE;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:55,代码来源:ezwaituntildatetype.php


示例7: initializeEvent

 function initializeEvent($event, $params)
 {
     eZDebugSetting::writeDebug('kernel-notification', $params, 'params for type');
     $time = 0;
     if (array_key_exists('time', $params)) {
         $time = $params['time'];
     } else {
         $time = time();
     }
     $event->setAttribute('data_int1', $time);
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:11,代码来源:ezcurrenttimetype.php


示例8: passwordHasExpired

 /**
  * Writes audit information and redirects the user to the password change form.
  *
  * @param eZUser $user
  */
 protected static function passwordHasExpired($user)
 {
     $userID = $user->attribute('contentobject_id');
     // Password expired
     eZDebugSetting::writeDebug('kernel-user', $user, 'user password expired');
     // Failed login attempts should be logged
     $userIDAudit = isset($userID) ? $userID : 'null';
     $loginEscaped = eZDB::instance()->escapeString($user->attribute('login'));
     eZAudit::writeAudit('user-failed-login', array('User id' => $userIDAudit, 'User login' => $loginEscaped, 'Comment' => 'Failed login attempt: Password Expired. eZPaExUser::loginUser()'));
     // Redirect user to password change form
     self::redirectToChangePasswordForm($userID);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:17,代码来源:ezpaexuser.php


示例9: doSeek

 function doSeek($offset, $whence)
 {
     if ($whence == SEEK_SET) {
         $offset = $offset - gztell($this->File);
     } else {
         if ($whence == SEEK_END) {
             eZDebugSetting::writeError('lib-ezfile-gziplibz', "Seeking from end is not supported for gzipped files");
             return false;
         }
     }
     return @gzseek($this->File, $offset);
 }
开发者ID:legende91,项目名称:ez,代码行数:12,代码来源:ezgzipshellcompressionhandler.php


示例10: executeSending

 /**
  * Execute sending process in Email
  * @see extension/ezcomments/classes/ezcomNotificationManager#executeSending($subject, $body, $subscriber)
  */
 public function executeSending($subject, $body, $subscriber)
 {
     $email = $subscriber->attribute('email');
     $parameters = array();
     $parameters['content_type'] = $this->emailContentType;
     $parameters['from'] = $this->emailFrom;
     $transport = eZNotificationTransport::instance('ezmail');
     $result = $transport->send(array($email), $subject, $body, null, $parameters);
     if ($result === false) {
         throw new Exception('Send email error! Subscriber id:' . $subscriber->attribute('id'));
     }
     eZDebugSetting::writeNotice('extension-ezcomments', "An email has been sent to '{$email}' (subject: {$subject})", __METHOD__);
 }
开发者ID:ezsystems,项目名称:ezcomments-ls-extension,代码行数:17,代码来源:ezcomnotificationemailmanager.php


示例11: cachedTree

 static function cachedTree($key, $uri, $res, $templatePath, &$extraParameters)
 {
     $templateCache =& eZTemplateTreeCache::cacheTable();
     $key = eZTemplateTreeCache::internalKey($key);
     $root = null;
     if (isset($templateCache[$key])) {
         $root =& $templateCache[$key]['root'];
         eZDebugSetting::writeDebug('eztemplate-tree-cache', "Cache hit for uri '{$uri}' with key '{$key}'", 'eZTemplateTreeCache::cachedTree');
     } else {
         eZDebugSetting::writeDebug('eztemplate-tree-cache', "Cache miss for uri '{$uri}' with key '{$key}'", 'eZTemplateTreeCache::cachedTree');
     }
     return $root;
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:13,代码来源:eztemplatetreecache.php


示例12: handle

 function handle($event)
 {
     eZDebugSetting::writeDebug('kernel-notification', $event, "trying to handle event");
     if ($event->attribute('event_type_string') == 'ezcollaboration') {
         $parameters = array();
         $status = $this->handleCollaborationEvent($event, $parameters);
         if ($status == eZNotificationEventHandler::EVENT_HANDLED) {
             $this->sendMessage($event, $parameters);
         } else {
             return false;
         }
     }
     return true;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:14,代码来源:ezcollaborationnotificationhandler.php


示例13: create

 static function create($notificationEventTypeString)
 {
     $types =& $GLOBALS["eZNotificationEventTypes"];
     if (!isset($types[$notificationEventTypeString])) {
         eZDebugSetting::writeDebug('kernel-notification', $types, 'notification types');
         eZNotificationEventType::loadAndRegisterType($notificationEventTypeString);
         eZDebugSetting::writeDebug('kernel-notification', $types, 'notification types 2');
     }
     $def = null;
     if (isset($types[$notificationEventTypeString])) {
         $className = $types[$notificationEventTypeString];
         $def =& $GLOBALS["eZNotificationEventTypeObjects"][$notificationEventTypeString];
         if (!is_object($def) || strtolower(get_class($def)) != $className) {
             $def = new $className();
         }
     }
     return $def;
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:18,代码来源:eznotificationeventtype.php


示例14: setDateForItem

 static function setDateForItem($item, $settings)
 {
     if (!is_array($settings)) {
         return false;
     }
     $dayNum = isset($settings['day']) ? $settings['day'] : false;
     $hour = $settings['hour'];
     $currentDate = getdate();
     $hoursDiff = $hour - $currentDate['hours'];
     switch ($settings['frequency']) {
         case 'day':
             if ($hoursDiff <= 0) {
                 $hoursDiff += 24;
             }
             $secondsDiff = 3600 * $hoursDiff - $currentDate['seconds'] - 60 * $currentDate['minutes'];
             break;
         case 'week':
             $daysDiff = $dayNum - $currentDate['wday'];
             if ($daysDiff < 0 or $daysDiff == 0 and $hoursDiff <= 0) {
                 $daysDiff += 7;
             }
             $secondsDiff = 3600 * ($daysDiff * 24 + $hoursDiff) - $currentDate['seconds'] - 60 * $currentDate['minutes'];
             break;
         case 'month':
             // If the daynum the user has chosen is larger than the number of days in this month,
             // then reduce it to the number of days in this month.
             $daysInMonth = intval(date('t', mktime(0, 0, 0, $currentDate['mon'], 1, $currentDate['year'])));
             if ($dayNum > $daysInMonth) {
                 $dayNum = $daysInMonth;
             }
             $daysDiff = $dayNum - $currentDate['mday'];
             if ($daysDiff < 0 or $daysDiff == 0 and $hoursDiff <= 0) {
                 $daysDiff += $daysInMonth;
             }
             $secondsDiff = 3600 * ($daysDiff * 24 + $hoursDiff) - $currentDate['seconds'] - 60 * $currentDate['minutes'];
             break;
     }
     $sendDate = time() + $secondsDiff;
     eZDebugSetting::writeDebug('kernel-notification', getdate($sendDate), "item date");
     $item->setAttribute('send_date', $sendDate);
     return $sendDate;
 }
开发者ID:legende91,项目名称:ez,代码行数:42,代码来源:eznotificationschedule.php


示例15: move

 /**
  * Move file.
  *
  * \public
  */
 function move($dstPath)
 {
     $srcPath = $this->filePath;
     eZDebugSetting::writeDebug('kernel-clustering', "fs::move( '{$srcPath}', '{$dstPath}' )", __METHOD__);
     eZDebug::accumulatorStart('dbfile', false, 'dbfile');
     eZFileHandler::move($srcPath, $dstPath);
     eZDebug::accumulatorStop('dbfile');
 }
开发者ID:schwabokaner,项目名称:ezpublish-legacy,代码行数:13,代码来源:ezfsfilehandler.php


示例16: getEngine

    static function getEngine()
    {
        // Get instance if already created.
        $instanceName = "eZSearchPlugin_" . $GLOBALS["eZCurrentAccess"]["name"];
        if ( isset( $GLOBALS[$instanceName] ) )
        {
            return $GLOBALS[$instanceName];
        }

        $ini = eZINI::instance();

        $searchEngineString = 'ezsearch';
        if ( $ini->hasVariable( 'SearchSettings', 'SearchEngine' ) == true )
        {
            $searchEngineString = $ini->variable( 'SearchSettings', 'SearchEngine' );
        }

        $directoryList = array();
        if ( $ini->hasVariable( 'SearchSettings', 'ExtensionDirectories' ) )
        {
            $extensionDirectories = $ini->variable( 'SearchSettings', 'ExtensionDirectories' );
            if ( is_array( $extensionDirectories ) )
            {
                $directoryList = eZExtension::expandedPathList( $extensionDirectories, 'search/plugins' );
            }
        }

        $kernelDir = array( 'kernel/search/plugins' );
        $directoryList = array_merge( $kernelDir, $directoryList );

        foreach( $directoryList as $directory )
        {
            $searchEngineFile = implode( '/', array( $directory, strtolower( $searchEngineString ), strtolower( $searchEngineString ) ) ) . '.php';

            if ( file_exists( $searchEngineFile ) )
            {
                eZDebugSetting::writeDebug( 'kernel-search-ezsearch', 'Loading search engine from ' . $searchEngineFile, 'eZSearch::getEngine' );

                include_once( $searchEngineFile );
                $GLOBALS[$instanceName] = new $searchEngineString();
                return $GLOBALS[$instanceName];
            }
        }

        eZDebug::writeDebug( 'Unable to find the search engine:' . $searchEngineString, 'eZSearch' );
        eZDebug::writeDebug( 'Tried paths: ' . implode( ', ', $directoryList ), 'eZSearch' );
        return false;
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:48,代码来源:ezsearch.php


示例17: sendToPublishingQueue

 /**
  * Sends the published object/version for publishing to the queue
  * Used by the content/publish operation
  * @param int $objectId
  * @param int $version
  *
  * @return array( status => int )
  * @since 4.5
  */
 public static function sendToPublishingQueue($objectId, $version)
 {
     $behaviour = ezpContentPublishingBehaviour::getBehaviour();
     if ($behaviour->disableAsynchronousPublishing) {
         $asyncEnabled = false;
     } else {
         $asyncEnabled = eZINI::instance('content.ini')->variable('PublishingSettings', 'AsynchronousPublishing') == 'enabled';
     }
     $accepted = true;
     if ($asyncEnabled === true) {
         // Filter handlers
         $ini = eZINI::instance('content.ini');
         $filterHandlerClasses = $ini->variable('PublishingSettings', 'AsynchronousPublishingFilters');
         if (count($filterHandlerClasses)) {
             $versionObject = eZContentObjectVersion::fetchVersion($version, $objectId);
             foreach ($filterHandlerClasses as $filterHandlerClass) {
                 if (!class_exists($filterHandlerClass)) {
                     eZDebug::writeError("Unknown asynchronous publishing filter handler class '{$filterHandlerClass}'", __METHOD__);
                     continue;
                 }
                 $handler = new $filterHandlerClass($versionObject);
                 if (!$handler instanceof ezpAsynchronousPublishingFilterInterface) {
                     eZDebug::writeError("Asynchronous publishing filter handler class '{$filterHandlerClass}' does not implement ezpAsynchronousPublishingFilterInterface", __METHOD__);
                     continue;
                 }
                 $accepted = $handler->accept();
                 if (!$accepted) {
                     eZDebugSetting::writeDebug("Object #{$objectId}/{$version} was excluded from asynchronous publishing by {$filterHandlerClass}", __METHOD__);
                     break;
                 }
             }
         }
         unset($filterHandlerClasses, $handler);
     }
     if ($asyncEnabled && $accepted) {
         // if the object is already in the process queue, we move ahead
         // this test should NOT be necessary since http://issues.ez.no/17840 was fixed
         if (ezpContentPublishingQueue::isQueued($objectId, $version)) {
             return array('status' => eZModuleOperationInfo::STATUS_CONTINUE);
         } else {
             ezpContentPublishingQueue::add($objectId, $version);
             return array('status' => eZModuleOperationInfo::STATUS_HALTED, 'redirect_url' => "content/queued/{$objectId}/{$version}");
         }
     } else {
         return array('status' => eZModuleOperationInfo::STATUS_CONTINUE);
     }
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:56,代码来源:ezcontentoperationcollection.php


示例18: createHash

 static function createHash($user, $password, $site, $type, $hash = false)
 {
     $user = self::trimAuthString($user);
     $password = self::trimAuthString($password);
     $str = '';
     if ($type == self::PASSWORD_HASH_MD5_USER) {
         $str = md5("{$user}\n{$password}");
     } else {
         if ($type == self::PASSWORD_HASH_MD5_SITE) {
             $str = md5("{$user}\n{$password}\n{$site}");
         } else {
             if ($type == self::PASSWORD_HASH_MYSQL) {
                 $db = eZDB::instance();
                 $hash = $db->escapeString($password);
                 $str = $db->arrayQuery("SELECT PASSWORD( '{$hash}' )");
                 $hashes = array_values($str[0]);
                 $str = $hashes[0];
             } else {
                 if ($type == self::PASSWORD_HASH_PLAINTEXT) {
                     $str = $password;
                 } else {
                     $str = md5($password);
                 }
             }
         }
     }
     eZDebugSetting::writeDebug('kernel-user', $str, "ezuser({$type})");
     return $str;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:29,代码来源:ezuser.php


示例19: hasCompiledTemplate

 static function hasCompiledTemplate($key, $timestamp, &$resourceData)
 {
     if (!eZTemplateCompiler::isCompilationEnabled()) {
         return false;
     }
     if (eZTemplateCompiler::alwaysGenerate()) {
         return false;
     }
     $cacheFileName = eZTemplateCompiler::compilationFilename($key, $resourceData);
     $php = new eZPHPCreator(eZTemplateCompiler::compilationDirectory(), $cacheFileName, eZTemplateCompiler::TemplatePrefix());
     $canRestore = $php->canRestore($timestamp);
     $uri = false;
     if ($canRestore) {
         eZDebugSetting::writeDebug('eztemplate-compile', "Cache hit for uri '{$uri}' with key '{$key}'", 'eZTemplateCompiler::hasCompiledTemplate');
     } else {
         eZDebugSetting::writeDebug('eztemplate-compile', "Cache miss for uri '{$uri}' with key '{$key}'", 'eZTemplateCompiler::hasCompiledTemplate');
     }
     return $canRestore;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:19,代码来源:eztemplatecompiler.php


示例20: processCache

 /**
  * Same code as parent, with one extra eZPerfLogger::accumulatorStart/Stop call
  */
 function processCache($retrieveCallback, $generateCallback = null, $ttl = null, $expiry = null, $extraData = null)
 {
     $forceDB = false;
     $curtime = time();
     $tries = 0;
     $noCache = false;
     if ($expiry < 0) {
         $expiry = null;
     }
     if ($ttl < 0) {
         $ttl = null;
     }
     // Main loop
     while (true) {
         // Start read checks
         // Note: The while loop is used to make it easier to break out of the "read" code
         while (true) {
             // No retrieve method so go directly to generate+store
             if ($retrieveCallback === null || !$this->filePath) {
                 break;
             }
             if (!self::LOCAL_CACHE) {
                 $forceDB = true;
             } else {
                 if ($this->isLocalFileExpired($expiry, $curtime, $ttl)) {
                     // if we are in stale cache mode, we only forceDB if the
                     // file does not exist at all
                     if ($this->useStaleCache) {
                         if (!file_exists($this->filePath)) {
                             eZDebugSetting::writeDebug('kernel-clustering', "Local file '{$this->filePath}' does not exist and can not be used for stale cache. Checking with DB", __METHOD__);
                             $forceDB = true;
                             // forceDB + useStaleCache means that we should check for the DB file.
                         }
                     } else {
                         // Local file is older than global timestamp, check with DB
                         eZDebugSetting::writeDebug('kernel-clustering', "Local file (mtime=" . @filemtime($this->filePath) . ") is older than timestamp ({$expiry}) and ttl({$ttl}), check with DB", __METHOD__);
                         $forceDB = true;
                     }
                 }
             }
             if (!$forceDB) {
                 // check if DB file is deleted
                 if (!$this->useStaleCache && ($this->metaData === false || $this->metaData['mtime'] < 0)) {
                     if ($generateCallback !== false) {
                         eZDebugSetting::writeDebug('kernel-clustering', "Database file is deleted, need to regenerate data", __METHOD__);
                     } else {
                         eZDebugSetting::writeDebug('kernel-clustering', "Database file is deleted, cannot get data", __METHOD__);
                     }
                     break;
                 }
                 // check if FS file is older than DB file
                 if (!$this->useStaleCache && $this->isLocalFileExpired($this->metaData['mtime'], $curtime, $ttl)) {
                     eZDebugSetting::writeDebug('kernel-clustering', "Local file (mtime=" . @filemtime($this->filePath) . ") is older than DB, checking with DB", __METHOD__);
                     $forceDB = true;
                 } else {
                     if ($this->useStaleCache) {
                         // to get the retrieve callback to accept the cache file,
                         // we force its mtime to the current time
                         $mtime = $curtime;
                         eZDebugSetting::writeDebug('kernel-clustering', "Processing local stale cache file {$this->filePath}", __METHOD__);
                     } else {
                         $mtime = filemtime($this->filePath);
                         eZDebugSetting::writeDebug('kernel-clustering', "Processing local cache file {$this->filePath}", __METHOD__);
                     }
                     $args = array($this->filePath, $mtime);
                     if ($extraData !== null) {
                         $args[] = $extraData;
                     }
                     $retval = call_user_func_array($retrieveCallback, $args);
                     if ($retval instanceof eZClusterFileFailure) {
                         break;
                     }
                     return $retval;
                 }
             }
             if ($forceDB) {
                 // stale cache, and no DB or FS file available
                 if ($this->useStaleCache && $this->metaData === false) {
                     // configuration says we have to generate our own version
                     if ($this->nonExistantStaleCacheHandling[$this->cacheType] == 'generate') {
                         // no cache available, but a generate callback exists, skip to generation
                         if ($generateCallback !== false) {
                             eZDebugSetting::writeDebug('kernel-clustering', "Database file is deleted, need to regenerate data");
                             break;
                         } else {
                             eZDebugSetting::writeDebug('kernel-clustering', "Database file is deleted, cannot get data");
                             break 2;
                         }
                     } else {
                         eZPerfLogger::accumulatorStart('mysql_cluster_cache_waits', 'MySQL Cluster', 'Cache waits');
                         while ($this->remainingCacheGenerationTime-- >= 0) {
                             // we don't know if the file gets generated on the current
                             // frontend or not. However, we can still try the FS cache
                             // first, then the DB cache if FS is not found, since this
                             // will be much more efficient
                             if (!file_exists($this->filePath)) {
                                 $this->loadMetaData(true);
//.........这里部分代码省略.........
开发者ID:gggeek,项目名称:ezperformancelogger,代码行数:101,代码来源:ezdfstracingfilehandler.php



注:本文中的eZDebugSetting类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP eZDir类代码示例发布时间:2022-05-23
下一篇:
PHP eZDebug类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap