本文整理汇总了PHP中ConnectorUtils::updateMetaDataFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP ConnectorUtils::updateMetaDataFiles方法的具体用法?PHP ConnectorUtils::updateMetaDataFiles怎么用?PHP ConnectorUtils::updateMetaDataFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectorUtils
的用法示例。
在下文中一共展示了ConnectorUtils::updateMetaDataFiles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
if (!ConnectorUtils::updateMetaDataFiles()) {
$this->log('Cannot update metadata files for connectors');
}
//Delete the custom connectors.php file if it exists so that it may be properly rebuilt
if (file_exists('custom/modules/Connectors/metadata/connectors.php')) {
unlink('custom/modules/Connectors/metadata/connectors.php');
}
}
示例2: action_SaveModifyMapping
/**
* action_SaveModifyMapping
*/
function action_SaveModifyMapping()
{
$mapping_sources = !empty($_REQUEST['mapping_sources']) ? explode(',', $_REQUEST['mapping_sources']) : array();
$mapping_values = !empty($_REQUEST['mapping_values']) ? explode(',', $_REQUEST['mapping_values']) : array();
//Build the source->module->fields mapping
$source_modules_fields = array();
foreach ($mapping_values as $id) {
$parts = explode(':', $id);
$key_vals = explode('=', $parts[2]);
//Note the strtolwer call... we are lowercasing the key values
$source_modules_fields[$parts[0]][$parts[1]][strtolower($key_vals[0])] = $key_vals[1];
}
//foreach
foreach ($mapping_sources as $source_id) {
if (empty($source_modules_fields[$source_id])) {
$source = SourceFactory::getSource($source_id);
$mapping = $source->getMapping();
foreach ($mapping['beans'] as $module => $entry) {
$source_modules_fields[$source_id][$module] = array();
}
}
}
//foreach
require_once 'include/connectors/utils/ConnectorUtils.php';
$source_entries = ConnectorUtils::getConnectors();
require_once 'include/connectors/sources/SourceFactory.php';
foreach ($source_modules_fields as $id => $mapping_entry) {
//Insert the id mapping
foreach ($mapping_entry as $module => $entry) {
$mapping_entry[$module]['id'] = 'id';
}
$source = SourceFactory::getSource($id);
$mapping = $source->getMapping();
$mapping['beans'] = $mapping_entry;
//Now write the new mapping entry to the custom folder
$dir = $source_entries[$id]['directory'];
if (!preg_match('/^custom\\//', $dir)) {
$dir = 'custom/' . $dir;
}
if (!file_exists("{$dir}")) {
mkdir_recursive("{$dir}");
}
if (!write_array_to_file('mapping', $mapping, "{$dir}/mapping.php")) {
$GLOBALS['log']->fatal("Cannot write file {$dir}/mapping.php");
}
$source->saveMappingHook($mapping);
}
//Rewrite the metadata files
ConnectorUtils::updateMetaDataFiles();
// BEGIN SUGAR INT
if (empty($_REQUEST['from_unit_test'])) {
// END SUGAR INT
header("Location: index.php?action=ConnectorSettings&module=Connectors");
// BEGIN SUGAR INT
}
// END SUGAR INT
}
示例3: upgrade_connectors
/**
* upgrade_connectors
*
* This function handles support for upgrading connectors it is invoked from both end.php and silentUpgrade_step2.php
*
*/
function upgrade_connectors()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
if (!ConnectorUtils::updateMetaDataFiles()) {
$GLOBALS['log']->fatal('Cannot update metadata files for connectors');
}
//Delete the custom connectors.php file if it exists so that it may be properly rebuilt
if (file_exists('custom/modules/Connectors/metadata/connectors.php')) {
unlink('custom/modules/Connectors/metadata/connectors.php');
}
}
示例4: foreach
foreach ($sources as $source_key => $source) {
foreach ($previous_connectors as $previous_connector) {
if (in_array($previous_connector, $default_modules_sources[$module])) {
unset($default_modules_sources[$module][$previous_connector]);
}
}
}
}
// Merge in the new connector default settings with the current settings
foreach ($modules_sources as $module => $sources) {
if (!empty($default_modules_sources[$module])) {
$merged = array_merge($modules_sources[$module], $default_modules_sources[$module]);
$default_modules_sources[$module] = $merged;
} else {
$default_modules_sources[$module] = $modules_sources[$module];
}
}
}
if (!file_exists('custom/modules/Connectors/metadata')) {
mkdir_recursive('custom/modules/Connectors/metadata');
}
if (!write_array_to_file('connectors', $default_connectors, 'custom/modules/Connectors/metadata/connectors.php')) {
$GLOBALS['log']->fatal('Cannot write file custom/modules/Connectors/metadata/connectors.php');
}
if (!write_array_to_file('modules_sources', $default_modules_sources, 'custom/modules/Connectors/metadata/display_config.php')) {
$GLOBALS['log']->fatal('Cannot write file custom/modules/Connectors/metadata/display_config.php');
}
require_once 'include/connectors/utils/ConnectorUtils.php';
if (!ConnectorUtils::updateMetaDataFiles()) {
$GLOBALS['log']->fatal('Cannot update metadata files for connectors');
}
示例5: action_SaveModifyProperties
function action_SaveModifyProperties()
{
require_once 'include/connectors/sources/SourceFactory.php';
$sources = array();
$properties = array();
foreach ($_REQUEST as $name => $value) {
if (preg_match("/^source[0-9]+\$/", $name, $matches)) {
$source_id = $value;
$properties = array();
foreach ($_REQUEST as $arg => $val) {
if (preg_match("/^{$source_id}_(.*?)\$/", $arg, $matches2)) {
$properties[$matches2[1]] = $val;
}
}
$source = SourceFactory::getSource($source_id);
if (!empty($properties)) {
$source->setProperties($properties);
$source->saveConfig();
}
}
}
require_once 'include/connectors/utils/ConnectorUtils.php';
ConnectorUtils::updateMetaDataFiles();
// BEGIN SUGAR INT
if (empty($_REQUEST['from_unit_test'])) {
// END SUGAR INT
header("Location: index.php?action=ConnectorSettings&module=Connectors");
// BEGIN SUGAR INT
}
}