updated core to 7.37
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
/**
|
||||
* The current system version.
|
||||
*/
|
||||
define('VERSION', '7.36');
|
||||
define('VERSION', '7.37');
|
||||
|
||||
/**
|
||||
* Core API compatibility.
|
||||
|
@@ -1522,7 +1522,7 @@ function _filter_xss_split($m, $store = FALSE) {
|
||||
return '<';
|
||||
}
|
||||
|
||||
if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?|(<!--.*?-->)$%', $string, $matches)) {
|
||||
if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9\-]+)([^>]*)>?|(<!--.*?-->)$%', $string, $matches)) {
|
||||
// Seriously malformed.
|
||||
return '';
|
||||
}
|
||||
@@ -3802,7 +3802,7 @@ function drupal_load_stylesheet_content($contents, $optimize = FALSE) {
|
||||
|
||||
// Replaces @import commands with the actual stylesheet content.
|
||||
// This happens recursively but omits external files.
|
||||
$contents = preg_replace_callback('/@import\s*(?:url\(\s*)?[\'"]?(?![a-z]+:)([^\'"\()]+)[\'"]?\s*\)?\s*;/', '_drupal_load_stylesheet', $contents);
|
||||
$contents = preg_replace_callback('/@import\s*(?:url\(\s*)?[\'"]?(?![a-z]+:)(?!\/\/)([^\'"\()]+)[\'"]?\s*\)?\s*;/', '_drupal_load_stylesheet', $contents);
|
||||
return $contents;
|
||||
}
|
||||
|
||||
@@ -7137,6 +7137,23 @@ function _drupal_schema_initialize(&$schema, $module, $remove_descriptions = TRU
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the type for every field in a table schema.
|
||||
*
|
||||
* @param $table
|
||||
* The name of the table from which to retrieve type information.
|
||||
*
|
||||
* @return
|
||||
* An array of types, keyed by field name.
|
||||
*/
|
||||
function drupal_schema_field_types($table) {
|
||||
$table_schema = drupal_get_schema($table);
|
||||
foreach ($table_schema['fields'] as $field_name => $field_info) {
|
||||
$field_types[$field_name] = isset($field_info['type']) ? $field_info['type'] : NULL;
|
||||
}
|
||||
return $field_types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of fields from a table schema.
|
||||
*
|
||||
@@ -7761,6 +7778,7 @@ function entity_get_info($entity_type = NULL) {
|
||||
// Prepare entity schema fields SQL info for
|
||||
// DrupalEntityControllerInterface::buildQuery().
|
||||
if (isset($entity_info[$name]['base table'])) {
|
||||
$entity_info[$name]['base table field types'] = drupal_schema_field_types($entity_info[$name]['base table']);
|
||||
$entity_info[$name]['schema_fields_sql']['base table'] = drupal_schema_fields_sql($entity_info[$name]['base table']);
|
||||
if (isset($entity_info[$name]['revision table'])) {
|
||||
$entity_info[$name]['schema_fields_sql']['revision table'] = drupal_schema_fields_sql($entity_info[$name]['revision table']);
|
||||
|
@@ -157,18 +157,6 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
|
||||
public function load($ids = array(), $conditions = array()) {
|
||||
$entities = array();
|
||||
|
||||
# PATCH http://drupal.org/node/1003788#comment-5195682
|
||||
// Clean the $ids array to remove non-integer values that can be passed
|
||||
// in from various sources, including menu callbacks.
|
||||
if (is_array($ids)) {
|
||||
foreach ($ids as $key => $id) {
|
||||
if (empty($id) || ((string) $id !== (string) (int) $id)) {
|
||||
unset($ids[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
# endpatch
|
||||
|
||||
// Revisions are not statically cached, and require a different query to
|
||||
// other conditions, so separate the revision id into its own variable.
|
||||
if ($this->revisionKey && isset($conditions[$this->revisionKey])) {
|
||||
@@ -195,6 +183,11 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure integer entity IDs are valid.
|
||||
if (!empty($ids)) {
|
||||
$this->cleanIds($ids);
|
||||
}
|
||||
|
||||
// Load any remaining entities from the database. This is the case if $ids
|
||||
// is set to FALSE (so we load all entities), if there are any ids left to
|
||||
// load, if loading a revision, or if $conditions was passed without $ids.
|
||||
@@ -235,6 +228,35 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
|
||||
return $entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures integer entity IDs are valid.
|
||||
*
|
||||
* The identifier sanitization provided by this method has been introduced
|
||||
* as Drupal used to rely on the database to facilitate this, which worked
|
||||
* correctly with MySQL but led to errors with other DBMS such as PostgreSQL.
|
||||
*
|
||||
* @param array $ids
|
||||
* The entity IDs to verify. Non-integer IDs are removed from this array if
|
||||
* the entity type requires IDs to be integers.
|
||||
*/
|
||||
protected function cleanIds(&$ids) {
|
||||
$entity_info = entity_get_info($this->entityType);
|
||||
if (isset($entity_info['base table field types'])) {
|
||||
$id_type = $entity_info['base table field types'][$this->idKey];
|
||||
if ($id_type == 'serial' || $id_type == 'int') {
|
||||
$ids = array_filter($ids, array($this, 'filterId'));
|
||||
$ids = array_map('intval', $ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for array_filter that removes non-integer IDs.
|
||||
*/
|
||||
protected function filterId($id) {
|
||||
return is_numeric($id) && $id == (int) $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the query to load the entity.
|
||||
*
|
||||
|
@@ -2662,8 +2662,8 @@ function _form_options_flatten($array) {
|
||||
* - #required: (optional) Whether the user needs to select an option (TRUE)
|
||||
* or not (FALSE). Defaults to FALSE.
|
||||
* - #empty_option: (optional) The label to show for the first default option.
|
||||
* By default, the label is automatically set to "- Please select -" for a
|
||||
* required field and "- None -" for an optional field.
|
||||
* By default, the label is automatically set to "- Select -" for a required
|
||||
* field and "- None -" for an optional field.
|
||||
* - #empty_value: (optional) The value for the first default option, which is
|
||||
* used to determine whether the user submitted a value or not.
|
||||
* - If #required is TRUE, this defaults to '' (an empty string).
|
||||
|
@@ -362,7 +362,8 @@ function install_run_tasks(&$install_state) {
|
||||
* Runs an individual installation task.
|
||||
*
|
||||
* @param $task
|
||||
* An array of information about the task to be run.
|
||||
* An array of information about the task to be run as returned by
|
||||
* hook_install_tasks().
|
||||
* @param $install_state
|
||||
* An array of information about the current installation state. This is
|
||||
* passed in by reference so that it can be modified by the task.
|
||||
@@ -478,11 +479,15 @@ function install_run_task($task, &$install_state) {
|
||||
* the page request evolves (for example, if an installation profile hasn't
|
||||
* been selected yet, we don't yet know which profile tasks need to be run).
|
||||
*
|
||||
* You can override this using hook_install_tasks() or
|
||||
* hook_install_tasks_alter().
|
||||
*
|
||||
* @param $install_state
|
||||
* An array of information about the current installation state.
|
||||
*
|
||||
* @return
|
||||
* A list of tasks to be performed, with associated metadata.
|
||||
* A list of tasks to be performed, with associated metadata as returned by
|
||||
* hook_install_tasks().
|
||||
*/
|
||||
function install_tasks_to_perform($install_state) {
|
||||
// Start with a list of all currently available tasks.
|
||||
|
Reference in New Issue
Block a user