/**
* Test that the links are added to the page (no JS testing).
*/
function testPermissions()
{
module_enable(array('contact'));
$this->resetAll();
// Anonymous users should not see the menu.
$this->drupalGet('');
$this->assertNoElementByXPath('//div[@id="admin-menu"]', array(), t('Administration menu not found.'));
// Create a user who
// - can access content overview
// - cannot access drupal.org links
// - cannot administer Contact module
$permissions = $this->basePermissions + array('access content overview');
$admin_user = $this->drupalCreateUser($permissions);
$this->drupalLogin($admin_user);
// Check that the user can see the admin links, but not the drupal links.
$this->assertElementByXPath('//div[@id="admin-menu"]', array(), 'Administration menu found.');
$this->assertElementByXPath('//div[@id="admin-menu"]//a[contains(@href, :path)]', array(':path' => 'admin/content'), 'Content link found.');
$this->assertNoElementByXPath('//div[@id="admin-menu"]//a[@href=:path]', array(':path' => 'http://drupal.org'), 'Icon » Drupal.org link not found.');
$this->assertNoElementByXPath('//div[@id="admin-menu"]//a[contains(@href, :path)]', array(':path' => 'admin/structure/contact'), 'Structure » Contact link not found.');
// Create a user "reversed" to the above; i.e., who
// - cannot access content overview
// - can access drupal.org links
// - can administer Contact module
$permissions = $this->basePermissions + array('display drupal links', 'administer contact forms');
$admin_user2 = $this->drupalCreateUser($permissions);
$this->drupalLogin($admin_user2);
$this->assertElementByXPath('//div[@id="admin-menu"]', array(), 'Administration menu found.');
$this->assertNoElementByXPath('//div[@id="admin-menu"]//a[contains(@href, :path)]', array(':path' => 'admin/content'), 'Content link not found.');
$this->assertElementByXPath('//div[@id="admin-menu"]//a[@href=:path]', array(':path' => 'http://drupal.org'), 'Icon » Drupal.org link found.');
$this->assertElementByXPath('//div[@id="admin-menu"]//a[contains(@href, :path)]', array(':path' => 'admin/structure/contact'), 'Structure » Contact link found.');
}
/**
* @param array $cache_types
* The autoloader modes that are enabled, e.g.
* array('apc' => 'apc', 'xcache' => 'xcache')
* @param bool $cache_lazy
* Whether the "lazy" mode is enabled.
*/
protected function xautoloadTestWithCacheTypes($cache_types, $cache_lazy)
{
// @FIXME
// // @FIXME
// // The correct configuration object could not be determined. You'll need to
// // rewrite this call manually.
// variable_set(XAUTOLOAD_VARNAME_CACHE_TYPES, $cache_types);
$this->pass("Set cache types: " . var_export($cache_types, TRUE));
// @FIXME
// // @FIXME
// // The correct configuration object could not be determined. You'll need to
// // rewrite this call manually.
// variable_set(XAUTOLOAD_VARNAME_CACHE_LAZY, $cache_lazy);
$this->pass("Set cache lazy mode: " . var_export($cache_lazy, TRUE));
// Enable xautoload.
module_enable(array('xautoload'), FALSE);
// At this time the xautoload_cache_mode setting is not in effect yet,
// so we have to clear old cached values from APC cache.
xautoload()->cacheManager->renewCachePrefix();
module_enable(array('xautoload_test_1', 'xautoload_test_2', 'xautoload_test_3', 'xautoload_test_4', 'xautoload_test_5'), FALSE);
menu_rebuild();
foreach (array('xautoload_test_1' => array('Drupal\\xautoload_test_1\\ExampleClass'), 'xautoload_test_2' => array('xautoload_test_2_ExampleClass'), 'xautoload_test_3' => array('Drupal\\xautoload_test_3\\ExampleClass')) as $module => $classes) {
$classes_on_include = in_array($module, array('xautoload_test_2', 'xautoload_test_3'));
$this->xautoloadModuleEnabled($module, $classes, $classes_on_include);
$this->xautoloadModuleCheckJson($module, $cache_types, $cache_lazy, $classes);
}
}
/**
* Test successful execution of hook_requirements() during install/enable.
*
* Function module_enable() does not check requirements, unlike normal
* enabling, so we need to invoke the hook manually to simulate it.
*/
public function testEnable()
{
module_load_install(static::MODULE);
module_invoke(static::MODULE, 'requirements', 'install');
module_enable([static::MODULE], FALSE);
$this->pass('Successfully enabled mongodb.module.');
}
/**
* implements hook_sanmateo_is_master_set
*
* PARAM is_master: a bool that states if this is the master site
*
* THis is called when ever this site is set as master or not master
* It can be used when other items need to be udpated
*/
function hook_sanmateo_is_master_set($is_master)
{
if ($is_master) {
module_enable(array('openid_provider'));
} else {
module_disable(array('openid_provider'));
}
}
function prepTestData()
{
$servers = array();
$variables = array();
$authentication = array();
$authorization = array();
$this->testFunctions = new LdapTestFunctions();
if ($this->useFeatureData) {
module_enable(array('ctools'), TRUE);
module_enable(array('strongarm'), TRUE);
module_enable(array('features'), TRUE);
module_enable(array($this->featureName), TRUE);
// will need to set non exportables such as bind password also
// also need to create fake ldap server data. use
if (!(module_exists('ctools') && module_exists('strongarm') && module_exists('features') && module_exists('$this->featureName'))) {
drupal_set_message(t('Features and Strongarm modules must be available to use Features as configuratio of simpletests'), 'warning');
}
// with test data stored in features, need to get server properties from ldap_server properties
require_once drupal_get_path('module', $this->featureName) . '/' . $this->featureName . '.ldap_servers.inc';
require_once drupal_get_path('module', $this->featureName) . '/fake_ldap_server_data.inc';
$function_name = $this->featureName . '_default_ldap_servers';
$servers = call_user_func($function_name);
foreach ($servers as $sid => $server) {
$this->testData['servers'][$sid]['properties'] = (array) $server;
// convert to array
$this->testData['servers'][$sid]['properties']['inDatabase'] = TRUE;
$this->testData['servers'][$sid]['properties']['bindpw'] = 'goodpwd';
$this->testData['servers'][$sid] = array_merge($this->testData['servers'][$sid], $fake_ldap_server_data[$sid]);
}
// make included fake sid match feature sid
$this->testFunctions->prepTestConfiguration($this->testData, TRUE);
} else {
include drupal_get_path('module', 'ldap_authorization') . '/tests/' . $this->authorizationData;
$this->testData['authorization'] = $authorization;
include drupal_get_path('module', 'ldap_authorization') . '/tests/' . $this->authenticationData;
$this->testData['authentication'] = $authentication;
include drupal_get_path('module', 'ldap_authorization') . '/tests/' . $this->serversData;
$this->testData['servers'] = $servers;
$this->testData['variables'] = $variables;
// if only one server, set as default in authentication and authorization
if (count($this->testData['servers']) == 1) {
$sids = array_keys($servers);
$this->sid = $sids[0];
foreach ($this->testData['authorization'] as $consumer_type => $consumer_conf) {
$this->testData['authorization'][$consumer_type]['consumerType'] = $consumer_type;
$this->testData['authorization'][$consumer_type]['sid'] = $this->sid;
}
$this->testData['authentication']['sids'] = array($this->sid => $this->sid);
$this->testData['servers'][$this->sid]['sid'] = $this->sid;
}
$this->testFunctions->prepTestConfiguration($this->testData, FALSE);
}
}
/**
* React to an environment state change.
*
* Use this hook to specify changes to your site configuration depending on
* what kind of environment the site is operating in. For example, production
* environments should not have developer/site-builder oriented modules enabled,
* such as administrative UI modules.
*
* When defining your state change actions, be careful to account for a given
* state always consisting of the same behaviors and configuration, regardless
* of how it returns to that state (which previous environment it was in.) Be
* careful that you do not *disable* any modules in one environment that
* implement a necessary instance of hook_environment_switch().
*
* @param $target_env
* The name of the environment being activated.
* @param $current_env
* The name of the environment being deactivated.
* @param $workflow
* The name of the environment workflow whose current state is being switched.
* A "NULL" workflow is the default/generic/unspecified workflow for the site.
*
* @return
* String summarizing changes made for drush user.
*/
function hook_environment_switch($target_env, $current_env, $workflow = NULL)
{
// Declare each optional development-related module
$devel_modules = array('devel', 'devel_generate', 'devel_node_access');
switch ($target_env) {
case 'production':
module_disable($devel_modules);
drupal_set_message('Disabled development modules');
return;
case 'development':
module_enable($devel_modules);
drupal_set_message('Enabled development modules');
return;
}
}
/**
* Test successful execution of hook_uninstall() with Mongodb disabled.
*
* This cannot be checked by API calls, because the missing functions will
* still be loaded in PHP, hence the need to use the UI to trigger page
* reloads.
*/
public function testUninstall()
{
module_enable([static::DRIVER, static::MODULE]);
$this->pass('Successfully enabled driver and watchdog.module.');
module_disable([static::MODULE, static::DRIVER]);
$admin = $this->drupalCreateUser(['administer modules']);
$this->drupalLogin($admin);
$modules = ['uninstall[mongodb_watchdog]' => 1];
$this->drupalPost('admin/modules/uninstall', $modules, t('Uninstall'));
$this->assertResponse(200, 'Module uninstall form succeeded');
$this->drupalPost(NULL, [], t('Uninstall'));
// Broken core : this should NOT be a 200, but actually is.
// $this->assertResponse(200, 'Module uninstall confirmation succeeded');
$this->assertText(t('The selected modules have been uninstalled.'), 'Module uninstall confirmation succeeded.');
$this->pass('Successfully uninstalled watchdog module.');
}
/**
* Enable modules if disabled.
*
* @param array $modules
* An array of modules
*/
function enable_modules_if_needed($modules)
{
foreach ($modules as $module) {
// Check if modules are disabled.
$result = db_select('system', 's')->fields('s', array('status'))->condition('name', $module, '=')->condition('status', 0, '=')->execute();
if ($result->fetchAssoc()) {
// Create an array of modules to enable.
$to_enable[] = $module;
}
}
if ($to_enable) {
module_enable($to_enable);
echo "Enabled new modules";
} else {
echo "No new modules to enable";
}
}
/**
* Enables given module(s) at given location by symlinking their contents
*
* @param string $loc the location the module(s) can be found
* @param array|string|null $name the name(s) of the module(s). Defaults to basename($loc).
*
* @throws \InvalidArgumentException
*/
public static function enableModule($loc, $name = null)
{
$loc = rtrim($loc, '/');
if (!is_dir($loc) || !is_readable($loc)) {
throw new \InvalidArgumentException(sprintf('Unable to read directory %s', $loc));
}
$base = basename($loc);
$link = DRUPAL_ROOT . "/sites/all/modules/{$base}";
if (file_exists($link) && readlink($link)) {
unlink($link);
}
symlink($loc, $link);
drupal_static('system_rebuild_module_data', null, true);
$modules = (array) ($name ?: $base);
$enabled = module_enable($modules);
if (false === $enabled) {
throw new \InvalidArgumentException(sprintf('Unable to enable module(s) "%s"', implode(',', $modules)));
}
module_invoke_all('boot');
module_invoke_all('init');
}
public function setUp()
{
// For benchmarking.
$this->start = time();
// Enable any modules required for the test.
parent::setUp('better_exposed_filters', 'date', 'date_views', 'list', 'number', 'taxonomy', 'text', 'views', 'views_ui');
// One of these days I'll figure out why Features is breaking all my tests.
module_enable(array('bef_test_content'));
// User with edit views perms
$this->admin_user = $this->drupalCreateUser();
$role = user_role_load_by_name('administrator');
$this->assertTrue(!empty($role->rid), 'Found the "administrator" role.');
user_save($this->admin_user, array('roles' => array($role->rid => $role->rid)));
$this->drupalLogin($this->admin_user);
// Build a basic view for use in tests.
$this->createView();
// $this->createDisplay('Page', array('path' => array('path' => 'bef_test_page')));
// Add field to default display
// $this->addField('node.title');
// Turn of Better Exposed Filters
$this->setBefExposedForm();
}
/**
* Implements AcsfEventHandler::handle().
*/
public function handle()
{
drush_print(dt('Entered @class', array('@class' => get_class($this))));
// Enable any modules that are currently disabled, but were once enabled, so
// that their data cleanup hooks (e.g. hook_user_delete) and functions
// (e.g. search_reindex) can be invoked.
//
// Note: These modules will all be uninstalled. Uninstalling them should
// really take care of all the cleanup these modules should be doing. But
// enable them here for good measure just incase there's some cleanup
// depending on these hooks.
require_once DRUPAL_ROOT . '/includes/install.inc';
$modules = system_rebuild_module_data();
$enable_for_scrub = array();
foreach ($modules as $module) {
// Disabled modules with schema_version > -1 have not been uninstalled.
if (empty($module->status) && $module->schema_version > SCHEMA_UNINSTALLED) {
$enable_for_scrub[] = $module->name;
}
}
// Get a list of disabled dependencies. These will get automatically enabled
// during module_enable(), but we want to be able to disable and uninstall
// them explicitly later.
foreach ($enable_for_scrub as $dependent) {
foreach (array_keys($modules[$dependent]->requires) as $dependency) {
// Use isset() to make sure the module is still in the filesystem before
// trying to enable it. (Historically there have been modules in Gardens
// which were disabled but then removed from the codebase without ever
// uninstalling them, and we don't want to try to enable those now,
// because it will fail.)
if (isset($modules[$dependency]) && empty($modules[$dependency]->status)) {
$enable_for_scrub[] = $dependency;
}
}
}
module_enable($enable_for_scrub);
acsf_vset('acsf_duplication_enable_for_scrub', $enable_for_scrub, 'acsf_duplication_scrub');
}
/**
* @param $config
*
* @return mixed
*/
public function install($config)
{
global $installDirPath;
// create database if does not exists
$this->createDatabaseIfNotExists($config['mysql']['server'], $config['mysql']['username'], $config['mysql']['password'], $config['mysql']['database']);
global $installDirPath;
// Build database
require_once $installDirPath . 'civicrm.php';
civicrm_main($config);
if (!$this->errors) {
global $installType, $installURLPath;
$registerSiteURL = "https://civicrm.org/register-site";
$commonOutputMessage = "<li>" . ts("Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to <a %1>fill out the site registration form</a>. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume mailing list).", array(1 => "href='{$registerSiteURL}' target='_blank'")) . "</li>" . "<li>" . ts("We have integrated KCFinder with CKEditor and TinyMCE. This allows a user to upload images. All uploaded images are public.") . "</li>";
$output = NULL;
if ($installType == 'drupal' && version_compare(VERSION, '7.0-rc1') >= 0) {
// clean output
@ob_clean();
$output .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
$output .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">';
$output .= '<head>';
$output .= '<title>' . ts('CiviCRM Installed') . '</title>';
$output .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
$output .= '<link rel="stylesheet" type="text/css" href="template.css" />';
$output .= '</head>';
$output .= '<body>';
$output .= '<div style="padding: 1em;"><p class="good">' . ts('CiviCRM has been successfully installed') . '</p>';
$output .= '<ul>';
$drupalURL = civicrm_cms_base();
$drupalPermissionsURL = "{$drupalURL}index.php?q=admin/people/permissions";
$drupalURL .= "index.php?q=civicrm/admin/configtask&reset=1";
$output .= "<li>" . ts("Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you <a %1>review these permissions</a> to ensure that they are appropriate for your requirements (<a %2>learn more...</a>)", array(1 => "target='_blank' href='{$drupalPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'")) . "</li>";
$output .= "<li>" . ts("Use the <a %1>Configuration Checklist</a> to review and configure settings for your new site", array(1 => "target='_blank' href='{$drupalURL}'")) . "</li>";
$output .= $commonOutputMessage;
// automatically enable CiviCRM module once it is installed successfully.
// so we need to Bootstrap Drupal, so that we can call drupal hooks.
global $cmsPath, $crmPath;
// relative / abosolute paths are not working for drupal, hence using chdir()
chdir($cmsPath);
// Force the re-initialisation of the config singleton on the next call
// since so far, we had used the Config object without loading the DB.
$c = CRM_Core_Config::singleton(FALSE);
$c->free();
include_once "./includes/bootstrap.inc";
include_once "./includes/unicode.inc";
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// prevent session information from being saved.
drupal_save_session(FALSE);
// Force the current user to anonymous.
$original_user = $GLOBALS['user'];
$GLOBALS['user'] = drupal_anonymous_user();
// explicitly setting error reporting, since we cannot handle drupal related notices
error_reporting(1);
// rebuild modules, so that civicrm is added
system_rebuild_module_data();
// now enable civicrm module.
module_enable(array('civicrm', 'civicrmtheme'));
// clear block, page, theme, and hook caches
drupal_flush_all_caches();
//add basic drupal permissions
civicrm_install_set_drupal_perms();
// restore the user.
$GLOBALS['user'] = $original_user;
drupal_save_session(TRUE);
//change the default language to one chosen
if (isset($config['seedLanguage']) && $config['seedLanguage'] != 'en_US') {
civicrm_api3('Setting', 'create', array('domain_id' => 'current_domain', 'lcMessages' => $config['seedLanguage']));
}
$output .= '</ul>';
$output .= '</div>';
$output .= '</body>';
$output .= '</html>';
echo $output;
} elseif ($installType == 'drupal' && version_compare(VERSION, '6.0') >= 0) {
// clean output
@ob_clean();
$output .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
$output .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">';
$output .= '<head>';
$output .= '<title>' . ts('CiviCRM Installed') . '</title>';
$output .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
$output .= '<link rel="stylesheet" type="text/css" href="template.css" />';
$output .= '</head>';
$output .= '<body>';
$output .= '<div style="padding: 1em;"><p class="good">' . ts("CiviCRM has been successfully installed") . '</p>';
$output .= '<ul>';
$drupalURL = civicrm_cms_base();
$drupalPermissionsURL = "{$drupalURL}index.php?q=admin/user/permissions";
$drupalURL .= "index.php?q=civicrm/admin/configtask&reset=1";
$output .= "<li>" . ts("Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you <a %1>review these permissions</a> to ensure that they are appropriate for your requirements (<a %2>learn more...</a>)", array(1 => "target='_blank' href='{$drupalPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'")) . "</li>";
$output .= "<li>" . ts("Use the <a %1>Configuration Checklist</a> to review and configure settings for your new site", array(1 => "target='_blank' href='{$drupalURL}'")) . "</li>";
$output .= $commonOutputMessage;
// explicitly setting error reporting, since we cannot handle drupal related notices
error_reporting(1);
// automatically enable CiviCRM module once it is installed successfully.
// so we need to Bootstrap Drupal, so that we can call drupal hooks.
//.........这里部分代码省略.........
function install($config)
{
global $installDirPath;
// create database if does not exists
$this->createDatabaseIfNotExists($config['mysql']['server'], $config['mysql']['username'], $config['mysql']['password'], $config['mysql']['database']);
global $installDirPath;
// Build database
require_once $installDirPath . 'civicrm.php';
civicrm_main($config);
if (!$this->errors) {
global $installType, $installURLPath;
$output = NULL;
if ($installType == 'drupal' && version_compare(VERSION, '7.0-rc1') >= 0) {
// clean output
@ob_clean();
$output .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
$output .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">';
$output .= '<head>';
$output .= '<title>CiviCRM Installed</title>';
$output .= '<link rel="stylesheet" type="text/css" href="template.css" />';
$output .= '</head>';
$output .= '<body>';
$output .= '<div style="padding: 1em;"><p class="good">CiviCRM has been successfully installed</p>';
$output .= '<ul>';
$docLinkConfig = CRM_Utils_System::docURL2('Configuring a New Site', FALSE, 'here', NULL, NULL, "wiki");
if (!function_exists('ts')) {
$docLinkConfig = "<a href=\"{$docLinkConfig}\">here</a>";
}
$drupalURL = civicrm_cms_base();
$drupalPermissionsURL = "{$drupalURL}index.php?q=admin/people/permissions";
$drupalURL .= "index.php?q=civicrm/admin/configtask&reset=1";
$registerSiteURL = "http://civicrm.org/civicrm/profile/create?reset=1&gid=15";
$output .= "<li>Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you <a target='_blank' href={$drupalPermissionsURL}>review these permissions</a> to ensure that they are appropriate for your requirements (<a target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'>learn more...</a>)</li>\n <li>Use the <a target='_blank' href=\"{$drupalURL}\">Configuration Checklist</a> to review and configure settings for your new site</li>\n <li> Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to <a href='{$registerSiteURL}' target='_blank'>fill out the site registration form</a>. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume mailing list).</li>\n <li>We have integrated KCFinder with CKEditor and TinyMCE, which enables user to upload images. Note that all the images uploaded using KCFinder will be public.</li>";
// automatically enable CiviCRM module once it is installed successfully.
// so we need to Bootstrap Drupal, so that we can call drupal hooks.
global $cmsPath, $crmPath;
// relative / abosolute paths are not working for drupal, hence using chdir()
chdir($cmsPath);
include_once "./includes/bootstrap.inc";
include_once "./includes/unicode.inc";
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// prevent session information from being saved.
drupal_save_session(FALSE);
// Force the current user to anonymous.
$original_user = $GLOBALS['user'];
$GLOBALS['user'] = drupal_anonymous_user();
// explicitly setting error reporting, since we cannot handle drupal related notices
error_reporting(1);
// rebuild modules, so that civicrm is added
system_rebuild_module_data();
// now enable civicrm module.
module_enable(array('civicrm', 'civicrmtheme'));
// clear block and page cache, to make sure civicrm link is present in navigation block
cache_clear_all();
//add basic drupal permissions
civicrm_install_set_drupal_perms();
// restore the user.
$GLOBALS['user'] = $original_user;
drupal_save_session(TRUE);
$output .= '</ul>';
$output .= '</div>';
$output .= '</body>';
$output .= '</html>';
echo $output;
} elseif ($installType == 'drupal' && version_compare(VERSION, '6.0') >= 0) {
// clean output
@ob_clean();
$output .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
$output .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">';
$output .= '<head>';
$output .= '<title>CiviCRM Installed</title>';
$output .= '<link rel="stylesheet" type="text/css" href="template.css" />';
$output .= '</head>';
$output .= '<body>';
$output .= '<div style="padding: 1em;"><p class="good">CiviCRM has been successfully installed</p>';
$output .= '<ul>';
$docLinkConfig = CRM_Utils_System::docURL2('Configuring a New Site', FALSE, 'here', NULL, NULL, "wiki");
if (!function_exists('ts')) {
$docLinkConfig = "<a href=\"{$docLinkConfig}\">here</a>";
}
$drupalURL = civicrm_cms_base();
$drupalPermissionsURL = "{$drupalURL}index.php?q=admin/user/permissions";
$drupalURL .= "index.php?q=civicrm/admin/configtask&reset=1";
$registerSiteURL = "http://civicrm.org/civicrm/profile/create?reset=1&gid=15";
$output .= "<li>Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you <a target='_blank' href={$drupalPermissionsURL}>review these permissions</a> to ensure that they are appropriate for your requirements (<a target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'>learn more...</a>)</li>\n <li>Use the <a target='_blank' href=\"{$drupalURL}\">Configuration Checklist</a> to review and configure settings for your new site</li>\n <li> Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to <a href='{$registerSiteURL}' target='_blank'>fill out the site registration form</a>. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume mailing list).</li>\n <li>We have integrated KCFinder with CKEditor and TinyMCE, which enables user to upload images. Note that all the images uploaded using KCFinder will be public.</li>";
// explicitly setting error reporting, since we cannot handle drupal related notices
error_reporting(1);
// automatically enable CiviCRM module once it is installed successfully.
// so we need to Bootstrap Drupal, so that we can call drupal hooks.
global $cmsPath, $crmPath;
// relative / abosolute paths are not working for drupal, hence using chdir()
chdir($cmsPath);
include_once "./includes/bootstrap.inc";
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// rebuild modules, so that civicrm is added
module_rebuild_cache();
// now enable civicrm module.
module_enable(array('civicrm'));
// clear block and page cache, to make sure civicrm link is present in navigation block
cache_clear_all();
//.........这里部分代码省略.........
请发表评论