There are 3 main reasons to contribute to Drupal: 1) To learn best practices from the community, 2) To exchange code, testing, and ideas with other developers, and 3) To build a professional network of contacts in the Drupal field. Contributing allows developers to improve their skills, collaborate with peers, and find new opportunities.
12. What is a contribution?
Wednesday, June 13, 2012
13. diff --git a/core/includes/common.inc b/core/includes/common.inc
index 9d498c2..63a8aec 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -5201,13 +5201,9 @@ function drupal_cron_run() {
// Allow execution to continue even if the request gets canceled.
@ignore_user_abort(TRUE);
- // Prevent session information from being saved while cron is running.
- drupal_save_session(FALSE);
-
// Force the current user to anonymous to ensure consistent permissions on
// cron runs.
- $original_user = $GLOBALS['user'];
- $GLOBALS['user'] = drupal_anonymous_user();
+ user_impersonate_user(drupal_anonymous_user());
// Try to allocate enough time to run all the hook_cron implementations.
drupal_set_time_limit(240);
@@ -5263,8 +5259,7 @@ function drupal_cron_run() {
}
} Restore the user.
//
- $GLOBALS['user'] = $original_user;
- drupal_save_session(TRUE);
+ user_revert_user();
return $return;
}
diff --git a/core/modules/simpletest/drupal_web_test_case.php b/core/modules/simpletest/drupal_web_test_case.php
index 3069268..dfbef9d 100644
--- a/core/modules/simpletest/drupal_web_test_case.php
+++ b/core/modules/simpletest/drupal_web_test_case.php
@@ -1414,9 +1414,7 @@ class DrupalWebTestCase extends DrupalTestCase {
drupal_cron_run();
// Log in with a clean $user.
- $this->originalUser = $user;
- drupal_save_session(FALSE);
- $user = user_load(1);
+ user_impersonate_user(user_load(1));
// Restore necessary variables.
variable_set('install_task', 'done');
@@ -1550,8 +1548,7 @@ class DrupalWebTestCase extends DrupalTestCase {
$callbacks = $this->originalShutdownCallbacks;
// Return the user to the original one.
- $user = $this->originalUser;
- drupal_save_session(TRUE);
+ user_revert_user();
// Ensure that internal logged in variable and cURL options are reset.
$this->loggedInUser = FALSE;
diff --git a/core/modules/simpletest/tests/common.test b/core/modules/simpletest/tests/common.test
13, 2012
Wednesday, June index fee3831..07b0f5b 100644
30. “Mathematics is like sex: sure, it may give some
practical results, but that's not why we do it.”
― Richard P. Feynman
Wednesday, June 13, 2012
31. Open Source
“Mathematics is like sex: sure, it may give some
practical results, but that's not why we do it.”
― Richard P. Feynman
Wednesday, June 13, 2012