本文整理汇总了PHP中ModuleInstaller类的典型用法代码示例。如果您正苦于以下问题:PHP ModuleInstaller类的具体用法?PHP ModuleInstaller怎么用?PHP ModuleInstaller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleInstaller类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Workflow: Check module builder modules for "moduleList" and "moduleListSingular"
* labels and translations. Create or append fixed content to package
* language file to make it compatible with Studio or ModuleBuilder for future changes
*/
public function run()
{
if (empty($this->upgrader->state['MBModules'])) {
// No MB modules - nothing to do
return;
}
$app_list_strings = return_app_list_strings_language("en_us");
$changes = array();
$packages = $this->getPackages();
foreach ($this->upgrader->state['MBModules'] as $MBModule) {
// All custom modules will have package key in module name
$keys = explode('_', $MBModule);
$packageKey = $keys[0];
if (!isset($packages[$packageKey])) {
$this->upgrader->log('FixSingularList: can\'t find package for module: key - ' . $packageKey . '. Script will use current key as package name');
$packages[$packageKey] = $packageKey;
}
$changes[$packageKey] = isset($changes[$packageKey]) ? $changes[$packageKey] : array();
// Try to add custom module to moduleList
if (!isset($app_list_strings['moduleList'][$MBModule])) {
$langFile = $this->getLanguageFilePath($MBModule);
if (file_exists($langFile)) {
$mod_strings = array();
require $langFile;
$moduleName = isset($mod_strings['LBL_MODULE_NAME']) ? $mod_strings['LBL_MODULE_NAME'] : false;
if ($moduleName) {
$app_list_strings['moduleList'][$MBModule] = $moduleName;
$changes[$packageKey]['moduleList'][$MBModule] = $moduleName;
} else {
$this->upgrader->log('FixSingularList: warning - module ' . $MBModule . ' do not have module name translation');
}
}
}
if (!isset($app_list_strings['moduleListSingular'][$MBModule]) && !empty($app_list_strings['moduleList'][$MBModule])) {
$changes[$packageKey]['moduleListSingular'][$MBModule] = $app_list_strings['moduleList'][$MBModule];
}
}
$rebuildLang = false;
foreach ($changes as $packageKey => $content) {
// if no changes - continue
if (empty($content)) {
continue;
}
$packageName = $packages[$packageKey];
$fileName = $this->getPackageLangFile($packageName);
$values = $this->mergeCustomTranslations($fileName, $content);
$header = file_get_contents('modules/ModuleBuilder/MB/header.php');
$file = $header;
foreach ($values as $key => $array) {
$file .= override_value_to_string_recursive2('app_list_strings', $key, $array);
}
$this->upgrader->putFile($fileName, $file);
$rebuildLang = true;
}
if ($rebuildLang) {
$mi = new ModuleInstaller();
$mi->silent = true;
$mi->rebuild_languages(array('en_us' => 'en_us'));
}
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:65,代码来源:7_FixSingularList.php
示例2: install_gmaps
function install_gmaps()
{
require_once 'ModuleInstall/ModuleInstaller.php';
$ModuleInstaller = new ModuleInstaller();
$ModuleInstaller->install_custom_fields(getCustomFields());
installJJWHooks();
}
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:7,代码来源:GoogleMaps.php
示例3: 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();
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:26,代码来源:Bug53223Test.php
示例4: tearDown
public function tearDown()
{
SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
unset($GLOBALS['current_user']);
require_once 'ModuleInstall/ModuleInstaller.php';
$moduleInstaller = new ModuleInstaller();
$moduleInstaller->silent = true;
// make sure that the ModuleInstaller->log() function doesn't echo while rebuilding the layoutdefs
$moduleInstaller->rebuild_layoutdefs();
}
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:10,代码来源:ITR27836Test.php
示例5: UWrebuild
function UWrebuild()
{
global $log;
global $db;
$log->info('Deleting Relationship Cache. Relationships will automatically refresh.');
echo "\n\t<div id='rrresult'></div>\n\t<script>\n\t\tvar xmlhttp=false;\n\t\t/*@cc_on @*/\n\t\t/*@if (@_jscript_version >= 5)\n\t\t// JScript gives us Conditional compilation, we can cope with old IE versions.\n\t\t// and security blocked creation of the objects.\n\t\t try {\n\t\t xmlhttp = new ActiveXObject(\"Msxml2.XMLHTTP\");\n\t\t } catch (e) {\n\t\t try {\n\t\t xmlhttp = new ActiveXObject(\"Microsoft.XMLHTTP\");\n\t\t } catch (E) {\n\t\t xmlhttp = false;\n\t\t }\n\t\t }\n\t\t@end @*/\n\t\tif (!xmlhttp && typeof XMLHttpRequest!='undefined') {\n\t\t\ttry {\n\t\t\t\txmlhttp = new XMLHttpRequest();\n\t\t\t} catch (e) {\n\t\t\t\txmlhttp = false;\n\t\t\t}\n\t\t}\n\t\tif (!xmlhttp && window.createRequest) {\n\t\t\ttry {\n\t\t\t\txmlhttp = window.createRequest();\n\t\t\t} catch (e) {\n\t\t\t\txmlhttp = false;\n\t\t\t}\n\t\t}\n\t\txmlhttp.onreadystatechange = function() {\n\t\t if(xmlhttp.readyState == 4) {\n\t\t document.getElementById('rrresult').innerHTML = xmlhttp.responseText;\n\t\t }\n\t\t }\n\t\txmlhttp.open('GET', 'index.php?module=Administration&action=RebuildRelationship&to_pdf=true', true);\n\t\txmlhttp.send(null);\n\t\t</script>";
$log->info('Rebuilding everything.');
require_once 'ModuleInstall/ModuleInstaller.php';
$mi = new ModuleInstaller();
$mi->rebuild_all();
}
开发者ID:samus-aran,项目名称:SuiteCRM,代码行数:11,代码来源:UpgradeWizard_commit.php
示例6: run
/**
* {@inheritdoc}
*/
public function run()
{
$hooksModules = $this->findHookFiles();
//Check modules hooks.
foreach ($hooksModules['hooks'] as $file) {
$this->testHooks($file);
}
//Check extension hooks.
foreach ($hooksModules['ext'] as $file) {
$this->testHooks($file);
}
if (!empty($hooksModules['ext'])) {
$mi = new ModuleInstaller();
$mi->rebuild_logichooks();
}
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:19,代码来源:9_ClearHooks.php
示例7: run
public function run()
{
if (!$this->toFlavor('pro')) {
return;
}
require_once 'ModuleInstall/ModuleInstaller.php';
$this->putFile($this->cacheDir('config.js'), ModuleInstaller::getJSConfig(ModuleInstaller::getBaseConfig()));
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:8,代码来源:3_SidecarConfig.php
示例8: run
public function run()
{
if (!$this->toFlavor('ent')) {
return;
}
require_once 'ModuleInstall/ModuleInstaller.php';
$this->putFile('portal2/config.js', ModuleInstaller::getJSConfig(ModuleInstaller::getPortalConfig()));
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:8,代码来源:3_PortalConfig.php
示例9: rebuildLanguages
/**
* Rebuild changes languages for module
*
* @param $languages
* @param $module
*/
protected function rebuildLanguages($languages, $module)
{
if (!$this->mi) {
$this->mi = new ModuleInstaller();
$this->mi->silent = true;
}
$this->mi->rebuild_languages($languages, array($module));
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:14,代码来源:7_FixCustomLabelsForCoreModules.php
示例10: buildPackageDisplay
/**
* A Static method to Build the display for the package manager
*
* @param String form1 - the form to display for manual downloading
* @param String hidden_fields - the hidden fields related to downloading a package
* @param String form_action - the form_action to be used when downloading from the server
* @param String types - the types of objects we will request from the server
* @param String active_form - the form to display first
* @return String - a string of html which will be used to display the forms
*/
function buildPackageDisplay($form1, $hidden_fields, $form_action, $types = array('module'), $active_form = 'form1', $install = false)
{
global $current_language, $app_strings;
$app_strings = return_application_language($current_language);
$ss = new Sugar_Smarty();
$ss->assign('APP_STRINGS', $app_strings);
$ss->assign('FORM_1_PLACE_HOLDER', $form1);
$ss->assign('form_action', $form_action);
$ss->assign('hidden_fields', $hidden_fields);
$result = PackageManagerDisplay::getHeader();
$isAlive = $result['isAlive'];
$mi = new ModuleInstaller();
$mi_errors = $mi->getErrors();
$error_html = "";
if (!empty($mi_errors)) {
$error_html = "<div style='margin:0px 10px 10px 10px;'>";
foreach ($mi_errors as $error) {
$error_html .= "<font color='red'>" . $error . "</font><br>";
}
$error_html .= "</div>";
}
$tree = PackageManagerDisplay::buildTreeView('treeview', $isAlive);
$tree->tree_style = 'vendor/ytree/TreeView/css/check/tree.css';
$ss->assign('TREEHEADER', $tree->generate_header());
$ss->assign('installation', $install ? 'true' : 'false');
$mod_strings = return_module_language($current_language, "Administration");
$ss->assign('MOD', $mod_strings);
$ss->assign('module_load', 'true');
if (UploadStream::getSuhosinStatus() == false) {
$ss->assign('ERR_SUHOSIN', true);
} else {
$ss->assign('scripts', PackageManagerDisplay::getDisplayScript($install));
}
$show_login = false;
//hiding install from sugar
$ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login));
$ss->assign('INSTALL_ERRORS', $error_html);
$ss->assign('MOD', $mod_strings);
$descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED'];
$ss->assign('INSTALLED_PACKAGES_HOLDER', PackageManagerDisplay::buildInstalledGrid($mod_strings, $types));
$str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageForm.tpl');
return $str;
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:53,代码来源:PackageManagerDisplay.php
示例11: UWrebuild
function UWrebuild()
{
global $db;
Log::info('Deleting Relationship Cache. Relationships will automatically refresh.');
echo "\n\t<div id='rrresult'></div>\n\t<script>\n\t\tvar xmlhttp=false;\n\t\t/*@cc_on @*/\n\t\t/*@if (@_jscript_version >= 5)\n\t\t// JScript gives us Conditional compilation, we can cope with old IE versions.\n\t\t// and security blocked creation of the objects.\n\t\t try {\n\t\t xmlhttp = new ActiveXObject(\"Msxml2.XMLHTTP\");\n\t\t } catch (e) {\n\t\t try {\n\t\t xmlhttp = new ActiveXObject(\"Microsoft.XMLHTTP\");\n\t\t } catch (E) {\n\t\t xmlhttp = false;\n\t\t }\n\t\t }\n\t\t@end @*/\n\t\tif (!xmlhttp && typeof XMLHttpRequest!='undefined') {\n\t\t\ttry {\n\t\t\t\txmlhttp = new XMLHttpRequest();\n\t\t\t} catch (e) {\n\t\t\t\txmlhttp = false;\n\t\t\t}\n\t\t}\n\t\tif (!xmlhttp && window.createRequest) {\n\t\t\ttry {\n\t\t\t\txmlhttp = window.createRequest();\n\t\t\t} catch (e) {\n\t\t\t\txmlhttp = false;\n\t\t\t}\n\t\t}\n\t\txmlhttp.onreadystatechange = function() {\n\t\t if(xmlhttp.readyState == 4) {\n\t\t document.getElementById('rrresult').innerHTML = xmlhttp.responseText;\n\t\t }\n\t\t }\n\t\txmlhttp.open('GET', 'index.php?module=Administration&action=RebuildRelationship&to_pdf=true', true);\n\t\txmlhttp.send(null);\n\t\t</script>";
Log::info('Rebuilding everything.');
require_once 'ModuleInstall/ModuleInstaller.php';
$mi = new ModuleInstaller();
$mi->rebuild_all();
$query = "DELETE FROM versions WHERE name='Rebuild Extensions'";
Log::info($query);
$db->query($query);
// insert a new database row to show the rebuild extensions is done
$id = create_guid();
$gmdate = TimeDate::getInstance()->nowDb();
$date_entered = db_convert("'{$gmdate}'", 'datetime');
$query = 'INSERT INTO versions (id, deleted, date_entered, date_modified, modified_user_id, created_by, name, file_version, db_version) ' . "VALUES ('{$id}', '0', {$date_entered}, {$date_entered}, '1', '1', 'Rebuild Extensions', '4.0.0', '4.0.0')";
Log::info($query);
$db->query($query);
}
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:20,代码来源:UpgradeWizard_commit.php
示例12: rebuildLanguageExtensions
/**
* Rebuilds extensions and language files for this language and module
*
* @param string $language The language to rebuild extensions for
* @param string $moduleName The name of the module whose extensions are being rebuilt
*/
protected static function rebuildLanguageExtensions($language, $moduleName)
{
if (empty(self::$moduleInstaller)) {
self::$moduleInstaller = new ModuleInstaller();
self::$moduleInstaller->silent = true;
}
self::$moduleInstaller->rebuild_extensions(array($moduleName), array('languages'));
// While this *is* called from rebuild_extensions, it doesn't do anything
// there because there is no language or module provided to it. This fixes
// that.
self::$moduleInstaller->rebuild_languages(array($language => $language), array($moduleName));
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:18,代码来源:parser.label.php
示例13: preDisplay
/**
* This method checks to see if the configuration file exists and, if not, creates one by default
*
*/
public function preDisplay()
{
global $app_strings;
//Rebuild config file if it doesn't exist
if (!file_exists($this->configFile)) {
ModuleInstaller::handleBaseConfig();
}
$this->ss->assign("configFile", $this->configFile);
$config = ModuleInstaller::getBaseConfig();
$this->ss->assign('configHash', md5(serialize($config)));
$sugarSidecarPath = ensureJSCacheFilesExist();
$this->ss->assign("sugarSidecarPath", $sugarSidecarPath);
// TODO: come up with a better way to deal with the various JS files
// littered in sidecar.tpl.
$voodooFile = 'custom/include/javascript/voodoo.js';
if (SugarAutoLoader::fileExists($voodooFile)) {
$this->ss->assign('voodooFile', $voodooFile);
}
//Load sidecar theme css
$theme = new SidecarTheme();
$this->ss->assign("css_url", $theme->getCSSURL());
$this->ss->assign("developerMode", inDeveloperMode());
//Loading label
$this->ss->assign('LBL_LOADING', $app_strings['LBL_ALERT_TITLE_LOADING']);
$this->ss->assign('LBL_ENABLE_JAVASCRIPT', $app_strings['LBL_ENABLE_JAVASCRIPT']);
$slFunctionsPath = inDeveloperMode() ? "cache/Expressions/functions_cache_debug.js" : "cache/Expressions/functions_cache.js";
if (!is_file($slFunctionsPath)) {
$GLOBALS['updateSilent'] = true;
include "include/Expressions/updatecache.php";
}
$this->ss->assign("SLFunctionsPath", $slFunctionsPath);
if (!empty($this->authorization)) {
$this->ss->assign('appPrefix', $config['env'] . ":" . $config['appId'] . ":");
$this->ss->assign('authorization', $this->authorization);
}
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:40,代码来源:SidecarView.php
示例14: performUninstall
function performUninstall($name)
{
$uh = new UpgradeHistory();
$uh->name = $name;
$uh->id_name = $name;
$found = $uh->checkForExisting($uh);
if ($found != null) {
global $sugar_config;
global $mod_strings;
global $current_language;
$base_upgrade_dir = sugar_cached("/upgrades");
$base_tmp_upgrade_dir = "{$base_upgrade_dir}/temp";
if (!isset($GLOBALS['mi_remove_tables'])) {
$GLOBALS['mi_remove_tables'] = true;
}
$unzip_dir = mk_temp_dir($base_tmp_upgrade_dir);
unzip($found->filename, $unzip_dir);
$mi = new ModuleInstaller();
$mi->silent = true;
$mi->uninstall("{$unzip_dir}");
$found->delete();
unlink(remove_file_extension($found->filename) . '-manifest.php');
unlink($found->filename);
}
}
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:25,代码来源:PackageManager.php
示例15: buildPackageDisplay
/**
* A Static method to Build the display for the package manager
*
* @param String form1 - the form to display for manual downloading
* @param String hidden_fields - the hidden fields related to downloading a package
* @param String form_action - the form_action to be used when downloading from the server
* @param String types - the types of objects we will request from the server
* @param String active_form - the form to display first
* @return String - a string of html which will be used to display the forms
*/
function buildPackageDisplay($form1, $hidden_fields, $form_action, $types = array('module'), $active_form = 'form1', $install = false)
{
global $current_language;
$mod_strings = return_module_language($current_language, "Administration");
global $app_strings;
global $sugar_version, $sugar_config;
$app_strings = return_application_language($current_language);
$ss = new Sugar_Smarty();
$ss->assign('FORM_1_PLACE_HOLDER', $form1);
$ss->assign('form_action', $form_action);
$ss->assign('hidden_fields', $hidden_fields);
$result = PackageManagerDisplay::getHeader();
$header_text = $result['text'];
$isAlive = $result['isAlive'];
$show_login = $result['show_login'];
$mi_errors = ModuleInstaller::getErrors();
$error_html = "";
if (!empty($mi_errors)) {
$error_html = "<tr><td><span>";
foreach ($mi_errors as $error) {
$error_html .= "<font color='red'>" . $error . "</font><br>";
}
$error_html .= "</span></td></tr>";
}
$form2 = "<table class='tabForm' width='100%' cellpadding='0' cellspacing='0' width='100%' border='0'>";
$form2 .= $error_html;
if (!$isAlive) {
$form2 .= "<tr><td><span id='span_display_html'>" . $header_text . "</span></td></tr>";
}
$form2 .= "</table>";
$tree = null;
//if($isAlive){
$tree = PackageManagerDisplay::buildTreeView('treeview', $isAlive);
$tree->tree_style = 'include/ytree/TreeView/css/check/tree.css';
$ss->assign('TREEHEADER', $tree->generate_header());
//}
//$form2 .= PackageManagerDisplay::buildLoginPanel($mod_strings);
$form2 .= "<table class='tabForm' cellpadding='0' cellspacing='0' width='100%' border='0'>";
$form2 .= "<tr><td></td><td align='left'>";
if ($isAlive) {
$form2 .= "<input type='button' id='modifCredentialsBtn' class='button' onClick='PackageManager.showLoginDialog(true);' value='" . $mod_strings['LBL_MODIFY_CREDENTIALS'] . "'>";
} else {
$form2 .= "<input type='button' id='modifCredentialsBtn' class='button' onClick='PackageManager.showLoginDialog(true);' value='" . $mod_strings['LBL_MODIFY_CREDENTIALS'] . "'style='display:none;'>";
}
$form2 .= "</td><td align='left'><div id='workingStatusDiv' style='display:none;'>" . SugarThemeRegistry::current()->getImage("sqsWait", "border='0' align='bottom'", null, null, '.gif', "Loading") . "</div></td><td align='right'>";
if ($isAlive) {
$form2 .= "<slot><a class=\"listViewTdToolsS1\" id='href_animate' onClick=\"PackageManager.toggleDiv('span_animate_server_div', 'catview');\"><span id='span_animate_server_div'><img src='" . SugarThemeRegistry::current()->getImageURL('basic_search.gif') . "' width='8' height='8' border='0'> Collapse</span></a></slot>";
} else {
$form2 .= "<slot><a class=\"listViewTdToolsS1\" id='href_animate' onClick=\"PackageManager.toggleDiv('span_animate_server_div', 'catview');\"><span id='span_animate_server_div' style='display:none;'><img src='" . SugarThemeRegistry::current()->getImageURL('basic_search.gif') . "' width='8' height='8' border='0'> Collapse</span></a></slot>";
}
$form2 .= "</td></tr></table>";
$form2 = '';
//Commenting out the form as part of sugar depot hiding.
$ss->assign('installation', $install ? 'true' : 'false');
$mod_strings = return_module_language($current_language, "Administration");
$ss->assign('MOD', $mod_strings);
$ss->assign('module_load', 'true');
$ss->assign('scripts', PackageManagerDisplay::getDisplayScript($install));
$show_login = false;
//hiding install from sugar
$ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login));
$ss->assign('FORM_2_PLACE_HOLDER', $form2);
$ss->assign('MOD', $mod_strings);
$descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED'];
$ss->assign('INSTALLED_PACKAGES_HOLDER', PackageManagerDisplay::buildInstalledGrid($mod_strings, $types));
$str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageForm.tpl');
return $str;
}
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:78,代码来源:PackageManagerDisplay.php
示例16: upgradeTeamColumn
/**
* upgradeTeamColumn
* Helper function to create a team_set_id column and also set team_set_id column
* to have the value of the $column_name parameter
*
* @param $bean SugarBean which we are adding team_set_id column to
* @param $column_name The name of the column containing the default team_set_id value
*/
function upgradeTeamColumn($bean, $column_name)
{
//first let's check to ensure that the team_set_id field is defined, if not it could be the case that this is an older
//module that does not use the SugarObjects
if (empty($bean->field_defs['team_set_id']) && $bean->module_dir != 'Trackers') {
//at this point we could assume that since we have a team_id defined and not a team_set_id that we need to
//add that field and the corresponding relationships
$object = $bean->object_name;
$module = $bean->module_dir;
$object_name = $object;
$_object_name = strtolower($object_name);
if (!empty($GLOBALS['dictionary'][$object]['table'])) {
$table_name = $GLOBALS['dictionary'][$object]['table'];
} else {
$table_name = strtolower($module);
}
$path = 'include/SugarObjects/implements/team_security/vardefs.php';
require $path;
//go through each entry in the vardefs from team_security and unset anything that is already set in the core module
//this will ensure we have the proper ordering.
$fieldDiff = array_diff_assoc($vardefs['fields'], $GLOBALS['dictionary'][$bean->object_name]['fields']);
$file = 'custom/Extension/modules/' . $bean->module_dir . '/Ext/Vardefs/teams.php';
$contents = "<?php\n";
if (!empty($fieldDiff)) {
foreach ($fieldDiff as $key => $val) {
$contents .= "\n\$GLOBALS['dictionary']['" . $object . "']['fields']['" . $key . "']=" . var_export_helper($val) . ";";
}
}
$relationshipDiff = array_diff_assoc($vardefs['relationships'], $GLOBALS['dictionary'][$bean->object_name]['relationships']);
if (!empty($relationshipDiff)) {
foreach ($relationshipDiff as $key => $val) {
$contents .= "\n\$GLOBALS['dictionary']['" . $object . "']['relationships']['" . $key . "']=" . var_export_helper($val) . ";";
}
}
$indexDiff = array_diff_assoc($vardefs['indices'], $GLOBALS['dictionary'][$bean->object_name]['indices']);
if (!empty($indexDiff)) {
foreach ($indexDiff as $key => $val) {
$contents .= "\n\$GLOBALS['dictionary']['" . $object . "']['indices']['" . $key . "']=" . var_export_helper($val) . ";";
}
}
if ($fh = @sugar_fopen($file, 'wt')) {
fputs($fh, $contents);
fclose($fh);
}
//we have written out the teams.php into custom/Extension/modules/{$module_dir}/Ext/Vardefs/teams.php'
//now let's merge back into vardefs.ext.php
require_once 'ModuleInstall/ModuleInstaller.php';
$mi = new ModuleInstaller();
$mi->merge_files('Ext/Vardefs/', 'vardefs.ext.php');
VardefManager::loadVardef($bean->module_dir, $bean->object_name, true);
$bean->field_defs = $GLOBALS['dictionary'][$bean->object_name]['fields'];
}
if (isset($bean->field_defs['team_set_id'])) {
//Create the team_set_id column
$FieldArray = $GLOBALS['db']->helper->get_columns($bean->table_name);
if (!isset($FieldArray['team_set_id'])) {
$GLOBALS['db']->addColumn($bean->table_name, $bean->field_defs['team_set_id']);
}
$indexArray = $GLOBALS['db']->helper->get_indices($bean->table_name);
$indexName = getValidDBName('idx_' . strtolower($bean->table_name) . '_tmst_id', true, 34);
$indexDef = array(array('name' => $indexName, 'type' => 'index', 'fields' => array('team_set_id')));
if (!isset($indexArray[$indexName])) {
$GLOBALS['db']->addIndexes($bean->table_name, $indexDef);
}
//Update the table's team_set_id column to have the same values as team_id
$GLOBALS['db']->query("UPDATE {$bean->table_name} SET team_set_id = {$column_name}");
}
}
开发者ID:omusico,项目名称:sugar_work,代码行数:76,代码来源:uw_utils.php
示例17: build
function build()
{
$basepath = "custom/Extension/modules";
$this->activitiesToAdd = false;
// and mark all as built so that the next time we come through we'll know and won't build again
foreach ($this->relationships as $name => $relationship) {
$definition = $relationship->getDefinition();
// activities will always appear on the rhs only - lhs will be always be this module in MB
if (strtolower($definition['rhs_module']) == 'activities') {
$this->activitiesToAdd = true;
$relationshipName = $definition['relationship_name'];
foreach (self::$activities as $activitiesSubModuleLower => $activitiesSubModuleName) {
$definition['rhs_module'] = $activitiesSubModuleName;
$definition['for_activities'] = true;
$definition['relationship_name'] = $relationshipName . '_' . $activitiesSubModuleLower;
$this->relationships[$definition['relationship_name']] = RelationshipFactory::newRelationship($definition);
}
unset($this->relationships[$name]);
}
}
$GLOBALS['log']->info(get_class($this) . "->build(): installing relationships");
$MBModStrings = $GLOBALS['mod_strings'];
$adminModStrings = return_module_language('', 'Administration');
// required by ModuleInstaller
foreach ($this->relationships as $name => $relationship) {
$relationship->setFromStudio();
$GLOBALS['mod_strings'] = $MBModStrings;
$installDefs = parent::build($basepath, "<basepath>", array($name => $relationship));
// and mark as built so that the next time we come through we'll know and won't build again
$relationship->setReadonly();
$this->relationships[$name] = $relationship;
// now install the relationship - ModuleInstaller normally only does this as part of a package load where it installs the relationships defined in the manifest. However, we don't have a manifest or a package, so...
// If we were to chose to just use the Extension mechanism, without using the ModuleInstaller install_...() methods, we must :
// 1) place the information for each side of the relationship in the appropriate Ext directory for the module, which means specific $this->save...() methods for DeployedRelationships, and
// 2) we must also manually add the relationship into the custom/application/Ext/TableDictionary/tabledictionary.ext.php file as install_relationship doesn't handle that (install_relationships which requires the manifest however does)
// Relationships must be in tabledictionary.ext.php for the Admin command Rebuild Relationships to reliably work:
// Rebuild Relationships looks for relationships in the modules vardefs.php, in custom/modules/<modulename>/Ext/vardefs/vardefs.ext.php, and in modules/TableDictionary.php and custom/application/Ext/TableDictionary/tabledictionary.ext.php
// if the relationship is not defined in one of those four places it could be deleted during a rebuilt, or during a module installation (when RebuildRelationships.php deletes all entries in the Relationships table)
// So instead of doing this, we use common save...() methods between DeployedRelationships and UndeployedRelationships that will produce installDefs,
// and rather than building a full manifest file to carry them, we manually add these installDefs to the ModuleInstaller, and then
// individually call the appropriate ModuleInstaller->install_...() methods to take our relationship out of our staging area and expand it out to the individual module Ext areas
$GLOBALS['mod_strings'] = $adminModStrings;
require_once 'ModuleInstall/ModuleInstaller.php';
$mi = new ModuleInstaller();
$mi->id_name = 'custom' . $name;
// provide the moduleinstaller with a unique name for this relationship - normally this value is set to the package key...
$mi->installdefs = $installDefs;
$mi->base_dir = $basepath;
$mi->silent = true;
VardefManager::clearVardef();
$mi->install_relationships();
$mi->install_languages();
$mi->install_vardefs();
$mi->install_layoutdefs();
}
// now clear all caches so that our changes are visible
require_once 'modules/Administration/QuickRepairAndRebuild.php';
$rac = new RepairAndClear();
$rac->repairAndClearAll(array('clearAll'), array($GLOBALS['mod_strings']['LBL_ALL_MODULES']), true, false);
$GLOBALS['mod_strings'] = $MBModStrings;
// finally, restore the ModuleBuilder mod_strings
// save out the updated definitions so that we keep track of the change in built status
$this->save();
$GLOBALS['log']->info(get_class($this) . "->build(): finished relationship installation");
}
开发者ID:klr2003,项目名称:sourceread,代码行数:65,代码来源:DeployedRelationships.php
示例18: action_saveSugarField
function action_saveSugarField()
{
global $mod_strings;
require_once 'modules/DynamicFields/FieldCases.php';
$field = get_widget($_REQUEST['type']);
$_REQUEST['name'] = trim($_POST['name']);
$field->populateFromPost();
require_once 'modules/ModuleBuilder/parsers/StandardField.php';
$module = $_REQUEST['view_module'];
// Need to map Employees -> Users
if ($module == 'Employees') {
$module = 'Users';
}
$df = new StandardField($module);
$mod = BeanFactory::getBean($module);
$class_name = $GLOBALS['beanList'][$module];
$df->setup($mod);
$field->module = $mod;
$field->save($df);
$this->action_SaveLabel();
$MBmodStrings = $mod_strings;
$GLOBALS['mod_strings'] = return_module_language('', 'Administration');
include_once 'modules/Administration/QuickRepairAndRebuild.php';
$GLOBALS['mod_strings']['LBL_ALL_MODULES'] = 'all_modules';
$_REQUEST['execute_sql'] = true;
require_once 'ModuleInstall/ModuleInstaller.php';
$mi = new ModuleInstaller();
$mi->silent = true;
$mi->rebuild_extensions();
$repair = new RepairAndClear();
$repair->repairAndClearAll(array('clearVardefs', 'clearTpls'), array($class_name), true, false);
//#28707 ,clear all the js files in cache
$repair->module_list = array();
$repair->clearJsFiles();
// now clear the cache so that the results are immediately visible
include_once 'include/TemplateHandler/TemplateHandler.php';
TemplateHandler::clearCache($module);
if ($module == 'Users') {
TemplateHandler::clearCache('Employees');
}
$GLOBALS['mod_strings'] = $MBmodStrings;
}
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:42,代码来源:controller.php
示例19: saveSubPanelDefOverride
function saveSubPanelDefOverride($panel, $subsection, $override)
{
global $layout_defs, $beanList;
//save the new subpanel
$name = "subpanel_layout['list_fields']";
//bugfix: load looks for moduleName/metadata/subpanels, not moduleName/subpanels
$path = 'custom/modules/' . $panel->_instance_properties['module'] . '/metadata/subpanels';
//bug# 40171: "Custom subpanels not working as expected"
//each custom subpanel needs to have a unique custom def file
$filename = $panel->parent_bean->object_name . "_subpanel_" . $panel->name;
//bug 42262 (filename with $panel->_instance_properties['get_subpanel_data'] can create problem if had word "function" in it)
$oldName1 = '_override' . $panel->parent_bean->object_name . $panel->_instance_properties['module'] . $panel->_instance_properties['subpanel_name'];
$oldName2 = '_override' . $panel->parent_bean->object_name . $panel->_instance_properties['get_subpanel_data'];
if (file_exists('custom/Extension/modules/' . $panel->parent_bean->module_dir . "/Ext/Layoutdefs/{$oldName1}.php")) {
unlink('custom/Extension/modules/' . $panel->parent_bean->module_dir . "/Ext/Layoutdefs/{$oldName1}.php");
}
if (file_exists('custom/Extension/modules/' . $panel->parent_bean->module_dir . "/Ext/Layoutdefs/{$oldName2}.php")) {
unlink('custom/Extension/modules/' . $panel->parent_bean->module_dir . "/Ext/Layoutdefs/{$oldName2}.php");
}
$extname = '_override' . $filename;
//end of bug# 40171
mkdir_recursive($path, true);
write_array_to_file($name, $override, $path . '/' . $filename . '.php');
//save the override for the layoutdef
//tyoung 10.12.07 pushed panel->name to lowercase to match case in subpaneldefs.php files -
//gave error on bad index 'module' as this override key didn't match the key in the subpaneldefs
$name = "layout_defs['" . $panel->parent_bean->module_dir . "']['subpanel_setup']['" . strtolower($panel->name) . "']";
// $GLOBALS['log']->debug('SubPanel.php->saveSubPanelDefOverride(): '.$name);
$newValue = override_value_to_string($name, 'override_subpanel_name', $filename);
mkdir_recursive('custom/Extension/modules/' . $panel->parent_bean->module_dir . '/Ext/Layoutdefs', true);
$fp = sugar_fopen('custom/Extension/modules/' . $panel->parent_bean->module_dir . "/Ext/Layoutdefs/{$extname}.php", 'w');
fwrite($fp, "<?php\n//auto-generated file DO NOT EDIT\n{$newValue}\n?>");
fclose($fp);
require_once 'ModuleInstall/ModuleInstaller.php';
$moduleInstaller = new ModuleInstaller();
$moduleInstaller->silent = true;
// make sure that the ModuleInstaller->log() function doesn't echo while rebuilding the layoutdefs
$moduleInstaller->rebuild_layoutdefs();
if (file_exists('modules/' . $panel->parent_bean->module_dir . '/layout_defs.php')) {
include 'modules/' . $panel->parent_bean->module_dir . '/layout_defs.php';
}
if (file_exists('custom/modules/' . $panel->parent_bean->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php')) {
include 'custom/modules/' . $panel->parent_bean->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php';
}
}
开发者ID:recci,项目名称:SuiteCRM,代码行数:45,代码来源:SubPanel.php
|
请发表评论