本文整理汇总了PHP中Relationship::delete_cache方法的典型用法代码示例。如果您正苦于以下问题:PHP Relationship::delete_cache方法的具体用法?PHP Relationship::delete_cache怎么用?PHP Relationship::delete_cache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relationship
的用法示例。
在下文中一共展示了Relationship::delete_cache方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
function delete($rel_name)
{
require_once "ModuleInstall/ModuleInstaller.php";
require_once 'modules/Administration/QuickRepairAndRebuild.php';
$mi = new ModuleInstaller();
$mi->silent = true;
$mi->uninstall_relationship("custom/metadata/{$rel_name}MetaData.php");
// now clear all caches so that our changes are visible
Relationship::delete_cache();
$mi->rebuild_tabledictionary();
$MBmodStrings = $GLOBALS['mod_strings'];
$GLOBALS['mod_strings'] = return_module_language('', 'Administration');
$rac = new RepairAndClear();
$rac->repairAndClearAll(array('clearAll', 'rebuildExtensions'), array($GLOBALS['mod_strings']['LBL_ALL_MODULES']), true, false);
$GLOBALS['mod_strings'] = $MBmodStrings;
}
示例2: delete
function delete($rel_name)
{
//Remove any fields from layouts
$rel = $this->get($rel_name);
if (!empty($rel)) {
$this->removeFieldsFromDeployedLayout($rel);
}
require_once "ModuleInstall/ModuleInstaller.php";
require_once 'modules/Administration/QuickRepairAndRebuild.php';
$mi = new ModuleInstaller();
$mi->silent = true;
$mi->uninstall_relationship("custom/metadata/{$rel_name}MetaData.php");
// now clear all caches so that our changes are visible
Relationship::delete_cache();
$mi->rebuild_tabledictionary();
$MBmodStrings = $GLOBALS['mod_strings'];
$GLOBALS['mod_strings'] = return_module_language('', 'Administration');
$rac = new RepairAndClear();
$rac->repairAndClearAll(array('clearAll', 'rebuildExtensions'), array($GLOBALS['mod_strings']['LBL_ALL_MODULES']), true, false);
$GLOBALS['mod_strings'] = $MBmodStrings;
//Bug 41070, supercedes the previous 40941 fix in this section
if (isset($this->relationships[$rel_name])) {
unset($this->relationships[$rel_name]);
}
}
示例3: uninstall_relationships
function uninstall_relationships($include_studio_relationships = false)
{
$relationships = array();
//Find and remove studio created relationships.
global $beanList, $beanFiles, $dictionary;
//Load up the custom relationship definitions.
if (file_exists('custom/application/Ext/TableDictionary/tabledictionary.ext.php')) {
include 'custom/application/Ext/TableDictionary/tabledictionary.ext.php';
}
//Find all the relatioships/relate fields involving this module.
$rels_to_remove = array();
foreach ($beanList as $mod => $bean) {
//Some modules like cases have a bean name that doesn't match the object name
$bean = BeanFactory::getObjectName($mod);
VardefManager::loadVardef($mod, $bean);
//We can skip modules that are in this package as they will be removed anyhow
if (!in_array($mod, $this->modulesInPackage) && !empty($dictionary[$bean]) && !empty($dictionary[$bean]['fields'])) {
$field_defs = $dictionary[$bean]['fields'];
foreach ($field_defs as $field => $def) {
//Weed out most fields first
if (isset($def['type'])) {
//Custom relationships created in the relationship editor
if ($def['type'] == "link" && !empty($def['relationship']) && !empty($dictionary[$def['relationship']])) {
$rel_name = $def['relationship'];
$rel_def = $dictionary[$rel_name]['relationships'][$rel_name];
//Check against mods to be removed.
foreach ($this->modulesInPackage as $removed_mod) {
if ($rel_def['lhs_module'] == $removed_mod || $rel_def['rhs_module'] == $removed_mod) {
$dictionary[$rel_name]['from_studio'] = true;
$relationships[$rel_name] = $dictionary[$rel_name];
}
}
}
//Custom "relate" fields created in studio also need to be removed
if ($def['type'] == 'relate' && isset($def['module'])) {
foreach ($this->modulesInPackage as $removed_mod) {
if ($def['module'] == $removed_mod) {
require_once 'modules/ModuleBuilder/Module/StudioModule.php';
$studioMod = new StudioModule($mod);
$studioMod->removeFieldFromLayouts($field);
if (isset($def['custom_module'])) {
require_once 'modules/DynamicFields/DynamicField.php';
require_once $beanFiles[$bean];
$seed = new $bean();
$df = new DynamicField($mod);
$df->setup($seed);
//Need to load the entire field_meta_data for some field types
$field_obj = $df->getFieldWidget($mod, $field);
$field_obj->delete($df);
}
}
}
}
}
}
}
}
$this->uninstall_relationship(null, $relationships);
if (isset($this->installdefs['relationships'])) {
$relationships = $this->installdefs['relationships'];
$this->log(translate('LBL_MI_UN_RELATIONSHIPS'));
foreach ($relationships as $relationship) {
// remove the metadata entry
$filename = basename($relationship['meta_data']);
$pathname = file_exists("custom/metadata/{$filename}") ? "custom/metadata/{$filename}" : "metadata/{$filename}";
if (isset($GLOBALS['mi_remove_tables']) && $GLOBALS['mi_remove_tables']) {
$this->uninstall_relationship($pathname);
}
if (file_exists($pathname)) {
unlink($pathname);
}
}
}
if (file_exists("custom/Extension/application/Ext/TableDictionary/{$this->id_name}.php")) {
unlink("custom/Extension/application/Ext/TableDictionary/{$this->id_name}.php");
}
Relationship::delete_cache();
$this->rebuild_tabledictionary();
}
示例4: testdelete_cache
public function testdelete_cache()
{
//execute the method and test if it works and does not throws an exception.
try {
Relationship::delete_cache();
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail();
}
}
示例5: create_guid
//clean relationship cache..will be rebuilt upon first access.
if (empty($_REQUEST['silent'])) {
echo $mod_strings['LBL_REBUILD_REL_DEL_CACHE'];
}
Relationship::delete_cache();
//////////////////////////////////////////////////////////////////////////////
// Remove the "Rebuild Relationships" red text message on admin logins
if (empty($_REQUEST['silent'])) {
echo $mod_strings['LBL_REBUILD_REL_UPD_WARNING'];
}
// clear the database row if it exists (just to be sure)
$query = "DELETE FROM versions WHERE name='Rebuild Relationships'";
$log->info($query);
$db->query($query);
// insert a new database row to show the rebuild relationships is done
$id = create_guid();
$gmdate = gmdate('Y-m-d H:i:s');
$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 Relationships', '4.0.0', '4.0.0')";
$log->info($query);
$db->query($query);
$rel = new Relationship();
Relationship::delete_cache();
$rel->build_relationship_cache();
// unset the session variable so it is not picked up in DisplayWarnings.php
if (isset($_SESSION['rebuild_relationships'])) {
unset($_SESSION['rebuild_relationships']);
}
if (empty($_REQUEST['silent'])) {
echo $mod_strings['LBL_DONE'];
}
示例6: setUp
//.........这里部分代码省略.........
'rhs_key' => 'id',
'relationship_type' => 'one-to-many',
'join_table' => 'abc_test_abc_test_c',
'join_key_lhs' => 'abc_test_ab6dabc_test_ida',
'join_key_rhs' => 'abc_test_aed49bc_test_idb',
),
),
'table' => 'abc_test_abc_test_c',
'fields' =>
array (
0 =>
array (
'name' => 'id',
'type' => 'varchar',
'len' => 36,
),
1 =>
array (
'name' => 'date_modified',
'type' => 'datetime',
),
2 =>
array (
'name' => 'deleted',
'type' => 'bool',
'len' => '1',
'default' => '0',
'required' => true,
),
3 =>
array (
'name' => 'abc_test_ab6dabc_test_ida',
'type' => 'varchar',
'len' => 36,
),
4 =>
array (
'name' => 'abc_test_aed49bc_test_idb',
'type' => 'varchar',
'len' => 36,
),
),
'indices' =>
array (
0 =>
array (
'name' => 'abc_test_abc_testspk',
'type' => 'primary',
'fields' =>
array (
0 => 'id',
),
),
1 =>
array (
'name' => 'abc_test_abc_test_ida1',
'type' => 'index',
'fields' =>
array (
0 => 'abc_test_ab6dabc_test_ida',
),
),
2 =>
array (
'name' => 'abc_test_abc_test_alt',
'type' => 'alternate_key',
'fields' =>
array (
0 => 'abc_test_aed49bc_test_idb',
),
),
),
);
?>
EOQ;
fputs($fh, $string);
fclose($fh);
}
if (!file_exists('custom/Extension/application/Ext/TableDictionary')) {
mkdir_recursive('custom/Extension/application/Ext/TableDictionary');
}
if ($fh = @fopen('custom/Extension/application/Ext/TableDictionary/abc_test_abc_test.php', 'w+')) {
$string = <<<EOQ
<?php
include('custom/metadata/abc_test_abc_testMetaData.php');
?>
EOQ;
fputs($fh, $string);
fclose($fh);
}
$this->rel_guid = create_guid();
$sql = "INSERT INTO relationships (id, relationship_name, lhs_module, lhs_table, lhs_key, rhs_module, rhs_table, rhs_key, join_table, join_key_lhs, join_key_rhs, relationship_type, reverse, deleted) VALUES ('{$this->rel_guid}', 'abc_test_abc_test', 'abc_Test', 'abc_test', 'id', 'abc_Test', 'abc_test', 'id', 'abc_test_abc_test_c', 'abc_test_ab6abc_test_id', 'abc_test_aed49bc_test_id', 'one-to-many', 0, 0)";
$GLOBALS['db']->query($sql);
$rel = new Relationship();
Relationship::delete_cache();
$rel->build_relationship_cache();
$this->moduleList = $GLOBALS['moduleList'];
}
示例7: cleanCache
/**
* Clears cache.
*/
protected function cleanCache()
{
$mi = new ModuleInstaller();
$mi->silent = true;
Relationship::delete_cache();
$mi->rebuild_vardefs();
$mi->rebuild_tabledictionary();
}
示例8: uninstall_relationship
function uninstall_relationship($file)
{
if (!file_exists($file)) {
$GLOBALS['log']->debug('File does not exists : ' . $file);
return;
}
include_once $file;
$rel_dictionary = $dictionary;
foreach ($rel_dictionary as $rel_name => $rel_data) {
$table = $rel_data['table'];
if ($this->db->tableExists($table)) {
SugarBean::removeRelationshipMeta($rel_name, $this->db, $table, $rel_dictionary, '');
$this->db->dropTableName($table);
Relationship::delete_cache();
if (!$this->silent) {
$GLOBALS['log']->debug('droping table ' . $table);
}
}
}
}