當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Logger::debug方法代碼示例

本文整理匯總了PHP中Pimcore\Logger::debug方法的典型用法代碼示例。如果您正苦於以下問題:PHP Logger::debug方法的具體用法?PHP Logger::debug怎麽用?PHP Logger::debug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Pimcore\Logger的用法示例。


在下文中一共展示了Logger::debug方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // display error message
     if (!$input->getOption("mode")) {
         $this->writeError("Please specify the mode!");
         exit;
     }
     $db = \Pimcore\Db::get();
     if ($input->getOption("mode") == "optimize") {
         $tables = $db->fetchAll("SHOW TABLES");
         foreach ($tables as $table) {
             $t = current($table);
             try {
                 Logger::debug("Running: OPTIMIZE TABLE " . $t);
                 $db->query("OPTIMIZE TABLE " . $t);
             } catch (\Exception $e) {
                 Logger::error($e);
             }
         }
     } elseif ($input->getOption("mode") == "warmup") {
         $tables = $db->fetchAll("SHOW TABLES");
         foreach ($tables as $table) {
             $t = current($table);
             try {
                 Logger::debug("Running: SELECT COUNT(*) FROM {$t}");
                 $res = $db->fetchOne("SELECT COUNT(*) FROM {$t}");
                 Logger::debug("Result: " . $res);
             } catch (\Exception $e) {
                 Logger::error($e);
             }
         }
     }
 }
開發者ID:pimcore,項目名稱:pimcore,代碼行數:33,代碼來源:MysqlToolsCommand.php

示例2: stopCrawler

 /**
  * @static
  * @return bool
  */
 public static function stopCrawler()
 {
     \Pimcore\Logger::debug('LuceneSearch: forcing frontend crawler stop');
     self::setStopLock('frontend', FALSE);
     self::setCrawlerState('frontend', 'finished', FALSE);
     return TRUE;
 }
開發者ID:dachcom-digital,項目名稱:pimcore-lucene-search,代碼行數:11,代碼來源:Executer.php

示例3: registerPlugin

 /**
  * @param AbstractPlugin $plugin
  * @param null $stackIndex
  * @return $this
  * @throws \Exception
  */
 public function registerPlugin(AbstractPlugin $plugin, $stackIndex = null)
 {
     if (false !== array_search($plugin, $this->_plugins, true)) {
         throw new \Exception('Plugin already registered');
     }
     //installed?
     if (!$plugin::isInstalled()) {
         if (is_object($plugin)) {
             $className = get_class($plugin);
             Logger::debug("Not registering plugin [ " . $className . " ] because it is not installed");
         } else {
             Logger::debug("Not registering plugin, it is not an object");
         }
         return $this;
     }
     $stackIndex = (int) $stackIndex;
     if ($stackIndex) {
         if (isset($this->_plugins[$stackIndex])) {
             throw new \Exception('Plugin with stackIndex "' . $stackIndex . '" already registered');
         }
         $this->_plugins[$stackIndex] = $plugin;
     } else {
         $stackIndex = count($this->_plugins);
         while (isset($this->_plugins[$stackIndex])) {
             ++$stackIndex;
         }
         $this->_plugins[$stackIndex] = $plugin;
     }
     ksort($this->_plugins);
     $plugin->init();
     return $this;
 }
開發者ID:pimcore,項目名稱:pimcore,代碼行數:38,代碼來源:Broker.php

示例4: getDb

 /**
  * @return \Zend_Db_Adapter_Abstract
  */
 protected function getDb()
 {
     if (!$this->db) {
         // we're using a new mysql connection here to avoid problems with active (nested) transactions
         Logger::debug("Initialize dedicated MySQL connection for the cache adapter");
         $this->db = Db::getConnection();
     }
     return $this->db;
 }
開發者ID:pimcore,項目名稱:pimcore,代碼行數:12,代碼來源:MysqlTable.php

示例5: generateSitemap

 public function generateSitemap()
 {
     $this->prepareSiteMapFolder();
     if (!is_null($this->sitemapDir)) {
         $hosts = $this->getValidHosts();
         if (is_array($hosts)) {
             foreach ($hosts as $hostName) {
                 $query = new \Zend_Search_Lucene_Search_Query_Boolean();
                 $hostTerm = new \Zend_Search_Lucene_Index_Term($hostName, 'host');
                 $hostQuery = new \Zend_Search_Lucene_Search_Query_Term($hostTerm);
                 $query->addSubquery($hostQuery, TRUE);
                 $hostTerm = new \Zend_Search_Lucene_Index_Term(TRUE, 'restrictionGroup_default');
                 $hostQuery = new \Zend_Search_Lucene_Search_Query_Term($hostTerm);
                 $query->addSubquery($hostQuery, TRUE);
                 $hits = $this->index->find($query);
                 $name = str_replace('.', '-', $hostName);
                 $filePath = $this->sitemapDir . '/sitemap-' . $name . '.xml';
                 $fh = fopen($filePath, 'w');
                 fwrite($fh, '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n");
                 fwrite($fh, '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
                 fwrite($fh, "\r\n");
                 for ($i = 0; $i < count($hits); $i++) {
                     $url = $hits[$i]->getDocument()->getField('url');
                     $uri = str_replace(array('?pimcore_outputfilters_disabled=1', '&pimcore_outputfilters_disabled=1'), '', $url->value);
                     fwrite($fh, '<url>' . "\r\n");
                     fwrite($fh, '    <loc>' . htmlspecialchars($uri, ENT_QUOTES) . '</loc>' . "\r\n");
                     fwrite($fh, '</url>' . "\r\n");
                 }
                 fwrite($fh, '</urlset>' . "\r\n");
                 fclose($fh);
             }
             $filePath = $this->sitemapDir . '/sitemap.xml';
             $fh = fopen($filePath, 'w');
             fwrite($fh, '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n");
             fwrite($fh, '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
             fwrite($fh, "\r\n");
             foreach ($hosts as $hostName) {
                 $name = str_replace('.', '-', $hostName);
                 //first host must be main domain - see hint in plugin settings
                 $currenthost = $hosts[0];
                 fwrite($fh, '<sitemap>' . "\r\n");
                 fwrite($fh, '    <loc>http://' . $currenthost . '/plugin/LuceneSearch/frontend/sitemap/?sitemap=sitemap-' . $name . '.xml' . '</loc>' . "\r\n");
                 fwrite($fh, '</sitemap>' . "\r\n");
                 \Pimcore\Logger::debug('LuceneSearch: ' . $hostName . ' for sitemap.xml added.');
             }
             fwrite($fh, '</sitemapindex>' . "\r\n");
             fclose($fh);
         } else {
             \Pimcore\Logger::debug('LuceneSearch: could not generate sitemaps, did not find any hosts in index.');
         }
     } else {
         \Pimcore\Logger::emerg('LuceneSearch: Cannot generate sitemap. Sitemap directory [ ' . $this->sitemapDir . ' ]  not available/not writeable and cannot be created');
     }
 }
開發者ID:dachcom-digital,項目名稱:pimcore-lucene-search,代碼行數:54,代碼來源:SitemapBuilder.php

示例6: validateAction

 /**
  * Validates that a transition between requested states can be done on an element
  * NOTE: DOES NOT VALIDATE FIELDS @see performAction
  * @param $actionName
  * @param $newStatus
  * @param $newState
  * @return bool
  */
 public function validateAction($actionName, $newState, $newStatus)
 {
     $element = $this->element;
     if (!$this->workflow->isGlobalAction($actionName)) {
         $availableActions = $this->getAvailableActions();
         //check the action is available
         if (!array_key_exists($actionName, $availableActions)) {
             $this->error = "Workflow::validateTransition, Action [{$actionName}] not available for element [{$element->getId()}] with status [{$this->getElementStatus()}]";
             Logger::debug($this->error);
             return false;
         }
         $actionToTake = $availableActions[$actionName];
         if ($this->actionHasTransition($actionToTake)) {
             //check that the new state is correct for the action taken
             if (!array_key_exists($newState, $actionToTake['transitionTo'])) {
                 $this->error = "Workflow::validateTransition, State [{$newState}] not a valid transition state for action [{$actionName}] from status [{$this->getElementStatus()}]";
                 Logger::debug($this->error);
                 return false;
             }
             $availableNewStatuses = $actionToTake['transitionTo'][$newState];
             //check that the new status is valid for the action taken
             if (!in_array($newStatus, $availableNewStatuses)) {
                 $this->error = "Workflow::validateTransition, Status [{$newState}] not a valid transition status for action [{$actionName}] from status [{$this->getElementStatus()}]";
                 Logger::debug($this->error);
                 return false;
             }
         }
     }
     return true;
 }
開發者ID:pimcore,項目名稱:pimcore,代碼行數:38,代碼來源:Manager.php

示例7: createBackendSearchQuery

 /**
  * @param $queryStr
  * @param null $type
  * @param null $subtype
  * @param null $classname
  * @param null $modifiedRange
  * @param null $createdRange
  * @param null $userOwner
  * @param null $userModification
  * @param bool $countOnly
  */
 protected function createBackendSearchQuery($queryStr, $type = null, $subtype = null, $classname = null, $modifiedRange = null, $createdRange = null, $userOwner = null, $userModification = null, $countOnly = false)
 {
     if ($countOnly) {
         $selectFields = " count(*) as count ";
     } else {
         $selectFields = " * ";
     }
     $this->backendQuery = "SELECT " . $selectFields . "\n                FROM search_backend_data d\n                WHERE (d.data like ? OR properties like ? )";
     $this->backendQueryParams = ["%{$queryStr}%", "%{$queryStr}%"];
     if (!empty($type)) {
         $this->backendQuery .= " AND maintype = ? ";
         $this->backendQueryParams[] = $type;
     }
     if (!empty($subtype)) {
         $this->backendQuery .= " AND type = ? ";
         $this->backendQueryParams[] = $subtype;
     }
     if (!empty($classname)) {
         $this->backendQuery .= " AND subtype = ? ";
         $this->backendQueryParams[] = $classname;
     }
     if (is_array($modifiedRange)) {
         if ($modifiedRange[0] != null) {
             $this->backendQuery .= " AND modificationDate >= ? ";
             $this->backendQueryParams[] = $modifiedRange[0];
         }
         if ($modifiedRange[1] != null) {
             $this->backendQuery .= " AND modificationDate <= ? ";
             $this->backendQueryParams[] = $modifiedRange[1];
         }
     }
     if (is_array($createdRange)) {
         if ($createdRange[0] != null) {
             $this->backendQuery .= " AND creationDate >= ? ";
             $this->backendQueryParams[] = $createdRange[0];
         }
         if ($createdRange[1] != null) {
             $this->backendQuery .= " AND creationDate <= ? ";
             $this->backendQueryParams[] = $createdRange[1];
         }
     }
     if (!empty($userOwner)) {
         $this->backendQuery .= " AND userOwner = ? ";
         $this->backendQueryParams[] = $userOwner;
     }
     if (!empty($userModification)) {
         $this->backendQuery .= " AND userModification = ? ";
         $this->backendQueryParams[] = $userModification;
     }
     Logger::debug($this->backendQuery);
     Logger::debug($this->backendQueryParams);
 }
開發者ID:pimcore,項目名稱:pimcore,代碼行數:63,代碼來源:Backend.php

示例8: getConnection

 /**
  * @param bool $raw
  * @param bool $writeOnly
  * @return Wrapper|\Zend_Db_Adapter_Abstract
  * @throws \Exception
  * @throws \Zend_Db_Profiler_Exception
  */
 public static function getConnection($raw = false, $writeOnly = false)
 {
     // just return the wrapper (for compatibility reasons)
     // the wrapper itself get's then the connection using $raw = true
     if (!$raw) {
         return new Wrapper();
     }
     $charset = "UTF8";
     // explicit set charset for connection (to the adapter)
     $config = Config::getSystemConfig()->database->toArray();
     // write only handling
     if ($writeOnly && isset($config["writeOnly"])) {
         // overwrite params with write only configuration
         $config["params"] = $config["writeOnly"]["params"];
     } else {
         if ($writeOnly) {
             throw new \Exception("writeOnly connection is requested but not configured");
         }
     }
     $config["params"]["charset"] = $charset;
     try {
         $db = \Zend_Db::factory($config["adapter"], $config["params"]);
         $db->query("SET NAMES " . $charset);
     } catch (\Exception $e) {
         \Logger::emerg($e);
         \Pimcore\Tool::exitWithError("Database Error! See debug.log for details");
     }
     // try to set innodb as default storage-engine
     try {
         $db->query("SET storage_engine=InnoDB;");
     } catch (\Exception $e) {
         \Logger::warn($e);
     }
     // try to set mysql mode
     try {
         $db->query("SET sql_mode = '';");
     } catch (\Exception $e) {
         \Logger::warn($e);
     }
     $connectionId = $db->fetchOne("SELECT CONNECTION_ID()");
     // enable the db-profiler if the devmode is on and there is no custom profiler set (eg. in system.xml)
     if (PIMCORE_DEVMODE && !$db->getProfiler()->getEnabled() || array_key_exists("pimcore_log", $_REQUEST) && \Pimcore::inDebugMode()) {
         $profiler = new \Pimcore\Db\Profiler('All DB Queries');
         $profiler->setEnabled(true);
         $profiler->setConnectionId($connectionId);
         $db->setProfiler($profiler);
     }
     \Logger::debug(get_class($db) . ": Successfully established connection to MySQL-Server, Process-ID: " . $connectionId);
     return $db;
 }
開發者ID:sfie,項目名稱:pimcore,代碼行數:57,代碼來源:Db.php

示例9: storeToCache

 /**
  * Write's an item to the cache // don't use the logger inside here
  * @param $data
  * @param $key
  * @param array $tags
  * @param null $lifetime
  * @param null $priority
  * @param bool $force
  * @return bool|void
  */
 public static function storeToCache($data, $key, $tags = array(), $lifetime = null, $priority = null, $force = false)
 {
     if (!self::$enabled) {
         return;
     }
     // don't put anything into the cache, when cache is cleared
     if (in_array("__CLEAR_ALL__", self::$clearedTagsStack) && !$force) {
         return;
     }
     // do not cache hardlink-wrappers
     if ($data instanceof Document\Hardlink\Wrapper\WrapperInterface) {
         return;
     }
     // $priority is currently just for sorting the items in self::addToSaveStack()
     // maybe it will be added to prioritize items for backends with volatile memories
     // get cache instance
     if ($cache = self::getInstance()) {
         //if ($lifetime !== null) {
         //    $cache->setLifetime($lifetime);
         //}
         if ($data instanceof Element\ElementInterface) {
             // check for currupt data
             if ($data->getId() < 1) {
                 return;
             }
             if (isset($data->_fulldump)) {
                 unset($data->_fulldump);
             }
             // get dependencies for this element
             $tags = $data->getCacheTags($tags);
             $type = get_class($data);
             \Logger::debug("prepared " . $type . " " . $data->getId() . " for data cache with tags: " . implode(",", $tags));
         }
         // check for cleared tags, only item which are not cleared within the same session are stored to the cache
         if (is_array($tags)) {
             foreach ($tags as $t) {
                 if (in_array($t, self::$clearedTagsStack)) {
                     \Logger::debug("Aborted caching for key: " . $key . " because it is in the clear stack");
                     return;
                 }
             }
         } else {
             $tags = array();
         }
         // always add the key as tag
         $tags[] = $key;
         // array_values() because the tags from \Element_Interface and some others are associative eg. array("object_123" => "object_123")
         $tags = array_values($tags);
         if (is_object($data) && isset($data->____pimcore_cache_item__)) {
             unset($data->____pimcore_cache_item__);
         }
         $key = self::$cachePrefix . $key;
         if ($lifetime === null) {
             $lifetime = false;
             // set to false otherwise the lifetime stays at null (\Zend_Cache_Backend::getLifetime())
         }
         $success = $cache->save($data, $key, $tags, $lifetime);
         if ($success !== true) {
             \Logger::error("Failed to add entry {$key} to the cache, item-size was " . formatBytes(strlen(serialize($data))));
         }
         \Logger::debug("Added " . $key . " to cache");
         return $success;
     }
 }
開發者ID:pokleh,項目名稱:pimcore,代碼行數:74,代碼來源:Cache.php

示例10: update


//.........這裏部分代碼省略.........
             }
         }
     }
     $this->db->insertOrUpdate("object_store_" . $this->model->getClassId(), $data);
     // get data for query table
     $data = [];
     $this->inheritanceHelper->resetFieldsToCheck();
     $oldData = $this->db->fetchRow("SELECT * FROM object_query_" . $this->model->getClassId() . " WHERE oo_id = ?", $this->model->getId());
     $inheritanceEnabled = $this->model->getClass()->getAllowInherit();
     $parentData = null;
     if ($inheritanceEnabled) {
         // get the next suitable parent for inheritance
         $parentForInheritance = $this->model->getNextParentForInheritance();
         if ($parentForInheritance) {
             // we don't use the getter (built in functionality to get inherited values) because we need to avoid race conditions
             // we cannot Object\AbstractObject::setGetInheritedValues(true); and then $this->model->$method();
             // so we select the data from the parent object using FOR UPDATE, which causes a lock on this row
             // so the data of the parent cannot be changed while this transaction is on progress
             $parentData = $this->db->fetchRow("SELECT * FROM object_query_" . $this->model->getClassId() . " WHERE oo_id = ? FOR UPDATE", $parentForInheritance->getId());
         }
     }
     foreach ($fieldDefinitions as $key => $fd) {
         if ($fd->getQueryColumnType()) {
             //exclude untouchables if value is not an array - this means data has not been loaded
             if (!(in_array($key, $untouchable) and !is_array($this->model->{$key}))) {
                 $method = "get" . $key;
                 $fieldValue = $this->model->{$method}();
                 $insertData = $fd->getDataForQueryResource($fieldValue, $this->model);
                 $isEmpty = $fd->isEmpty($fieldValue);
                 if (is_array($insertData)) {
                     $columnNames = array_keys($insertData);
                     $data = array_merge($data, $insertData);
                 } else {
                     $columnNames = [$key];
                     $data[$key] = $insertData;
                 }
                 // if the current value is empty and we have data from the parent, we just use it
                 if ($isEmpty && $parentData) {
                     foreach ($columnNames as $columnName) {
                         if (array_key_exists($columnName, $parentData)) {
                             $data[$columnName] = $parentData[$columnName];
                             if (is_array($insertData)) {
                                 $insertData[$columnName] = $parentData[$columnName];
                             } else {
                                 $insertData = $parentData[$columnName];
                             }
                         }
                     }
                 }
                 if ($inheritanceEnabled && $fd->getFieldType() != "calculatedValue") {
                     //get changed fields for inheritance
                     if ($fd->isRelationType()) {
                         if (is_array($insertData)) {
                             $doInsert = false;
                             foreach ($insertData as $insertDataKey => $insertDataValue) {
                                 if ($isEmpty && $oldData[$insertDataKey] == $parentData[$insertDataKey]) {
                                     // do nothing, ... value is still empty and parent data is equal to current data in query table
                                 } elseif ($oldData[$insertDataKey] != $insertDataValue) {
                                     $doInsert = true;
                                     break;
                                 }
                             }
                             if ($doInsert) {
                                 $this->inheritanceHelper->addRelationToCheck($key, $fd, array_keys($insertData));
                             }
                         } else {
                             if ($isEmpty && $oldData[$key] == $parentData[$key]) {
                                 // do nothing, ... value is still empty and parent data is equal to current data in query table
                             } elseif ($oldData[$key] != $insertData) {
                                 $this->inheritanceHelper->addRelationToCheck($key, $fd);
                             }
                         }
                     } else {
                         if (is_array($insertData)) {
                             foreach ($insertData as $insertDataKey => $insertDataValue) {
                                 if ($isEmpty && $oldData[$insertDataKey] == $parentData[$insertDataKey]) {
                                     // do nothing, ... value is still empty and parent data is equal to current data in query table
                                 } elseif ($oldData[$insertDataKey] != $insertDataValue) {
                                     $this->inheritanceHelper->addFieldToCheck($insertDataKey, $fd);
                                 }
                             }
                         } else {
                             if ($isEmpty && $oldData[$key] == $parentData[$key]) {
                                 // do nothing, ... value is still empty and parent data is equal to current data in query table
                             } elseif ($oldData[$key] != $insertData) {
                                 // data changed, do check and update
                                 $this->inheritanceHelper->addFieldToCheck($key, $fd);
                             }
                         }
                     }
                 }
             } else {
                 Logger::debug("Excluding untouchable query value for object [ " . $this->model->getId() . " ]  key [ {$key} ] because it has not been loaded");
             }
         }
     }
     $data["oo_id"] = $this->model->getId();
     $this->db->insertOrUpdate("object_query_" . $this->model->getClassId(), $data);
     Object\AbstractObject::setGetInheritedValues($inheritedValues);
 }
開發者ID:pimcore,項目名稱:pimcore,代碼行數:101,代碼來源:Dao.php

示例11: maintenanceJob

 /**
  * Hook called when maintenance script is called
  */
 public function maintenanceJob()
 {
     if (self::isInstalled()) {
         $currentHour = date('H', time());
         //Frontend recrawl
         $running = self::frontendCrawlerRunning();
         $enabled = Configuration::get('frontend.enabled');
         $lastStarted = Configuration::getCoreSetting('started');
         $lastFinished = Configuration::getCoreSetting('finished');
         $forceStart = Configuration::getCoreSetting('forceStart');
         $aDayAgo = time() - 24 * 60 * 60;
         /**
          * + If Crawler is enabled
          * + If Crawler is not running
          * + If last start of Crawler is initial or a day ago
          * + If it's between 1 + 3 o clock in the night
          * + OR if its force
          * => RUN
          */
         if ($enabled && !$running && ((is_bool($lastStarted) || $lastStarted <= $aDayAgo) && $currentHour > 1 && $currentHour < 3 || $forceStart)) {
             \Pimcore\Logger::debug('starting frontend recrawl...');
             $this->frontendCrawl();
             /**
              * + If Crawler is Running
              * + If last stop of crawler is before last start
              * + If last start is older than one day
              * => We have some errors: EXIT CRAWLING!
              */
         } else {
             if ($running && $lastFinished < $lastStarted && $lastStarted <= $aDayAgo) {
                 \Pimcore\Logger::error('LuceneSearch: There seems to be a problem with the search crawler! Trying to stop it.');
                 $this->stopFrontendCrawler();
             }
         }
     } else {
         \Pimcore\Logger::debug('LuceneSearch: Plugin is not installed - no maintenance to do for this plugin.');
     }
 }
開發者ID:dachcom-digital,項目名稱:pimcore-lucene-search,代碼行數:41,代碼來源:Plugin.php

示例12: logEvent

 protected function logEvent($name, GenericEvent $event)
 {
     if ($this->debug === TRUE) {
         \Pimcore\Logger::debug('LuceneSearch [' . $name . ']: ' . $event->getArgument('uri')->toString());
     }
 }
開發者ID:dachcom-digital,項目名稱:pimcore-lucene-search,代碼行數:6,代碼來源:Logger.php

示例13: getForCsvExport

 /**
  * converts object data to a simple string value or CSV Export
  * @abstract
  * @param Object\AbstractObject $object
  * @param array $params
  * @return string
  */
 public function getForCsvExport($object, $params = [])
 {
     Logger::debug("csv not supported");
     //TODO
 }
開發者ID:pimcore,項目名稱:pimcore,代碼行數:12,代碼來源:CalculatedValue.php

示例14: maintenanceCleanUp

 /**
  *
  */
 public function maintenanceCleanUp()
 {
     $conf["document"] = Config::getSystemConfig()->documents->versions;
     $conf["asset"] = Config::getSystemConfig()->assets->versions;
     $conf["object"] = Config::getSystemConfig()->objects->versions;
     $elementTypes = [];
     foreach ($conf as $elementType => $tConf) {
         if (intval($tConf->days) > 0) {
             $versioningType = "days";
             $value = intval($tConf->days);
         } else {
             $versioningType = "steps";
             $value = intval($tConf->steps);
         }
         if ($versioningType) {
             $elementTypes[] = ["elementType" => $elementType, $versioningType => $value];
         }
     }
     $ignoredIds = [];
     while (true) {
         $versions = $this->getDao()->maintenanceGetOutdatedVersions($elementTypes, $ignoredIds);
         if (count($versions) == 0) {
             break;
         }
         $counter = 0;
         Logger::debug("versions to check: " . count($versions));
         if (is_array($versions) && !empty($versions)) {
             $totalCount = count($versions);
             foreach ($versions as $index => $id) {
                 try {
                     $version = Version::getById($id);
                 } catch (\Exception $e) {
                     $ignoredIds[] = $id;
                     Logger::debug("Version with " . $id . " not found\n");
                     continue;
                 }
                 $counter++;
                 // do not delete public versions
                 if ($version->getPublic()) {
                     $ignoredIds[] = $version->getId();
                     continue;
                 }
                 if ($version->getCtype() == "document") {
                     $element = Document::getById($version->getCid());
                 } elseif ($version->getCtype() == "asset") {
                     $element = Asset::getById($version->getCid());
                 } elseif ($version->getCtype() == "object") {
                     $element = Object::getById($version->getCid());
                 }
                 if ($element instanceof ElementInterface) {
                     Logger::debug("currently checking Element-ID: " . $element->getId() . " Element-Type: " . Element\Service::getElementType($element) . " in cycle: " . $counter . "/" . $totalCount);
                     if ($element->getModificationDate() >= $version->getDate()) {
                         // delete version if it is outdated
                         Logger::debug("delete version: " . $version->getId() . " because it is outdated");
                         $version->delete();
                     } else {
                         $ignoredIds[] = $version->getId();
                         Logger::debug("do not delete version (" . $version->getId() . ") because version's date is newer than the actual modification date of the element. Element-ID: " . $element->getId() . " Element-Type: " . Element\Service::getElementType($element));
                     }
                 } else {
                     // delete version if the corresponding element doesn't exist anymore
                     Logger::debug("delete version (" . $version->getId() . ") because the corresponding element doesn't exist anymore");
                     $version->delete();
                 }
                 // call the garbage collector if memory consumption is > 100MB
                 if (memory_get_usage() > 100000000) {
                     \Pimcore::collectGarbage();
                 }
             }
         }
     }
 }
開發者ID:pimcore,項目名稱:pimcore,代碼行數:75,代碼來源:Version.php

示例15: queryEnd

 /**
  * Intercept the query end and log the profiling data.
  *
  * @param  integer $queryId
  * @throws \Zend_Db_Profiler_Exception
  * @return void
  */
 public function queryEnd($queryId)
 {
     $state = parent::queryEnd($queryId);
     if (!$this->getEnabled() || $state == self::IGNORED) {
         return;
     }
     $profile = $this->getQueryProfile($queryId);
     $this->_totalElapsedTime += $profile->getElapsedSecs();
     $this->_totalQueries++;
     $logEntry = $profile->getQuery() . " | " . implode(",", $profile->getQueryParams());
     Logger::debug($logEntry, ["connection" => $this->getConnectionId(), "queryNum" => $this->_totalQueries, "time" => (string) round($profile->getElapsedSecs(), 5)]);
     $this->queries[] = ["time" => $profile->getElapsedSecs(), "query" => $profile->getQuery() . " | " . implode(",", $profile->getQueryParams())];
 }
開發者ID:pimcore,項目名稱:pimcore,代碼行數:20,代碼來源:Profiler.php


注:本文中的Pimcore\Logger::debug方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。