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


PHP Context::getCache方法代碼示例

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


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

示例1: initialize

 public function initialize()
 {
     $filename = THEBUGGENIE_PATH . 'i18n' . DS . $this->_language . DS . 'initialize.inc.php';
     if (file_exists($filename)) {
         Logging::log("Initiating with file '{$filename}", 'i18n');
         include $filename;
         Logging::log("Done Initiating", 'i18n');
     }
     if ($this->_strings === null) {
         if (Context::getCache()->fileHas(Cache::KEY_I18N . 'strings_' . $this->_language, false)) {
             Logging::log('Trying cached strings');
             $strings = Context::getCache()->fileGet(Cache::KEY_I18N . 'strings_' . $this->_language, false);
             $this->_strings = is_array($strings) ? $strings : null;
         }
         if ($this->_strings === null) {
             Logging::log('No usable cached strings available');
             $this->loadStrings();
             foreach (array_keys(Context::getModules()) as $module_name) {
                 $this->loadStrings($module_name);
             }
             if (is_array($this->_strings)) {
                 Context::getCache()->fileAdd(Cache::KEY_I18N . 'strings_' . $this->_language, $this->_strings, false);
             }
         }
     }
 }
開發者ID:shoreless-Limited,項目名稱:thebuggenie,代碼行數:26,代碼來源:I18n.php

示例2: getIssueRegex

 /**
  * Returns an array of regular expressions that should be used for matching
  * the issue numbers and workflow transitions in a VCS commit.
  *
  * Each element of an array is a single regular expression that will be
  * applied against the incoming commit message. Each regular expression
  * should have two named patterns - one denoting the issue number (should
  * include prefix if used in project), and one denoting workflow
  * transitions.
  *
  * Simple example would be:
  *
  * '#fixes issue #(?P<issues>([A-Z0-9]+\-)?\d+) (?P<transitions> \(.*?\))?#i'
  *
  * @return array
  */
 public static function getIssueRegex()
 {
     // Try getting the regexes from cache first.
     if (!($regex = framework\Context::getCache()->get(framework\Cache::KEY_TEXTPARSER_ISSUE_REGEX))) {
         // List of keywords that are expected to prefix the issue number in a
         // commit message (these are _not_ project prefixes).
         $issue_strings = array('bug', 'issue', 'ticket', 'fix', 'fixes', 'fixed', 'fixing', 'applies to', 'closes', 'references', 'ref', 'addresses', 're', 'see', 'according to', 'also see', 'story');
         // Add the issue types as prefixes as well.
         foreach (\thebuggenie\core\entities\Issuetype::getAll() as $issuetype) {
             $issue_strings[] = $issuetype->getName();
         }
         // Construct the OR'ed (|) regex out of issue prefixes.
         $issue_string = join('|', $issue_strings);
         $issue_string = html_entity_decode($issue_string, ENT_QUOTES);
         $issue_string = str_replace(array(' ', "'"), array('\\s{1,1}', "\\'"), $issue_string);
         // Store all regular expressions for mathces in an array.
         $regex = array();
         // This regex will match messages that contain template like "KEYWORD
         // (#)ISSUE_NUMBER (TRANSITIONS)" (parenthesis means optional). For
         // example:
         // "Resolves issue #2 (Resolve issue)"
         $regex[] = '#( |^)(?<!\\!)((' . $issue_string . ')\\s\\#?(?P<issues>([A-Z0-9]+\\-)?\\d+))( \\((?P<transitions>.*?)\\))?#i';
         // This regex will match messages that contain template at the beginning
         // of message in format "ISSUE_NUMBER: (TRANSITIONS)".
         $regex[] = '#^(?<!\\!)((?P<issues>([A-Z0-9]+\\-)?\\d+)):( \\((?P<transitions>.*?)\\))?#i';
         // Add the constructed regexes to cache.
         framework\Context::getCache()->add(framework\Cache::KEY_TEXTPARSER_ISSUE_REGEX, $regex);
     }
     // Return the regular expressions.
     return $regex;
 }
開發者ID:underblaze,項目名稱:thebuggenie-4.1.0,代碼行數:47,代碼來源:TextParser.php

示例3: do_execute


//.........這裏部分代碼省略.........
                     $this->cliEcho($db_name . "\n");
                     $this->cliEcho("\nIf these settings are ok, press ENTER, or anything else to retry: ");
                     $e_ok = $this->askToDecline();
                 } while (!$e_ok);
                 try {
                     \b2db\Core::setHost($db_hostname);
                     \b2db\Core::setUname($db_username);
                     \b2db\Core::setPasswd($db_password);
                     \b2db\Core::setDBtype($db_type);
                     \b2db\Core::setTablePrefix('tbg_');
                     \b2db\Core::doConnect();
                     \b2db\Core::createDatabase($db_name);
                     \b2db\Core::setDBname($db_name);
                     \b2db\Core::doConnect();
                 } catch (\Exception $e) {
                     throw new \Exception("Could not connect to the database:\n" . $e->getMessage());
                 }
                 \b2db\Core::setDBname($db_name);
                 $this->cliEcho("\nSuccessfully connected to the database.\n", 'green');
                 $this->cliEcho("Press ENTER to continue ... ");
                 $this->pressEnterToContinue();
                 $this->cliEcho("\n");
                 $this->cliEcho("Saving database connection information ... ", 'white', 'bold');
                 $this->cliEcho("\n");
                 \b2db\Core::saveConnectionParameters($this->_b2db_config_file);
                 $this->cliEcho("Successfully saved database connection information.\n", 'green');
                 $this->cliEcho("\n");
             } else {
                 $b2db_config = \Spyc::YAMLLoad($this->_b2db_config_file);
                 if (!array_key_exists("b2db", $b2db_config)) {
                     throw new \Exception("Could not find database configuration in file " . $this->_b2db_config_file);
                 }
                 try {
                     \b2db\Core::initialize($b2db_config["b2db"], \thebuggenie\core\framework\Context::getCache());
                     \b2db\Core::doConnect();
                 } catch (\Exception $e) {
                     throw new \Exception("Could not connect to the database:\n" . $e->getMessage() . "\nPlease check your configuration file " . $this->_b2db_config_file);
                 }
                 $this->cliEcho("Successfully connected to the database.\n", 'green');
             }
             $this->cliEcho("\nThe Bug Genie needs some server settings to function properly...\n\n");
             do {
                 $this->cliEcho("URL rewriting\n", 'cyan', 'bold');
                 $this->cliEcho("The Bug Genie uses a technique called \"url rewriting\" - which allows for pretty\nURLs such as ") . $this->cliEcho('/issue/1', 'white', 'bold') . $this->cliEcho(' instead of ') . $this->cliEcho("viewissue.php?issue_id=1\n", 'white', 'bold');
                 $this->cliEcho("Make sure you have read the URL_REWRITE document located in the root\nfolder, or at http://www.thebuggenie.com before you continue\n");
                 if (!$this->hasProvidedArgument('url_subdir')) {
                     $this->cliEcho("Press ENTER to continue ... ");
                     $this->pressEnterToContinue();
                 }
                 $this->cliEcho("\n");
                 $this->cliEcho("The Bug Genie subdir\n", 'white', 'bold');
                 $this->cliEcho("This is the sub-path of the Web server where The Bug Genie will be located.\n");
                 if ($this->hasProvidedArgument('url_subdir')) {
                     $this->cliEcho('The Bug Genie subdir: ', 'white', 'bold');
                     $url_subdir = $this->getProvidedArgument('url_subdir');
                     $this->cliEcho($url_subdir, 'yellow', 'bold');
                     $this->cliEcho("\n");
                 } else {
                     $this->cliEcho('Start and end this with a forward slash', 'white', 'bold');
                     $this->cliEcho(". (ex: \"/thebuggenie/\")\nIf The Bug Genie is running at the root directory, just type \"/\" (without the quotes)\n\n");
                     $this->cliEcho('The Bug Genie subdir: ', 'white', 'bold');
                     $url_subdir = $this->getInput();
                 }
                 $this->cliEcho("\n");
                 $this->cliEcho("The Bug Genie will now be accessible at\n");
                 $this->cliEcho("http://example.com" . $url_subdir, 'white', 'bold');
開發者ID:RTechSoft,項目名稱:thebuggenie,代碼行數:67,代碼來源:Install.php

示例4: cache

 public function cache()
 {
     Context::getCache()->fileAdd(Cache::KEY_ROUTES_CACHE, $this->getRoutes());
     Context::getCache()->add(Cache::KEY_ROUTES_CACHE, $this->getRoutes());
     Context::getCache()->fileAdd(Cache::KEY_COMPONENT_OVERRIDE_MAP_CACHE, $this->getComponentOverrideMap());
     Context::getCache()->add(Cache::KEY_COMPONENT_OVERRIDE_MAP_CACHE, $this->getComponentOverrideMap());
     Context::getCache()->fileAdd(Cache::KEY_ANNOTATION_LISTENERS_CACHE, $this->getAnnotationListeners());
     Context::getCache()->add(Cache::KEY_ANNOTATION_LISTENERS_CACHE, $this->getAnnotationListeners());
 }
開發者ID:RTechSoft,項目名稱:thebuggenie,代碼行數:9,代碼來源:Routing.php

示例5: saveLinkOrder

 public function saveLinkOrder($links)
 {
     foreach ($links as $key => $link_id) {
         $crit = $this->getCriteria();
         $crit->addUpdate(self::LINK_ORDER, $key + 1);
         $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
         $this->doUpdateById($crit, $link_id);
     }
     framework\Context::getCache()->clearCacheKeys(array(framework\Cache::KEY_MAIN_MENU_LINKS));
 }
開發者ID:founderio,項目名稱:thebuggenie,代碼行數:10,代碼來源:Links.php

示例6: _postSave

 protected function _postSave($is_new)
 {
     framework\Context::getCache()->delete(framework\Cache::KEY_TEXTPARSER_ISSUE_REGEX);
 }
開發者ID:founderio,項目名稱:thebuggenie,代碼行數:4,代碼來源:IssuetypeScheme.php


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