|
iTx Technologies offre gratuitement
|
||
[Vue sommaire] [Imprimer] [Vue textuelle]
1 <?php 2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 3 /** 4 * CacheHandler 5 * 6 * SugarCRM is a customer relationship management program developed by 7 * SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc. 8 * 9 * This program is free software; you can redistribute it and/or modify it under 10 * the terms of the GNU General Public License version 3 as published by the 11 * Free Software Foundation with the addition of the following permission added 12 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK 13 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY 14 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. 15 * 16 * This program is distributed in the hope that it will be useful, but WITHOUT 17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 19 * details. 20 * 21 * You should have received a copy of the GNU General Public License along with 22 * this program; if not, see http://www.gnu.org/licenses or write to the Free 23 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 24 * 02110-1301 USA. 25 * 26 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, 27 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. 28 * 29 * The interactive user interfaces in modified source and object code versions 30 * of this program must display Appropriate Legal Notices, as required under 31 * Section 5 of the GNU General Public License version 3. 32 * 33 * In accordance with Section 7(b) of the GNU General Public License version 3, 34 * these Appropriate Legal Notices must retain the display of the "Powered by 35 * SugarCRM" logo. If the display of the logo is not reasonably feasible for 36 * technical reasons, the Appropriate Legal Notices must display the words 37 * "Powered by SugarCRM". 38 */ 39 40 41 42 $moduleDefs = array(); 43 $fileName = 'field_arrays.php'; 44 45 /************************************************ 46 * LoadCachedArray 47 * PARAMS 48 * module_dir - the module directory 49 * module - the name of the module 50 * key - the type of field array we are referencing, i.e. list_fields, 51 * column_fields, required_fields 52 * DESCRIPTION 53 * This function is designed to cache references 54 * to field arrays that were previously stored in the bean files 55 * and have since been moved to seperate files. 56 *************************************************/ 57 function LoadCachedArray($module_dir, $module, $key) 58 { 59 global $moduleDefs, $fileName; 60 61 $cache_key = "load_cached_array.$module_dir.$module.$key"; 62 $result = sugar_cache_retrieve($cache_key); 63 if(!empty($result)) 64 { 65 // Use EXTERNAL_CACHE_NULL_VALUE to store null values in the cache. 66 if($result == EXTERNAL_CACHE_NULL_VALUE) 67 { 68 return null; 69 } 70 71 return $result; 72 } 73 74 if(file_exists('modules/'.$module_dir.'/'.$fileName)) 75 { 76 // If the data was not loaded, try loading again.... 77 if(!isset($moduleDefs[$module])) 78 { 79 include('modules/'.$module_dir.'/'.$fileName); 80 $moduleDefs[$module] = $fields_array; 81 } 82 // Now that we have tried loading, make sure it was loaded 83 if(empty($moduleDefs[$module]) || empty($moduleDefs[$module][$module][$key])) 84 { 85 // It was not loaded.... Fail. Cache null to prevent future repeats of this calculation 86 sugar_cache_put($cache_key, EXTERNAL_CACHE_NULL_VALUE); 87 return null; 88 } 89 90 // It has been loaded, cache the result. 91 sugar_cache_put($cache_key, $moduleDefs[$module][$module][$key]); 92 return $moduleDefs[$module][$module][$key]; 93 } 94 95 // It was not loaded.... Fail. Cache null to prevent future repeats of this calculation 96 sugar_cache_put($cache_key, EXTERNAL_CACHE_NULL_VALUE); 97 return null; 98 } 99 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
|
|
|
|