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


PHP sugar_cache_put函数代码示例

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


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

示例1: exportBase64

 /**
  * Export a Base64 PDF Report
  * @param SugarBean report
  * @return file contents
  */
 protected function exportBase64(ServiceBase $api, SugarBean $report)
 {
     global $beanList, $beanFiles;
     global $sugar_config, $current_language;
     require_once 'modules/Reports/templates/templates_pdf.php';
     $contents = '';
     $report_filename = false;
     if ($report->id != null) {
         //Translate pdf to correct language
         $reporter = new Report(html_entity_decode($report->content), '', '');
         $reporter->layout_manager->setAttribute("no_sort", 1);
         $reporter->fromApi = true;
         //Translate pdf to correct language
         $mod_strings = return_module_language($current_language, 'Reports');
         //Generate actual pdf
         $report_filename = template_handle_pdf($reporter, false);
         sugar_cache_put($report->id . '-' . $GLOBALS['current_user']->id, $report_filename, $this->cacheLength * 60);
         $dl = new DownloadFile();
         $contents = $dl->getFileByFilename($report_filename);
     }
     if (empty($contents)) {
         throw new SugarApiException('File contents empty.');
     }
     // Reply is raw just pass back the base64 encoded contents
     return base64_encode($contents);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:31,代码来源:ReportsExportApi.php

示例2: saveTabGroups

 /**
  * Takes in the request params from a save request and processes 
  * them for the save.
  *
  * @param REQUEST params  $params
  */
 function saveTabGroups($params)
 {
     $tabGroups = array();
     $selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
     for ($count = 0; isset($params['slot_' . $count]); $count++) {
         if ($params['delete_' . $count] == 1) {
             continue;
         }
         $index = $params['slot_' . $count];
         $labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time();
         $labelValue = $params['tablabel_' . $index];
         if (empty($GLOBALS['app_strings'][$labelID]) || $GLOBALS['app_strings'][$labelID] != $labelValue) {
             $contents = return_custom_app_list_strings_file_contents($selected_lang);
             $new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
             save_custom_app_list_strings_contents($new_contents, $selected_lang);
             $app_strings[$labelID] = $labelValue;
         }
         $tabGroups[$labelID] = array('label' => $labelID);
         $tabGroups[$labelID]['modules'] = array();
         for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) {
             $tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount];
         }
     }
     sugar_cache_put('app_strings', $GLOBALS['app_strings']);
     $newFile = create_custom_directory('include/tabConfig.php');
     write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile);
     $GLOBALS['tabStructure'] = $tabGroups;
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:34,代码来源:TabGroupHelper.php

示例3: LoadCachedArray

function LoadCachedArray($module_dir, $module, $key)
{
    global $moduleDefs, $fileName;
    $cache_key = "load_cached_array.{$module_dir}.{$module}.{$key}";
    $result = sugar_cache_retrieve($cache_key);
    if (!empty($result)) {
        // Use EXTERNAL_CACHE_NULL_VALUE to store null values in the cache.
        if ($result == EXTERNAL_CACHE_NULL_VALUE) {
            return null;
        }
        return $result;
    }
    if (file_exists('modules/' . $module_dir . '/' . $fileName)) {
        // If the data was not loaded, try loading again....
        if (!isset($moduleDefs[$module])) {
            include 'modules/' . $module_dir . '/' . $fileName;
            $moduleDefs[$module] = $fields_array;
        }
        // Now that we have tried loading, make sure it was loaded
        if (empty($moduleDefs[$module]) || empty($moduleDefs[$module][$module][$key])) {
            // It was not loaded....  Fail.  Cache null to prevent future repeats of this calculation
            sugar_cache_put($cache_key, EXTERNAL_CACHE_NULL_VALUE);
            return null;
        }
        // It has been loaded, cache the result.
        sugar_cache_put($cache_key, $moduleDefs[$module][$module][$key]);
        return $moduleDefs[$module][$module][$key];
    }
    // It was not loaded....  Fail.  Cache null to prevent future repeats of this calculation
    sugar_cache_put($cache_key, EXTERNAL_CACHE_NULL_VALUE);
    return null;
}
开发者ID:klr2003,项目名称:sourceread,代码行数:32,代码来源:CacheHandler.php

示例4: _loadConfig

 /**
  * Load the view_<view>_config.php file which holds options used by the view.
  */
 function _loadConfig(&$view, $type)
 {
     $view_config_custom = array();
     $view_config_module = array();
     $view_config_root_cstm = array();
     $view_config_root = array();
     $view_config_app = array();
     $config_file_name = 'view.' . $type . '.config.php';
     $view_config = sugar_cache_retrieve("VIEW_CONFIG_FILE_" . $view->module . "_TYPE_" . $type);
     if (!$view_config) {
         $view_config_all = array('actions' => array(), 'req_params' => array());
         foreach (SugarAutoLoader::existingCustom('include/MVC/View/views/view.config.php', 'include/MVC/View/views/' . $config_file_name, 'modules/' . $view->module . '/views/' . $config_file_name) as $file) {
             $view_config = array();
             require $file;
             if (!empty($view_config['actions'])) {
                 $view_config_all['actions'] = array_merge($view_config_all['actions'], $view_config['actions']);
             }
             if (!empty($view_config['req_params'])) {
                 $view_config_all['req_params'] = array_merge($view_config_all['req_params'], $view_config['req_params']);
             }
         }
         $view_config = $view_config_all;
         sugar_cache_put("VIEW_CONFIG_FILE_" . $view->module . "_TYPE_" . $type, $view_config);
     }
     $action = strtolower($view->action);
     $config = null;
     if (!empty($view_config['req_params'])) {
         //try the params first
         foreach ($view_config['req_params'] as $key => $value) {
             if (!empty($_REQUEST[$key]) && $_REQUEST[$key] == "false") {
                 $_REQUEST[$key] = false;
             }
             if (!empty($_REQUEST[$key])) {
                 if (!is_array($value['param_value'])) {
                     if ($value['param_value'] == $_REQUEST[$key]) {
                         $config = $value['config'];
                         break;
                     }
                 } else {
                     foreach ($value['param_value'] as $v) {
                         if ($v == $_REQUEST[$key]) {
                             $config = $value['config'];
                             break;
                         }
                     }
                 }
             }
         }
     }
     if ($config == null && !empty($view_config['actions']) && !empty($view_config['actions'][$action])) {
         $config = $view_config['actions'][$action];
     }
     if ($config != null) {
         $view->options = $config;
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:59,代码来源:ViewFactory.php

示例5: handleOverride

 function handleOverride()
 {
     global $sugar_config, $sugar_version;
     $sc = SugarConfig::getInstance();
     list($oldConfig, $overrideArray) = $this->readOverride();
     $this->previous_sugar_override_config_array = $overrideArray;
     $diffArray = deepArrayDiff($this->config, $sugar_config);
     $overrideArray = sugarArrayMergeRecursive($overrideArray, $diffArray);
     if (isset($overrideArray['authenticationClass']) && empty($overrideArray['authenticationClass'])) {
         unset($overrideArray['authenticationClass']);
     }
     $overideString = "<?php\n/***CONFIGURATOR***/\n";
     sugar_cache_put('sugar_config', $this->config);
     $GLOBALS['sugar_config'] = $this->config;
     //print_r($overrideArray);
     //Bug#53013: Clean the tpl cache if action menu style has been changed.
     if (isset($overrideArray['enable_action_menu']) && (!isset($this->previous_sugar_override_config_array['enable_action_menu']) || $overrideArray['enable_action_menu'] != $this->previous_sugar_override_config_array['enable_action_menu'])) {
         require_once 'modules/Administration/QuickRepairAndRebuild.php';
         $repair = new RepairAndClear();
         $repair->module_list = array();
         $repair->clearTpls();
     }
     foreach ($overrideArray as $key => $val) {
         if (in_array($key, $this->allow_undefined) || isset($sugar_config[$key])) {
             if (is_string($val) && strcmp($val, 'true') == 0) {
                 $val = true;
                 $this->config[$key] = $val;
             }
             if (is_string($val) && strcmp($val, 'false') == 0) {
                 $val = false;
                 $this->config[$key] = false;
             }
         }
         $overideString .= override_value_to_string_recursive2('sugar_config', $key, $val, true, $oldConfig);
     }
     $overideString .= '/***CONFIGURATOR***/';
     $this->saveOverride($overideString);
     if (isset($this->config['logger']['level']) && $this->logger) {
         $this->logger->setLevel($this->config['logger']['level']);
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:41,代码来源:Configurator.php

示例6: handleOverride

 function handleOverride()
 {
     global $sugar_config, $sugar_version;
     $this->readOverride();
     foreach ($this->config as $key => $value) {
         if (in_array($key, $this->allow_undefined) || isset($sugar_config[$key]) && strcmp("{$sugar_config[$key]}", "{$value}") != 0) {
             if (strcmp("{$value}", 'true') == 0) {
                 $value = true;
                 $this->config[$key] = $value;
             }
             if (strcmp("{$value}", 'false') == 0) {
                 $value = false;
                 $this->config[$key] = false;
             }
             $this->replaceOverride('sugar_config', $key, $value);
         }
     }
     sugar_cache_put('sugar_config', $this->config);
     $GLOBALS['sugar_config'] = $this->config;
     $this->saveOverride();
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:21,代码来源:Configurator.php

示例7: loadCurrencies

 /**
  * wrapper for whatever currency system we implement
  */
 function loadCurrencies()
 {
     // doing it dirty here
     global $db;
     global $sugar_config;
     if (empty($db)) {
         return array();
     }
     $load = sugar_cache_retrieve('currency_list');
     if (!is_array($load)) {
         // load default from config.php
         $this->currencies['-99'] = array('name' => $sugar_config['default_currency_name'], 'symbol' => $sugar_config['default_currency_symbol'], 'conversion_rate' => 1);
         $q = "SELECT id, name, symbol, conversion_rate FROM currencies WHERE status = 'Active' and deleted = 0";
         $r = $db->query($q);
         while ($a = $db->fetchByAssoc($r)) {
             $load = array();
             $load['name'] = $a['name'];
             $load['symbol'] = $a['symbol'];
             $load['conversion_rate'] = $a['conversion_rate'];
             $this->currencies[$a['id']] = $load;
         }
         sugar_cache_put('currency_list', $this->currencies);
     } else {
         $this->currencies = $load;
     }
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:29,代码来源:Localization.php

示例8: get_date_time_format

 /**
  * Get user datetime format.
  *
  * @param User $user user object, current user if not specified
  * @return string
  */
 public function get_date_time_format($user = null)
 {
     // BC fix - had (bool, user) signature before
     if (!$user instanceof User) {
         if (func_num_args() > 1) {
             $user = func_get_arg(1);
             if (!$user instanceof User) {
                 $user = null;
             }
         } else {
             $user = null;
         }
     }
     $cacheKey = $this->get_date_time_format_cache_key($user);
     $cachedValue = sugar_cache_retrieve($cacheKey);
     if (!empty($cachedValue)) {
         return $cachedValue;
     } else {
         $value = $this->merge_date_time($this->get_date_format($user), $this->get_time_format($user));
         sugar_cache_put($cacheKey, $value, 0);
         return $value;
     }
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:29,代码来源:TimeDate.php

示例9: loadModuleLanguage

 function loadModuleLanguage($module, $lang, $refresh = false)
 {
     //here check if the cache file exists, if it does then load it, if it doesn't
     //then call refreshVardef
     //if either our session or the system is set to developerMode then refresh is set to true
     // Retrieve the vardefs from cache.
     $key = self::getLanguageCacheKey($module, $lang);
     if (!$refresh) {
         $return_result = sugar_cache_retrieve($key);
         if (!empty($return_result) && is_array($return_result)) {
             return $return_result;
         }
     }
     // Some of the vardefs do not correctly define dictionary as global.  Declare it first.
     $cachedfile = sugar_cached('modules/') . $module . '/language/' . $lang . '.lang.php';
     if ($refresh || !file_exists($cachedfile)) {
         LanguageManager::refreshLanguage($module, $lang);
     }
     //at this point we should have the cache/modules/... file
     //which was created from the refreshVardefs so let's try to load it.
     if (file_exists($cachedfile)) {
         global $mod_strings;
         require $cachedfile;
         // now that we hae loaded the data from disk, put it in the cache.
         if (!empty($mod_strings)) {
             sugar_cache_put($key, $mod_strings);
         }
         if (!empty($_SESSION['translation_mode'])) {
             $mod_strings = array_map('translated_prefix', $mod_strings);
         }
         return $mod_strings;
     }
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:33,代码来源:LanguageManager.php

示例10: testBuildMergeLink

 public function testBuildMergeLink()
 {
     $this->_lvd->seed = new stdClass();
     $this->_lvd->seed->module_dir = 'foobarfoobar';
     $GLOBALS['current_user']->setPreference('mailmerge_on', 'on');
     $settings_cache = sugar_cache_retrieve('admin_settings_cache');
     if (empty($settings_cache)) {
         $settings_cache = array();
     }
     $settings_cache['system_mailmerge_on'] = true;
     sugar_cache_put('admin_settings_cache', $settings_cache);
     $output = $this->_lvd->buildMergeLink(array('foobarfoobar' => 'foobarfoobar'));
     $this->assertContains("index.php?action=index&module=MailMerge&entire=true", $output);
     sugar_cache_clear('admin_settings_cache');
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:15,代码来源:ListViewDisplayTest.php

示例11: checkDatabaseVersion

 /**
  * checkDatabaseVersion
  * Check the db version sugar_version.php and compare to what the version is stored in the config table.
  * Ensure that both are the same.
  */
 function checkDatabaseVersion($dieOnFailure = true)
 {
     $row_count = sugar_cache_retrieve('checkDatabaseVersion_row_count');
     if (empty($row_count)) {
         $version_query = "SELECT count(*) as the_count FROM config WHERE category='info' AND name='sugar_version' AND " . $GLOBALS['db']->convert('value', 'text2char') . " = " . $GLOBALS['db']->quoted($GLOBALS['sugar_db_version']);
         $result = $GLOBALS['db']->query($version_query);
         $row = $GLOBALS['db']->fetchByAssoc($result);
         $row_count = $row['the_count'];
         sugar_cache_put('checkDatabaseVersion_row_count', $row_count);
     }
     if ($row_count == 0 && empty($GLOBALS['sugar_config']['disc_client'])) {
         if ($dieOnFailure) {
             $replacementStrings = array(0 => $GLOBALS['sugar_version'], 1 => $GLOBALS['sugar_db_version']);
             sugar_die(string_format($GLOBALS['app_strings']['ERR_DB_VERSION'], $replacementStrings));
         } else {
             return false;
         }
     }
     return true;
 }
开发者ID:switcode,项目名称:SuiteCRM,代码行数:25,代码来源:SugarApplication.php

示例12: testStoreAndRetrieveWithTTL

 public function testStoreAndRetrieveWithTTL()
 {
     sugar_cache_put($this->_cacheKey1, $this->_cacheValue1, 100);
     sugar_cache_put($this->_cacheKey2, $this->_cacheValue2, 100);
     sugar_cache_put($this->_cacheKey3, $this->_cacheValue3, 100);
     $this->assertEquals($this->_cacheValue1, sugar_cache_retrieve($this->_cacheKey1));
     $this->assertEquals($this->_cacheValue2, sugar_cache_retrieve($this->_cacheKey2));
     $this->assertEquals($this->_cacheValue3, sugar_cache_retrieve($this->_cacheKey3));
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:9,代码来源:ExternalCacheAPITest.php

示例13: loadMapping

 /**
  * Generic load method to load mapping arrays.
  */
 private function loadMapping($var, $merge = false)
 {
     ${$var} = sugar_cache_retrieve("CONTROLLER_" . $var . "_" . $this->module);
     if (!${$var}) {
         if ($merge && !empty($this->{$var})) {
             ${$var} = $this->{$var};
         } else {
             ${$var} = [];
         }
         if (file_exists($path = DOCROOT . "include/MVC/Controller/{$var}.php")) {
             require $path;
         }
         if (file_exists($path = DOCROOT . "modules/{$this->module}/{$var}'.php")) {
             require $path;
         }
         if (file_exists($path = DOCROOT . "custom/modules/{$this->module}/{$var}.php")) {
             require $path;
         }
         if (file_exists($path = DOCROOT . "custom/include/MVC/Controller/{$var}.php")) {
             require $path;
         }
         $varname = str_replace(" ", "", ucwords(str_replace("_", " ", $var)));
         if (file_exists($path = DOCROOT . "custom/application/Ext/{$varname}/{$var}.ext.php")) {
             require $path;
         }
         if (file_exists($path = DOCROOT . "custom/modules/{$this->module}/Ext/{$varname}/{$var}.ext.php")) {
             require $path;
         }
         sugar_cache_put("CONTROLLER_" . $var . "_" . $this->module, ${$var});
     }
     $this->{$var} = ${$var};
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:35,代码来源:SugarController.php

示例14: getLinkTypes

 static function getLinkTypes()
 {
     static $linkTypeList = null;
     // Fastest, already stored in the static variable
     if ($linkTypeList != null) {
         return $linkTypeList;
     }
     // Second fastest, stored in a cache somewhere
     $linkTypeList = sugar_cache_retrieve('SugarFeedLinkType');
     if ($linkTypeList != null) {
         return $linkTypeList;
     }
     // Third fastest, already stored in a file
     if (file_exists($GLOBALS['sugar_config']['cache_dir'] . 'modules/SugarFeed/linkTypeCache.php')) {
         require_once $GLOBALS['sugar_config']['cache_dir'] . 'modules/SugarFeed/linkTypeCache.php';
         sugar_cache_put('SugarFeedLinkType', $linkTypeList);
         return $linkTypeList;
     }
     // Slow, have to actually collect the data
     $baseDirs = array('custom/modules/SugarFeed/linkHandlers/', 'modules/SugarFeed/linkHandlers');
     $linkTypeList = array();
     foreach ($baseDirs as $dirName) {
         if (!file_exists($dirName)) {
             continue;
         }
         $d = dir($dirName);
         while ($file = $d->read()) {
             if ($file[0] == '.') {
                 continue;
             }
             if (substr($file, -4) == '.php') {
                 // We found one
                 $typeName = substr($file, 0, -4);
                 $linkTypeList[$typeName] = $typeName;
             }
         }
     }
     sugar_cache_put('SugarFeedLinkType', $linkTypeList);
     if (!file_exists($GLOBALS['sugar_config']['cache_dir'] . 'modules/SugarFeed')) {
         mkdir_recursive($GLOBALS['sugar_config']['cache_dir'] . 'modules/SugarFeed');
     }
     $fd = fopen($GLOBALS['sugar_config']['cache_dir'] . 'modules/SugarFeed/linkTypeCache.php', 'w');
     fwrite($fd, '<' . "?php\n\n" . '$linkTypeList = ' . var_export($linkTypeList, true) . ';');
     fclose($fd);
     return $linkTypeList;
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:46,代码来源:SugarFeed.php

示例15: handleOverride

 function handleOverride()
 {
     global $sugar_config, $sugar_version;
     $sc = SugarConfig::getInstance();
     $overrideArray = $this->readOverride();
     $this->previous_sugar_override_config_array = $overrideArray;
     $diffArray = deepArrayDiff($this->config, $sugar_config);
     $overrideArray = sugarArrayMerge($overrideArray, $diffArray);
     $overideString = "<?php\n/***CONFIGURATOR***/\n";
     sugar_cache_put('sugar_config', $this->config);
     $GLOBALS['sugar_config'] = $this->config;
     foreach ($overrideArray as $key => $val) {
         if (in_array($key, $this->allow_undefined) || isset($sugar_config[$key])) {
             if (strcmp("{$val}", 'true') == 0) {
                 $val = true;
                 $this->config[$key] = $val;
             }
             if (strcmp("{$val}", 'false') == 0) {
                 $val = false;
                 $this->config[$key] = false;
             }
         }
         $overideString .= override_value_to_string_recursive2('sugar_config', $key, $val);
     }
     $overideString .= '/***CONFIGURATOR***/';
     $this->saveOverride($overideString);
     if (isset($this->config['logger']['level']) && $this->logger) {
         $this->logger->setLevel($this->config['logger']['level']);
     }
 }
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:30,代码来源:Configurator.php


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