コード例 #1
0
function civicrm_main()
{
    global $civicrmUpgrade, $adminPath;
    civicrm_setup();
    // setup vars
    $configFile = $adminPath . DIRECTORY_SEPARATOR . 'civicrm.settings.php';
    // generate backend config file
    $string = "\n<?php\ndefine('CIVICRM_SETTINGS_PATH', '{$configFile}');\n\$error = @include_once( '{$configFile}' );\nif ( \$error == false ) {\n    echo \"Could not load the settings file at: {$configFile}\n\";\n    exit( );\n}\n\n// Load class loader\nrequire_once \$civicrm_root . '/CRM/Core/ClassLoader.php';\nCRM_Core_ClassLoader::singleton()->register();\n";
    $string = trim($string);
    civicrm_write_file($adminPath . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'civicrm.config.php', $string);
    $liveSite = substr_replace(JURI::root(), '', -1, 1);
    $siteKey = md5(uniqid('', true) . $liveSite);
    // generate backend settings file
    $string = civicrm_config(FALSE, $siteKey);
    civicrm_write_file($configFile, $string);
    // generate frontend settings file
    $string = civicrm_config(TRUE, $siteKey);
    civicrm_write_file(JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_civicrm' . DIRECTORY_SEPARATOR . 'civicrm.settings.php', $string);
    define('CIVICRM_SETTINGS_PATH', $configFile);
    include_once CIVICRM_SETTINGS_PATH;
    // for install case only
    if (!$civicrmUpgrade) {
        $sqlPath = $adminPath . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'sql';
        civicrm_source($sqlPath . DIRECTORY_SEPARATOR . 'civicrm.mysql');
        civicrm_source($sqlPath . DIRECTORY_SEPARATOR . 'civicrm_data.mysql');
        require_once 'CRM/Core/ClassLoader.php';
        CRM_Core_ClassLoader::singleton()->register();
        require_once 'CRM/Core/Config.php';
        $config = CRM_Core_Config::singleton();
        // now also build the menu
        require_once 'CRM/Core/Menu.php';
        CRM_Core_Menu::store();
    }
}
コード例 #2
0
ファイル: civicrm.php プロジェクト: ksecor/civicrm
function civicrm_main(&$config)
{
    global $sqlPath, $crmPath, $installType;
    if ($installType == 'drupal') {
        global $cmsPath;
        $siteDir = getSiteDir($cmsPath, $_SERVER['SCRIPT_FILENAME']);
        civicrm_setup($cmsPath . DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . $siteDir . DIRECTORY_SEPARATOR . 'files');
    } elseif ($installType == 'standalone') {
        $filesDirectory = $crmPath . DIRECTORY_SEPARATOR . 'standalone' . DIRECTORY_SEPARATOR . 'files';
        civicrm_setup($filesDirectory);
    }
    $dsn = "mysql://{$config['mysql']['username']}:{$config['mysql']['password']}@{$config['mysql']['server']}/{$config['mysql']['database']}?new_link=true";
    civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . 'civicrm.mysql');
    if (isset($config['loadGenerated']) && $config['loadGenerated']) {
        civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . 'civicrm_generated.mysql', true);
    } else {
        if (isset($config['seedLanguage']) and preg_match('/^[a-z][a-z]_[A-Z][A-Z]$/', $config['seedLanguage']) and file_exists($sqlPath . DIRECTORY_SEPARATOR . "civicrm_data.{$config['seedLanguage']}.mysql") and file_exists($sqlPath . DIRECTORY_SEPARATOR . "civicrm_acl.{$config['seedLanguage']}.mysql")) {
            civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . "civicrm_data.{$config['seedLanguage']}.mysql");
            civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . "civicrm_acl.{$config['seedLanguage']}.mysql");
        } else {
            civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . 'civicrm_data.mysql');
            civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . 'civicrm_acl.mysql');
        }
        civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . 'civicrm_sample_report.mysql', true);
    }
    // generate backend settings file
    if ($installType == 'drupal') {
        $siteDir = getSiteDir($cmsPath, $_SERVER['SCRIPT_FILENAME']);
        $configFile = $cmsPath . DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . $siteDir . DIRECTORY_SEPARATOR . 'civicrm.settings.php';
    } elseif ($installType == 'standalone') {
        $configFile = $crmPath . DIRECTORY_SEPARATOR . 'standalone' . DIRECTORY_SEPARATOR . 'civicrm.settings.php';
    }
    $string = civicrm_config($config);
    civicrm_write_file($configFile, $string);
}
コード例 #3
0
function civicrm_main()
{
    global $civicrmUpgrade, $adminPath;
    civicrm_setup();
    // setup vars
    $configFile = $adminPath . DIRECTORY_SEPARATOR . 'civicrm.settings.php';
    // generate backend config file
    $string = "\n<?php\nrequire_once '{$configFile}';\n";
    $string = trim($string);
    civicrm_write_file($adminPath . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'civicrm.config.php', $string);
    // generate backend settings file
    $string = civicrm_config(false);
    civicrm_write_file($configFile, $string);
    // generate frontend settings file
    $string = civicrm_config(true);
    civicrm_write_file(JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_civicrm' . DIRECTORY_SEPARATOR . 'civicrm.settings.php', $string);
    include_once $configFile;
    // for install case only
    if (!$civicrmUpgrade) {
        $sqlPath = $adminPath . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'sql';
        civicrm_source($sqlPath . DIRECTORY_SEPARATOR . 'civicrm.mysql');
        civicrm_source($sqlPath . DIRECTORY_SEPARATOR . 'civicrm_data.mysql');
        require_once 'CRM/Core/Config.php';
        $config = CRM_Core_Config::singleton();
        // now also build the menu
        require_once 'CRM/Core/Menu.php';
        CRM_Core_Menu::store();
    }
}
コード例 #4
0
function civicrm_main()
{
    global $sqlPath, $comPath, $crmPath, $frontPath;
    civicrm_setup();
    civicrm_source($sqlPath . DIRECTORY_SEPARATOR . 'civicrm_40.mysql');
    civicrm_source($sqlPath . DIRECTORY_SEPARATOR . 'civicrm_data.mysql');
    // generate backend settings file
    $configFile = $comPath . DIRECTORY_SEPARATOR . 'civicrm.settings.php';
    $string = civicrm_config(false);
    civicrm_write_file($configFile, $string);
    // generate backend config file
    $string = "\n<?php\ninclude_once '{$configFile}';\n?>\n";
    $string = trim($string);
    civicrm_write_file($crmPath . DIRECTORY_SEPARATOR . 'civicrm.config.php', $string);
    // generate frontend settings file
    $string = civicrm_config(true);
    civicrm_write_file($frontPath . DIRECTORY_SEPARATOR . 'civicrm.settings.php', $string);
}
コード例 #5
0
ファイル: civicrm.php プロジェクト: kcristiano/civicrm-core
/**
 * @param $config
 */
function civicrm_main(&$config)
{
    global $sqlPath, $crmPath, $cmsPath, $installType;
    if ($installType == 'drupal') {
        $siteDir = isset($config['site_dir']) ? $config['site_dir'] : getSiteDir($cmsPath, $_SERVER['SCRIPT_FILENAME']);
        civicrm_setup($cmsPath . DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . $siteDir . DIRECTORY_SEPARATOR . 'files');
    } elseif ($installType == 'backdrop') {
        civicrm_setup($cmsPath . DIRECTORY_SEPARATOR . 'files');
    } elseif ($installType == 'wordpress') {
        $upload_dir = wp_upload_dir();
        $files_dirname = $upload_dir['basedir'];
        civicrm_setup($files_dirname);
    }
    $dsn = "mysql://{$config['mysql']['username']}:{$config['mysql']['password']}@{$config['mysql']['server']}/{$config['mysql']['database']}?new_link=true";
    civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . 'civicrm.mysql');
    if (!empty($config['loadGenerated'])) {
        civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . 'civicrm_generated.mysql', TRUE);
    } else {
        if (isset($config['seedLanguage']) and preg_match('/^[a-z][a-z]_[A-Z][A-Z]$/', $config['seedLanguage']) and file_exists($sqlPath . DIRECTORY_SEPARATOR . "civicrm_data.{$config['seedLanguage']}.mysql") and file_exists($sqlPath . DIRECTORY_SEPARATOR . "civicrm_acl.{$config['seedLanguage']}.mysql")) {
            civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . "civicrm_data.{$config['seedLanguage']}.mysql");
            civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . "civicrm_acl.{$config['seedLanguage']}.mysql");
        } else {
            civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . 'civicrm_data.mysql');
            civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . 'civicrm_acl.mysql');
        }
    }
    // generate backend settings file
    if ($installType == 'drupal') {
        $configFile = $cmsPath . DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . $siteDir . DIRECTORY_SEPARATOR . 'civicrm.settings.php';
    } elseif ($installType == 'backdrop') {
        $configFile = $cmsPath . DIRECTORY_SEPARATOR . 'civicrm.settings.php';
    } elseif ($installType == 'wordpress') {
        $configFile = $files_dirname . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'civicrm.settings.php';
    }
    $string = civicrm_config($config);
    civicrm_write_file($configFile, $string);
}