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


PHP WCF::getCache方法代码示例

本文整理汇总了PHP中WCF::getCache方法的典型用法代码示例。如果您正苦于以下问题:PHP WCF::getCache方法的具体用法?PHP WCF::getCache怎么用?PHP WCF::getCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WCF的用法示例。


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

示例1: execute

 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.template.canDeleteTemplate');
     if (!count($this->templateID)) {
         throw new IllegalLinkException();
     }
     // delete templates (files)
     $templateIDs = '';
     require_once WCF_DIR . 'lib/data/template/TemplateEditor.class.php';
     $sql = "SELECT\t\ttemplate.*, pack.templatePackFolderName, package.packageDir\n\t\t\tFROM\t\twcf" . WCF_N . "_template template\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_template_pack pack\n\t\t\tON\t\t(pack.templatePackID = template.templatePackID)\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_package package\n\t\t\tON\t\t(package.packageID = template.packageID)\n\t\t\tWHERE\t\ttemplate.templateID IN (" . implode(',', $this->templateID) . ")\n\t\t\t\t\tAND template.templatePackID > 0";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         if (!empty($templateIDs)) {
             $templateIDs .= ',';
         }
         $templateIDs .= $row['templateID'];
         $template = new TemplateEditor(null, $row);
         if ($template->templateID) {
             $template->deleteFile();
         }
     }
     // delete database entries
     if (!empty($templateIDs)) {
         TemplateEditor::deleteAll($templateIDs);
     }
     // reset cache
     WCF::getCache()->clear(WCF_DIR . 'cache', 'cache.templates-*.php');
     $this->executed();
     // forward to list page
     HeaderUtil::redirect('index.php?page=TemplateList&deletedTemplates=' . count($this->templateID) . '&templatePackID=' . $this->templatePackID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:37,代码来源:TemplateDeleteAction.class.php

示例2: loadSearchTypeObjects

 /**
  * Loads the search type objects.
  */
 public static function loadSearchTypeObjects()
 {
     if (self::$searchTypeObjects !== null) {
         return;
     }
     // get cache
     WCF::getCache()->addResource('searchableMessageTypes-' . PACKAGE_ID, WCF_DIR . 'cache/cache.searchableMessageTypes-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderSearchableMessageType.class.php');
     self::$searchTypeData = WCF::getCache()->get('searchableMessageTypes-' . PACKAGE_ID);
     // get objects
     self::$searchTypeObjects = array();
     foreach (self::$searchTypeData as $type) {
         // calculate class path
         $path = '';
         if (empty($type['packageDir'])) {
             $path = WCF_DIR;
         } else {
             $path = FileUtil::getRealPath(WCF_DIR . $type['packageDir']);
         }
         // include class file
         if (!file_exists($path . $type['classPath'])) {
             throw new SystemException("unable to find class file '" . $path . $type['classPath'] . "'", 11000);
         }
         require_once $path . $type['classPath'];
         // create instance
         $className = StringUtil::getClassName($type['classPath']);
         if (!class_exists($className)) {
             throw new SystemException("unable to find class '" . $className . "'", 11001);
         }
         self::$searchTypeObjects[$type['typeName']] = new $className();
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:34,代码来源:SearchEngine.class.php

示例3: loadCache

 /**
  * @see TreeMenu::loadCache()
  */
 protected function loadCache()
 {
     parent::loadCache();
     WCF::getCache()->addResource('userProfileMenu-' . PACKAGE_ID, WCF_DIR . 'cache/cache.userProfileMenu-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderUserProfileMenu.class.php');
     $this->menuItems = WCF::getCache()->get('userProfileMenu-' . PACKAGE_ID);
     EventHandler::fireAction($this, 'loadedCache');
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:10,代码来源:UserProfileMenu.class.php

示例4: execute

 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (MODULE_TEAM_LIST) {
         if ($eventName == 'readFormParameters') {
             if (isset($_POST['showOnTeamPage'])) {
                 $this->showOnTeamPage = intval($_POST['showOnTeamPage']);
             }
             if (isset($_POST['teamPagePosition'])) {
                 $this->teamPagePosition = intval($_POST['teamPagePosition']);
             }
         } else {
             if ($eventName == 'save') {
                 $eventObj->additionalFields['showOnTeamPage'] = $this->showOnTeamPage;
                 $eventObj->additionalFields['teamPagePosition'] = $this->teamPagePosition;
                 if (!$eventObj instanceof GroupEditForm) {
                     $this->showOnTeamPage = $this->teamPagePosition = 0;
                 }
                 // clear cache
                 WCF::getCache()->clear(WCF_DIR . 'cache', 'cache.teamCount.php');
             } else {
                 if ($eventName == 'assignVariables') {
                     if (!count($_POST) && $eventObj instanceof GroupEditForm) {
                         $this->showOnTeamPage = $eventObj->group->showOnTeamPage;
                         $this->teamPagePosition = $eventObj->group->teamPagePosition;
                     }
                     WCF::getTPL()->assign(array('showOnTeamPage' => $this->showOnTeamPage, 'teamPagePosition' => $this->teamPagePosition));
                     WCF::getTPL()->append('additionalFields', WCF::getTPL()->fetch('groupAddShowOnTeamPage'));
                 }
             }
         }
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:35,代码来源:GroupAddFormShowOnTeamPageListener.class.php

示例5: getPromotions

 /**
  * hide promotion for active user
  */
 protected static function getPromotions()
 {
     $languageID = WCF::getLanguage()->getLanguageID();
     $cacheName = 'contest.promotion-' . PACKAGE_ID . '-' . $languageID;
     WCF::getCache()->addResource($cacheName, WCF_DIR . 'cache/' . $cacheName . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderContestPromotion.class.php', 0, 3600);
     return (array) WCF::getCache()->get($cacheName);
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:10,代码来源:ContestPromotionUtil.class.php

示例6: save

 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     //save activation token into database
     $token = StringUtil::getRandomID();
     $sql = 'INSERT INTO wcf' . WCF_N . '_' . $this->subscriberTable . "\n        \t\t(email)\n        \t\t\tVALUES\n        \t\t('" . escapeString($this->email) . "')";
     WCF::getDB()->sendQuery($sql);
     $subscriberID = WCF::getDB()->getInsertID();
     //clears cache
     WCF::getCache()->clear(WCF_DIR . 'cache/', 'cache.newsletter-subscriber-' . PACKAGE_ID . '.php', true);
     $sql = 'INSERT INTO wcf' . WCF_N . '_' . $this->activationTable . '
     		(subscriberID, token)
     			VALUES
     		(' . intval($subscriberID) . ", '" . escapeString($token) . "')";
     WCF::getDB()->sendQuery($sql);
     $url = PAGE_URL . '/index.php?action=NewsletterGuestActivate&id=' . $subscriberID . '&t=' . $token;
     $subject = WCF::getLanguage()->get('wcf.acp.newsletter.optin.subject');
     $content = WCF::getLanguage()->getDynamicVariable('wcf.acp.newsletter.optin.text', array('username' => WCF::getLanguage()->get('wcf.acp.newsletter.optin.hello'), 'url' => $url));
     WCF::getTPL()->assign(array('subject' => $subject, 'content' => $content));
     $output = WCF::getTPL()->fetch('validationEmail');
     $mail = new Mail($this->email, $subject, $output, MESSAGE_NEWSLETTERSYSTEM_GENERAL_FROM);
     $mail->setContentType('text/html');
     $mail->send();
     $this->saved();
     WCF::getTPL()->assign(array('message' => WCF::getLanguage()->get('wcf.acp.newsletter.optin.activationPending'), 'url' => PAGE_URL . '/index.php?page=Index' . SID_ARG_2ND));
     WCF::getTPL()->display('redirect');
     exit;
 }
开发者ID:CaribeSoy,项目名称:Newsletter-System,代码行数:31,代码来源:NewsletterRegisterGuestForm.class.php

示例7: renderBoards

 /**
  * Renders the list of boards.
  */
 public function renderBoards()
 {
     // get unread threads
     $this->readUnreadThreads();
     // get boards
     $this->readBoards();
     // assign data
     WCF::getTPL()->assign('boards', $this->boards);
     WCF::getTPL()->assign('unreadThreadsCount', $this->unreadThreadsCount);
     // show newest posts
     if (BOARD_LIST_ENABLE_LAST_POST) {
         $lastPosts = WCF::getCache()->get('boardData', 'lastPosts');
         if (is_array($lastPosts)) {
             $visibleLanguages = false;
             if (count(WCF::getSession()->getVisibleLanguageIDArray())) {
                 $visibleLanguages = WCF::getSession()->getVisibleLanguageIDArray();
             }
             foreach ($lastPosts as $boardID => $languages) {
                 foreach ($languages as $languageID => $row) {
                     if (!$languageID || !$visibleLanguages || in_array($languageID, $visibleLanguages)) {
                         $this->lastPosts[$row['boardID']] = new DatabaseObject($row);
                         continue 2;
                     }
                 }
             }
         }
         WCF::getTPL()->assign('lastPosts', $this->lastPosts);
     }
     // stats
     if (BOARD_LIST_ENABLE_STATS) {
         WCF::getTPL()->assign('boardStats', WCF::getCache()->get('boardData', 'counts'));
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:36,代码来源:SubscribedBoardList.class.php

示例8: save

 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // save
     $updateOptionValueUpdate = '';
     foreach ($this->activeOptions as $option) {
         if ($option['defaultValue'] != $option['optionValue']) {
             $sql = "UPDATE\twcf" . WCF_N . "_user_option\n\t\t\t\t\tSET\tdefaultValue = '" . escapeString($option['optionValue']) . "'\n\t\t\t\t\tWHERE\toptionID = " . $option['optionID'];
             WCF::getDB()->sendQuery($sql);
             if (!empty($updateOptionValueUpdate)) {
                 $updateOptionValueUpdate .= ',';
             }
             $updateOptionValueUpdate .= 'userOption' . $option['optionID'] . "='" . escapeString($option['optionValue']) . "'";
         }
     }
     // apply to existing users
     if ($this->applyChangesToExistingUsers == 1 && !empty($updateOptionValueUpdate)) {
         $sql = "UPDATE\twcf" . WCF_N . "_user_option_value\n\t\t\t\tSET\t" . $updateOptionValueUpdate;
         WCF::getDB()->sendQuery($sql);
         // reset sessions
         Session::resetSessions();
     }
     // reset cache
     WCF::getCache()->clearResource($this->cacheName . PACKAGE_ID);
     // show success message
     WCF::getTPL()->assign('success', true);
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:30,代码来源:UserOptionSetDefaultsForm.class.php

示例9: execute

 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // count board
     $sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twbb" . WBB_N . "_board";
     $row = WCF::getDB()->getFirstRow($sql);
     $count = $row['count'];
     // get board ids
     $boardIDs = '';
     $sql = "SELECT\t\tboardID\n\t\t\tFROM\t\twbb" . WBB_N . "_board\n\t\t\tORDER BY\tboardID";
     $result = WCF::getDB()->sendQuery($sql, $this->limit, $this->limit * $this->loop);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $boardIDs .= ',' . $row['boardID'];
         // update last post
         $board = new BoardEditor($row['boardID']);
         $board->setLastPosts();
     }
     if (empty($boardIDs)) {
         // clear board cache
         WCF::getCache()->clear(WBB_DIR . 'cache', 'cache.boardData.php');
         $this->calcProgress();
         $this->finish();
     }
     // update boards
     $sql = "UPDATE\twbb" . WBB_N . "_board board\n\t\t\tSET\tthreads = (\n\t\t\t\t\tSELECT\tCOUNT(*)\n\t\t\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\t\t\tWHERE\tboardID = board.boardID\n\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t),\n\t\t\t\tposts = (\n\t\t\t\t\tSELECT\tIFNULL(SUM(replies), 0) + COUNT(*)\n\t\t\t\t\tFROM\twbb" . WBB_N . "_thread thread\n\t\t\t\t\tWHERE\tboardID = board.boardID\n\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t)\n\t\t\tWHERE\tboard.boardID IN (0" . $boardIDs . ")";
     WCF::getDB()->sendQuery($sql);
     $this->executed();
     $this->calcProgress($this->limit * $this->loop, $count);
     $this->nextLoop();
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:33,代码来源:UpdateBoardsAction.class.php

示例10: loadCache

 /**
  * Loads cached menu items.
  */
 protected function loadCache()
 {
     // call loadCache event
     EventHandler::fireAction($this, 'loadCache');
     WCF::getCache()->addResource('pageMenu-' . PACKAGE_ID, WCF_DIR . 'cache/cache.pageMenu-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderPageMenu.class.php');
     $this->menuItems = WCF::getCache()->get('pageMenu-' . PACKAGE_ID);
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:10,代码来源:PageMenu.class.php

示例11: execute

 /**
  * @see AbstractAction::execute()
  */
 public function execute()
 {
     parent::execute();
     $subscriber = new NewsletterSubscriber($this->subscriberID);
     //deletes user subscribers
     $sql = 'DELETE FROM wcf' . WCF_N . '_' . $this->activationTable . '
     		WHERE userID = ' . intval($subscriber->userID);
     WCF::getDB()->sendQuery($sql);
     //resets user setting
     $user = new UserEditor($subscriber->userID);
     $options = array('acceptNewsletter' => 0);
     $user->updateOptions($options);
     //deletes guest subscribers
     $sql = 'DELETE FROM wcf' . WCF_N . '_' . $this->guestActivationTable . '
     		WHERE subscriberID = ' . $this->subscriberID;
     WCF::getDB()->sendQuery($sql);
     //deletes unsubscribe tokens
     $sql = 'DELETE FROM wcf' . WCF_N . '_' . $this->unsubscriptionTable . '
             WHERE subscriberID = ' . $this->subscriberID;
     WCF::getDB()->sendQuery($sql);
     $sql = 'DELETE FROM wcf' . WCF_N . '_' . $this->subscriberTable . '
     		WHERE subscriberID = ' . $this->subscriberID;
     WCF::getDB()->sendQuery($sql);
     $this->executed();
     //clear cache
     $cacheName = 'newsletter-subscriber-' . PACKAGE_ID;
     WCF::getCache()->clear(WCF_DIR . 'cache/', 'cache.' . $cacheName . '.php');
     HeaderUtil::redirect('index.php?page=NewsletterSubscriberList&result=success&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
开发者ID:CaribeSoy,项目名称:Newsletter-System,代码行数:33,代码来源:NewsletterSubscriberDeleteAction.class.php

示例12: readCache

 /**
  * Reads the missions cache.
  */
 public static function readCache()
 {
     if (!count(self::$cache)) {
         WCF::getCache()->addResource('eventTypes-' . PACKAGE_ID, WCF_DIR . 'cache/cache.eventTypes-' . PACKAGE_ID . '.php', LW_DIR . 'lib/system/cache/CacheBuilderEventTypes.class.php');
         self::$cache = WCF::getCache()->get('eventTypes-' . PACKAGE_ID);
     }
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:10,代码来源:WOTEventEditor.class.php

示例13: execute

 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // add cache resources
     WCF::getCache()->addResource('bbcodes', WCF_DIR . 'cache/cache.bbcodes.php', WCF_DIR . 'lib/system/cache/CacheBuilderBBCodes.class.php');
     WCF::getCache()->addResource('smileys', WCF_DIR . 'cache/cache.smileys.php', WCF_DIR . 'lib/system/cache/CacheBuilderSmileys.class.php');
     // count threads
     $sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twbb" . WBB_N . "_thread";
     $row = WCF::getDB()->getFirstRow($sql);
     $count = $row['count'];
     // get thread ids
     $threadIDs = '';
     $sql = "SELECT\t\tthreadID\n\t\t\tFROM\t\twbb" . WBB_N . "_thread\n\t\t\tORDER BY\tthreadID";
     $result = WCF::getDB()->sendQuery($sql, $this->limit, $this->limit * $this->loop);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $threadIDs .= ',' . $row['threadID'];
     }
     if (empty($threadIDs)) {
         $this->calcProgress();
         $this->finish();
     }
     // get data
     $sql = "SELECT\t\tthread.threadID,\n\t\t\t\t\tpost.postID, post.message, post.enableSmilies, post.enableHtml, post.enableBBCodes\n\t\t\tFROM\t\twbb" . WBB_N . "_thread thread\n\t\t\tLEFT JOIN\twbb" . WBB_N . "_post post\n\t\t\tON\t\t(post.postID = thread.firstPostID)\n\t\t\tWHERE\t\tthread.threadID IN (0" . $threadIDs . ")";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         if ($row['postID']) {
             PostEditor::updateFirstPostPreview($row['threadID'], $row['postID'], $row['message'], $row);
         }
     }
     $this->executed();
     $this->calcProgress($this->limit * $this->loop, $count);
     $this->nextLoop();
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:36,代码来源:UpdateMessagePreviewsAction.class.php

示例14: execute

 /**
  * @see AdminToolsFunction::execute($data)
  */
 public function execute($data)
 {
     parent::execute($data);
     $parameters = $data['parameters']['cache.clearCache'];
     if ($parameters['clearWCFCache']) {
         WCF::getCache()->clear(WCF_DIR . 'cache', '*.php', true);
     }
     if ($parameters['clearStandaloneCache']) {
         $sql = "SELECT packageDir FROM wcf" . WCF_N . "_package WHERE packageID = " . PACKAGE_ID;
         $row = WCF::getDB()->getFirstRow($sql);
         WCF::getCache()->clear($row['packageDir'] . 'cache', '*.php', true);
     }
     if ($parameters['clearTemplateCache']) {
         require_once WCF_DIR . 'lib/system/template/ACPTemplate.class.php';
         ACPTemplate::deleteCompiledACPTemplates();
         Template::deleteCompiledTemplates();
     }
     if ($parameters['clearLanguageCache']) {
         LanguageEditor::deleteLanguageFiles('*', '*', '*');
     }
     if ($parameters['clearStandaloneOptions']) {
         Options::resetCache();
         Options::resetFile();
     }
     $this->executed();
 }
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:29,代码来源:ClearCacheAdminToolsFunction.class.php

示例15: loadTaggables

 /**
  * Loads the taggable objects.
  */
 protected function loadTaggables()
 {
     if ($this->taggables !== null) {
         return;
     }
     // get cache
     WCF::getCache()->addResource('taggables-' . PACKAGE_ID, WCF_DIR . 'cache/cache.taggables-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderTaggable.class.php');
     $this->taggablesData = WCF::getCache()->get('taggables-' . PACKAGE_ID);
     // get objects
     $this->taggables = array();
     foreach ($this->taggablesData as $type) {
         // calculate class path
         $path = '';
         if (empty($type['packageDir'])) {
             $path = WCF_DIR;
         } else {
             $path = FileUtil::getRealPath(WCF_DIR . $type['packageDir']);
         }
         // include class file
         if (!file_exists($path . $type['classPath'])) {
             throw new SystemException("unable to find class file '" . $path . $type['classPath'] . "'", 11000);
         }
         require_once $path . $type['classPath'];
         // create instance
         $className = StringUtil::getClassName($type['classPath']);
         if (!class_exists($className)) {
             throw new SystemException("unable to find class '" . $className . "'", 11001);
         }
         $this->taggables[$type['taggableID']] = new $className($type['taggableID'], $type['name']);
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:34,代码来源:TagEngine.class.php


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