本文整理汇总了PHP中RepairAndClear::rebuildExtensions方法的典型用法代码示例。如果您正苦于以下问题:PHP RepairAndClear::rebuildExtensions方法的具体用法?PHP RepairAndClear::rebuildExtensions怎么用?PHP RepairAndClear::rebuildExtensions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RepairAndClear
的用法示例。
在下文中一共展示了RepairAndClear::rebuildExtensions方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
// we just finished with the layouts, we need to rebuild the extensions
include "include/modules.php";
require_once "modules/Administration/QuickRepairAndRebuild.php";
$rac = new RepairAndClear('', '', false, false);
$rac->rebuildExtensions();
}
示例2: RepairAndClear
global $sugar_config;
if ($unzip_dir == null) {
$unzip_dir = $_SESSION['unzip_dir'];
}
//First repair the databse to ensure it is up to date with the new vardefs/tabledefs
logThis('About to repair the database.', $path);
//Use Repair and rebuild to update the database.
global $dictionary, $beanFiles;
require_once 'modules/Trackers/TrackerManager.php';
$trackerManager = TrackerManager::getInstance();
$trackerManager->pause();
$trackerManager->unsetMonitors();
require_once "modules/Administration/QuickRepairAndRebuild.php";
$rac = new RepairAndClear();
$rac->clearVardefs();
$rac->rebuildExtensions();
//bug: 44431 - defensive check to ensure the method exists since upgrades to 6.2.0 may not have this method define yet.
if (method_exists($rac, 'clearExternalAPICache')) {
$rac->clearExternalAPICache();
}
$repairedTables = array();
foreach ($beanFiles as $bean => $file) {
if (file_exists($file)) {
require_once $file;
unset($GLOBALS['dictionary'][$bean]);
$focus = new $bean();
if ($focus instanceof SugarBean) {
if (!isset($repairedTables[$focus->table_name])) {
$sql = $GLOBALS['db']->repairTable($focus, true);
if (trim($sql) != '') {
logThis('Running sql:' . $sql, $path);
示例3: removeCustomExtensions
function removeCustomExtensions()
{
$out = "";
$extDir = "custom/Extension/modules/{$this->module}";
if (is_dir($extDir)) {
rmdir_recursive($extDir);
require_once 'modules/Administration/QuickRepairAndRebuild.php';
$rac = new RepairAndClear();
$rac->repairAndClearAll(array('clearAll'), array($this->module), true, false);
$rac->rebuildExtensions();
$out .= "Cleared extensions for {$this->module}<br/>";
}
return $out;
}
示例4: action_listViewSave
public function action_listViewSave()
{
$GLOBALS['log']->info("action_listViewSave");
if (isset($_REQUEST['PORTAL'])) {
$this->view = 'portallistview';
$parser = ParserFactory::getParser($this->view, $_REQUEST['view_module'], null, null, MB_PORTAL);
//$parser->init ( $_REQUEST [ 'view_module' ] ) ; // removed init because MetaDataParsers don't use it
} else {
$packageName = isset($_REQUEST['view_package']) && strtolower($_REQUEST['view_package']) != 'studio' ? $_REQUEST['view_package'] : null;
$subpanelName = !empty($_REQUEST['subpanel']) ? $_REQUEST['subpanel'] : null;
$parser = ParserFactory::getParser($_REQUEST['view'], $_REQUEST['view_module'], $packageName, $subpanelName);
$this->view = 'listView';
// To make sure that dashlets can render customized list views on BWC
// modules, we need to save list customizations for BWC modules in
// the new style as well.
if (isModuleBWC($_REQUEST['view_module']) && empty($packageName) && empty($subpanelName)) {
$sidecarListParser = new SidecarListLayoutMetaDataParser(MB_SIDECARLISTVIEW, $_REQUEST['view_module'], null, 'base');
$sidecarListParser->handleSave();
}
}
// for backwards compatibility we need to parse the subpanel the old way as well
// TODO: Remove this when all BWC Modules are converted
if ($parser instanceof SidecarSubpanelLayoutMetaDataParser) {
require_once 'modules/ModuleBuilder/parsers/views/SubpanelMetaDataParser.php';
$oldSubpanelParser = new SubpanelMetaDataParser($subpanelName, $_REQUEST['view_module'], $packageName);
$oldSubpanelParser->handleSave();
unset($oldSubpanelParser);
}
$parser->handleSave();
if (empty($packageName) && !empty($subpanelName)) {
$rr = new RepairAndClear();
$rr->show_output = false;
$rr->rebuildExtensions();
}
// clear the cache for the linked module and requested module
MetaDataManager::refreshModulesCache($parser->getAffectedModules());
}
示例5: build
function build()
{
$modulesToBuild = array();
if (!isset($this->relationships[$this->newRelationshipName])) {
$GLOBALS['log']->fatal("Could not find a relationship by the name of {$this->newRelationshipName}, you will have to quick repair and rebuild to get the new relationship added.");
} else {
$newRel = $this->relationships[$this->newRelationshipName];
$newRelDef = $newRel->getDefinition();
$modulesToBuild[$newRelDef['rhs_module']] = true;
$modulesToBuild[$newRelDef['lhs_module']] = true;
}
$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) {
if ($relationship->readonly()) {
continue;
}
$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) {
if ($relationship->readonly()) {
continue;
}
$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();
$mi->install_extensions();
$mi->install_client_files();
}
$GLOBALS['mod_strings'] = $MBModStrings;
// finally, restore the ModuleBuilder mod_strings
// Anything that runs in-process needs to reload their vardefs
$GLOBALS['reload_vardefs'] = true;
// save out the updated definitions so that we keep track of the change in built status
// sending false so we don't rebuild relationshsips for a third time.
$this->save(false);
$mi = new ModuleInstaller();
$mi->silent = true;
$mi->rebuild_relationships($modulesToBuild);
// now clear all caches so that our changes are visible
require_once 'modules/Administration/QuickRepairAndRebuild.php';
$rac = new RepairAndClear();
$rac->module_list = $modulesToBuild;
$rac->clearJsFiles();
$rac->clearVardefs();
$rac->clearJsLangFiles();
$rac->clearLanguageCache();
$rac->rebuildExtensions(array_keys($modulesToBuild));
$rac->clearVardefs();
foreach ($rac->module_list as $moduleName => $ignore) {
// Now rebuild the vardefs in memory
$bean = BeanFactory::newBean($moduleName);
VardefManager::loadVardef($bean->module_dir, $bean->object_name, true, array('bean' => $bean));
}
foreach (array_keys($modulesToBuild) as $module) {
unset($GLOBALS['dictionary'][BeanFactory::getObjectName($module)]);
}
//.........这里部分代码省略.........
示例6: runRebuildExtensions
public function runRebuildExtensions(array $modules = array('Forecasts'))
{
SugarAutoLoader::load('modules/Administration/QuickRepairAndRebuild.php');
$rac = new RepairAndClear();
$rac->show_output = false;
$rac->module_list = $modules;
$rac->clearVardefs();
$rac->rebuildExtensions($modules);
}
示例7: run
public function run()
{
global $dictionary, $beanFiles;
include "include/modules.php";
require_once "modules/Administration/QuickRepairAndRebuild.php";
$rac = new RepairAndClear('', '', false, false);
$rac->clearVardefs();
$rac->rebuildExtensions();
$rac->clearExternalAPICache();
// this is dirty, but otherwise SugarBean caches old defs :(
$GLOBALS['reload_vardefs'] = true;
$repairedTables = array();
foreach ($beanFiles as $bean => $file) {
if (file_exists($file)) {
unset($GLOBALS['dictionary'][$bean]);
require_once $file;
$focus = new $bean();
if (empty($focus->table_name) || isset($repairedTables[$focus->table_name])) {
continue;
}
if ($focus instanceof SugarBean) {
if (!isset($repairedTables[$focus->table_name])) {
$sql = $this->db->repairTable($focus, true);
if (trim($sql) != '') {
$this->log('Running sql: ' . $sql);
}
$repairedTables[$focus->table_name] = true;
}
//Check to see if we need to create the audit table
if ($focus->is_AuditEnabled() && !$focus->db->tableExists($focus->get_audit_table_name())) {
$this->log('Creating audit table:' . $focus->get_audit_table_name());
$focus->create_audit_table();
}
}
}
}
unset($dictionary);
include "modules/TableDictionary.php";
foreach ($dictionary as $meta) {
$tablename = $meta['table'];
if (isset($repairedTables[$tablename])) {
continue;
}
$fielddefs = $meta['fields'];
$indices = $meta['indices'];
$sql = $this->db->repairTableParams($tablename, $fielddefs, $indices, true);
if (!empty($sql)) {
$this->log('Running sql: ' . $sql);
$repairedTables[$tablename] = true;
}
}
$this->log('Database repaired');
$this->log('Start rebuilding relationships');
$_REQUEST['silent'] = true;
include 'modules/Administration/RebuildRelationship.php';
$_REQUEST['upgradeWizard'] = true;
include 'modules/ACL/install_actions.php';
$this->log('Done rebuilding relationships');
unset($GLOBALS['reload_vardefs']);
// enable metadata caching once the database schema has been rebuilt
MetaDataManager::enableCache();
}