当前位置: 首页>>代码示例>>PHP>>正文


PHP type\ObjectTypeCache类代码示例

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


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

示例1: rebuild

	/**
	 * @see	wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
	 */
	public function rebuild(array $parameters) {	
		// get object types
		$objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.versionableObject');
		
		$data = array(
			'versions' => array(),
			'versionIDs' => array()
		);	
		
		foreach ($objectTypes as $objectTypeID => $objectType) {
			$processorObject = $objectType->getProcessor();
			
			$sql = "SELECT	* 
				FROM	".$processorObject::getDatabaseVersionTableName();
			$statement = WCF::getDB()->prepareStatement($sql);
			$statement->execute(array());
			
			while ($row = $statement->fetchArray()) {
				$object = new $objectType->className(null, $row);
				$data['versions'][$objectTypeID][$object->{$processorObject::getDatabaseIndexName()}] = $object;
				$data['versionIDs'][$objectTypeID][$object->{$processorObject::getDatabaseIndexName()}][] = $object->{$processorObject::getDatabaseVersionTableIndexName()};
			}
		}
		
		return $data;
	}
开发者ID:0xLeon,项目名称:WCF,代码行数:29,代码来源:VersionCacheBuilder.class.php

示例2: rebuild

 /**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 protected function rebuild(array $parameters)
 {
     $data = array('boxes' => array(), 'pages' => array());
     // load boxes
     $boxList = new DashboardBoxList();
     $boxList->readObjects();
     foreach ($boxList as $box) {
         $data['boxes'][$box->boxID] = $box;
     }
     // load settings
     $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.user.dashboardContainer');
     $objectTypeIDs = array();
     foreach ($objectTypes as $objectType) {
         $objectTypeIDs[] = $objectType->objectTypeID;
     }
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("objectTypeID IN (?)", array($objectTypeIDs));
     $sql = "SELECT\t\t*\n\t\t\tFROM\t\twcf" . WCF_N . "_dashboard_option\n\t\t\t" . $conditions . "\n\t\t\tORDER BY\tshowOrder ASC";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute($conditions->getParameters());
     while ($row = $statement->fetchArray()) {
         if (!isset($data['pages'][$row['objectTypeID']])) {
             $data['pages'][$row['objectTypeID']] = array();
         }
         $data['pages'][$row['objectTypeID']][] = $row['boxID'];
     }
     return $data;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:31,代码来源:DashboardBoxCacheBuilder.class.php

示例3: execute

 /**
  * @see	\wcf\system\worker\IWorker::execute()
  */
 public function execute()
 {
     EventHandler::getInstance()->fireAction($this, 'execute');
     if (!$this->loopCount) {
         // delete existing stat
         $sql = "DELETE FROM\twcf" . WCF_N . "_stat_daily";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute();
     }
     // prepare insert statement
     $sql = "INSERT IGNORE INTO\twcf" . WCF_N . "_stat_daily\n\t\t\t\t\t\t(objectTypeID, date, counter, total)\n\t\t\tVALUES\t\t\t(?, ?, ?, ?)";
     $statement = WCF::getDB()->prepareStatement($sql);
     $this->getStartDate();
     $d = DateUtil::getDateTimeByTimestamp($this->startDate);
     $d->setTimezone(new \DateTimeZone(TIMEZONE));
     $d->setTime(0, 0);
     if ($this->loopCount) {
         $d->add(new \DateInterval('P' . $this->loopCount * $this->limit . 'D'));
     }
     for ($i = 0; $i < $this->limit; $i++) {
         if ($d->getTimestamp() > TIME_NOW) {
             break;
         }
         // get object types
         foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.statDailyHandler') as $objectType) {
             $data = $objectType->getProcessor()->getData($d->getTimestamp());
             $statement->execute(array($objectType->objectTypeID, $d->format('Y-m-d'), $data['counter'], $data['total']));
         }
         $d->add(new \DateInterval('P1D'));
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:34,代码来源:StatDailyRebuildDataWorker.class.php

示例4: __construct

 /**
  * Creates a new GroupedAttachmentList object.
  * 
  * @param	string		$objectType
  */
 public function __construct($objectType)
 {
     parent::__construct();
     $this->objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.attachment.objectType', $objectType);
     $this->getConditionBuilder()->add('attachment.objectTypeID = ?', array($this->objectType->objectTypeID));
     $this->getConditionBuilder()->add('(SELECT embeddedObjectID FROM wcf' . WCF_N . '_message_embedded_object WHERE messageObjectTypeID = ? AND messageID = attachment.objectID AND embeddedObjectTypeID = ? AND embeddedObjectID = attachment.attachmentID) IS NULL', array(ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.message', $objectType), ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.message.embeddedObject', 'com.woltlab.wcf.attachment')));
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:12,代码来源:GroupedAttachmentList.class.php

示例5: getLikedObject

 /**
  * Returns the liked object.
  * 
  * @return	\wcf\data\like\object\ILikeObject
  */
 public function getLikedObject()
 {
     if ($this->likedObject === null) {
         $this->likedObject = ObjectTypeCache::getInstance()->getObjectType($this->objectTypeID)->getProcessor()->getObjectByID($this->objectID);
     }
     return $this->likedObject;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:12,代码来源:LikeObject.class.php

示例6: execute

 /**
  * @see	\wcf\system\worker\IWorker::execute()
  */
 public function execute()
 {
     $this->objectList->getConditionBuilder()->add('conversation_message.messageID BETWEEN ? AND ?', array($this->limit * $this->loopCount + 1, $this->limit * $this->loopCount + $this->limit));
     parent::execute();
     if (!$this->loopCount) {
         // reset search index
         SearchIndexManager::getInstance()->reset('com.woltlab.wcf.conversation.message');
     }
     // prepare statements
     $attachmentObjectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.attachment.objectType', 'com.woltlab.wcf.conversation.message');
     $sql = "SELECT\t\tCOUNT(*) AS attachments\n\t\t\tFROM\t\twcf" . WCF_N . "_attachment\n\t\t\tWHERE\t\tobjectTypeID = ?\n\t\t\t\t\tAND objectID = ?";
     $attachmentStatement = WCF::getDB()->prepareStatement($sql);
     foreach ($this->objectList as $message) {
         SearchIndexManager::getInstance()->add('com.woltlab.wcf.conversation.message', $message->messageID, $message->message, $message->subject ?: '', $message->time, $message->userID, $message->username);
         $editor = new ConversationMessageEditor($message);
         $data = array();
         // count attachments
         $attachmentStatement->execute(array($attachmentObjectType->objectTypeID, $message->messageID));
         $row = $attachmentStatement->fetchSingleRow();
         $data['attachments'] = $row['attachments'];
         // update embedded objects
         $data['hasEmbeddedObjects'] = MessageEmbeddedObjectManager::getInstance()->registerObjects('com.woltlab.wcf.conversation.message', $message->messageID, $message->message) ? 1 : 0;
         $editor->update($data);
     }
 }
开发者ID:wouka,项目名称:com.woltlab.wcf.conversation,代码行数:28,代码来源:ConversationMessageRebuildDataWorker.class.php

示例7: init

 /**
  * @see	\wcf\system\SingletonFactory::init()
  */
 protected function init()
 {
     // load locations
     foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.user.online.location') as $objectType) {
         $this->locations[$objectType->controller] = $objectType;
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:10,代码来源:UserOnlineLocationHandler.class.php

示例8: getProcessor

 /**
  * @see	wcf\data\ProcessibleDatabaseObject::getProcessor()
  */
 public function getProcessor()
 {
     if ($this->processor === null) {
         if ($this->className) {
             if (!class_exists($this->className)) {
                 throw new SystemException("Unable to find class '" . $this->className . "'");
             }
             /*
             	TODO:
             	Why should the class implement IDatabaseObjectProcessor? Given the fact,
             	that the default implementation IObjectTypeProvider does not decorate the
             	objects itself - instead it provides methods to receive the required objects.
             
             if (!ClassUtil::isInstanceOf($this->className, 'wcf\data\IDatabaseObjectProcessor')) {
             	throw new SystemException("'".$this->className."' should implement wcf\data\IDatabaseObjectProcessor");
             }
             */
             if (($definitionInterface = ObjectTypeCache::getInstance()->getDefinition($this->definitionID)->interfaceName) && !ClassUtil::isInstanceOf($this->className, $definitionInterface)) {
                 throw new SystemException("'" . $this->className . "' should implement " . $definitionInterface);
             }
             if (ClassUtil::isInstanceOf($this->className, 'wcf\\system\\SingletonFactory')) {
                 $this->processor = call_user_func(array($this->className, 'getInstance'));
             } else {
                 $this->processor = new $this->className($this);
             }
         }
     }
     return $this->processor;
 }
开发者ID:ZerGabriel,项目名称:WCF,代码行数:32,代码来源:ObjectType.class.php

示例9: init

 /**
  * @see	\wcf\system\SingletonFactory::init()
  */
 protected function init()
 {
     $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.captcha');
     foreach ($objectTypes as $objectType) {
         $this->objectTypes[$objectType->objectTypeID] = $objectType;
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:10,代码来源:CaptchaHandler.class.php

示例10: save

 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     $this->label = 'wcf.acp.label.label' . $this->labelObj->labelID;
     if (I18nHandler::getInstance()->isPlainValue('label')) {
         I18nHandler::getInstance()->remove($this->label);
         $this->label = I18nHandler::getInstance()->getValue('label');
     } else {
         I18nHandler::getInstance()->save('label', $this->label, 'wcf.acp.label', 1);
     }
     // update label
     $this->objectAction = new LabelAction(array($this->labelID), 'update', array('data' => array_merge($this->additionalFields, array('label' => $this->label, 'cssClassName' => $this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName, 'groupID' => $this->groupID))));
     $this->objectAction->executeAction();
     $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.label.objectType');
     foreach ($objectTypes as $objectType) {
         $objectType->getProcessor()->save();
     }
     $this->saved();
     // reset values if non-custom value was choosen
     if ($this->cssClassName != 'custom') {
         $this->customCssClassName = '';
     }
     // show success
     WCF::getTPL()->assign(array('success' => true));
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:28,代码来源:LabelEditForm.class.php

示例11: __construct

 /**
  * Fetches the information of the latest edit.
  * 
  * @see	\wcf\data\DatabaseObjectDecorator::__construct()
  */
 public function __construct(DatabaseObject $object)
 {
     parent::__construct($object);
     $objectTypeID = ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.modifiableContent', 'de.incendium.cms.news.entry');
     $sql = "SELECT\t*\n\t\t\tFROM\twcf" . WCF_N . "_modification_log\n\t\t\tWHERE\t\tobjectTypeID = ?\n\t\t\t\tAND\tobjectID = ?\n\t\t\t\tAND\taction = ?\n\t\t\tORDER BY time DESC";
     $statement = WCF::getDB()->prepareStatement($sql, 1);
     $statement->execute(array($objectTypeID, $this->getDecoratedObject()->entryID, 'edit'));
     $row = $statement->fetchArray();
     if ($row) {
         $this->userID = $row['userID'];
         $this->username = $row['username'];
         $this->time = $row['time'];
         $additionalData = @unserialize($row['additionalData']);
         if (isset($additionalData['reason'])) {
             $this->reason = $additionalData['reason'];
         } else {
             $this->reason = '';
         }
     } else {
         $this->userID = $this->getDecoratedObject()->getUserID();
         $this->username = $this->getDecoratedObject()->getUsername();
         $this->time = $this->getDecoratedObject()->getTime();
         $this->reason = '';
     }
 }
开发者ID:Griborim,项目名称:de.incendium.cms.news,代码行数:30,代码来源:HistorySavingEntry.class.php

示例12: readParameters

 /**
  * @see	\wcf\page\IPage::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['id'])) {
         $this->objectTypeID = intval($_REQUEST['id']);
     }
     // load object type
     $objectTypeDefinition = ObjectTypeCache::getInstance()->getDefinitionByName('com.woltlab.wcf.user.dashboardContainer');
     $this->objectType = ObjectTypeCache::getInstance()->getObjectType($this->objectTypeID);
     if ($this->objectType === null || $this->objectType->definitionID != $objectTypeDefinition->definitionID) {
         throw new IllegalLinkException();
     }
     // load available boxes
     $allowedBoxTypes = array();
     if ($this->objectType->allowcontent) {
         $allowedBoxTypes[] = 'content';
     }
     if ($this->objectType->allowsidebar) {
         $allowedBoxTypes[] = 'sidebar';
     }
     if (empty($allowedBoxTypes)) {
         // this should not happen unless you go full retard
         throw new IllegalLinkException();
     }
     $boxList = new DashboardBoxList();
     $boxList->getConditionBuilder()->add("dashboard_box.boxType IN (?)", array($allowedBoxTypes));
     $boxList->readObjects();
     $this->boxes = $boxList->getObjects();
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:32,代码来源:DashboardOptionForm.class.php

示例13: getObjectType

 /**
  * @see	\wcf\data\like\object\ILikeObject::getObjectType()
  */
 public function getObjectType()
 {
     if ($this->objectType === null) {
         $this->objectType = ObjectTypeCache::getInstance()->getObjectType($this->getDecoratedObject()->objectTypeID);
     }
     return $this->objectType;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:10,代码来源:LikeableComment.class.php

示例14: rebuild

 /**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 public function rebuild(array $parameters)
 {
     if (!isset($parameters['definitionID'])) {
         throw new SystemException("Missing 'definitionID' parameter");
     }
     $definition = ObjectTypeCache::getInstance()->getDefinition($parameters['definitionID']);
     if ($definition === null) {
         throw new SystemException("Unknown object type definition with id '" . $parameters['definitionID'] . "'");
     }
     $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes($definition->definitionName);
     if (empty($objectTypes)) {
         return array();
     }
     $objectTypeIDs = array();
     foreach ($objectTypes as $objectType) {
         $objectTypeIDs[] = $objectType->objectTypeID;
     }
     $conditionList = new ConditionList();
     $conditionList->getConditionBuilder()->add('condition_table.objectTypeID IN (?)', array($objectTypeIDs));
     $conditionList->readObjects();
     $groupedConditions = array();
     foreach ($conditionList as $condition) {
         if (!isset($groupedConditions[$condition->objectID])) {
             $groupedConditions[$condition->objectID] = array();
         }
         $groupedConditions[$condition->objectID][$condition->conditionID] = $condition;
     }
     return $groupedConditions;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:32,代码来源:ConditionCacheBuilder.class.php

示例15: init

 /**
  * @see	\wcf\system\SingletonFactory::init()
  */
 protected function init()
 {
     $this->objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.user.activityPointEvent');
     foreach ($this->objectTypes as $objectType) {
         $this->objectTypeNames[$objectType->objectTypeID] = $objectType->objectType;
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:10,代码来源:UserActivityPointHandler.class.php


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