security update core+modules

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-26 18:38:56 +02:00
parent 2f45ea820a
commit 7c96373038
1022 changed files with 30319 additions and 11259 deletions

View File

@@ -309,7 +309,7 @@ define('MENU_PREFERRED_LINK', '1cf698d64d1aa4b83907cf6ed55db3a7f8e92c91');
* actually exists. This list of 'masks' is built in menu_rebuild().
*
* @param $parts
* An array of path parts, for the above example
* An array of path parts; for the above example,
* array('node', '12345', 'edit').
*
* @return
@@ -430,7 +430,7 @@ function menu_set_item($path, $router_item) {
* Gets a router item.
*
* @param $path
* The path, for example node/5. The function will find the corresponding
* The path; for example, 'node/5'. The function will find the corresponding
* node/% item and return that.
* @param $router_item
* Internal use only.
@@ -456,7 +456,9 @@ function menu_get_item($path = NULL, $router_item = NULL) {
// Rebuild if we know it's needed, or if the menu masks are missing which
// occurs rarely, likely due to a race condition of multiple rebuilds.
if (variable_get('menu_rebuild_needed', FALSE) || !variable_get('menu_masks', array())) {
menu_rebuild();
if (_menu_check_rebuild()) {
menu_rebuild();
}
}
$original_map = arg(NULL, $path);
@@ -542,7 +544,7 @@ function menu_execute_active_handler($path = NULL, $deliver = TRUE) {
* @param $item
* A menu router or menu link item
* @param $map
* An array of path arguments (ex: array('node', '5'))
* An array of path arguments; for example, array('node', '5').
*
* @return
* Returns TRUE for success, FALSE if an object cannot be loaded.
@@ -612,12 +614,13 @@ function _menu_load_objects(&$item, &$map) {
* @param $item
* A menu router or menu link item
* @param $map
* An array of path arguments (ex: array('node', '5'))
* An array of path arguments; for example, array('node', '5').
*
* @return
* $item['access'] becomes TRUE if the item is accessible, FALSE otherwise.
*/
function _menu_check_access(&$item, $map) {
$item['access'] = FALSE;
// Determine access callback, which will decide whether or not the current
// user has access to this path.
$callback = empty($item['access_callback']) ? 0 : trim($item['access_callback']);
@@ -737,7 +740,7 @@ function _menu_item_localize(&$item, $map, $link_translate = FALSE) {
* @param $router_item
* A menu router item
* @param $map
* An array of path arguments (ex: array('node', '5'))
* An array of path arguments; for example, array('node', '5').
* @param $to_arg
* Execute $item['to_arg_functions'] or not. Use only if you want to render a
* path from the menu table, for example tabs.
@@ -800,9 +803,9 @@ function _menu_translate(&$router_item, $map, $to_arg = FALSE) {
* Translates the path elements in the map using any to_arg helper function.
*
* @param $map
* An array of path arguments (ex: array('node', '5'))
* An array of path arguments; for example, array('node', '5').
* @param $to_arg_functions
* An array of helper function (ex: array(2 => 'menu_tail_to_arg'))
* An array of helper functions; for example, array(2 => 'menu_tail_to_arg').
*
* @see hook_menu()
*/
@@ -999,7 +1002,7 @@ function menu_tree($menu_name) {
}
/**
* Returns a rendered menu tree.
* Returns an output structure for rendering a menu tree.
*
* The menu item's LI element is given one of the following classes:
* - expanded: The menu item is showing its submenu.
@@ -1925,13 +1928,21 @@ function menu_local_tasks($level = 0) {
}
// Get all tabs (also known as local tasks) and the root page.
$result = db_select('menu_router', NULL, array('fetch' => PDO::FETCH_ASSOC))
->fields('menu_router')
->condition('tab_root', $router_item['tab_root'])
->condition('context', MENU_CONTEXT_INLINE, '<>')
->orderBy('weight')
->orderBy('title')
->execute();
$cid = 'local_tasks:' . $router_item['tab_root'];
if ($cache = cache_get($cid, 'cache_menu')) {
$result = $cache->data;
}
else {
$result = db_select('menu_router', NULL, array('fetch' => PDO::FETCH_ASSOC))
->fields('menu_router')
->condition('tab_root', $router_item['tab_root'])
->condition('context', MENU_CONTEXT_INLINE, '<>')
->orderBy('weight')
->orderBy('title')
->execute()
->fetchAll();
cache_set($cid, $result, 'cache_menu');
}
$map = $router_item['original_map'];
$children = array();
$tasks = array();
@@ -2138,7 +2149,7 @@ function menu_local_tasks($level = 0) {
* example 'node' or 'admin/structure/block/manage'.
* @param $args
* A list of dynamic path arguments to append to $parent_path to form the
* fully-qualified menu router path, for example array(123) for a certain
* fully-qualified menu router path; for example, array(123) for a certain
* node or array('system', 'navigation') for a certain block.
*
* @return
@@ -2429,7 +2440,7 @@ function menu_set_active_trail($new_trail = NULL) {
* Looks up the preferred menu link for a given system path.
*
* @param $path
* The path, for example 'node/5'. The function will find the corresponding
* The path; for example, 'node/5'. The function will find the corresponding
* menu link ('node/5' if it exists, or fallback to 'node/%').
* @param $selected_menu
* The name of a menu used to restrict the search for a preferred menu link.
@@ -2486,6 +2497,7 @@ function menu_link_get_preferred($path = NULL, $selected_menu = NULL) {
$query->addField('ml', 'weight', 'link_weight');
$query->fields('m');
$query->condition('ml.link_path', $path_candidates, 'IN');
$query->addTag('preferred_menu_links');
// Sort candidates by link path and menu name.
$candidates = array();
@@ -2683,6 +2695,21 @@ function menu_reset_static_cache() {
drupal_static_reset('menu_link_get_preferred');
}
/**
* Checks whether a menu_rebuild() is necessary.
*/
function _menu_check_rebuild() {
// To absolutely ensure that the menu rebuild is required, re-load the
// variables in case they were set by another process.
$variables = variable_initialize();
if (empty($variables['menu_rebuild_needed']) && !empty($variables['menu_masks'])) {
unset($GLOBALS['conf']['menu_rebuild_needed']);
$GLOBALS['conf']['menu_masks'] = $variables['menu_masks'];
return FALSE;
}
return TRUE;
}
/**
* Populates the database tables used by various menu functions.
*
@@ -2703,6 +2730,14 @@ function menu_rebuild() {
// We choose to block here since otherwise the router item may not
// be available in menu_execute_active_handler() resulting in a 404.
lock_wait('menu_rebuild');
if (_menu_check_rebuild()) {
// If we get here and menu_masks was not set, then it is possible a menu
// is being reloaded, or that the process rebuilding the menu was unable
// to complete successfully. A missing menu_masks variable could result
// in a 404, so re-run the function.
return menu_rebuild();
}
return FALSE;
}
@@ -2727,6 +2762,12 @@ function menu_rebuild() {
$transaction->rollback();
watchdog_exception('menu', $e);
}
// Explicitly commit the transaction now; this ensures that the database
// operations during the menu rebuild are committed before the lock is made
// available again, since locks may not always reside in the same database
// connection. The lock is acquired outside of the transaction so should also
// be released outside of it.
unset($transaction);
lock_release('menu_rebuild');
return TRUE;