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


PHP sugar_file_put_contents_atomic函数代码示例

本文整理汇总了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函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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