示例#1
0
/**
 * Enable the InsideView connector for the four default modules.
 */
function upgradeEnableInsideViewConnector($path = '')
{
    logThis('Begin upgradeEnableInsideViewConnector', $path);
    // Load up the existing mapping and hand it to the InsideView connector to have it setup the correct logic hooks
    $mapFile = 'modules/Connectors/connectors/sources/ext/rest/insideview/mapping.php';
    if (file_exists('custom/' . $mapFile)) {
        logThis('Found CUSTOM mappings', $path);
        require 'custom/' . $mapFile;
    } else {
        logThis('Used default mapping', $path);
        require $mapFile;
    }
    require_once 'include/connectors/sources/SourceFactory.php';
    $source = SourceFactory::getSource('ext_rest_insideview');
    // $mapping is brought in from the mapping.php file above
    $source->saveMappingHook($mapping);
    require_once 'include/connectors/utils/ConnectorUtils.php';
    ConnectorUtils::installSource('ext_rest_insideview');
    // Now time to set the various modules to active, because this part ignores the default config
    require CONNECTOR_DISPLAY_CONFIG_FILE;
    // $modules_sources come from that config file
    foreach ($source->allowedModuleList as $module) {
        $modules_sources[$module]['ext_rest_insideview'] = 'ext_rest_insideview';
    }
    if (!write_array_to_file('modules_sources', $modules_sources, CONNECTOR_DISPLAY_CONFIG_FILE)) {
        //Log error and return empty array
        logThis("Cannot write \$modules_sources to " . CONNECTOR_DISPLAY_CONFIG_FILE, $path);
    }
    logThis('End upgradeEnableInsideViewConnector', $path);
}
示例#2
0
 function install_connectors()
 {
     if (isset($this->installdefs['connectors'])) {
         foreach ($this->installdefs['connectors'] as $cp) {
             $this->log(translate('LBL_MI_IN_CONNECTORS') . $cp['name']);
             $dir = str_replace('_', '/', $cp['name']);
             $cp['connector'] = str_replace('<basepath>', $this->base_dir, $cp['connector']);
             $source_path = 'custom/modules/Connectors/connectors/sources/' . $dir . '/';
             $GLOBALS['log']->debug("Installing Connector " . $cp['name'] . "..." . $cp['connector']);
             if (!file_exists($source_path)) {
                 mkdir_recursive($source_path, true);
             }
             copy_recursive($cp['connector'], $source_path);
             //Install optional formatter code if it is specified
             if (!empty($cp['formatter'])) {
                 $cp['formatter'] = str_replace('<basepath>', $this->base_dir, $cp['formatter']);
                 $formatter_path = 'custom/modules/Connectors/connectors/formatters/' . $dir . '/';
                 if (!file_exists($formatter_path)) {
                     mkdir_recursive($formatter_path, true);
                 }
                 copy_recursive($cp['formatter'], $formatter_path);
             }
         }
         require_once 'include/connectors/utils/ConnectorUtils.php';
         ConnectorUtils::installSource($cp['name']);
     }
 }