update core to 7.36

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-19 19:33:23 +02:00
parent 6de56c702c
commit 802ec0c6f3
271 changed files with 4111 additions and 1227 deletions

View File

@@ -229,7 +229,24 @@ function image_gd_desaturate(stdClass $image) {
function image_gd_load(stdClass $image) {
$extension = str_replace('jpg', 'jpeg', $image->info['extension']);
$function = 'imagecreatefrom' . $extension;
return (function_exists($function) && $image->resource = $function($image->source));
if (function_exists($function) && $image->resource = $function($image->source)) {
if (imageistruecolor($image->resource)) {
return TRUE;
}
else {
// Convert indexed images to truecolor, copying the image to a new
// truecolor resource, so that filters work correctly and don't result
// in unnecessary dither.
$resource = image_gd_create_tmp($image, $image->info['width'], $image->info['height']);
if ($resource) {
imagecopy($resource, $image->resource, 0, 0, 0, 0, imagesx($resource), imagesy($resource));
imagedestroy($image->resource);
$image->resource = $resource;
}
}
return (bool) $image->resource;
}
return FALSE;
}
/**
@@ -297,17 +314,31 @@ function image_gd_create_tmp(stdClass $image, $width, $height) {
$res = imagecreatetruecolor($width, $height);
if ($image->info['extension'] == 'gif') {
// Grab transparent color index from image resource.
// Find out if a transparent color is set, will return -1 if no
// transparent color has been defined in the image.
$transparent = imagecolortransparent($image->resource);
if ($transparent >= 0) {
// The original must have a transparent color, allocate to the new image.
$transparent_color = imagecolorsforindex($image->resource, $transparent);
$transparent = imagecolorallocate($res, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
// Find out the number of colors in the image palette. It will be 0 for
// truecolor images.
$palette_size = imagecolorstotal($image->resource);
if ($palette_size == 0 || $transparent < $palette_size) {
// Set the transparent color in the new resource, either if it is a
// truecolor image or if the transparent color is part of the palette.
// Since the index of the transparency color is a property of the
// image rather than of the palette, it is possible that an image
// could be created with this index set outside the palette size (see
// http://stackoverflow.com/a/3898007).
$transparent_color = imagecolorsforindex($image->resource, $transparent);
$transparent = imagecolorallocate($res, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
// Flood with our new transparent color.
imagefill($res, 0, 0, $transparent);
imagecolortransparent($res, $transparent);
// Flood with our new transparent color.
imagefill($res, 0, 0, $transparent);
imagecolortransparent($res, $transparent);
}
else {
imagefill($res, 0, 0, imagecolorallocate($res, 255, 255, 255));
}
}
}
elseif ($image->info['extension'] == 'png') {

View File

@@ -640,13 +640,13 @@ function system_theme_settings_validate($form, &$form_state) {
// If the user provided a path for a logo or favicon file, make sure a file
// exists at that path.
if ($form_state['values']['logo_path']) {
if (!empty($form_state['values']['logo_path'])) {
$path = _system_theme_settings_validate_path($form_state['values']['logo_path']);
if (!$path) {
form_set_error('logo_path', t('The custom logo path is invalid.'));
}
}
if ($form_state['values']['favicon_path']) {
if (!empty($form_state['values']['favicon_path'])) {
$path = _system_theme_settings_validate_path($form_state['values']['favicon_path']);
if (!$path) {
form_set_error('favicon_path', t('The custom favicon path is invalid.'));
@@ -703,14 +703,16 @@ function system_theme_settings_submit($form, &$form_state) {
// If the user uploaded a new logo or favicon, save it to a permanent location
// and use it in place of the default theme-provided file.
if ($file = $values['logo_upload']) {
if (!empty($values['logo_upload'])) {
$file = $values['logo_upload'];
unset($values['logo_upload']);
$filename = file_unmanaged_copy($file->uri);
$values['default_logo'] = 0;
$values['logo_path'] = $filename;
$values['toggle_logo'] = 1;
}
if ($file = $values['favicon_upload']) {
if (!empty($values['favicon_upload'])) {
$file = $values['favicon_upload'];
unset($values['favicon_upload']);
$filename = file_unmanaged_copy($file->uri);
$values['default_favicon'] = 0;
@@ -950,7 +952,11 @@ function system_sort_modules_by_info_name($a, $b) {
}
/**
* Array sorting callback; sorts modules or themes by their name.
* Sorts themes by their names, with the default theme listed first.
*
* Callback for uasort() within system_themes_page().
*
* @see system_sort_modules_by_info_name().
*/
function system_sort_themes($a, $b) {
if ($a->is_default) {
@@ -2640,8 +2646,8 @@ function theme_system_modules_fieldset($variables) {
}
$row[] = array('data' => $description, 'class' => array('description'));
// Display links (such as help or permissions) in their own columns.
foreach (array('help', 'permissions', 'configure') as $key) {
$row[] = array('data' => drupal_render($module['links'][$key]), 'class' => array($key));
foreach (array('help', 'permissions', 'configure') as $link_type) {
$row[] = array('data' => drupal_render($module['links'][$link_type]), 'class' => array($link_type));
}
$rows[] = $row;
}

View File

@@ -247,7 +247,7 @@ function hook_entity_info() {
'custom settings' => FALSE,
),
'search_result' => array(
'label' => t('Search result'),
'label' => t('Search result highlighting input'),
'custom settings' => FALSE,
),
);
@@ -606,8 +606,8 @@ function hook_cron() {
* @return
* An associative array where the key is the queue name and the value is
* again an associative array. Possible keys are:
* - 'worker callback': The name of the function to call. It will be called
* with one argument, the item created via DrupalQueue::createItem().
* - 'worker callback': A PHP callable to call that is an implementation of
* callback_queue_worker().
* - 'time': (optional) How much time Drupal should spend on calling this
* worker in seconds. Defaults to 15.
* - 'skip on cron': (optional) Set to TRUE to avoid being processed during
@@ -643,6 +643,28 @@ function hook_cron_queue_info_alter(&$queues) {
$queues['aggregator_feeds']['time'] = 90;
}
/**
* Work on a single queue item.
*
* Callback for hook_queue_info().
*
* @param $queue_item_data
* The data that was passed to DrupalQueue::createItem() when the item was
* queued.
*
* @throws \Exception
* The worker callback may throw an exception to indicate there was a problem.
* The cron process will log the exception, and leave the item in the queue to
* be processed again later.
*
* @see drupal_cron_run()
*/
function callback_queue_worker($queue_item_data) {
$node = node_load($queue_item_data);
$node->title = 'Updated title';
$node->save();
}
/**
* Allows modules to declare their own Form API element types and specify their
* default values.
@@ -1890,9 +1912,8 @@ function hook_init() {
/**
* Define image toolkits provided by this module.
*
* The file which includes each toolkit's functions must be declared as part of
* the files array in the module .info file so that the registry will find and
* parse it.
* The file which includes each toolkit's functions must be included in this
* hook.
*
* The toolkit's functions must be named image_toolkitname_operation().
* where the operation may be:
@@ -2109,6 +2130,61 @@ function hook_permission() {
);
}
/**
* Provide online user help.
*
* By implementing hook_help(), a module can make documentation available to
* the user for the module as a whole, or for specific paths. Help for
* developers should usually be provided via function header comments in the
* code, or in special API example files.
*
* The page-specific help information provided by this hook appears as a system
* help block on that page. The module overview help information is displayed
* by the Help module. It can be accessed from the page at admin/help or from
* the Modules page.
*
* For detailed usage examples of:
* - Module overview help, see node_help(). Module overview help should follow
* @link https://drupal.org/node/632280 the standard help template. @endlink
* - Page-specific help with simple paths, see dashboard_help().
* - Page-specific help using wildcards in path and $arg, see node_help()
* and block_help().
*
* @param $path
* The router menu path, as defined in hook_menu(), for the help that is
* being requested; e.g., 'admin/people' or 'user/register'. If the router
* path includes a wildcard, then this will appear in $path as %, even if it
* is a named %autoloader wildcard in the hook_menu() implementation; for
* example, node pages would have $path equal to 'node/%' or 'node/%/view'.
* For the help page for the module as a whole, $path will have the value
* 'admin/help#module_name', where 'module_name" is the machine name of your
* module.
* @param $arg
* An array that corresponds to the return value of the arg() function, for
* modules that want to provide help that is specific to certain values
* of wildcards in $path. For example, you could provide help for the path
* 'user/1' by looking for the path 'user/%' and $arg[1] == '1'. This given
* array should always be used rather than directly invoking arg(), because
* your hook implementation may be called for other purposes besides building
* the current page's help. Note that depending on which module is invoking
* hook_help, $arg may contain only empty strings. Regardless, $arg[0] to
* $arg[11] will always be set.
*
* @return
* A localized string containing the help text.
*/
function hook_help($path, $arg) {
switch ($path) {
// Main module help for the block module
case 'admin/help#block':
return '<p>' . t('Blocks are boxes of content rendered into an area, or region, of a web page. The default theme Bartik, for example, implements the regions "Sidebar first", "Sidebar second", "Featured", "Content", "Header", "Footer", etc., and a block may appear in any one of these areas. The <a href="@blocks">blocks administration page</a> provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions.', array('@blocks' => url('admin/structure/block'))) . '</p>';
// Help for another path in the block module
case 'admin/structure/block':
return '<p>' . t('This page provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions. Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. Remember that your changes will not be saved until you click the <em>Save blocks</em> button at the bottom of the page.') . '</p>';
}
}
/**
* Register a module (or theme's) theme implementations.
*
@@ -3371,24 +3447,31 @@ function hook_install() {
* hooks. See @link update_api Update versions of API functions @endlink for
* details.
*
* If your update task is potentially time-consuming, you'll need to implement a
* multipass update to avoid PHP timeouts. Multipass updates use the $sandbox
* parameter provided by the batch API (normally, $context['sandbox']) to store
* information between successive calls, and the $sandbox['#finished'] value
* to provide feedback regarding completion level.
* The $sandbox parameter should be used when a multipass update is needed, in
* circumstances where running the whole update at once could cause PHP to
* timeout. Each pass is run in a way that avoids PHP timeouts, provided each
* pass remains under the timeout limit. To signify that an update requires
* at least one more pass, set $sandbox['#finished'] to a number less than 1
* (you need to do this each pass). The value of $sandbox['#finished'] will be
* unset between passes but all other data in $sandbox will be preserved. The
* system will stop iterating this update when $sandbox['#finished'] is left
* unset or set to a number higher than 1. It is recommended that
* $sandbox['#finished'] is initially set to 0, and then updated each pass to a
* number between 0 and 1 that represents the overall % completed for this
* update, finishing with 1.
*
* See the batch operations page for more information on how to use the
* @link http://drupal.org/node/180528 Batch API. @endlink
* See the @link batch Batch operations topic @endlink for more information on
* how to use the Batch API.
*
* @param $sandbox
* @param array $sandbox
* Stores information for multipass updates. See above for more information.
*
* @throws DrupalUpdateException, PDOException
* @throws DrupalUpdateException|PDOException
* In case of error, update hooks should throw an instance of DrupalUpdateException
* with a meaningful message for the user. If a database query fails for whatever
* reason, it will throw a PDOException.
*
* @return
* @return string|null
* Optionally, update hooks may return a translated string that will be
* displayed to the user after the update has completed. If no message is
* returned, no message will be presented to the user.

View File

@@ -9,10 +9,10 @@
*/
/* Animated throbber */
html.js input.form-autocomplete {
background-position: 0% 2px;
background-position: 0% center;
}
html.js input.throbbing {
background-position: 0% -18px;
background-position: 0% center;
}
/**

View File

@@ -31,12 +31,13 @@
}
/* Animated throbber */
html.js input.form-autocomplete {
background-image: url(../../misc/throbber.gif);
background-position: 100% 2px; /* LTR */
background-image: url(../../misc/throbber-inactive.png);
background-position: 100% center; /* LTR */
background-repeat: no-repeat;
}
html.js input.throbbing {
background-position: 100% -18px; /* LTR */
background-image: url(../../misc/throbber-active.gif);
background-position: 100% center; /* LTR */
}
/**
@@ -164,7 +165,7 @@ table.sticky-header {
display: inline-block;
}
.ajax-progress .throbber {
background: transparent url(../../misc/throbber.gif) no-repeat 0px -18px;
background: transparent url(../../misc/throbber-active.gif) no-repeat 0px center;
float: left; /* LTR */
height: 15px;
margin: 2px;

View File

@@ -12,8 +12,8 @@ files[] = system.test
required = TRUE
configure = admin/config/system
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -2854,7 +2854,14 @@ function system_update_7061(&$sandbox) {
// We will convert filepaths to URI using the default scheme
// and stripping off the existing file directory path.
$file['uri'] = $scheme . preg_replace('!^' . preg_quote($basename) . '!', '', $file['filepath']);
$file['uri'] = file_stream_wrapper_uri_normalize($file['uri']);
// Normalize the URI but don't call file_stream_wrapper_uri_normalize()
// directly, since that is a higher-level API function which invokes
// hooks while validating the scheme, and those will not work during
// the upgrade. Instead, use a simpler version that just assumes the
// scheme from above is already valid.
if (($file_uri_scheme = file_uri_scheme($file['uri'])) && ($file_uri_target = file_uri_target($file['uri']))) {
$file['uri'] = $file_uri_scheme . '://' . $file_uri_target;
}
unset($file['filepath']);
// Insert into the file_managed table.
// Each fid should only be stored once in file_managed.

View File

@@ -242,6 +242,7 @@ function system_permission() {
),
'access site reports' => array(
'title' => t('View site reports'),
'restrict access' => TRUE,
),
'block IP addresses' => array(
'title' => t('Block IP addresses'),
@@ -373,6 +374,9 @@ function system_element_info() {
'#element_validate' => array('form_validate_machine_name'),
'#theme' => 'textfield',
'#theme_wrappers' => array('form_element'),
// Use the same value callback as for textfields; this ensures that we only
// get string values.
'#value_callback' => 'form_type_textfield_value',
);
$types['password'] = array(
'#input' => TRUE,
@@ -381,6 +385,9 @@ function system_element_info() {
'#process' => array('ajax_process_form'),
'#theme' => 'password',
'#theme_wrappers' => array('form_element'),
// Use the same value callback as for textfields; this ensures that we only
// get string values.
'#value_callback' => 'form_type_textfield_value',
);
$types['password_confirm'] = array(
'#input' => TRUE,
@@ -2398,6 +2405,10 @@ function _system_rebuild_module_data() {
continue;
}
// Add the info file modification time, so it becomes available for
// contributed modules to use for ordering module lists.
$module->info['mtime'] = filemtime(dirname($module->uri) . '/' . $module->name . '.info');
// Merge in defaults and save.
$modules[$key]->info = $module->info + $defaults;
@@ -2536,6 +2547,10 @@ function _system_rebuild_theme_data() {
$themes[$key]->filename = $theme->uri;
$themes[$key]->info = drupal_parse_info_file($theme->uri) + $defaults;
// Add the info file modification time, so it becomes available for
// contributed modules to use for ordering theme lists.
$themes[$key]->info['mtime'] = filemtime($theme->uri);
// Invoke hook_system_info_alter() to give installed modules a chance to
// modify the data in the .info files if necessary.
$type = 'theme';
@@ -3385,7 +3400,7 @@ function system_timezone($abbreviation = '', $offset = -1, $is_daylight_saving_t
* @ingroup themeable
*/
function theme_system_powered_by() {
return '<span>' . t('Powered by <a href="@poweredby">Drupal</a>', array('@poweredby' => 'http://drupal.org')) . '</span>';
return '<span>' . t('Powered by <a href="@poweredby">Drupal</a>', array('@poweredby' => 'https://www.drupal.org')) . '</span>';
}
/**

View File

@@ -556,6 +556,34 @@ class ModuleDependencyTestCase extends ModuleTestCase {
$this->drupalPost(NULL, NULL, t('Uninstall'));
$this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
}
/**
* Tests whether the correct module metadata is returned.
*/
function testModuleMetaData() {
// Generate the list of available modules.
$modules = system_rebuild_module_data();
// Check that the mtime field exists for the system module.
$this->assertTrue(!empty($modules['system']->info['mtime']), 'The system.info file modification time field is present.');
// Use 0 if mtime isn't present, to avoid an array index notice.
$test_mtime = !empty($modules['system']->info['mtime']) ? $modules['system']->info['mtime'] : 0;
// Ensure the mtime field contains a number that is greater than zero.
$this->assertTrue(is_numeric($test_mtime) && ($test_mtime > 0), 'The system.info file modification time field contains a timestamp.');
}
/**
* Tests whether the correct theme metadata is returned.
*/
function testThemeMetaData() {
// Generate the list of available themes.
$themes = system_rebuild_theme_data();
// Check that the mtime field exists for the bartik theme.
$this->assertTrue(!empty($themes['bartik']->info['mtime']), 'The bartik.info file modification time field is present.');
// Use 0 if mtime isn't present, to avoid an array index notice.
$test_mtime = !empty($themes['bartik']->info['mtime']) ? $themes['bartik']->info['mtime'] : 0;
// Ensure the mtime field contains a number that is greater than zero.
$this->assertTrue(is_numeric($test_mtime) && ($test_mtime > 0), 'The bartik.info file modification time field contains a timestamp.');
}
}
/**
@@ -2797,3 +2825,75 @@ class SystemValidTokenTest extends DrupalUnitTestCase {
return TRUE;
}
}
/**
* Tests drupal_set_message() and related functions.
*/
class DrupalSetMessageTest extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Messages',
'description' => 'Tests that messages can be displayed using drupal_set_message().',
'group' => 'System',
);
}
function setUp() {
parent::setUp('system_test');
}
/**
* Tests setting messages and removing one before it is displayed.
*/
function testSetRemoveMessages() {
// The page at system-test/drupal-set-message sets two messages and then
// removes the first before it is displayed.
$this->drupalGet('system-test/drupal-set-message');
$this->assertNoText('First message (removed).');
$this->assertText('Second message (not removed).');
}
}
/**
* Tests confirm form destinations.
*/
class ConfirmFormTest extends DrupalWebTestCase {
protected $admin_user;
public static function getInfo() {
return array(
'name' => 'Confirm form',
'description' => 'Tests that the confirm form does not use external destinations.',
'group' => 'System',
);
}
function setUp() {
parent::setUp();
$this->admin_user = $this->drupalCreateUser(array('administer users'));
$this->drupalLogin($this->admin_user);
}
/**
* Tests that the confirm form does not use external destinations.
*/
function testConfirmForm() {
$this->drupalGet('user/1/cancel');
$this->assertCancelLinkUrl(url('user/1'));
$this->drupalGet('user/1/cancel', array('query' => array('destination' => 'node')));
$this->assertCancelLinkUrl(url('node'));
$this->drupalGet('user/1/cancel', array('query' => array('destination' => 'http://example.com')));
$this->assertCancelLinkUrl(url('user/1'));
}
/**
* Asserts that a cancel link is present pointing to the provided URL.
*/
function assertCancelLinkUrl($url, $message = '', $group = 'Other') {
$links = $this->xpath('//a[normalize-space(text())=:label and @href=:url]', array(':label' => t('Cancel'), ':url' => $url));
$message = ($message ? $message : format_string('Cancel link with url %url found.', array('%url' => $url)));
return $this->assertTrue(isset($links[0]), $message, $group);
}
}

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"