本文整理汇总了PHP中Relationship::build_relationship_cache方法的典型用法代码示例。如果您正苦于以下问题:PHP Relationship::build_relationship_cache方法的具体用法?PHP Relationship::build_relationship_cache怎么用?PHP Relationship::build_relationship_cache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relationship
的用法示例。
在下文中一共展示了Relationship::build_relationship_cache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gmdate
//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'];
}
示例2: testbuild_relationship_cache
public function testbuild_relationship_cache()
{
//unset and reconnect Db to resolve mysqli fetch exeception
global $db;
unset($db->database);
$db->checkConnection();
$relationship = new Relationship();
//execute the method and test if it works and does not throws an exception.
try {
$relationship->build_relationship_cache();
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail();
}
}
示例3: 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'];
}