本文整理汇总了PHP中module_rebuild_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP module_rebuild_cache函数的具体用法?PHP module_rebuild_cache怎么用?PHP module_rebuild_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了module_rebuild_cache函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install_tasks
/**
* Tasks performed after the database is initialized.
*/
function install_tasks($profile, $task)
{
global $base_url, $install_locale;
// Bootstrap newly installed Drupal, while preserving existing messages.
$messages = isset($_SESSION['messages']) ? $_SESSION['messages'] : '';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$_SESSION['messages'] = $messages;
// URL used to direct page requests.
$url = $base_url . '/install.php?locale=' . $install_locale . '&profile=' . $profile;
// Build a page for final tasks.
if (empty($task)) {
variable_set('install_task', 'profile-install');
$task = 'profile-install';
}
// We are using a list of if constructs here to allow for
// passing from one task to the other in the same request.
// Install profile modules.
if ($task == 'profile-install') {
$modules = variable_get('install_profile_modules', array());
$files = module_rebuild_cache();
variable_del('install_profile_modules');
$operations = array();
foreach ($modules as $module) {
$operations[] = array('_install_module_batch', array($module, $files[$module]->info['name']));
}
$batch = array('operations' => $operations, 'finished' => '_install_profile_batch_finished', 'title' => st('Installing @drupal', array('@drupal' => drupal_install_profile_name())), 'error_message' => st('The installation has encountered an error.'));
// Start a batch, switch to 'profile-install-batch' task. We need to
// set the variable here, because batch_process() redirects.
variable_set('install_task', 'profile-install-batch');
batch_set($batch);
batch_process($url, $url);
}
// We are running a batch install of the profile's modules.
// This might run in multiple HTTP requests, constantly redirecting
// to the same address, until the batch finished callback is invoked
// and the task advances to 'locale-initial-import'.
if ($task == 'profile-install-batch') {
include_once 'includes/batch.inc';
$output = _batch_page();
}
// Import interface translations for the enabled modules.
if ($task == 'locale-initial-import') {
if (!empty($install_locale) && $install_locale != 'en') {
include_once 'includes/locale.inc';
// Enable installation language as default site language.
locale_add_language($install_locale, NULL, NULL, NULL, NULL, NULL, 1, TRUE);
// Collect files to import for this language.
$batch = locale_batch_by_language($install_locale, '_install_locale_initial_batch_finished');
if (!empty($batch)) {
// Remember components we cover in this batch set.
variable_set('install_locale_batch_components', $batch['#components']);
// Start a batch, switch to 'locale-batch' task. We need to
// set the variable here, because batch_process() redirects.
variable_set('install_task', 'locale-initial-batch');
batch_set($batch);
batch_process($url, $url);
}
}
// Found nothing to import or not foreign language, go to next task.
$task = 'configure';
}
if ($task == 'locale-initial-batch') {
include_once 'includes/batch.inc';
include_once 'includes/locale.inc';
$output = _batch_page();
}
if ($task == 'configure') {
if (variable_get('site_name', FALSE) || variable_get('site_mail', FALSE)) {
// Site already configured: This should never happen, means re-running
// the installer, possibly by an attacker after the 'install_task' variable
// got accidentally blown somewhere. Stop it now.
install_already_done_error();
}
$form = drupal_get_form('install_configure_form', $url);
if (!variable_get('site_name', FALSE) && !variable_get('site_mail', FALSE)) {
// Not submitted yet: Prepare to display the form.
$output = $form;
drupal_set_title(st('Configure site'));
// Warn about settings.php permissions risk
$settings_dir = './' . conf_path();
$settings_file = $settings_dir . '/settings.php';
if (!drupal_verify_install_file($settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE) || !drupal_verify_install_file($settings_dir, FILE_NOT_WRITABLE, 'dir')) {
drupal_set_message(st('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, please consult the <a href="@handbook_url">on-line handbook</a>.', array('%dir' => $settings_dir, '%file' => $settings_file, '@handbook_url' => 'http://drupal.org/getting-started')), 'error');
} else {
drupal_set_message(st('All necessary changes to %dir and %file have been made. They have been set to read-only for security.', array('%dir' => $settings_dir, '%file' => $settings_file)));
}
// Add JavaScript validation.
_user_password_dynamic_validation();
drupal_add_js(drupal_get_path('module', 'system') . '/system.js', 'module');
// We add these strings as settings because JavaScript translation does not
// work on install time.
drupal_add_js(array('copyFieldValue' => array('edit-site-mail' => array('edit-account-mail')), 'cleanURL' => array('success' => st('Your server has been successfully tested to support this feature.'), 'failure' => st('Your system configuration does not currently support this feature. The <a href="http://drupal.org/node/15365">handbook page on Clean URLs</a> has additional troubleshooting information.'), 'testing' => st('Testing clean URLs...'))), 'setting');
drupal_add_js('
// Global Killswitch
if (Drupal.jsEnabled) {
$(document).ready(function() {
Drupal.cleanURLsInstallCheck();
//.........这里部分代码省略.........
示例2: registry_rebuild_cc_all
/**
* Registry Rebuild needs to aggressively clear all caches,
* not just some bins (at least to attempt it) also *before*
* attempting to rebuild registry, or it may not be able
* to fix the problem at all, if it relies on some cached
* and no longer valid data/paths etc. This problem has been
* confirmed and reproduced many times with option --fire-bazooka
* which is available only in the Drush variant, but it confirms
* the importance of starting with real, raw and not cached
* in any way site state. While the --no-cache-clear option
* still disables this procedure, --fire-bazooka takes precedence
* and forces all caches clear action. All caches are cleared
* by default in the PHP script variant.
*/
function registry_rebuild_cc_all()
{
if (function_exists('cache_clear_all')) {
cache_clear_all('*', 'cache', TRUE);
cache_clear_all('*', 'cache_form', TRUE);
} else {
cache('cache')->deleteAll();
cache('cache_form')->deleteAll();
}
if (function_exists('module_rebuild_cache')) {
// D5-D6
module_list(TRUE, FALSE);
module_rebuild_cache();
}
if (function_exists('drupal_flush_all_caches')) {
// D6+
drupal_flush_all_caches();
} else {
// D5
cache_clear_all();
system_theme_data();
node_types_rebuild();
menu_rebuild();
}
print "All caches have been cleared with registry_rebuild_cc_all.<br/>\n";
}
示例3: install
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();
//.........这里部分代码省略.........
示例4: install
//.........这里部分代码省略.........
// 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.
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";
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, page, theme, and hook caches
drupal_flush_all_caches();
//add basic drupal permissions
db_query('UPDATE {permission} SET perm = CONCAT( perm, \', access CiviMail subscribe/unsubscribe pages, access all custom data, access uploaded files, make online contributions, profile create, profile edit, profile view, register for events, view event info\') WHERE rid IN (1, 2)');
echo $output;
} elseif ($installType == 'wordpress') {
echo '<h1>' . ts('CiviCRM Installed') . '</h1>';
echo '<div style="padding: 1em;"><p style="background-color: #0C0; border: 1px #070 solid; color: white;">' . ts("CiviCRM has been successfully installed") . '</p>';
echo '<ul>';
$cmsURL = civicrm_cms_base();
$cmsURL .= "wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/configtask&reset=1";
$wpPermissionsURL = "wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/access/wp-permissions&reset=1";
$output .= "<li>" . ts("WordPress user permissions have been automatically set - giving Anonymous and Subscribers 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='{$wpPermissionsURL}'", 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='{$cmsURL}'")) . "</li>";
$output .= $commonOutputMessage;
echo '</ul>';
echo '</div>';
$c = CRM_Core_Config::singleton(FALSE);
$c->free();
$wpInstallRedirect = admin_url("?page=CiviCRM&q=civicrm&reset=1");
echo "<script>\n window.location = '{$wpInstallRedirect}';\n </script>";
}
}
return $this->errors;
}
示例5: rubik_preprocess_help_page
/**
* Preprocessor for theme('help_page').
*/
function rubik_preprocess_help_page(&$vars)
{
$vars['hook'] = 'help-page';
$vars['is_prose'] = TRUE;
$vars['layout'] = TRUE;
$vars['attr'] = array('class' => 'help-page clear-block');
// Truly hackish way to navigate help pages.
$module_info = module_rebuild_cache();
$modules = array();
foreach (module_implements('help', TRUE) as $module) {
if (module_invoke($module, 'help', "admin/help#{$module}", $empty_arg)) {
$modules[$module] = $module_info[$module]->info['name'];
}
}
asort($modules);
$links = array();
foreach ($modules as $module => $name) {
$links[] = array('title' => $name, 'href' => "admin/help/{$module}");
}
$vars['links'] = theme('links', $links);
}
示例6: update_check_incompatibility
/**
* Helper function to test compatibility of a module or theme.
*/
function update_check_incompatibility($name, $type = 'module')
{
static $themes, $modules;
// Store values of expensive functions for future use.
if (empty($themes) || empty($modules)) {
$themes = _system_theme_data();
$modules = module_rebuild_cache();
}
if ($type == 'module' && isset($modules[$name])) {
$file = $modules[$name];
} else {
if ($type == 'theme' && isset($themes[$name])) {
$file = $themes[$name];
}
}
if (!isset($file) || !isset($file->info['core']) || $file->info['core'] != DRUPAL_CORE_COMPATIBILITY || version_compare(phpversion(), $file->info['php']) < 0) {
return TRUE;
}
return FALSE;
}
示例7: drupalModuleDisable
/**
* Disables a drupal module in the test database.
*
* @param string $name Name of the module.
* @return boolean Success.
* @see drupalModuleEnable()
*/
function drupalModuleDisable($name)
{
if (!module_exists($name)) {
$this->pass(" [module] {$name} already disabled");
return TRUE;
}
unset($this->_modules[$key]);
$form_state['values'] = array('status' => $this->_modules, 'op' => t('Save configuration'));
drupal_execute('system_modules', $form_state);
//rebuilding all caches
drupal_rebuild_theme_registry();
node_types_rebuild();
menu_rebuild();
cache_clear_all('schema', 'cache');
module_rebuild_cache();
}
示例8: install
function install($config)
{
echo '<link rel="stylesheet" type="text/css" href="template.css" />';
echo '<div style="padding: 1em;"><h1>Installing CiviCRM...</h1>
<p>I am now running through the installation steps (this should take a few minutes)<p/>
<p>If you receive a fatal error, refresh this page to continue the installation</p>';
flush();
// Load the sapphire runtime
echo '<br/>Building database schema and setup files...</div>';
flush();
// create database if does not exists
$this->createDatabaseIfNotExists($config['mysql']['server'], $config['mysql']['username'], $config['mysql']['password'], $config['mysql']['database']);
// Build database
require_once 'civicrm.php';
civicrm_main($config);
// clean output
@ob_clean();
if (!$this->errors) {
global $installType;
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">';
echo '<head>';
echo '<title>CiviCRM Installed</title>';
echo '<link rel="stylesheet" type="text/css" href="template.css" />';
echo '</head>';
echo '<body>';
echo '<div style="padding: 1em;"><p class="good">CiviCRM has been successfully installed</p>';
echo '<ul>';
$docLinkConfig = CRM_Utils_System::docURL2('Configuring a New Site', false, 'here');
if (!function_exists('ts')) {
$docLinkConfig = "<a href=\"{$docLinkConfig}\">here</a>";
}
if ($installType == 'drupal') {
$drupalURL = civicrm_cms_base();
$drupalPermissionsURL = "{$drupalURL}index.php?q=admin/user/permissions";
$drupalURL .= "index.php?q=civicrm/admin/configtask&reset=1";
echo "<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>";
// 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();
//add basic drupal permissions
db_query('UPDATE {permission} SET perm = CONCAT( perm, \', access CiviMail subscribe/unsubscribe pages, access all custom data, access uploaded files, make online contributions, profile listings and forms, register for events, view event info, view event participants\') WHERE rid IN (1, 2)');
} elseif ($installType == 'standalone') {
$standaloneURL = civicrm_cms_base() . 'standalone/index.php';
$checkListURL = $standaloneURL . "?q=civicrm/admin/configtask&reset=1";
echo "<li>Click <a target=\"_blank\" href=\"{$standaloneURL}\">here</a> to go to your CiviCRM Standalone home page.</li>";
}
echo '</ul>';
echo '</div>';
echo '</body>';
echo '</html>';
}
return $this->errors;
}
示例9: tearDown
/**
* tearDown implementation, setting back switched modules etc
*/
function tearDown()
{
if ($this->_modules != $this->_originalModules) {
$form_state['values'] = array('status' => $this->_originalModules, 'op' => t('Save configuration'));
drupal_execute('system_modules', $form_state);
//rebuilding all caches
drupal_rebuild_theme_registry();
node_types_rebuild();
menu_rebuild();
cache_clear_all('schema', 'cache');
module_rebuild_cache();
$this->_modules = $this->_originalModules;
}
foreach ($this->_cleanupVariables as $name => $value) {
if (is_null($value)) {
variable_del($name);
} else {
variable_set($name, $value);
}
}
$this->_cleanupVariables = array();
//delete nodes
foreach ($this->_cleanupNodes as $nid) {
node_delete($nid);
}
$this->_cleanupNodes = array();
//delete roles
while (sizeof($this->_cleanupRoles) > 0) {
$rid = array_pop($this->_cleanupRoles);
db_query("DELETE FROM {role} WHERE rid = %d", $rid);
db_query("DELETE FROM {permission} WHERE rid = %d", $rid);
}
//delete users and their content
while (sizeof($this->_cleanupUsers) > 0) {
$uid = array_pop($this->_cleanupUsers);
// cleanup nodes this user created
$result = db_query("SELECT nid FROM {node} WHERE uid = %d", $uid);
while ($node = db_fetch_array($result)) {
node_delete($node['nid']);
}
user_delete(array(), $uid);
}
//delete content types
foreach ($this->_cleanupContentTypes as $type) {
node_type_delete($type);
}
$this->_cleanupContentTypes = array();
//Output drupal warnings and messages into assert messages
$drupal_msgs = drupal_get_messages();
foreach ($drupal_msgs as $type => $msgs) {
foreach ($msgs as $msg) {
$this->assertTrue(TRUE, "{$type}: {$msg}");
}
}
parent::tearDown();
}
示例10: drupalModuleEnable
/**
* Enables a drupal module
* @param string $name name of the module
* @return boolean success
*/
function drupalModuleEnable($name)
{
if (module_exists($name)) {
return TRUE;
}
include_once './includes/install.inc';
module_rebuild_cache();
// Rebuild the module cache
if (drupal_get_installed_schema_version($name, TRUE) == SCHEMA_UNINSTALLED) {
drupal_install_modules(array($name));
} else {
$try = module_enable(array($name));
}
if (module_exists($name)) {
if (!isset($this->_cleanupModules[$name])) {
$this->_cleanupModules[$name] = 0;
return TRUE;
}
} else {
die("required module {$name} could not be enabled (probably file does not exist)");
}
}
示例11: drupalModuleEnable
/**
* Enables a drupal module
* @param string $name name of the module
* @return boolean success
*/
function drupalModuleEnable($name)
{
if (module_exists($name)) {
$this->pass(" [module] {$name} already enabled");
return TRUE;
}
include_once './includes/install.inc';
module_rebuild_cache();
// Rebuild the module cache
if (drupal_get_installed_schema_version($name, TRUE) == SCHEMA_UNINSTALLED) {
drupal_install_modules(array($name));
} else {
$try = module_enable(array($name));
}
if (module_exists($name)) {
if (!isset($this->_cleanupModules[$name])) {
$this->_cleanupModules[$name] = 0;
}
$this->pass(" [module] {$name} enabled");
return TRUE;
} else {
$this->fail(" [module] {$name} could not be enbled, probably file not exists");
return FALSE;
}
}