当前位置: 首页>>代码示例>>PHP>>正文


PHP drupal_cron_run函数代码示例

本文整理汇总了PHP中drupal_cron_run函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_cron_run函数的具体用法?PHP drupal_cron_run怎么用?PHP drupal_cron_run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了drupal_cron_run函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * Generates a random database prefix, runs the install scripts on the
  * prefixed database and enable the specified modules. After installation
  * many caches are flushed and the internal browser is setup so that the
  * page requests will run on the new prefix. A temporary files directory
  * is created with the same name as the database prefix.
  *
  * @param ...
  *   List of modules to enable for the duration of the test. This can be
  *   either a single array or a variable number of string arguments.
  */
 protected function setUp()
 {
     global $user, $language, $conf;
     // Generate a temporary prefixed database to ensure that tests have a clean starting point.
     $this->databasePrefix = 'simpletest' . mt_rand(1000, 1000000);
     db_update('simpletest_test_id')->fields(array('last_prefix' => $this->databasePrefix))->condition('test_id', $this->testId)->execute();
     // Clone the current connection and replace the current prefix.
     $connection_info = Database::getConnectionInfo('default');
     Database::renameConnection('default', 'simpletest_original_default');
     foreach ($connection_info as $target => $value) {
         $connection_info[$target]['prefix'] = array('default' => $value['prefix']['default'] . $this->databasePrefix);
     }
     Database::addConnectionInfo('default', 'default', $connection_info['default']);
     // Store necessary current values before switching to prefixed database.
     $this->originalLanguage = $language;
     $this->originalLanguageDefault = variable_get('language_default');
     $this->originalFileDirectory = variable_get('file_public_path', conf_path() . '/files');
     $this->originalProfile = drupal_get_profile();
     $clean_url_original = variable_get('clean_url', 0);
     // Set to English to prevent exceptions from utf8_truncate() from t()
     // during install if the current language is not 'en'.
     // The following array/object conversion is copied from language_default().
     $language = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => '');
     // Save and clean shutdown callbacks array because it static cached and
     // will be changed by the test run. If we don't, then it will contain
     // callbacks from both environments. So testing environment will try
     // to call handlers from original environment.
     $callbacks =& drupal_register_shutdown_function();
     $this->originalShutdownCallbacks = $callbacks;
     $callbacks = array();
     // Create test directory ahead of installation so fatal errors and debug
     // information can be logged during installation process.
     // Use temporary files directory with the same prefix as the database.
     $public_files_directory = $this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10);
     $private_files_directory = $public_files_directory . '/private';
     $temp_files_directory = $private_files_directory . '/temp';
     // Create the directories
     file_prepare_directory($public_files_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
     file_prepare_directory($private_files_directory, FILE_CREATE_DIRECTORY);
     file_prepare_directory($temp_files_directory, FILE_CREATE_DIRECTORY);
     $this->generatedTestFiles = FALSE;
     // Log fatal errors.
     ini_set('log_errors', 1);
     ini_set('error_log', $public_files_directory . '/error.log');
     // Reset all statics and variables to perform tests in a clean environment.
     $conf = array();
     drupal_static_reset();
     // Set the test information for use in other parts of Drupal.
     $test_info =& $GLOBALS['drupal_test_info'];
     $test_info['test_run_id'] = $this->databasePrefix;
     $test_info['in_child_site'] = FALSE;
     include_once DRUPAL_ROOT . '/includes/install.inc';
     drupal_install_system();
     $this->preloadRegistry();
     // Set path variables.
     variable_set('file_public_path', $public_files_directory);
     variable_set('file_private_path', $private_files_directory);
     variable_set('file_temporary_path', $temp_files_directory);
     // Include the testing profile.
     variable_set('install_profile', $this->profile);
     $profile_details = install_profile_info($this->profile, 'en');
     // Install the modules specified by the testing profile.
     module_enable($profile_details['dependencies'], FALSE);
     // Install modules needed for this test. This could have been passed in as
     // either a single array argument or a variable number of string arguments.
     // @todo Remove this compatibility layer in Drupal 8, and only accept
     // $modules as a single array argument.
     $modules = func_get_args();
     if (isset($modules[0]) && is_array($modules[0])) {
         $modules = $modules[0];
     }
     if ($modules) {
         $success = module_enable($modules, TRUE);
         $this->assertTrue($success, t('Enabled modules: %modules', array('%modules' => implode(', ', $modules))));
     }
     // Run the profile tasks.
     $install_profile_module_exists = db_query("SELECT 1 FROM {system} WHERE type = 'module' AND name = :name", array(':name' => $this->profile))->fetchField();
     if ($install_profile_module_exists) {
         module_enable(array($this->profile), FALSE);
     }
     // Reset/rebuild all data structures after enabling the modules.
     $this->resetAll();
     // Run cron once in that environment, as install.php does at the end of
     // the installation process.
     drupal_cron_run();
     // Log in with a clean $user.
     $this->originalUser = $user;
     drupal_save_session(FALSE);
     $user = user_load(1);
//.........这里部分代码省略.........
开发者ID:rlugojr,项目名称:livereload-examples,代码行数:101,代码来源:drupal_web_test_case.php

示例2: runCron

 /**
  * Implements CoreInterface::runCron().
  */
 public function runCron()
 {
     return drupal_cron_run();
 }
开发者ID:wesnick,项目名称:drupal-bootstrap,代码行数:7,代码来源:Drupal7.php

示例3: setUp

 /**
  * Sets up a Drupal site for running functional and integration tests.
  *
  * Generates a random database prefix and installs Drupal with the specified
  * installation profile in DrupalWebTestCase::$profile into the
  * prefixed database. Afterwards, installs any additional modules specified by
  * the test.
  *
  * After installation all caches are flushed and several configuration values
  * are reset to the values of the parent site executing the test, since the
  * default values may be incompatible with the environment in which tests are
  * being executed.
  *
  * @param ...
  *   List of modules to enable for the duration of the test. This can be
  *   either a single array or a variable number of string arguments.
  *
  * @see DrupalWebTestCase::prepareDatabasePrefix()
  * @see DrupalWebTestCase::changeDatabasePrefix()
  * @see DrupalWebTestCase::prepareEnvironment()
  */
 protected function setUp()
 {
     global $user, $language, $conf;
     // Create the database prefix for this test.
     $this->prepareDatabasePrefix();
     // Prepare the environment for running tests.
     $this->prepareEnvironment();
     if (!$this->setupEnvironment) {
         return FALSE;
     }
     // Reset all statics and variables to perform tests in a clean environment.
     $conf = array();
     drupal_static_reset();
     // Change the database prefix.
     // All static variables need to be reset before the database prefix is
     // changed, since DrupalCacheArray implementations attempt to
     // write back to persistent caches when they are destructed.
     $this->changeDatabasePrefix();
     if (!$this->setupDatabasePrefix) {
         return FALSE;
     }
     // Preset the 'install_profile' system variable, so the first call into
     // system_rebuild_module_data() (in drupal_install_system()) will register
     // the test's profile as a module. Without this, the installation profile of
     // the parent site (executing the test) is registered, and the test
     // profile's hook_install() and other hook implementations are never invoked.
     $conf['install_profile'] = $this->profile;
     // Perform the actual Drupal installation.
     include_once DRUPAL_ROOT . '/includes/install.inc';
     drupal_install_system();
     $this->preloadRegistry();
     // Set path variables.
     variable_set('file_public_path', $this->public_files_directory);
     variable_set('file_private_path', $this->private_files_directory);
     variable_set('file_temporary_path', $this->temp_files_directory);
     // Set the 'simpletest_parent_profile' variable to add the parent profile's
     // search path to the child site's search paths.
     // @see drupal_system_listing()
     // @todo This may need to be primed like 'install_profile' above.
     variable_set('simpletest_parent_profile', $this->originalProfile);
     // Include the testing profile.
     variable_set('install_profile', $this->profile);
     $profile_details = install_profile_info($this->profile, 'en');
     // Install the modules specified by the testing profile.
     module_enable($profile_details['dependencies'], FALSE);
     // Install modules needed for this test. This could have been passed in as
     // either a single array argument or a variable number of string arguments.
     // @todo Remove this compatibility layer in Drupal 8, and only accept
     // $modules as a single array argument.
     $modules = func_get_args();
     if (isset($modules[0]) && is_array($modules[0])) {
         $modules = $modules[0];
     }
     if ($modules) {
         $success = module_enable($modules, TRUE);
         $this->assertTrue($success, t('Enabled modules: %modules', array('%modules' => implode(', ', $modules))));
     }
     // Run the profile tasks.
     $install_profile_module_exists = db_query("SELECT 1 FROM {system} WHERE type = 'module' AND name = :name", array(':name' => $this->profile))->fetchField();
     if ($install_profile_module_exists) {
         module_enable(array($this->profile), FALSE);
     }
     // Reset/rebuild all data structures after enabling the modules.
     $this->resetAll();
     // Run cron once in that environment, as install.php does at the end of
     // the installation process.
     drupal_cron_run();
     // Ensure that the session is not written to the new environment and replace
     // the global $user session with uid 1 from the new test site.
     drupal_save_session(FALSE);
     // Login as uid 1.
     $user = user_load(1);
     // Restore necessary variables.
     variable_set('install_task', 'done');
     variable_set('clean_url', $this->originalCleanUrl);
     variable_set('site_mail', 'simpletest@example.com');
     variable_set('date_default_timezone', date_default_timezone_get());
     // Set up English language.
     unset($conf['language_default']);
//.........这里部分代码省略.........
开发者ID:ayavuzerdogan,项目名称:thinkloud,代码行数:101,代码来源:drupal_web_test_case.php

示例4: define

<?php

// $Id: cron.php,v 1.42 2009/02/08 20:27:51 webchick Exp $
/**
 * @file
 * Handles incoming requests to fire off regularly-scheduled tasks (cron jobs).
 */
/**
 * Root directory of Drupal installation.
 */
define('DRUPAL_ROOT', getcwd());
include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
if (isset($_GET['cron_key']) && variable_get('cron_key', 'drupal') == $_GET['cron_key']) {
    drupal_cron_run();
} else {
    watchdog('cron', 'Cron could not run because an invalid key was used.', array(), WATCHDOG_NOTICE);
    drupal_access_denied();
}
开发者ID:veggieryan,项目名称:drupal,代码行数:19,代码来源:cron.php

示例5: install_finished

/**
 * Installation task; perform final steps and display a 'finished' page.
 *
 * @param $install_state
 *   An array of information about the current installation state.
 * @return
 *   A message informing the user that the installation is complete.
 */
function install_finished(&$install_state)
{
    drupal_set_title(st('@drupal installation complete', array('@drupal' => drupal_install_profile_name())), PASS_THROUGH);
    $messages = drupal_set_message();
    $output = '<p>' . st('Congratulations, @drupal has been successfully installed.', array('@drupal' => drupal_install_profile_name())) . '</p>';
    $output .= '<p>' . (isset($messages['error']) ? st('Review the messages above before continuing on to <a href="@url">your new site</a>.', array('@url' => url(''))) : st('You may now visit <a href="@url">your new site</a>.', array('@url' => url('')))) . '</p>';
    if (module_exists('help')) {
        $output .= '<p>' . st('For more information on configuring Drupal, refer to the <a href="@help">help section</a>.', array('@help' => url('admin/help'))) . '</p>';
    }
    // Rebuild the module and theme data, in case any newly-installed modules
    // need to modify it via hook_system_info_alter(). We need to clear the
    // theme static cache first, to make sure that the theme data is actually
    // rebuilt.
    drupal_static_reset('_system_rebuild_theme_data');
    system_rebuild_module_data();
    system_rebuild_theme_data();
    // Rebuild menu and registry to get content type links registered by the
    // profile, and possibly any other menu items created through the tasks.
    menu_rebuild();
    // Rebuild the database cache of node types, so that any node types added
    // by newly installed modules are registered correctly and initialized with
    // the necessary fields.
    node_types_rebuild();
    // Register actions declared by any modules.
    actions_synchronize();
    // Randomize query-strings on css/js files, to hide the fact that this is a
    // new install, not upgraded yet.
    _drupal_flush_css_js();
    // Remember the profile which was used.
    variable_set('install_profile', drupal_get_profile());
    // Install profiles are always loaded last
    db_update('system')->fields(array('weight' => 1000))->condition('type', 'module')->condition('name', drupal_get_profile())->execute();
    // Cache a fully-built schema.
    drupal_get_schema(NULL, TRUE);
    // Run cron to populate update status tables (if available) so that users
    // will be warned if they've installed an out of date Drupal version.
    // Will also trigger indexing of profile-supplied content or feeds.
    drupal_cron_run();
    return $output;
}
开发者ID:blipp,项目名称:drupal,代码行数:48,代码来源:install.php

示例6: install_tasks


//.........这里部分代码省略.........
            drupal_add_js('
// Global Killswitch
if (Drupal.jsEnabled) {
  $(document).ready(function() {
    Drupal.cleanURLsInstallCheck();
  });
}', 'inline');
            // Build menu to allow clean URL check.
            menu_rebuild();
            // Cache a fully-built schema. This is necessary for any
            // invocation of index.php because: (1) setting cache table
            // entries requires schema information, (2) that occurs during
            // bootstrap before any module are loaded, so (3) if there is no
            // cached schema, drupal_get_schema() will try to generate one
            // but with no loaded modules will return nothing.
            //
            // This logically could be done during task 'done' but the clean
            // URL check requires it now.
            drupal_get_schema(NULL, TRUE);
        } else {
            $task = 'profile';
        }
    }
    // If found an unknown task or the 'profile' task, which is
    // reserved for profiles, hand over the control to the profile,
    // so it can run any number of custom tasks it defines.
    if (!in_array($task, install_reserved_tasks())) {
        $function = $profile . '_profile_tasks';
        if (function_exists($function)) {
            // The profile needs to run more code, maybe even more tasks.
            // $task is sent through as a reference and may be changed!
            $output = $function($task, $url);
        }
        // If the profile doesn't move on to a new task we assume
        // that it is done.
        if ($task == 'profile') {
            $task = 'profile-finished';
        }
    }
    // Profile custom tasks are done, so let the installer regain
    // control and proceed with importing the remaining translations.
    if ($task == 'profile-finished') {
        if (!empty($install_locale) && $install_locale != 'en') {
            include_once DRUPAL_ROOT . '/includes/locale.inc';
            // Collect files to import for this language. Skip components
            // already covered in the initial batch set.
            $batch = locale_batch_by_language($install_locale, '_install_locale_remaining_batch_finished', variable_get('install_locale_batch_components', array()));
            // Remove temporary variable.
            variable_del('install_locale_batch_components');
            if (!empty($batch)) {
                // Start a batch, switch to 'locale-remaining-batch' task. We need to
                // set the variable here, because batch_process() redirects.
                variable_set('install_task', 'locale-remaining-batch');
                batch_set($batch);
                batch_process($url, $url);
            }
        }
        // Found nothing to import or not foreign language, go to next task.
        $task = 'finished';
    }
    if ($task == 'locale-remaining-batch') {
        include_once DRUPAL_ROOT . '/includes/batch.inc';
        include_once DRUPAL_ROOT . '/includes/locale.inc';
        $output = _batch_page();
    }
    // Display a 'finished' page to user.
    if ($task == 'finished') {
        drupal_set_title(st('@drupal installation complete', array('@drupal' => drupal_install_profile_name())));
        $messages = drupal_set_message();
        $output = '<p>' . st('Congratulations, @drupal has been successfully installed.', array('@drupal' => drupal_install_profile_name())) . '</p>';
        $output .= '<p>' . (isset($messages['error']) ? st('Please review the messages above before continuing on to <a href="@url">your new site</a>.', array('@url' => url(''))) : st('You may now visit <a href="@url">your new site</a>.', array('@url' => url('')))) . '</p>';
        $task = 'done';
    }
    // The end of the install process. Remember profile used.
    if ($task == 'done') {
        // Rebuild menu and registry to get content type links registered by the
        // profile, and possibly any other menu items created through the tasks.
        menu_rebuild();
        // Register actions declared by any modules.
        actions_synchronize();
        // Randomize query-strings on css/js files, to hide the fact that
        // this is a new install, not upgraded yet.
        _drupal_flush_css_js();
        variable_set('install_profile', $profile);
        // Cache a fully-built schema.
        drupal_get_schema(NULL, TRUE);
    }
    // Set task for user, and remember the task in the database.
    install_task_list($task);
    variable_set('install_task', $task);
    // Run cron to populate update status tables (if available) so that users
    // will be warned if they've installed an out of date Drupal version.
    // Will also trigger indexing of profile-supplied content or feeds.
    drupal_cron_run();
    // Output page, if some output was required. Otherwise it is possible
    // that we are printing a JSON page and theme output should not be there.
    if (isset($output)) {
        print theme('maintenance_page', $output);
    }
}
开发者ID:schuyler1d,项目名称:drupal,代码行数:101,代码来源:install.php

示例7: install_finished

/**
 * Installation task; perform final steps and display a 'finished' page.
 *
 * @param $install_state
 *   An array of information about the current installation state.
 * @return
 *   A message informing the user that the installation is complete.
 */
function install_finished(&$install_state)
{
    drupal_set_title(st('@drupal installation complete', array('@drupal' => drupal_install_profile_distribution_name())), PASS_THROUGH);
    $messages = drupal_set_message();
    $output = '<p>' . st('Congratulations, you installed @drupal!', array('@drupal' => drupal_install_profile_distribution_name())) . '</p>';
    $output .= '<p>' . (isset($messages['error']) ? st('Review the messages above before visiting <a href="@url">your new site</a>.', array('@url' => url(''))) : st('<a href="@url">Visit your new site</a>.', array('@url' => url('')))) . '</p>';
    // Rebuild the module and theme data, in case any newly-installed modules
    // need to modify it via hook_system_info_alter(). We need to clear the
    // theme static cache first, to make sure that the theme data is actually
    // rebuilt.
    drupal_static_reset('_system_rebuild_theme_data');
    system_rebuild_module_data();
    system_rebuild_theme_data();
    // Flush all caches to ensure that any full bootstraps during the installer
    // do not leave stale cached data, and that any content types or other items
    // registered by the install profile are registered correctly.
    drupal_flush_all_caches();
    // Register actions declared by any modules.
    actions_synchronize();
    // Remember the profile which was used.
    variable_set('install_profile', drupal_get_profile());
    // Install profiles are always loaded last
    db_update('system')->fields(array('weight' => 1000))->condition('type', 'module')->condition('name', drupal_get_profile())->execute();
    // Cache a fully-built schema.
    drupal_get_schema(NULL, TRUE);
    // Run cron to populate update status tables (if available) so that users
    // will be warned if they've installed an out of date Drupal version.
    // Will also trigger indexing of profile-supplied content or feeds.
    drupal_cron_run();
    return $output;
}
开发者ID:berkes,项目名称:sympal,代码行数:39,代码来源:install.php

示例8: setUpInstall

 /**
  * Perform Drupal installation.
  */
 protected function setUpInstall(array $modules, $public_files_directory, $private_files_directory, $temp_files_directory)
 {
     include_once DRUPAL_ROOT . '/includes/install.inc';
     drupal_install_system();
     $this->preloadRegistry();
     // Set path variables.
     variable_set('file_public_path', $public_files_directory);
     variable_set('file_private_path', $private_files_directory);
     variable_set('file_temporary_path', $temp_files_directory);
     // Include the testing profile.
     variable_set('install_profile', $this->profile);
     $profile_details = install_profile_info($this->profile, 'en');
     // Install the modules specified by the testing profile.
     module_enable($profile_details['dependencies'], FALSE);
     // Install modules needed for this test. This could have been passed in as
     // either a single array argument or a variable number of string arguments.
     // @todo Remove this compatibility layer in Drupal 8, and only accept
     // $modules as a single array argument.
     if (isset($modules[0]) && is_array($modules[0])) {
         $modules = $modules[0];
     }
     if ($modules) {
         module_enable($modules, TRUE);
     }
     // Run the profile tasks.
     $install_profile_module_exists = db_query("SELECT 1 FROM {system} WHERE type = 'module' AND name = :name", array(':name' => $this->profile))->fetchField();
     if ($install_profile_module_exists) {
         module_enable(array($this->profile), FALSE);
     }
     // Reset/rebuild all data structures after enabling the modules.
     $this->resetAll();
     // Run cron once in that environment, as install.php does at the end of
     // the installation process.
     drupal_cron_run();
     // Log in with a clean $user.
     $this->originalUser = $user;
     drupal_save_session(FALSE);
     $user = user_load(1);
 }
开发者ID:boombatower,项目名称:drupal,代码行数:42,代码来源:drupal_web_test_case.php

示例9: osha_add_agregator_rss_feeds

/**
 * Add press releases rss feed.
 */
function osha_add_agregator_rss_feeds()
{
    if (module_exists('aggregator') && module_load_include('inc', 'aggregator', 'aggregator.admin')) {
        drupal_set_message('Add press releases rss feed ...');
        $form_state = array('values' => array('title' => 'EU-OSHA in the media', 'url' => 'http://portal.kantarmedia.de/rss/index/1002043/100000063/1024803/9a7b629357e748080ff47e4d0db7ec57cffff3fe', 'refresh' => 900, 'block' => 2, 'op' => 'Save'));
        drupal_form_submit('aggregator_form_feed', $form_state);
        drupal_cron_run();
        cache_clear_all();
    }
}
开发者ID:enriquesanchezhernandez,项目名称:campaigns,代码行数:13,代码来源:post-update.php

示例10: setUp

 /**
  * Generates a random database prefix, runs the install scripts on the
  * prefixed database and enable the specified modules. After installation
  * many caches are flushed and the internal browser is setup so that the
  * page requests will run on the new prefix. A temporary files directory
  * is created with the same name as the database prefix.
  *
  * @param ...
  *   List of modules to enable for the duration of the test. This can be
  *   either a single array or a variable number of string arguments.
  */
 protected function setUp()
 {
     global $user, $language, $conf;
     // Generate a temporary prefixed database to ensure that tests have a clean starting point.
     $this->databasePrefix = 'simpletest' . mt_rand(1000, 1000000);
     db_update('simpletest_test_id')->fields(array('last_prefix' => $this->databasePrefix))->condition('test_id', $this->testId)->execute();
     // Clone the current connection and replace the current prefix.
     $connection_info = Database::getConnectionInfo('default');
     Database::renameConnection('default', 'simpletest_original_default');
     foreach ($connection_info as $target => $value) {
         $connection_info[$target]['prefix'] = array('default' => $value['prefix']['default'] . $this->databasePrefix);
     }
     Database::addConnectionInfo('default', 'default', $connection_info['default']);
     // Store necessary current values before switching to prefixed database.
     $this->originalLanguage = $language;
     $this->originalLanguageDefault = variable_get('language_default');
     $this->originalFileDirectory = file_directory_path();
     $this->originalProfile = drupal_get_profile();
     $clean_url_original = variable_get('clean_url', 0);
     // Save and clean shutdown callbacks array because it static cached and
     // will be changed by the test run. If we don't, then it will contain
     // callbacks from both environments. So testing environment will try
     // to call handlers from original environment.
     $callbacks =& drupal_register_shutdown_function();
     $this->originalShutdownCallbacks = $callbacks;
     $callbacks = array();
     // Create test directory ahead of installation so fatal errors and debug
     // information can be logged during installation process.
     // Use temporary files directory with the same prefix as the database.
     $public_files_directory = $this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10);
     $private_files_directory = $public_files_directory . '/private';
     $temp_files_directory = $private_files_directory . '/temp';
     // Create the directories
     file_prepare_directory($public_files_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
     file_prepare_directory($private_files_directory, FILE_CREATE_DIRECTORY);
     file_prepare_directory($temp_files_directory, FILE_CREATE_DIRECTORY);
     $this->generatedTestFiles = FALSE;
     // Log fatal errors.
     ini_set('log_errors', 1);
     ini_set('error_log', $public_files_directory . '/error.log');
     // Reset all statics and variables to perform tests in a clean environment.
     $conf = array();
     drupal_static_reset();
     // Set the test information for use in other parts of Drupal.
     $test_info =& $GLOBALS['drupal_test_info'];
     $test_info['test_run_id'] = $this->databasePrefix;
     $test_info['in_child_site'] = FALSE;
     include_once DRUPAL_ROOT . '/includes/install.inc';
     drupal_install_system();
     $this->preloadRegistry();
     // Set path variables.
     variable_set('file_public_path', $public_files_directory);
     variable_set('file_private_path', $private_files_directory);
     variable_set('file_temporary_path', $temp_files_directory);
     // Include the default profile.
     variable_set('install_profile', 'standard');
     $profile_details = install_profile_info('standard', 'en');
     // Install the modules specified by the default profile.
     module_enable($profile_details['dependencies'], FALSE);
     // Install modules needed for this test. This could have been passed in as
     // either a single array argument or a variable number of string arguments.
     // @todo Remove this compatibility layer in Drupal 8, and only accept
     // $modules as a single array argument.
     $modules = func_get_args();
     if (isset($modules[0]) && is_array($modules[0])) {
         $modules = $modules[0];
     }
     if ($modules) {
         module_enable($modules, TRUE);
     }
     // Run default profile tasks.
     module_enable(array('standard'), FALSE);
     // Rebuild caches.
     drupal_static_reset();
     drupal_flush_all_caches();
     // Register actions declared by any modules.
     actions_synchronize();
     // Reload global $conf array and permissions.
     $this->refreshVariables();
     $this->checkPermissions(array(), TRUE);
     // Reset statically cached schema for new database prefix.
     drupal_get_schema(NULL, TRUE);
     // Run cron once in that environment, as install.php does at the end of
     // the installation process.
     drupal_cron_run();
     // Log in with a clean $user.
     $this->originalUser = $user;
     drupal_save_session(FALSE);
     $user = user_load(1);
//.........这里部分代码省略.........
开发者ID:nagwani,项目名称:debugging_example,代码行数:101,代码来源:drupal_web_test_case.php

示例11: install_finished

/**
 * Installation task; perform final steps and display a 'finished' page.
 *
 * @param $install_state
 *   An array of information about the current installation state.
 * @return
 *   A message informing the user that the installation is complete.
 */
function install_finished(&$install_state)
{
    drupal_set_title(st('@drupal installation complete', array('@drupal' => drupal_install_profile_name())));
    $messages = drupal_set_message();
    $output = '<p>' . st('Congratulations, @drupal has been successfully installed.', array('@drupal' => drupal_install_profile_name())) . '</p>';
    $output .= '<p>' . (isset($messages['error']) ? st('Please review the messages above before continuing on to <a href="@url">your new site</a>.', array('@url' => url(''))) : st('You may now visit <a href="@url">your new site</a>.', array('@url' => url('')))) . '</p>';
    if (module_exists('help')) {
        $output .= '<p>' . st('For more information on configuring Drupal, please refer to the <a href="@help">help section</a>.', array('@help' => url('admin/help'))) . '</p>';
    }
    // Rebuild menu and registry to get content type links registered by the
    // profile, and possibly any other menu items created through the tasks.
    menu_rebuild();
    // Register actions declared by any modules.
    actions_synchronize();
    // Randomize query-strings on css/js files, to hide the fact that this is a
    // new install, not upgraded yet.
    _drupal_flush_css_js();
    // Remember the profile which was used.
    variable_set('install_profile', $install_state['parameters']['profile']);
    // Cache a fully-built schema.
    drupal_get_schema(NULL, TRUE);
    // Run cron to populate update status tables (if available) so that users
    // will be warned if they've installed an out of date Drupal version.
    // Will also trigger indexing of profile-supplied content or feeds.
    drupal_cron_run();
    return $output;
}
开发者ID:jmstacey,项目名称:drupal,代码行数:35,代码来源:install.php


注:本文中的drupal_cron_run函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。