本文整理汇总了PHP中VardefManager::refreshVardefs方法的典型用法代码示例。如果您正苦于以下问题:PHP VardefManager::refreshVardefs方法的具体用法?PHP VardefManager::refreshVardefs怎么用?PHP VardefManager::refreshVardefs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VardefManager
的用法示例。
在下文中一共展示了VardefManager::refreshVardefs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createRelationship
private function createRelationship($lhs_module, $rhs_module = null, $relationship_type = 'one-to-many')
{
$rhs_module = $rhs_module == null ? $lhs_module : $rhs_module;
// Adding relation between products and users
$this->relationships = new DeployedRelationships($lhs_module);
$definition = array('lhs_module' => $lhs_module, 'relationship_type' => $relationship_type, 'rhs_module' => $rhs_module, 'lhs_label' => $lhs_module, 'rhs_label' => $rhs_module, 'rhs_subpanel' => 'default');
$this->relationship = RelationshipFactory::newRelationship($definition);
$this->relationships->add($this->relationship);
$this->relationships->save();
$this->relationships->build();
LanguageManager::clearLanguageCache($lhs_module);
// Updating $dictionary by created relation
global $dictionary;
$moduleInstaller = new ModuleInstaller();
$moduleInstaller->silent = true;
$moduleInstaller->rebuild_tabledictionary();
require 'modules/TableDictionary.php';
// Updating vardefs
VardefManager::$linkFields = array();
VardefManager::clearVardef();
VardefManager::refreshVardefs($lhs_module, BeanFactory::getObjectName($lhs_module));
if ($lhs_module != $rhs_module) {
VardefManager::refreshVardefs($rhs_module, BeanFactory::getObjectName($rhs_module));
}
SugarRelationshipFactory::rebuildCache();
}
示例2: repairDictionary
protected function repairDictionary()
{
$this->df->buildCache($this->modulename);
VardefManager::clearVardef();
VardefManager::refreshVardefs($this->modulename, $this->objectname);
$this->seed->field_defs = $GLOBALS['dictionary'][$this->objectname]['fields'];
}
示例3: tearDown
public function tearDown()
{
global $dictionary, $bean_list;
$dictionary = $this->old_dictionary;
$bean_list = $this->old_bean_list;
VardefManager::clearVardef('Accounts', 'Account');
VardefManager::refreshVardefs('Accounts', 'Account');
}
示例4: setUp
public function setUp()
{
$beanList = array();
$beanFiles = array();
require 'include/modules.php';
$GLOBALS['beanList'] = $beanList;
$GLOBALS['beanFiles'] = $beanFiles;
$GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
$GLOBALS['current_user']->status = 'Active';
$GLOBALS['current_user']->is_admin = 1;
$GLOBALS['current_user']->save();
$this->field = get_widget('varchar');
$this->field->id = 'Accountstest_custom_c';
$this->field->name = 'test_custom_c';
$this->field->vanme = 'LBL_TEST_CUSTOM_C';
$this->field->comments = NULL;
$this->field->help = NULL;
$this->field->custom_module = 'Accounts';
$this->field->type = 'varchar';
$this->field->label = 'LBL_TEST_CUSTOM_C';
$this->field->len = 255;
$this->field->required = 0;
$this->field->default_value = NULL;
$this->field->date_modified = '2009-09-14 02:23:23';
$this->field->deleted = 0;
$this->field->audited = 0;
$this->field->massupdate = 0;
$this->field->duplicate_merge = 0;
$this->field->reportable = 1;
$this->field->importable = 'true';
$this->field->ext1 = NULL;
$this->field->ext2 = NULL;
$this->field->ext3 = NULL;
$this->field->ext4 = NULL;
$this->df = new DynamicField('Accounts');
$this->mod = new Account();
$this->df->setup($this->mod);
$this->df->addFieldObject($this->field);
$this->df->buildCache('Accounts');
VardefManager::clearVardef();
VardefManager::refreshVardefs('Accounts', 'Account');
$this->mod->field_defs = $GLOBALS['dictionary']['Account']['fields'];
$this->_contact = SugarTestContactUtilities::createContact();
$this->_account = SugarTestAccountUtilities::createAccount();
$this->_contact->load_relationship('accounts');
$this->_contact->accounts->add($this->_account->id);
$this->_account->test_custom_c = 'Custom Field';
$this->_account->save();
$GLOBALS['db']->commit();
// Making sure we commit any changes
}
示例5: createCustom
public function createCustom()
{
//create new varchar widget and associate with Accounts
$this->custField = get_widget('varchar');
$this->custField->id = 'Accounts' . $this->custFieldName;
$this->custField->name = $this->custFieldName;
$this->custField->type = 'varchar';
$this->custField->label = 'LBL_' . strtoupper($this->custFieldName);
$this->custField->vname = 'LBL_' . strtoupper($this->custFieldName);
$this->custField->len = 255;
$this->custField->custom_module = 'Accounts';
$this->custField->required = 0;
$this->custField->default = 'goofy';
$this->acc = new Account();
$this->df = new DynamicField('Accounts');
$this->df->setup($this->acc);
$this->df->addFieldObject($this->custField);
$this->df->buildCache('Accounts');
$this->custField->save($this->df);
VardefManager::clearVardef();
VardefManager::refreshVardefs('Accounts', 'Account');
//Now create the meta files to make this a Calculated Field.
$fn = $this->custFieldName;
$extensionContent = <<<EOQ
<?php
\$dictionary['Account']['fields']['{$fn}']['duplicate_merge_dom_value']=0;
\$dictionary['Account']['fields']['{$fn}']['calculated']='true';
\$dictionary['Account']['fields']['{$fn}']['formula']='related(\$assigned_user_link,"name")';
\$dictionary['Account']['fields']['{$fn}']['enforced']='true';
\$dictionary['Account']['fields']['{$fn}']['dependency']='';
\$dictionary['Account']['fields']['{$fn}']['type']='varchar';
\$dictionary['Account']['fields']['{$fn}']['name']='{$fn}';
EOQ;
//create custom field file
$this->custFileDirPath = create_custom_directory($this->custFileDirPath);
$fileLoc = $this->custFileDirPath . 'sugarfield_' . $this->custFieldName . '.php';
file_put_contents($fileLoc, $extensionContent);
//run repair and clear to make sure the meta gets picked up
$_REQUEST['repair_silent'] = 1;
$rc = new RepairAndClear();
$rc->repairAndClearAll(array("clearAll", "rebuildExtensions"), array("Accounts"), false, false);
$fn = $this->custFieldName;
}
示例6: tearDown
public function tearDown()
{
$GLOBALS['db']->dropTableName($this->_tablename . '_cstm');
$GLOBALS['db']->query("DELETE FROM fields_meta_data WHERE id in ('Accountsbug34993_test_c', 'Accountsbug34993_test2_c')");
if (isset($this->_old_installing)) {
$GLOBALS['installing'] = $this->_old_installing;
} else {
unset($GLOBALS['installing']);
}
if (file_exists('custom/Extension/modules/Accounts/Ext/Vardefs/sugarfield_bug34993_test_c.php')) {
unlink('custom/Extension/modules/Accounts/Ext/Vardefs/sugarfield_bug34993_test_c.php');
}
if (file_exists('custom/Extension/modules/Accounts/Ext/Vardefs/sugarfield_bug34993_test2_c.php')) {
unlink('custom/Extension/modules/Accounts/Ext/Vardefs/sugarfield_bug34993_test2_c.php');
}
VardefManager::clearVardef('Accounts', 'Account');
VardefManager::refreshVardefs('Accounts', 'Account');
}
示例7: setUp
public function setUp()
{
$this->_soapURL = $GLOBALS['sugar_config']['site_url'] . '/service/v2/soap.php';
SugarTestHelper::setUp('beanFiles');
SugarTestHelper::setUp('beanList');
SugarTestHelper::setUp('current_user', array(true, 1));
$this->field = get_widget('varchar');
$this->field->id = 'Accountstest_custom_c';
$this->field->name = 'test_custom_c';
$this->field->vanme = 'LBL_TEST_CUSTOM_C';
$this->field->comments = NULL;
$this->field->help = NULL;
$this->field->custom_module = 'Accounts';
$this->field->type = 'varchar';
$this->field->label = 'LBL_TEST_CUSTOM_C';
$this->field->len = 255;
$this->field->required = 0;
$this->field->default_value = NULL;
$this->field->date_modified = '2009-09-14 02:23:23';
$this->field->deleted = 0;
$this->field->audited = 0;
$this->field->massupdate = 0;
$this->field->duplicate_merge = 0;
$this->field->reportable = 1;
$this->field->importable = 'true';
$this->field->ext1 = NULL;
$this->field->ext2 = NULL;
$this->field->ext3 = NULL;
$this->field->ext4 = NULL;
$this->df = new DynamicField('Accounts');
$this->mod = new Account();
$this->df->setup($this->mod);
$this->df->addFieldObject($this->field);
$this->df->buildCache('Accounts');
VardefManager::clearVardef();
VardefManager::refreshVardefs('Accounts', 'Account');
$this->mod->field_defs = $GLOBALS['dictionary']['Account']['fields'];
$this->_account = SugarTestAccountUtilities::createAccount();
$this->_account->test_custom_c = 'Custom Field';
$this->_account->save();
$GLOBALS['db']->commit();
// Making sure we commit any changes
parent::setUp();
}
示例8: run
/**
* {@inheritdoc}
*/
public function run()
{
global $beanList;
foreach ($beanList as $bean => $class) {
$this->modules[strtolower($bean)] = $bean;
}
$needClearCache = false;
foreach ($beanList as $bean => $class) {
VardefManager::refreshVardefs($bean, $class);
$seed = BeanFactory::getBean($bean);
if ($seed instanceof SugarBean) {
if (!$this->checkBean($seed)) {
SugarRelationshipFactory::rebuildCache();
$needClearCache = true;
}
}
}
if ($needClearCache) {
$this->cleanCache();
}
}
示例9: fix_dropdown_list
//.........这里部分代码省略.........
$contents = $out;
$touched = true;
}
//if
}
//foreach
//This is a check for g => h instances where the file contents were incorrectly written
//and also fixes the scenario where via a UI upgrade, the app_list_strings were incorrectly
//merged with app_list_strings variables declared elsewhere
if (!$touched) {
if (preg_match('/\\$GLOBALS\\s*\\[\\s*[\\"|\']app_list_strings[\\"|\']\\s*\\]\\s*=\\s*array\\s*\\(/', $contents)) {
//Now also remove all the non-custom labels that were added
if (preg_match('/language\\/([^\\.]+)\\.lang\\.php$/', $file, $matches)) {
$language = $matches[1];
$app_list_strings = array();
if (file_exists("include/language/{$language}.lang.php")) {
include "include/language/{$language}.lang.php";
}
if (file_exists("include/language/{$language}.lang.override.php")) {
$app_list_strings = _mergeCustomAppListStrings("include/language/{$language}.lang.override.php", $app_list_strings);
}
if (file_exists("custom/application/Ext/Language/{$language}.ext.lang.php")) {
$app_list_strings = _mergeCustomAppListStrings("custom/application/Ext/Language/{$language}.ext.lang.php", $app_list_strings);
}
if (file_exists("custom/application/Ext/Language/{$language}.lang.ext.php")) {
$app_list_strings = _mergeCustomAppListStrings("custom/application/Ext/Language/{$language}.lang.ext.php", $app_list_strings);
}
$all_non_custom_include_language_strings = $app_strings;
$all_non_custom_include_language_list_strings = $app_list_strings;
$unset_keys = array();
if (!empty($GLOBALS['app_list_strings'])) {
foreach ($GLOBALS['app_list_strings'] as $key => $value) {
$diff = array();
if (isset($all_non_custom_include_language_list_strings[$key])) {
$diff = array_diff($all_non_custom_include_language_list_strings[$key], $GLOBALS['app_list_strings'][$key]);
}
if (!empty($all_non_custom_include_language_list_strings[$key]) && empty($diff)) {
$unset_keys[] = $key;
}
}
}
foreach ($unset_keys as $key) {
unset($GLOBALS['app_list_strings'][$key]);
}
if (!empty($GLOBALS['app_strings'])) {
foreach ($GLOBALS['app_strings'] as $key => $value) {
if (!empty($all_non_custom_include_language_strings[$key])) {
unset($GLOBALS['app_strings'][$key]);
}
}
}
}
//if(preg_match...)
$out = "<?php \n";
if (!empty($GLOBALS['app_strings'])) {
foreach ($GLOBALS['app_strings'] as $key => $entry) {
$out .= "\n\$GLOBALS['app_strings']['{$key}']=" . var_export_helper($entry) . ";";
}
}
foreach ($GLOBALS['app_list_strings'] as $key => $entry) {
$out .= "\n\$GLOBALS['app_list_strings']['{$key}']=" . var_export_helper($entry) . ";";
}
//foreach
$touched = true;
}
//if(preg_match...)
}
//if(!$touched)
if ($touched) {
//Create a backup just in case
copy($file, $file . '.bak');
$fp = @sugar_fopen($file, 'w');
if ($fp) {
fwrite($fp, $out);
fclose($fp);
} else {
//If we can't update the file, just return
$GLOBALS['log']->error("Unable to update file contents in fix_dropdown_list.");
return;
}
}
//if($touched)
}
//if
}
//foreach($files)
//Update db entries (the order matters here... need to process database changes first)
if (!empty($affected_keys)) {
foreach ($affected_keys as $old_key => $new_key) {
$GLOBALS['db']->query("UPDATE fields_meta_data SET ext1 = '{$new_key}' WHERE ext1 = '{$old_key}'");
}
}
//Update vardef files for affected modules
if (!empty($affected_modules)) {
foreach ($affected_modules as $module => $object) {
VardefManager::refreshVardefs($module, $object);
}
}
}
}
示例10: loadVardef
/**
* load the vardefs for a given module and object
* @param string $module the given module we want to load the vardefs for
* @param string $object the given object we wish to load the vardefs for
* @param bool $refresh whether or not we wish to refresh the cache file.
*/
static function loadVardef($module, $object, $refresh = false, $params = array())
{
//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
if (inDeveloperMode() || !empty($_SESSION['developerMode'])) {
$refresh = true;
}
// Retrieve the vardefs from cache.
$key = "VardefManager.{$module}.{$object}";
if (!$refresh) {
$return_result = sugar_cache_retrieve($key);
$return_result = self::applyGlobalAccountRequirements($return_result);
if (!empty($return_result)) {
$GLOBALS['dictionary'][$object] = $return_result;
return;
}
}
// Some of the vardefs do not correctly define dictionary as global. Declare it first.
global $dictionary;
if (empty($GLOBALS['dictionary'][$object]) || $refresh) {
//if the consumer has demanded a refresh or the cache/modules... file
//does not exist, then we should do out and try to reload things
$cachedfile = sugar_cached('modules/') . $module . '/' . $object . 'vardefs.php';
if ($refresh || !file_exists($cachedfile)) {
VardefManager::refreshVardefs($module, $object, null, true, $params);
}
//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)) {
if (is_readable($cachedfile)) {
include $cachedfile;
}
// now that we hae loaded the data from disk, put it in the cache.
if (!empty($GLOBALS['dictionary'][$object])) {
$GLOBALS['dictionary'][$object] = self::applyGlobalAccountRequirements($GLOBALS['dictionary'][$object]);
sugar_cache_put($key, $GLOBALS['dictionary'][$object]);
}
}
}
}
示例11: deleteField
/**
* Deletes the field from fields_meta_data and drops the database column then it rebuilds the cache
* Use the widgets get_db_modify_alter_table() method to get the table sql - some widgets do not need any custom table modifications
* @param STRING $name - field name
*/
function deleteField($widget)
{
require_once 'modules/DynamicFields/templates/Fields/TemplateField.php';
global $beanList;
if (!$widget instanceof TemplateField) {
$field_name = $widget;
$widget = new TemplateField();
$widget->name = $field_name;
}
$object_name = $beanList[$this->module];
//Some modules like cases have a bean name that doesn't match the object name
if (empty($GLOBALS['dictionary'][$object_name])) {
$newName = BeanFactory::getObjectName($this->module);
$object_name = $newName != false ? $newName : $object_name;
}
$GLOBALS['db']->query("DELETE FROM fields_meta_data WHERE id='" . $this->module . $widget->name . "'");
$sql = $widget->get_db_delete_alter_table($this->bean->table_name . "_cstm");
if (!empty($sql)) {
$GLOBALS['db']->query($sql);
}
$this->removeVardefExtension($widget);
VardefManager::clearVardef();
VardefManager::refreshVardefs($this->module, $object_name);
}
示例12: deleteField
/**
* Deletes the field from fields_meta_data and drops the database column then it rebuilds the cache
* Use the widgets get_db_modify_alter_table() method to get the table sql - some widgets do not need any custom table modifications
* @param STRING $name - field name
*/
function deleteField($widget)
{
require_once 'modules/DynamicFields/templates/Fields/TemplateField.php';
global $beanList;
if (!$widget instanceof TemplateField) {
$field_name = $widget;
$widget = new TemplateField();
$widget->name = $field_name;
}
$object_name = $beanList[$this->module];
if ($object_name == 'aCase') {
$object_name = 'Case';
}
$GLOBALS['db']->query("DELETE FROM fields_meta_data WHERE id='" . $this->module . $widget->name . "'");
$sql = $widget->get_db_delete_alter_table($this->bean->table_name . "_cstm");
if (!empty($sql)) {
$GLOBALS['db']->query($sql);
}
$this->removeVardefExtension($widget);
VardefManager::clearVardef();
VardefManager::refreshVardefs($this->module, $object_name);
}
示例13: tearDown_relation
/**
* Doing the same things like setUp but for initialized list of modules
*
* @static
* @return bool are caches refreshed or not
*/
protected static function tearDown_relation()
{
SugarRelationshipFactory::deleteCache();
$modules = array_unique(self::$cleanModules);
foreach ($modules as $module) {
LanguageManager::clearLanguageCache($module);
}
self::tearDown('dictionary');
VardefManager::$linkFields = array();
VardefManager::clearVardef();
foreach ($modules as $module) {
VardefManager::refreshVardefs($module, BeanFactory::getBeanName($module));
}
SugarRelationshipFactory::rebuildCache();
self::$cleanModules = array();
return true;
}
示例14: clearAffectedVardefsCache
/**
* Refreshes vardefs for modules that are affected by a change during installation.
*
* @param array $modules List of modules to refresh vardefs for
*/
protected function clearAffectedVardefsCache($modules = array())
{
foreach ($modules as $module) {
$obj = BeanFactory::getObjectName($module);
VardefManager::refreshVardefs($module, $obj);
}
}
示例15: setUp
public function setUp()
{
SugarTestHelper::setUp('current_user', array(true, 1));
SugarTestHelper::setUp('beanFiles');
SugarTestHelper::setUp('beanList');
SugarTestHelper::setUp('app_list_strings');
SugarTestHelper::setUp('app_strings');
$_REQUEST = $this->keys;
$_REQUEST['view_module'] = "Accounts";
$_REQUEST['lhs_module'] = "Accounts";
$_REQUEST['rhs_module'] = "Contacts";
$_REQUEST['lhs_label'] = "Accounts";
$_REQUEST['rhs_label'] = "Contacts";
$relationAccountContact = new DeployedRelationships($_REQUEST['view_module']);
$this->relationAccountContact = $relationAccountContact->addFromPost();
$relationAccountContact->save();
$relationAccountContact->build();
$_REQUEST['view_module'] = "Contacts";
$_REQUEST['lhs_module'] = "Contacts";
$_REQUEST['rhs_module'] = "Accounts";
$_REQUEST['lhs_label'] = "Contacts";
$_REQUEST['rhs_label'] = "Accounts";
$relationContactAccount = new DeployedRelationships($_REQUEST['view_module']);
$this->relationContactAccount = $relationContactAccount->addFromPost();
$relationContactAccount->save();
$relationContactAccount->build();
SugarTestHelper::setUp('relation', array('Contacts', 'Accounts'));
//create a new field for accounts
$this->field = get_widget('varchar');
$this->field->id = 'Accountstest_45339333_c';
$this->field->name = 'test_45339333_c';
$this->field->vname = 'LBL_TEST_CUSTOM_C';
$this->field->help = NULL;
$this->field->custom_module = 'Accounts';
$this->field->type = 'varchar';
$this->field->label = 'LBL_TEST_CUSTOM_C';
$this->field->len = 255;
$this->field->required = 0;
$this->field->default_value = NULL;
$this->field->date_modified = '2012-10-31 02:23:23';
$this->field->deleted = 0;
$this->field->audited = 0;
$this->field->massupdate = 0;
$this->field->duplicate_merge = 0;
$this->field->reportable = 1;
$this->field->importable = 'true';
$this->field->ext1 = NULL;
$this->field->ext2 = NULL;
$this->field->ext3 = NULL;
$this->field->ext4 = NULL;
//add field to metadata
$this->df = new DynamicField('Accounts');
$this->df->setup(new Account());
$this->df->addFieldObject($this->field);
$this->df->buildCache('Accounts');
VardefManager::clearVardef();
VardefManager::refreshVardefs('Accounts', 'Account');
$this->mbPackage = new Bug45339MBPackageMock($this->packName);
}