updated drupal core to 7.43
This commit is contained in:
@@ -688,6 +688,13 @@ function drupal_goto($path = '', array $options = array(), $http_response_code =
|
||||
$options['fragment'] = $destination['fragment'];
|
||||
}
|
||||
|
||||
// In some cases modules call drupal_goto(current_path()). We need to ensure
|
||||
// that such a redirect is not to an external URL.
|
||||
if ($path === current_path() && empty($options['external']) && url_is_external($path)) {
|
||||
// Force url() to generate a non-external URL.
|
||||
$options['external'] = FALSE;
|
||||
}
|
||||
|
||||
drupal_alter('drupal_goto', $path, $options, $http_response_code);
|
||||
|
||||
// The 'Location' HTTP header must be absolute.
|
||||
@@ -1057,6 +1064,12 @@ function drupal_http_request($url, array $options = array()) {
|
||||
|
||||
switch ($code) {
|
||||
case 200: // OK
|
||||
case 201: // Created
|
||||
case 202: // Accepted
|
||||
case 203: // Non-Authoritative Information
|
||||
case 204: // No Content
|
||||
case 205: // Reset Content
|
||||
case 206: // Partial Content
|
||||
case 304: // Not modified
|
||||
break;
|
||||
case 301: // Moved permanently
|
||||
@@ -2214,20 +2227,8 @@ function url($path = NULL, array $options = array()) {
|
||||
'prefix' => ''
|
||||
);
|
||||
|
||||
// A duplicate of the code from url_is_external() to avoid needing another
|
||||
// function call, since performance inside url() is critical.
|
||||
if (!isset($options['external'])) {
|
||||
// Return an external link if $path contains an allowed absolute URL. Avoid
|
||||
// calling drupal_strip_dangerous_protocols() if there is any slash (/),
|
||||
// hash (#) or question_mark (?) before the colon (:) occurrence - if any -
|
||||
// as this would clearly mean it is not a URL. If the path starts with 2
|
||||
// slashes then it is always considered an external URL without an explicit
|
||||
// protocol part.
|
||||
$colonpos = strpos($path, ':');
|
||||
$options['external'] = (strpos($path, '//') === 0)
|
||||
|| ($colonpos !== FALSE
|
||||
&& !preg_match('![/?#]!', substr($path, 0, $colonpos))
|
||||
&& drupal_strip_dangerous_protocols($path) == $path);
|
||||
$options['external'] = url_is_external($path);
|
||||
}
|
||||
|
||||
// Preserve the original path before altering or aliasing.
|
||||
@@ -2347,12 +2348,18 @@ function url($path = NULL, array $options = array()) {
|
||||
*/
|
||||
function url_is_external($path) {
|
||||
$colonpos = strpos($path, ':');
|
||||
// Avoid calling drupal_strip_dangerous_protocols() if there is any slash (/),
|
||||
// hash (#) or question_mark (?) before the colon (:) occurrence - if any - as
|
||||
// this would clearly mean it is not a URL. If the path starts with 2 slashes
|
||||
// then it is always considered an external URL without an explicit protocol
|
||||
// part.
|
||||
// Some browsers treat \ as / so normalize to forward slashes.
|
||||
$path = str_replace('\\', '/', $path);
|
||||
// If the path starts with 2 slashes then it is always considered an external
|
||||
// URL without an explicit protocol part.
|
||||
return (strpos($path, '//') === 0)
|
||||
// Leading control characters may be ignored or mishandled by browsers, so
|
||||
// assume such a path may lead to an external location. The \p{C} character
|
||||
// class matches all UTF-8 control, unassigned, and private characters.
|
||||
|| (preg_match('/^\p{C}/u', $path) !== 0)
|
||||
// Avoid calling drupal_strip_dangerous_protocols() if there is any slash
|
||||
// (/), hash (#) or question_mark (?) before the colon (:) occurrence - if
|
||||
// any - as this would clearly mean it is not a URL.
|
||||
|| ($colonpos !== FALSE
|
||||
&& !preg_match('![/?#]!', substr($path, 0, $colonpos))
|
||||
&& drupal_strip_dangerous_protocols($path) == $path);
|
||||
@@ -2812,11 +2819,11 @@ function drupal_map_assoc($array, $function = NULL) {
|
||||
* into script execution a call such as set_time_limit(20) is made, the
|
||||
* script will run for a total of 45 seconds before timing out.
|
||||
*
|
||||
* It also means that it is possible to decrease the total time limit if
|
||||
* the sum of the new time limit and the current time spent running the
|
||||
* script is inferior to the original time limit. It is inherent to the way
|
||||
* set_time_limit() works, it should rather be called with an appropriate
|
||||
* value every time you need to allocate a certain amount of time
|
||||
* If the current time limit is not unlimited it is possible to decrease the
|
||||
* total time limit if the sum of the new time limit and the current time spent
|
||||
* running the script is inferior to the original time limit. It is inherent to
|
||||
* the way set_time_limit() works, it should rather be called with an
|
||||
* appropriate value every time you need to allocate a certain amount of time
|
||||
* to execute a task than only once at the beginning of the script.
|
||||
*
|
||||
* Before calling set_time_limit(), we check if this function is available
|
||||
@@ -2833,7 +2840,11 @@ function drupal_map_assoc($array, $function = NULL) {
|
||||
*/
|
||||
function drupal_set_time_limit($time_limit) {
|
||||
if (function_exists('set_time_limit')) {
|
||||
@set_time_limit($time_limit);
|
||||
$current = ini_get('max_execution_time');
|
||||
// Do not set time limit if it is currently unlimited.
|
||||
if ($current != 0) {
|
||||
@set_time_limit($time_limit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5212,6 +5223,11 @@ function _drupal_bootstrap_full() {
|
||||
fix_gpc_magic();
|
||||
// Load all enabled modules
|
||||
module_load_all();
|
||||
// Reset drupal_alter() and module_implements() static caches as these
|
||||
// include implementations for vital modules only when called early on
|
||||
// in the bootstrap.
|
||||
drupal_static_reset('drupal_alter');
|
||||
drupal_static_reset('module_implements');
|
||||
// Make sure all stream wrappers are registered.
|
||||
file_get_stream_wrappers();
|
||||
// Ensure mt_rand is reseeded, to prevent random values from one page load
|
||||
@@ -5308,8 +5324,8 @@ function drupal_page_set_cache() {
|
||||
*
|
||||
* Do not call this function from a test. Use $this->cronRun() instead.
|
||||
*
|
||||
* @return
|
||||
* TRUE if cron ran successfully.
|
||||
* @return bool
|
||||
* TRUE if cron ran successfully and FALSE if cron is already running.
|
||||
*/
|
||||
function drupal_cron_run() {
|
||||
// Allow execution to continue even if the request gets canceled.
|
||||
@@ -5371,12 +5387,12 @@ function drupal_cron_run() {
|
||||
// Do not run if queue wants to skip.
|
||||
continue;
|
||||
}
|
||||
$function = $info['worker callback'];
|
||||
$callback = $info['worker callback'];
|
||||
$end = time() + (isset($info['time']) ? $info['time'] : 15);
|
||||
$queue = DrupalQueue::get($queue_name);
|
||||
while (time() < $end && ($item = $queue->claimItem())) {
|
||||
try {
|
||||
$function($item->data);
|
||||
call_user_func($callback, $item->data);
|
||||
$queue->deleteItem($item);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
@@ -7083,7 +7099,8 @@ function drupal_uninstall_schema($module) {
|
||||
* specification of a schema, as it was defined in a module's
|
||||
* hook_schema(). No additional default values will be set,
|
||||
* hook_schema_alter() is not invoked and these unprocessed
|
||||
* definitions won't be cached.
|
||||
* definitions won't be cached. To retrieve the schema after
|
||||
* hook_schema_alter() has been invoked use drupal_get_schema().
|
||||
*
|
||||
* This function can be used to retrieve a schema specification in
|
||||
* hook_schema(), so it allows you to derive your tables from existing
|
||||
@@ -7156,6 +7173,7 @@ function _drupal_schema_initialize(&$schema, $module, $remove_descriptions = TRU
|
||||
*/
|
||||
function drupal_schema_field_types($table) {
|
||||
$table_schema = drupal_get_schema($table);
|
||||
$field_types = array();
|
||||
foreach ($table_schema['fields'] as $field_name => $field_info) {
|
||||
$field_types[$field_name] = isset($field_info['type']) ? $field_info['type'] : NULL;
|
||||
}
|
||||
@@ -7363,7 +7381,16 @@ function drupal_write_record($table, &$record, $primary_keys = array()) {
|
||||
* Information stored in a module .info file:
|
||||
* - name: The real name of the module for display purposes.
|
||||
* - description: A brief description of the module.
|
||||
* - dependencies: An array of shortnames of other modules this module requires.
|
||||
* - dependencies: An array of dependency strings. Each is in the form
|
||||
* 'project:module (versions)'; with the following meanings:
|
||||
* - project: (optional) Project shortname, recommended to ensure uniqueness,
|
||||
* if the module is part of a project hosted on drupal.org. If omitted,
|
||||
* also omit the : that follows. The project name is currently ignored by
|
||||
* Drupal core but is used for automated testing.
|
||||
* - module: (required) Module shortname within the project.
|
||||
* - (versions): Optional version information, consisting of one or more
|
||||
* comma-separated operator/value pairs or simply version numbers, which
|
||||
* can contain "x" as a wildcard. Examples: (>=7.22, <7.28), (7.x-3.x).
|
||||
* - package: The name of the package of modules this module belongs to.
|
||||
*
|
||||
* See forum.info for an example of a module .info file.
|
||||
@@ -7443,7 +7470,6 @@ function drupal_parse_info_file($filename) {
|
||||
*/
|
||||
function drupal_parse_info_format($data) {
|
||||
$info = array();
|
||||
$constants = get_defined_constants();
|
||||
|
||||
if (preg_match_all('
|
||||
@^\s* # Start at the beginning of a line, ignoring leading whitespace
|
||||
@@ -7483,8 +7509,8 @@ function drupal_parse_info_format($data) {
|
||||
}
|
||||
|
||||
// Handle PHP constants.
|
||||
if (isset($constants[$value])) {
|
||||
$value = $constants[$value];
|
||||
if (preg_match('/^\w+$/i', $value) && defined($value)) {
|
||||
$value = constant($value);
|
||||
}
|
||||
|
||||
// Insert actual value.
|
||||
@@ -7648,7 +7674,12 @@ function debug($data, $label = NULL, $print_r = FALSE) {
|
||||
* Parses a dependency for comparison by drupal_check_incompatibility().
|
||||
*
|
||||
* @param $dependency
|
||||
* A dependency string, for example 'foo (>=7.x-4.5-beta5, 3.x)'.
|
||||
* A dependency string, which specifies a module dependency, and optionally
|
||||
* the project it comes from and versions that are supported. Supported
|
||||
* formats include:
|
||||
* - 'module'
|
||||
* - 'project:module'
|
||||
* - 'project:module (>=version, version)'
|
||||
*
|
||||
* @return
|
||||
* An associative array with three keys:
|
||||
@@ -7663,6 +7694,12 @@ function debug($data, $label = NULL, $print_r = FALSE) {
|
||||
* @see drupal_check_incompatibility()
|
||||
*/
|
||||
function drupal_parse_dependency($dependency) {
|
||||
$value = array();
|
||||
// Split out the optional project name.
|
||||
if (strpos($dependency, ':')) {
|
||||
list($project_name, $dependency) = explode(':', $dependency);
|
||||
$value['project'] = $project_name;
|
||||
}
|
||||
// We use named subpatterns and support every op that version_compare
|
||||
// supports. Also, op is optional and defaults to equals.
|
||||
$p_op = '(?P<operation>!=|==|=|<|<=|>|>=|<>)?';
|
||||
@@ -7671,7 +7708,6 @@ function drupal_parse_dependency($dependency) {
|
||||
$p_major = '(?P<major>\d+)';
|
||||
// By setting the minor version to x, branches can be matched.
|
||||
$p_minor = '(?P<minor>(?:\d+|x)(?:-[A-Za-z]+\d+)?)';
|
||||
$value = array();
|
||||
$parts = explode('(', $dependency, 2);
|
||||
$value['name'] = trim($parts[0]);
|
||||
if (isset($parts[1])) {
|
||||
|
||||
Reference in New Issue
Block a user