本文整理汇总了PHP中ModuleInstaller类的典型用法代码示例。如果您正苦于以下问题:PHP ModuleInstaller类的具体用法?PHP ModuleInstaller怎么用?PHP ModuleInstaller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleInstaller类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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'));
}
}
示例2: install_gmaps
function install_gmaps()
{
require_once 'ModuleInstall/ModuleInstaller.php';
$ModuleInstaller = new ModuleInstaller();
$ModuleInstaller->install_custom_fields(getCustomFields());
installJJWHooks();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
}
示例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()));
}
示例8: run
public function run()
{
if (!$this->toFlavor('ent')) {
return;
}
require_once 'ModuleInstall/ModuleInstaller.php';
$this->putFile('portal2/config.js', ModuleInstaller::getJSConfig(ModuleInstaller::getPortalConfig()));
}
示例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));
}
示例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;
}
示例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);
}
示例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));
}
示例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);
}
}
示例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);
}
}
示例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;
}