Permalink
Browse files

Merge pull request #18 from pressflow/drupal-7.14

Drupal 7.14
  • Loading branch information...
2 parents fe5bb79 + 4ef920b commit 7c19e7ca77ea5a71fe7a14b076ff623539e5781c @joshkoenig joshkoenig committed May 3, 2012
Showing with 6,752 additions and 1,809 deletions.
  1. +50 −0 CHANGELOG.txt
  2. +6 −4 MAINTAINERS.txt
  3. +55 −13 includes/bootstrap.inc
  4. +34 −16 includes/cache.inc
  5. +52 −14 includes/common.inc
  6. +0 −3 includes/database/database.inc
  7. +0 −2 includes/database/mysql/database.inc
  8. +8 −3 includes/database/mysql/schema.inc
  9. +0 −2 includes/database/pgsql/database.inc
  10. +2 −2 includes/database/pgsql/schema.inc
  11. +1 −1 includes/database/query.inc
  12. +6 −1 includes/database/schema.inc
  13. +3 −5 includes/database/sqlite/database.inc
  14. +1 −1 includes/date.inc
  15. +14 −12 includes/entity.inc
  16. +13 −9 includes/errors.inc
  17. +52 −54 includes/file.inc
  18. +211 −117 includes/form.inc
  19. +2 −2 includes/graph.inc
  20. +10 −4 includes/language.inc
  21. +22 −12 includes/locale.inc
  22. +19 −17 includes/menu.inc
  23. +4 −0 includes/module.inc
  24. +7 −1 includes/pager.inc
  25. +18 −12 includes/path.inc
  26. +19 −15 includes/registry.inc
  27. +31 −9 includes/session.inc
  28. +27 −8 includes/theme.inc
  29. +1 −1 includes/unicode.inc
  30. +5 −5 includes/update.inc
  31. +1 −1 includes/updater.inc
  32. +1 −1 includes/utility.inc
  33. +6 −5 misc/autocomplete.js
  34. +16 −8 misc/machine-name.js
  35. +224 −104 misc/states.js
  36. +21 −17 misc/tabledrag.js
  37. +29 −7 misc/tableheader.js
  38. +7 −6 misc/tableselect.js
  39. +4 −1 misc/vertical-tabs.css
  40. +0 −10 misc/vertical-tabs.js
  41. +7 −3 modules/aggregator/aggregator.module
  42. +10 −0 modules/aggregator/aggregator.test
  43. +40 −33 modules/block/block.api.php
  44. +4 −20 modules/block/block.js
  45. +10 −9 modules/block/block.module
  46. +66 −0 modules/block/block.test
  47. +1 −1 modules/blog/blog.module
  48. +7 −2 modules/book/book-all-books-block.tpl.php
  49. +3 −1 modules/book/book-export-html.tpl.php
  50. +13 −10 modules/book/book-navigation.tpl.php
  51. +3 −2 modules/book/book-node-export-html.tpl.php
  52. +30 −12 modules/book/book.admin.inc
  53. +3 −0 modules/book/book.install
  54. +4 −4 modules/book/book.js
  55. +162 −64 modules/book/book.module
  56. +41 −33 modules/book/book.pages.inc
  57. +1 −1 modules/color/color.module
  58. +8 −2 modules/comment/comment.module
  59. +112 −1 modules/comment/comment.test
  60. +1 −1 modules/contact/contact.module
  61. +1 −0 modules/contextual/contextual.info
  62. +1 −1 modules/contextual/contextual.module
  63. +49 −0 modules/contextual/contextual.test
  64. +5 −0 modules/dashboard/dashboard-rtl.css
  65. +1 −1 modules/dashboard/dashboard.api.php
  66. +4 −0 modules/dashboard/dashboard.css
  67. +17 −12 modules/dashboard/dashboard.js
  68. +14 −10 modules/dashboard/dashboard.module
  69. +7 −6 modules/dashboard/dashboard.test
  70. +2 −5 modules/dblog/dblog.module
  71. +2 −0 modules/dblog/dblog.test
  72. +104 −52 modules/field/field.api.php
  73. +5 −12 modules/field/field.attach.inc
  74. +6 −5 modules/field/field.crud.inc
  75. +4 −0 modules/field/field.form.inc
  76. +7 −7 modules/field/field.info.inc
  77. +25 −2 modules/field/field.install
  78. +159 −171 modules/field/field.module
  79. +23 −8 modules/field/modules/list/list.module
  80. +83 −0 modules/field/modules/list/tests/list.test
  81. +9 −0 modules/field/modules/list/tests/list_test.module
  82. +2 −2 modules/field/modules/number/number.module
  83. +22 −0 modules/field/modules/number/number.test
  84. +6 −1 modules/field/modules/options/options.api.php
  85. +16 −5 modules/field/modules/options/options.module
  86. +35 −0 modules/field/modules/options/options.test
  87. +69 −4 modules/field/tests/field.test
  88. +1 −1 modules/field/theme/field.tpl.php
  89. +60 −42 modules/field_ui/field_ui.admin.inc
  90. +2 −2 modules/field_ui/field_ui.api.php
  91. +8 −0 modules/field_ui/field_ui.css
  92. +13 −6 modules/field_ui/field_ui.js
  93. +1 −1 modules/field_ui/field_ui.module
  94. +23 −4 modules/field_ui/field_ui.test
  95. +6 −7 modules/file/file.js
  96. +3 −2 modules/file/file.module
  97. +4 −0 modules/file/tests/file.test
  98. +1 −0 modules/file/tests/file_module_test.module
  99. +2 −2 modules/filter/filter.js
  100. +15 −5 modules/filter/filter.module
  101. +143 −0 modules/filter/filter.test
  102. +33 −19 modules/forum/forum.module
  103. +27 −1 modules/forum/forum.test
  104. +2 −2 modules/help/help.module
  105. +1 −1 modules/help/help.test
  106. +1 −1 modules/image/image.admin.inc
  107. +29 −3 modules/image/image.field.inc
  108. +12 −0 modules/image/image.install
  109. +76 −4 modules/image/image.module
  110. +265 −3 modules/image/image.test
  111. +1 −2 modules/locale/locale.admin.inc
  112. +0 −155 modules/locale/locale.api.php
  113. +68 −0 modules/locale/locale.install
  114. +39 −15 modules/locale/locale.module
  115. +246 −0 modules/locale/locale.test
  116. +127 −0 modules/locale/tests/locale_test.module
  117. +10 −0 modules/menu/menu.admin.inc
  118. +1 −2 modules/menu/menu.module
  119. +2 −2 modules/node/content_types.inc
  120. +3 −3 modules/node/node.api.php
  121. +17 −2 modules/node/node.install
  122. +69 −44 modules/node/node.module
  123. +190 −3 modules/node/node.test
  124. +9 −1 modules/node/tests/node_access_test.module
  125. +1 −1 modules/openid/openid.js
  126. +1 −1 modules/openid/openid.module
  127. +1 −1 modules/openid/openid.test
  128. +15 −6 modules/overlay/overlay-parent.js
  129. +17 −3 modules/overlay/overlay.module
  130. +43 −12 modules/path/path.admin.inc
  131. +3 −4 modules/path/path.api.php
  132. +5 −0 modules/path/path.js
  133. +11 −7 modules/path/path.module
  134. +38 −6 modules/path/path.test
  135. +3 −3 modules/php/php.module
  136. +5 −2 modules/poll/poll.module
  137. +72 −0 modules/poll/poll.test
  138. +1 −1 modules/profile/profile.js
  139. +3 −2 modules/profile/profile.module
  140. +1 −1 modules/rdf/rdf.module
  141. +2 −1 modules/search/search.admin.inc
  142. +6 −1 modules/search/search.module
  143. +26 −0 modules/search/search.test
  144. +5 −5 modules/shortcut/shortcut.admin.js
  145. +1 −1 modules/shortcut/shortcut.module
  146. +56 −48 modules/simpletest/drupal_web_test_case.php
  147. +5 −0 modules/simpletest/simpletest.info
  148. +3 −3 modules/simpletest/simpletest.js
  149. +1 −1 modules/simpletest/simpletest.module
  150. +88 −0 modules/simpletest/simpletest.test
  151. +1 −0 modules/simpletest/tests/actions_loop_test.module
  152. +57 −15 modules/simpletest/tests/ajax.test
  153. +9 −3 modules/simpletest/tests/ajax_forms_test.module
  154. +8 −0 modules/simpletest/tests/ajax_test.module
  155. +34 −0 modules/simpletest/tests/cache.test
  156. +63 −2 modules/simpletest/tests/common.test
  157. +1 −0 modules/simpletest/tests/database_test.install
  158. +34 −0 modules/simpletest/tests/database_test.test
  159. +21 −0 modules/simpletest/tests/entity_query.test
  160. +1 −1 modules/simpletest/tests/error.test
  161. +13 −0 modules/simpletest/tests/file.test
  162. +74 −2 modules/simpletest/tests/form.test
  163. +75 −1 modules/simpletest/tests/form_test.module
  164. +41 −0 modules/simpletest/tests/image.test
  165. +94 −0 modules/simpletest/tests/menu.test
  166. +36 −0 modules/simpletest/tests/menu_test.module
  167. +159 −0 modules/simpletest/tests/pager.test
  168. +46 −0 modules/simpletest/tests/path.test
  169. +6 −0 modules/simpletest/tests/path_test.info
  170. +23 −0 modules/simpletest/tests/path_test.module
  171. +3 −8 modules/simpletest/tests/session.test
  172. +28 −7 modules/simpletest/tests/theme.test
  173. +15 −0 modules/simpletest/tests/theme_test.inc
  174. +11 −7 modules/simpletest/tests/theme_test.module
  175. +2 −4 modules/simpletest/tests/themes/test_theme/template.php
  176. +82 −0 modules/simpletest/tests/upgrade/drupal-6.trigger.database.php
  177. +23 −2 modules/simpletest/tests/upgrade/drupal-6.upload.database.php
  178. +16 −0 modules/simpletest/tests/upgrade/drupal-7.field.database.php
  179. +28 −0 modules/simpletest/tests/upgrade/drupal-7.trigger.database.php
  180. +61 −0 modules/simpletest/tests/upgrade/update.field.test
  181. +37 −0 modules/simpletest/tests/upgrade/update.trigger.test
  182. +35 −0 modules/simpletest/tests/upgrade/update.user.test
  183. +4 −4 modules/simpletest/tests/upgrade/upgrade.test
  184. +39 −0 modules/simpletest/tests/upgrade/upgrade.trigger.test
  185. +6 −0 modules/simpletest/tests/upgrade/upgrade.upload.test
  186. +1 −1 modules/statistics/statistics.module
  187. +3 −3 modules/syslog/syslog.module
  188. +4 −1 modules/syslog/syslog.test
  189. +170 −0 modules/system/language.api.php
  190. +4 −0 modules/system/page.tpl.php
  191. +42 −22 modules/system/system.admin.inc
  192. +39 −25 modules/system/system.api.php
  193. +6 −2 modules/system/system.base-rtl.css
  194. +6 −5 modules/system/system.base.css
  195. +29 −2 modules/system/system.install
  196. +15 −12 modules/system/system.js
  197. +1 −1 modules/system/system.module
  198. +134 −12 modules/system/system.test
  199. +1 −1 modules/taxonomy/taxonomy.js
  200. +65 −8 modules/taxonomy/taxonomy.module
  201. +14 −1 modules/taxonomy/taxonomy.pages.inc
  202. +320 −10 modules/taxonomy/taxonomy.test
  203. +10 −5 modules/toolbar/toolbar.js
  204. +1 −1 modules/toolbar/toolbar.module
  205. +5 −0 modules/tracker/tracker.install
  206. +22 −12 modules/tracker/tracker.module
  207. +10 −7 modules/tracker/tracker.pages.inc
  208. +25 −10 modules/tracker/tracker.test
  209. +55 −43 modules/translation/translation.module
  210. +8 −3 modules/translation/translation.pages.inc
  211. +51 −27 modules/translation/translation.test
  212. +4 −1 modules/trigger/tests/trigger_test.module
  213. +20 −10 modules/trigger/trigger.admin.inc
  214. +39 −2 modules/trigger/trigger.install
  215. +28 −10 modules/trigger/trigger.module
  216. +3 −1 modules/trigger/trigger.test
  217. +17 −7 modules/update/update.fetch.inc
  218. +9 −4 modules/update/update.module
  219. +82 −1 modules/update/update.test
  220. +1 −0 modules/user/user.admin.inc
  221. +3 −2 modules/user/user.api.php
  222. +21 −0 modules/user/user.install
  223. +5 −5 modules/user/user.js
  224. +15 −12 modules/user/user.module
  225. +65 −3 modules/user/user.test
  226. +0 −1 profiles/minimal/minimal.info
  227. +7 −1 profiles/minimal/minimal.install
  228. +5 −1 profiles/minimal/minimal.profile
  229. +0 −1 profiles/standard/standard.info
  230. +6 −0 profiles/standard/standard.install
  231. +5 −1 profiles/standard/standard.profile
  232. +1 −0 .../testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info
  233. +37 −0 .../testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.test
  234. +6 −0 profiles/testing/testing.install
  235. +4 −0 profiles/testing/testing.profile
  236. +7 −7 scripts/run-tests.sh
  237. +4 −4 sites/default/default.settings.php
  238. +4 −0 themes/bartik/css/style-rtl.css
  239. +5 −1 themes/bartik/template.php
  240. +2 −1 themes/bartik/templates/page.tpl.php
  241. +1 −5 themes/garland/template.php
  242. +5 −2 themes/seven/vertical-tabs.css
  243. +5 −3 update.php
View
@@ -1,4 +1,54 @@
+Drupal 7.14 2012-05-02
+----------------------
+- Fixed "integrity constraint" fatal errors when rebuilding registry.
+- Fixed custom logo and favicon functionality referencing incorrect paths.
+- Fixed DB Case Sensitivity: Allow BINARY attribute in MySQL.
+- Split field_bundle_settings out per bundle.
+- Improve UX for machine names for fields (UI change).
+- Fixed User pictures are not removed properly.
+- Fixed HTTPS sessions not working in all cases.
+- Fixed Regression: Required radios throw illegal choice error when none
+ selected.
+- Fixed allow autocompletion requests to include slashes.
+- Eliminate $user->cache and {session}.cache in favor of
+ $_SESSION['cache_expiration'][$bin] (Performance).
+- Fixed focus jumps to tab when pressing enter on a form element within tab.
+- Fixed race condition in locale() - duplicates in {locales_source}.
+- Fixed Missing "Default image" per field instance.
+- Quit clobbering people's work when they click the filter tips link
+- Form API #states: Fix conditionals to allow OR and XOR constructions.
+- Fixed Focus jumps to tab when pressing enter on a form element within tab.
+ (Accessibility)
+- Improved performance of node_access queries.
+- Fixed Fieldsets inside vertical tabs have no title and can't be collapsed.
+- Reduce size of cache_menu table (Performance).
+- Fixed unnecessary aggregation of CSS/JS (Performance).
+- Fixed taxonomy_autocomplete() produces SQL error for nonexistent field.
+- Fixed HTML filter is not run first by default, despite default weight.
+- Fixed Overlay does not work with prefixed URL paths.
+- Better debug info for field errors (string change).
+- Fixed Data corruption in comment IDs (results in broken threading on
+ PostgreSQL).
+- Fixed machine name not editable if every character is replaced.
+- Fixed user picture not appearing in comment preview (Markup change).
+- Added optional vid argument for taxonomy_get_term_by_name().
+- Fixed Invalid Unicode code range in PREG_CLASS_UNICODE_WORD_BOUNDARY fails
+ with PCRE 8.30.
+- Fixed {trigger_assignments()}.hook has only 32 characters, is too short.
+- Numerous fixes to run-tests.sh.
+- Fixed Tests in profiles/[name]/modules cannot be run and cannot use a
+ different profile for running tests.
+- Numerous JavaScript performance fixes.
+- Numerous documentation fixes.
+- Fixed All pager links have an 'active' CSS class.
+- Numerous upgrade path fixes; notably:
+ - system_update_7061() fails on inserting files with same name but different
+ case.
+ - system_update_7061() converts filepaths too aggressively.
+ - Trigger upgrade path: Node triggers removed when upgrading to 7-x from 6.25.
+
+
Drupal 7.13 2012-05-02
----------------------
- Fixed security issues (Multiple vulnerabilities), see SA-CORE-2012-002.
View
@@ -59,8 +59,10 @@ Database system
Database update system
- Károly Négyesi 'chx' <http://drupal.org/user/9446>
+- Ashok Modi 'btmash' <http://drupal.org/user/60422>
Entity system
+- Wolfgang Ziegler 'fago' <http://drupal.org/user/16747>
- Nathaniel Catchpole 'catch' <http://drupal.org/user/35733>
- Franz Heinzmann 'Frando' <http://drupal.org/user/21850>
@@ -83,7 +85,7 @@ Install system
- David Rothstein 'David_Rothstein' <http://drupal.org/user/124982>
JavaScript
-- ?
+- Théodore Biadala 'nod_' <http://drupal.org/user/598310>
Language system
- Francesco Placella 'plach' <http://drupal.org/user/183211>
@@ -130,7 +132,7 @@ Topic coordinators
Accessibility
- Everett Zufelt 'Everett Zufelt' <http://drupal.org/user/406552>
-- Brandon Bowersox 'brandonojc' <http://drupal.org/user/186415>
+- Brandon Bowersox-Johnson 'bowersox' <http://drupal.org/user/186415>
Documentation
- Jennifer Hodgdon 'jhodgdon' <http://drupal.org/user/155601>
@@ -227,7 +229,7 @@ PHP module
- ?
Poll module
-- ?
+- Andrei Mateescu 'amateescu' <http://drupal.org/user/729614>
Profile module
- ?
@@ -247,7 +249,7 @@ Simpletest module
- Károly Négyesi 'chx' <http://drupal.org/user/9446>
Statistics module
-- Dave Reid 'davereid' <http://drupal.org/user/53892>
+- Tim Millwood 'timmillwood' <http://drupal.org/user/227849>
Syslog module
- Khalid Baheyeldin 'kbahey' <http://drupal.org/user/4063>
@@ -8,7 +8,7 @@
/**
* The current system version.
*/
-define('VERSION', '7.13');
+define('VERSION', '7.14');
/**
* Core API compatibility.
@@ -68,32 +68,32 @@ define('WATCHDOG_EMERGENCY', 0);
define('WATCHDOG_ALERT', 1);
/**
- * Log message severity -- Critical: critical conditions.
+ * Log message severity -- Critical conditions.
*/
define('WATCHDOG_CRITICAL', 2);
/**
- * Log message severity -- Error: error conditions.
+ * Log message severity -- Error conditions.
*/
define('WATCHDOG_ERROR', 3);
/**
- * Log message severity -- Warning: warning conditions.
+ * Log message severity -- Warning conditions.
*/
define('WATCHDOG_WARNING', 4);
/**
- * Log message severity -- Notice: normal but significant condition.
+ * Log message severity -- Normal but significant conditions.
*/
define('WATCHDOG_NOTICE', 5);
/**
- * Log message severity -- Informational: informational messages.
+ * Log message severity -- Informational messages.
*/
define('WATCHDOG_INFO', 6);
/**
- * Log message severity -- Debug: debug-level messages.
+ * Log message severity -- Debug-level messages.
*/
define('WATCHDOG_DEBUG', 7);
@@ -279,7 +279,7 @@ define('DRUPAL_PHP_FUNCTION_PATTERN', '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
* means that assigning an offset via arrayAccess will only apply while the
* object is in scope and will not be written back to the persistent cache.
* This follows a similar pattern to static vs. persistent caching in
- * procedural code. Extending classes may wish to alter this behaviour, for
+ * procedural code. Extending classes may wish to alter this behavior, for
* example by overriding offsetSet() and adding an automatic call to persist().
*
* @see SchemaCache
@@ -982,7 +982,7 @@ function variable_initialize($conf = array()) {
* The default value to use if this variable has never been set.
*
* @return
- * The value of the variable.
+ * The value of the variable. Unserialization is taken care of as necessary.
*
* @see variable_del()
* @see variable_set()
@@ -1707,8 +1707,16 @@ function watchdog_exception($type, Exception $exception, $message = NULL, $varia
* NULL if message is already translated or not possible to
* translate.
* @param $severity
- * The severity of the message, as per RFC 3164. Possible values are
- * WATCHDOG_ERROR, WATCHDOG_WARNING, etc.
+ * The severity of the message; one of the following values as defined in
+ * @link http://www.faqs.org/rfcs/rfc3164.html RFC 3164: @endlink
+ * - WATCHDOG_EMERGENCY: Emergency, system is unusable.
+ * - WATCHDOG_ALERT: Alert, action must be taken immediately.
+ * - WATCHDOG_CRITICAL: Critical conditions.
+ * - WATCHDOG_ERROR: Error conditions.
+ * - WATCHDOG_WARNING: Warning conditions.
+ * - WATCHDOG_NOTICE: (default) Normal but significant conditions.
+ * - WATCHDOG_INFO: Informational messages.
+ * - WATCHDOG_DEBUG: Debug-level messages.
* @param $link
* A link to associate with the message.
*
@@ -1725,6 +1733,9 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO
if (!$in_error_state && function_exists('module_implements')) {
$in_error_state = TRUE;
+ // The user object may not exist in all conditions, so 0 is substituted if needed.
+ $user_uid = isset($user->uid) ? $user->uid : 0;
+
// Prepare the fields to be logged
$log_entry = array(
'type' => $type,
@@ -1733,6 +1744,7 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO
'severity' => $severity,
'link' => $link,
'user' => $user,
+ 'uid' => $user_uid,
'request_uri' => $base_root . request_uri(),
'referer' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '',
'ip' => ip_address(),
@@ -1929,7 +1941,7 @@ function drupal_block_denied($ip) {
*/
function drupal_random_bytes($count) {
// $random_state does not use drupal_static as it stores random bytes.
- static $random_state, $bytes;
+ static $random_state, $bytes, $php_compatible;
// Initialize on the first call. The contents of $_SERVER includes a mix of
// user-specific and system information that varies a little with each page.
if (!isset($random_state)) {
@@ -1941,6 +1953,11 @@ function drupal_random_bytes($count) {
$bytes = '';
}
if (strlen($bytes) < $count) {
+ // PHP versions prior 5.3.4 experienced openssl_random_pseudo_bytes()
+ // locking on Windows and rendered it unusable.
+ if (!isset($php_compatible)) {
+ $php_compatible = version_compare(PHP_VERSION, '5.3.4', '>=');
+ }
// /dev/urandom is available on many *nix systems and is considered the
// best commonly available pseudo-random source.
if ($fh = @fopen('/dev/urandom', 'rb')) {
@@ -1950,6 +1967,11 @@ function drupal_random_bytes($count) {
$bytes .= fread($fh, max(4096, $count));
fclose($fh);
}
+ // openssl_random_pseudo_bytes() will find entropy in a system-dependent
+ // way.
+ elseif ($php_compatible && function_exists('openssl_random_pseudo_bytes')) {
+ $bytes .= openssl_random_pseudo_bytes($count - strlen($bytes));
+ }
// If /dev/urandom is not available or returns no bytes, this loop will
// generate a good set of pseudo-random bytes on any system.
// Note that it may be important that our $random_state is passed
@@ -2455,7 +2477,8 @@ function drupal_valid_test_ua() {
}
}
- return FALSE;
+ $test_prefix = FALSE;
+ return $test_prefix;
}
/**
@@ -3096,11 +3119,30 @@ function registry_rebuild() {
* to be called, because it is already known that the list of files in the
* {system} table matches those in the file system.
*
+ * @return
+ * TRUE if the registry was rebuilt, FALSE if another thread was rebuilding
+ * in parallel and the current thread just waited for completion.
+ *
* @see registry_rebuild()
*/
function registry_update() {
+ // install_system_module() calls module_enable() which calls into this
+ // function during initial system installation, so the lock system is neither
+ // loaded nor does its storage exist yet.
+ $in_installer = drupal_installation_attempted();
+ if (!$in_installer && !lock_acquire(__FUNCTION__)) {
+ // Another request got the lock, wait for it to finish.
+ lock_wait(__FUNCTION__);
+ return FALSE;
+ }
+
require_once DRUPAL_ROOT . '/includes/registry.inc';
_registry_update();
+
+ if (!$in_installer) {
+ lock_release(__FUNCTION__);
+ }
+ return TRUE;
}
/**
View
@@ -379,11 +379,31 @@ class DrupalDatabaseCache implements DrupalCacheInterface {
* The bin being requested.
*/
protected function garbageCollection() {
- global $user;
+ $cache_lifetime = variable_get('cache_lifetime', 0);
- // Garbage collection necessary when enforcing a minimum cache lifetime.
+ // Clean-up the per-user cache expiration session data, so that the session
+ // handler can properly clean-up the session data for anonymous users.
+ if (isset($_SESSION['cache_expiration'])) {
+ $expire = REQUEST_TIME - $cache_lifetime;
+ foreach ($_SESSION['cache_expiration'] as $bin => $timestamp) {
+ if ($timestamp < $expire) {
+ unset($_SESSION['cache_expiration'][$bin]);
+ }
+ }
+ if (!$_SESSION['cache_expiration']) {
+ unset($_SESSION['cache_expiration']);
+ }
+ }
+
+ // Garbage collection of temporary items is only necessary when enforcing
+ // a minimum cache lifetime.
+ if (!$cache_lifetime) {
+ return;
+ }
+ // When cache lifetime is in force, avoid running garbage collection too
+ // often since this will remove temporary cache items indiscriminately.
$cache_flush = variable_get('cache_flush_' . $this->bin, 0);
- if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= REQUEST_TIME)) {
+ if ($cache_flush && ($cache_flush + $cache_lifetime <= REQUEST_TIME)) {
// Reset the variable immediately to prevent a meltdown in heavy load situations.
variable_set('cache_flush_' . $this->bin, 0);
// Time to flush old cache data
@@ -413,17 +433,16 @@ class DrupalDatabaseCache implements DrupalCacheInterface {
if (!isset($cache->data)) {
return FALSE;
}
- // If enforcing a minimum cache lifetime, validate that the data is
- // currently valid for this user before we return it by making sure the cache
- // entry was created before the timestamp in the current session's cache
- // timer. The cache variable is loaded into the $user object by _drupal_session_read()
- // in session.inc. If the data is permanent or we're not enforcing a minimum
- // cache lifetime always return the cached data.
- if ($cache->expire != CACHE_PERMANENT && variable_get('cache_lifetime', 0) && $user->cache > $cache->created) {
- // This cache data is too old and thus not valid for us, ignore it.
+ // If the cached data is temporary and subject to a per-user minimum
+ // lifetime, compare the cache entry timestamp with the user session
+ // cache_expiration timestamp. If the cache entry is too old, ignore it.
+ if ($cache->expire != CACHE_PERMANENT && variable_get('cache_lifetime', 0) && isset($_SESSION['cache_expiration'][$this->bin]) && $_SESSION['cache_expiration'][$this->bin] > $cache->created) {
+ // Ignore cache data that is too old and thus not valid for this user.
return FALSE;
}
+ // If the data is permanent or not subject to a minimum cache lifetime,
+ // unserialize and return the cached data.
if ($cache->serialized) {
$cache->data = unserialize($cache->data);
}
@@ -468,11 +487,10 @@ class DrupalDatabaseCache implements DrupalCacheInterface {
if (empty($cid)) {
if (variable_get('cache_lifetime', 0)) {
- // We store the time in the current user's $user->cache variable which
- // will be saved into the sessions bin by _drupal_session_write(). We then
- // simulate that the cache was flushed for this user by not returning
- // cached data that was cached before the timestamp.
- $user->cache = REQUEST_TIME;
+ // We store the time in the current user's session. We then simulate
+ // that the cache was flushed for this user by not returning cached
+ // data that was cached before the timestamp.
+ $_SESSION['cache_expiration'][$this->bin] = REQUEST_TIME;
$cache_flush = variable_get('cache_flush_' . $this->bin, 0);
if ($cache_flush == 0) {
Oops, something went wrong.

0 comments on commit 7c19e7c

Please sign in to comment.