• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP sugar_file_put_contents_atomic函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __destruct

 /**
  * @see SugarCacheAbstract::__destruct()
  *
  * For this backend, we'll write the SugarCacheFile::$localCache array serialized out to a file
  */
 public function __destruct()
 {
     parent::__destruct();
     if ($this->_cacheChanged) {
         sugar_file_put_contents_atomic(sugar_cached($this->_cacheFileName), serialize($this->_localStore));
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:12,代码来源:SugarCacheFile.php


示例2: run

 /**
  * Upgrade Task to Run
  */
 public function run()
 {
     if (version_compare($this->from_version, '7.0.0', '<') && ($this->toFlavor('ent') || $this->toFlavor('ult'))) {
         $settings = Opportunity::getSettings();
         if ($settings['opps_view_by'] !== 'RevenueLineItems') {
             $this->log('Not using Revenue Line Items; Skipping Upgrade Script');
             return;
         }
         $filename = 'custom/Extension/modules/Opportunities/Ext/Vardefs/sugarfield_date_closed.php';
         if (!is_file($filename)) {
             return;
         }
         require $filename;
         if (!empty($dictionary['Opportunity']['fields'])) {
             $fileString = file_get_contents($filename);
             // PAT-584, need to set the field Expected Close Date to false when upgrade because:
             // In 6.7, the field Expected Close Date is Required and no formula associated out of box.
             // In 7, the field Expected Close Date is Not Required and there's a formula associated out of box.
             // So use steps from PAT-584, it results in a Required field with a formula associated.
             if (isset($dictionary['Opportunity']['fields']['date_closed']['required']) && $dictionary['Opportunity']['fields']['date_closed']['required'] == true) {
                 $this->log("Change Opportunity field date_closed to not required");
                 $fileString = preg_replace('/(\\$dictionary\\[\'Opportunity\'\\]\\[\'fields\'\\]\\[\'date_closed\'\\]\\[\'required\'\\]\\s*=\\s*)true\\s*;/', '${1}false;', $fileString);
                 sugar_file_put_contents_atomic($filename, $fileString);
             }
         }
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:30,代码来源:7_OpportunityUpdateDateClosed.php


示例3: run

 public function run()
 {
     if (!version_compare($this->from_version, '7.2.2', '<')) {
         // only needed for upgrades from pre-7.2.2
         return;
     }
     foreach (glob('custom/Extension/modules/*/Ext/Vardefs/*', GLOB_BRACE) as $customFieldFile) {
         if (is_dir($customFieldFile)) {
             continue;
         }
         $dictionary = array();
         require $customFieldFile;
         if (!empty($dictionary)) {
             $module = key($dictionary);
             if (!empty($dictionary[$module]['fields'])) {
                 $field = key($dictionary[$module]['fields']);
                 if (!empty($dictionary[$module]['fields'][$field]['full_text_search']) && !empty($dictionary[$module]['fields'][$field]['full_text_search']['boost']) && !isset($dictionary[$module]['fields'][$field]['full_text_search']['enabled'])) {
                     $dictionary[$module]['fields'][$field]['full_text_search']['enabled'] = true;
                     $strToFile = "<?php\n\n" . "/* This file was updated by 7_FixCustomFieldsForFTS */\n";
                     foreach ($dictionary[$module]['fields'][$field] as $key => $value) {
                         $strToFile .= "\$dictionary['{$module}']['fields']['{$field}']['{$key}'] = " . var_export($value, true) . ";\n";
                     }
                     sugar_file_put_contents_atomic($customFieldFile, $strToFile);
                 }
             }
         }
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:28,代码来源:7_FixCustomFieldsForFTS.php


示例4: run

 public function run()
 {
     $customFieldFiles = $this->getCustomFieldFiles();
     foreach ($customFieldFiles as $file) {
         if (is_dir($file)) {
             continue;
         }
         $dictionary = array();
         require $file;
         if (empty($dictionary)) {
             continue;
         }
         $module = key($dictionary);
         if (empty($dictionary[$module]['fields'])) {
             continue;
         }
         $field = key($dictionary[$module]['fields']);
         if (empty($dictionary[$module]['fields'][$field]['type']) || $dictionary[$module]['fields'][$field]['type'] != 'multienum' || isset($dictionary[$module]['fields'][$field]['isMultiSelect'])) {
             continue;
         }
         $this->log("Added isMultiSelect for the file: {$file}");
         $dictionary[$module]['fields'][$field]['isMultiSelect'] = true;
         $strToFile = "<?php\n\n";
         foreach ($dictionary[$module]['fields'][$field] as $key => $value) {
             $strToFile .= "\$dictionary['{$module}']['fields']['{$field}']['{$key}'] = " . var_export($value, true) . ";\n";
         }
         $this->upgrader->backupFile($file);
         sugar_file_put_contents_atomic($file, $strToFile);
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:30,代码来源:7_FixCustomMultienumFields.php


示例5: cleanUpField

 /**
  * Removes fields' filter definition.
  *
  * More precisely we need to remove the `dbFields`, `type` and `vname`
  * properties from the filter definition of `relate` type fields.
  *
  * @param string $module The module name.
  * @param array $fields The list of fields to fix.
  */
 private function cleanUpField($module, $fields)
 {
     $file = 'custom/modules/' . $module . '/clients/base/filters/default/default.php';
     if (!file_exists($file)) {
         return;
     }
     $viewdefs = null;
     require $file;
     foreach ($fields as $fieldName) {
         if (isset($viewdefs[$module]['base']['filter']['default']['fields'][$fieldName])) {
             $viewdefs[$module]['base']['filter']['default']['fields'][$fieldName] = array();
         }
     }
     sugar_file_put_contents_atomic($file, "<?php\n\n" . "/* This file was updated by 7_FixRelateFieldsFilterMetadata */\n" . "\$viewdefs['{$module}']['base']['filter']['default'] = " . var_export($viewdefs[$module]['base']['filter']['default'], true) . ";\n");
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:24,代码来源:7_FixRelateFieldsFilterMetadata.php


示例6: run

 public function run()
 {
     //run only when upgrading from 7.x to 7.2.1
     if (version_compare($this->from_version, '7.0', '<') || version_compare($this->from_version, '7.2.1', '>=')) {
         return;
     }
     foreach (glob('custom/modules/*/clients/{base,portal}/views/record/record.php', GLOB_BRACE) as $recordFile) {
         require $recordFile;
         if (!empty($viewdefs)) {
             $module = key($viewdefs);
             //make sure header panel exists and has fields
             if (!empty($viewdefs[$module]) && !empty($viewdefs[$module]['base']) && !empty($viewdefs[$module]['base']['view']['record']) && !empty($viewdefs[$module]['base']['view']['record']['panels']) && !empty($viewdefs[$module]['base']['view']['record']['panels'][0]['fields'])) {
                 $newViewdefs = $this->cleanUpAvatarField($viewdefs, $module);
                 sugar_file_put_contents_atomic($recordFile, "<?php\n\n" . "/* This file was updated by 7_CleanUpCustomRecordAvatar */\n" . "\$viewdefs['{$module}']['base']['view']['record'] = " . var_export($newViewdefs[$module]['base']['view']['record'], true) . ";\n");
             }
         }
         $viewdefs = null;
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:19,代码来源:7_CleanUpCustomRecordAvatar.php


示例7: appendOverrideConfig

 /**
  * Append a array of new settings to the file "config_override.php".
  * @param $settings Array of settings
  * @return bool
  * @throws Exception
  */
 public function appendOverrideConfig($settings)
 {
     $file = 'config_override.php';
     $sugar_config = array();
     if (file_exists($file)) {
         $this->upgrader->backupFile($file);
         include $file;
     }
     foreach ($settings as $key => $val) {
         $sugar_config[$key] = $val;
     }
     $out = "<?php\n // created: " . date('Y-m-d H:i:s') . "\n";
     foreach (array_keys($sugar_config) as $key) {
         $out .= override_value_to_string_recursive2('sugar_config', $key, $sugar_config[$key]);
     }
     if (!sugar_file_put_contents_atomic($file, $out)) {
         throw new Exception("Failed writing to the {$file} file.");
     }
     return true;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:26,代码来源:8_EnableLegacyDashboard.php


示例8: run

 public function run()
 {
     if (!version_compare($this->from_version, '7.6', '<')) {
         return;
     }
     $customFieldFiles = $this->getCustomFieldFiles();
     foreach ($customFieldFiles as $file) {
         if (is_dir($file)) {
             continue;
         }
         $dictionary = array();
         require $file;
         if (empty($dictionary)) {
             continue;
         }
         $module = key($dictionary);
         if (empty($dictionary[$module]['fields'])) {
             continue;
         }
         $fields = array_keys($dictionary[$module]['fields']);
         if (empty($dictionary[$module]['fields']['date_entered']['required']) && empty($dictionary[$module]['fields']['date_modified']['required'])) {
             continue;
         } else {
             // date_entered & date_modified are read only fields, set the required to false if set
             if (!empty($dictionary[$module]['fields']['date_entered']['required'])) {
                 $dictionary[$module]['fields']['date_entered']['required'] = false;
             }
             if (!empty($dictionary[$module]['fields']['date_modified']['required'])) {
                 $dictionary[$module]['fields']['date_modified']['required'] = false;
             }
         }
         $strToFile = "<?php\n\n";
         foreach ($fields as $field) {
             foreach ($dictionary[$module]['fields'][$field] as $key => $value) {
                 $strToFile .= "\$dictionary['{$module}']['fields']['{$field}']['{$key}'] = " . var_export($value, true) . ";\n";
             }
         }
         $this->upgrader->backupFile($file);
         sugar_file_put_contents_atomic($file, $strToFile);
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:41,代码来源:7_FixCustomRequiredFields.php


示例9: upgradeVardefsInUndeployedCustomModules

 /**
  * Find custom address fields added to modules in the modulebuilder that have yet to be deployed
  */
 public function upgradeVardefsInUndeployedCustomModules()
 {
     foreach (glob('custom/modulebuilder/packages/*/modules/*/vardefs.php') as $file) {
         require $file;
         if (!empty($vardefs['fields'])) {
             //Save opening string so we can put it back later
             $fileString = file_get_contents($file);
             $openingString = substr($fileString, 0, strpos($fileString, '$vardefs'));
             //Find all custom street fields
             foreach ($vardefs['fields'] as $fieldName => &$field) {
                 if ($this->validateStreetField($vardefs['fields'], $fieldName)) {
                     //Field is an address street. Proceed to update the street vardef
                     $field['type'] = 'text';
                     $field['dbType'] = 'varchar';
                 }
             }
             //Put the updated contents back into the file
             sugar_file_put_contents_atomic($file, $openingString . "\n" . '$vardefs = ' . var_export($vardefs, true) . ";\n");
         }
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:24,代码来源:7_FixAddressStreetFields.php


示例10: run

 public function run()
 {
     //run only when upgrading from 7.x to 7.2.1
     if (version_compare($this->from_version, '7.2.2', '>=')) {
         return;
     }
     // this is the core modules that it's on out of the box
     $modules = array('Accounts', 'Bugs', 'Cases', 'Contacts', 'Leads', 'Opportunities', 'Prospects', 'RevenueLineItems');
     $files = glob('custom/modules/{' . join(',', $modules) . '}/clients/base/views/record/record.php', GLOB_BRACE);
     foreach ($files as $recordFile) {
         require $recordFile;
         if (!empty($viewdefs)) {
             $module = key($viewdefs);
             //make sure header panel exists and has fields
             if (!empty($viewdefs[$module]) && !empty($viewdefs[$module]['base']) && !empty($viewdefs[$module]['base']['view']['record']) && !empty($viewdefs[$module]['base']['view']['record']['buttons'])) {
                 $newViewdefs = $this->addHistorySummaryButton($viewdefs, $module);
                 sugar_file_put_contents_atomic($recordFile, "<?php\n\n" . "/* This file was updated by 7_CustomRecordViewHistorySummaryButton */\n" . "\$viewdefs['{$module}']['base']['view']['record'] = " . var_export($newViewdefs[$module]['base']['view']['record'], true) . ";\n");
             }
         }
         $viewdefs = null;
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:22,代码来源:7_CustomRecordViewHistorySummaryButton.php


示例11: fixRelationship

 /**
  * Fix dict defs and attempt to overwrite record file
  * @param array $dictionary
  * @param string $file
  */
 public function fixRelationship($dictionary, $file)
 {
     $module = key($dictionary);
     if (empty($dictionary[$module]['fields'])) {
         return;
     }
     $field = key($dictionary[$module]['fields']) . '_name';
     if (isset($dictionary[$module]['fields'][$field])) {
         // if the _name field of this relationship is set
         $fieldDef = $dictionary[$module]['fields'][$field];
         if (!isset($fieldDef['rname']) && $fieldDef['type'] == 'relate') {
             // and its type is relate
             $dictionary[$module]['fields'][$field]['rname'] = 'name';
             // set 'rname' to default 'name'
             $strToFile = "<?php\n\n";
             foreach ($dictionary[$module]['fields'] as $key => $value) {
                 $strToFile .= "\$dictionary[\"{$module}\"][\"fields\"][\"{$key}\"] = " . var_export($value, true) . ";\n";
             }
             $this->upgrader->backupFile($file);
             sugar_file_put_contents_atomic($file, $strToFile);
         }
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:28,代码来源:7_UpdateMissingrname.php


示例12: fixRelationship

 /**
  * Fix dict defs and attempt to overwrite record file
  * @param array $dictionary
  * @param string $file
  */
 public function fixRelationship($dictionary, $file)
 {
     $module = key($dictionary);
     if (empty($dictionary[$module]['fields'])) {
         return;
     }
     $field = key($dictionary[$module]['fields']) . '_name';
     if (isset($dictionary[$module]['fields'][$field])) {
         // if the _name field of this relationship is set
         $fieldDef = $dictionary[$module]['fields'][$field];
         if (isset($fieldDef['module']) && is_subclass_of(BeanFactory::getBean($fieldDef['module']), 'Person') && isset($fieldDef['db_concat_fields']) && $fieldDef['rname'] == 'name' && $fieldDef['type'] == 'relate') {
             // and its type is relate
             $dictionary[$module]['fields'][$field]['rname'] = 'full_name';
             // change 'name' to 'full_name'
             $strToFile = "<?php\n\n";
             foreach ($dictionary[$module]['fields'] as $key => $value) {
                 $strToFile .= "\$dictionary[\"{$module}\"][\"fields\"][\"{$key}\"] = " . var_export($value, true) . ";\n";
             }
             $this->upgrader->backupFile($file);
             sugar_file_put_contents_atomic($file, $strToFile);
         }
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:28,代码来源:7_UpdateNameForPersonClasses.php


示例13: write_array_to_file

function write_array_to_file($the_name, $the_array, $the_file, $mode = "w", $header = '')
{
    if (!empty($header) && ($mode != 'a' || !file_exists($the_file))) {
        $the_string = $header;
    } else {
        $the_string = "<?php\n" . '// created: ' . date('Y-m-d H:i:s') . "\n";
    }
    $the_string .= "\${$the_name} = " . var_export_helper($the_array) . ";";
    if (sugar_file_put_contents_atomic($the_file, $the_string) !== false) {
        if (substr($the_file, 0, 7) === 'custom/') {
            // record custom writes to file map
            SugarAutoLoader::addToMap($the_file);
        }
        return true;
    }
    return false;
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:17,代码来源:file_utils.php


示例14: writeCustomClass

 /**
  * Override the existing file.
  *
  * @param string $moduleName The module name.
  * @param string $content The content of the file.
  */
 private function writeCustomClass($moduleName, $content)
 {
     //write sugar generated class
     $this->log("FixClassConstructor: Replace {$moduleName}_sugar.php for module: {$moduleName}");
     sugar_file_put_contents_atomic($this->getModuleClassFile($moduleName), $content);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:12,代码来源:4_FixClassConstructor.php


示例15: cacheQuery

function cacheQuery($queryString, $resArray)
{
    $file = create_cache_directory('modules/AOD_Index/QueryCache/' . md5($queryString));
    $out = serialize($resArray);
    sugar_file_put_contents_atomic($file, $out);
}
开发者ID:NALSS,项目名称:SuiteCRM,代码行数:6,代码来源:UnifiedSearch.php


示例16: save

 function save()
 {
     $path = $this->getPackageDir();
     if (mkdir_recursive($path)) {
         //Save all the modules when we save a package
         $this->updateModulesMetaData(true);
         sugar_file_put_contents_atomic($path . '/manifest.php', $this->getManifest());
     }
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:9,代码来源:MBPackage.php


示例17: buildRelationshipCache

 protected function buildRelationshipCache()
 {
     global $beanList, $dictionary, $buildingRelCache;
     if ($buildingRelCache) {
         return;
     }
     $buildingRelCache = true;
     include "modules/TableDictionary.php";
     if (empty($beanList)) {
         include "include/modules.php";
     }
     //Reload ALL the module vardefs....
     foreach ($beanList as $moduleName => $beanName) {
         VardefManager::loadVardef($moduleName, BeanFactory::getObjectName($moduleName));
     }
     $relationships = array();
     //Grab all the relationships from the dictionary.
     foreach ($dictionary as $key => $def) {
         if (!empty($def['relationships'])) {
             foreach ($def['relationships'] as $relKey => $relDef) {
                 if ($key == $relKey) {
                     //Relationship only entry, we need to capture everything
                     $relationships[$key] = array_merge(array('name' => $key), $def, $relDef);
                 } else {
                     $relationships[$relKey] = array_merge(array('name' => $relKey), $relDef);
                     if (!empty($relationships[$relKey]['join_table']) && empty($relationships[$relKey]['fields']) && isset($dictionary[$relationships[$relKey]['join_table']]['fields'])) {
                         $relationships[$relKey]['fields'] = $dictionary[$relationships[$relKey]['join_table']]['fields'];
                     }
                 }
             }
         }
     }
     //Save it out
     sugar_mkdir(dirname($this->getCacheFile()), null, true);
     $out = "<?php \n \$relationships = " . var_export($relationships, true) . ";";
     sugar_file_put_contents_atomic($this->getCacheFile(), $out);
     $this->relationships = $relationships;
     $buildingRelCache = false;
 }
开发者ID:sunmo,项目名称:snowlotus,代码行数:39,代码来源:RelationshipFactory.php


示例18: ConcatenateFiles

 public function ConcatenateFiles($from_path)
 {
     global $sugar_config;
     // Minifying the group files takes a long time sometimes.
     @ini_set('max_execution_time', 0);
     $js_groupings = $this->getJSGroupings();
     // Get the files that are not meant to be minified
     $excludedFiles = $this->get_exclude_files($from_path);
     // For each item in the $js_groupings array (from JSGroupings.php),
     // concatenate the source files into the target file
     foreach ($js_groupings as $fg) {
         // List of files to build into one
         $buildList = array();
         // Default the permissions to the most restrictive to start
         $currPerm = 0;
         // Process each group array. $loc is the file to read in, $trgt is
         // the concatenated file
         foreach ($fg as $loc => $trgt) {
             $already_minified = preg_match('/[\\.\\-]min\\.js$/', $loc);
             if (preg_match('/[\\.\\-]min\\.js$/', $loc)) {
                 $already_minified = true;
             } else {
                 $minified_loc = str_replace('.js', '-min.js', $loc);
                 if (is_file($minified_loc)) {
                     $loc = $minified_loc;
                     $already_minified = true;
                 }
             }
             $relpath = $loc;
             $loc = $from_path . '/' . $loc;
             $trgt = sugar_cached($trgt);
             //check to see that source file is a file, and is readable.
             if (is_file($loc) && is_readable($loc)) {
                 // Build a file perm based on the loosest file being read in
                 $tPerm = fileperms($loc);
                 if ($tPerm !== false && $tPerm > $currPerm) {
                     $currPerm = $tPerm;
                 }
                 //make sure we have handles to both source and target file
                 $content = file_get_contents($loc);
                 //Skip minifying files in exclude list and already minified files
                 if (!$already_minified && !isset($excludedFiles[$loc])) {
                     try {
                         $content = SugarMin::minify($content);
                     } catch (RuntimeException $e) {
                         //Use unminified $buffer instead
                     }
                 }
                 $content .= "\n/* End of File {$relpath} */\n\n";
                 $buildList[] = $content;
             }
         }
         // Ensure target directory exists
         $targetDir = dirname($trgt);
         if (!file_exists($targetDir)) {
             mkdir_recursive($targetDir);
         }
         // Build the file now using atomic write
         $contents = implode("", $buildList);
         sugar_file_put_contents_atomic($trgt, $contents);
         // And handle permissions like the way we used to do it
         $func = function_exists('sugar_chmod') ? 'sugar_chmod' : 'chmod';
         // Get a default permission, from config if possible
         if (isset($sugar_config['default_permissions']['file_mode'])) {
             $defaultPerm = $sugar_config['default_permissions']['file_mode'];
         } else {
             $defaultPerm = 0777;
         }
         // Handle permission value here
         $newPerm = $currPerm ? $currPerm : $defaultPerm;
         // Set the perms for the new file
         @$func($trgt, $newPerm);
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:74,代码来源:minify_utils.php


示例19: build_relationship_cache

 function build_relationship_cache()
 {
     $query = "SELECT * from relationships where deleted=0";
     $result = $this->db->query($query);
     while (($row = $this->db->fetchByAssoc($result)) != null) {
         $relationships[$row['relationship_name']] = $row;
     }
     sugar_mkdir($this->cache_file_dir(), null, true);
     $out = "<?php \n \$relationships = " . var_export($relationships, true) . ";";
     sugar_file_put_contents_atomic(Relationship::cache_file_dir() . '/' . Relationship::cache_file_name_only(), $out);
     require_once "data/Relationships/RelationshipFactory.php";
     SugarRelationshipFactory::deleteCache();
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:13,代码来源:Relationship.php


示例20: buildModuleClientCache

 /**
  * Builds up module client cache files
  *
  * @param array $platforms A list of platforms to build for. Uses the first
  *                         platform in the list as the platform.
  * @param string $type     The type of file to create the cache for.
  * @param array $modules   The module to create the cache for.
  * @param MetaDataContextInterface|null $context Metadata context
  */
 public static function buildModuleClientCache($platforms, $type, $modules = array(), MetaDataContextInterface $context = null, $noCache = false)
 {
     if (is_string($modules)) {
         // They just want one module
         $modules = array($modules);
     } elseif (count($modules) == 0) {
         // They want all of the modules
         $modules = array_keys($GLOBALS['app_list_strings']['moduleList']);
     }
     if (!$context) {
         $context = new MetaDataContextDefault();
     }
     foreach ($modules as $module) {
         $seed = BeanFactory::getBean($module);
         $fileList = self::getClientFiles($platforms, $type, $module, $context, $seed);
         $moduleResults = self::getClientFileContents($fileList, $type, $module, $seed);
         if ($type == "view") {
             foreach ($moduleResults as $view => $defs) {
                 if (!is_array($defs) || empty($seed) || empty($seed->field_defs)) {
                     continue;
                 }
                 $meta = !empty($defs['meta']) ? $defs['meta'] : array();
                 $deps = array_merge(DependencyManager::getDependenciesForFields($seed->field_defs, ucfirst($view) . "View"), DependencyManager::getDependenciesForView($meta, ucfirst($view) . "View", $module));
                 if (!empty($deps)) {
                     if (!isset($meta['dependencies']) || !is_array($meta['dependencies'])) {
                         $moduleResults[$view]['meta']['dependencies'] = array();
                     }
                     foreach ($deps as $dep) {
                         $moduleResults[$view]['meta']['dependencies'][] = $dep->getDefinition();
                     }
                 }
             }
         }
         if ($noCache) {
             return $moduleResults;
         } else {
             $basePath = sugar_cached('modules/' . $module . '/clients/' . $platforms[0]);
             sugar_mkdir($basePath, null, true);
             $output = "<?php\n\$clientCache['" . $module . "']['" . $platforms[0] . "']['" . $type . "'] = " . var_export($moduleResults, true) . ";\n\n";
             sugar_file_put_contents_atomic($basePath . '/' . $type . '.php', $output);
         }
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:52,代码来源:MetaDataFiles.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sugar_fopen函数代码示例发布时间:2022-05-23
下一篇:
PHP sugar_file_put_contents函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap