security update core+modules
This commit is contained in:
126
modules/system/form.api.php
Normal file
126
modules/system/form.api.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Callbacks provided by the form system.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup callbacks
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Perform a single batch operation.
|
||||
*
|
||||
* Callback for batch_set().
|
||||
*
|
||||
* @param $MULTIPLE_PARAMS
|
||||
* Additional parameters specific to the batch. These are specified in the
|
||||
* array passed to batch_set().
|
||||
* @param $context
|
||||
* The batch context array, passed by reference. This contains the following
|
||||
* properties:
|
||||
* - 'finished': A float number between 0 and 1 informing the processing
|
||||
* engine of the completion level for the operation. 1 (or no value
|
||||
* explicitly set) means the operation is finished: the operation will not
|
||||
* be called again, and execution passes to the next operation or the
|
||||
* callback_batch_finished() implementation. Any other value causes this
|
||||
* operation to be called again; however it should be noted that the value
|
||||
* set here does not persist between executions of this callback: each time
|
||||
* it is set to 1 by default by the batch system.
|
||||
* - 'sandbox': This may be used by operations to persist data between
|
||||
* successive calls to the current operation. Any values set in
|
||||
* $context['sandbox'] will be there the next time this function is called
|
||||
* for the current operation. For example, an operation may wish to store a
|
||||
* pointer in a file or an offset for a large query. The 'sandbox' array key
|
||||
* is not initially set when this callback is first called, which makes it
|
||||
* useful for determining whether it is the first call of the callback or
|
||||
* not:
|
||||
* @code
|
||||
* if (empty($context['sandbox'])) {
|
||||
* // Perform set-up steps here.
|
||||
* }
|
||||
* @endcode
|
||||
* The values in the sandbox are stored and updated in the database between
|
||||
* http requests until the batch finishes processing. This avoids problems
|
||||
* if the user navigates away from the page before the batch finishes.
|
||||
* - 'message': A text message displayed in the progress page.
|
||||
* - 'results': The array of results gathered so far by the batch processing.
|
||||
* This array is highly useful for passing data between operations. After
|
||||
* all operations have finished, this is passed to callback_batch_finished()
|
||||
* where results may be referenced to display information to the end-user,
|
||||
* such as how many total items were processed.
|
||||
*/
|
||||
function callback_batch_operation($MULTIPLE_PARAMS, &$context) {
|
||||
if (!isset($context['sandbox']['progress'])) {
|
||||
$context['sandbox']['progress'] = 0;
|
||||
$context['sandbox']['current_node'] = 0;
|
||||
$context['sandbox']['max'] = db_query('SELECT COUNT(DISTINCT nid) FROM {node}')->fetchField();
|
||||
}
|
||||
|
||||
// For this example, we decide that we can safely process
|
||||
// 5 nodes at a time without a timeout.
|
||||
$limit = 5;
|
||||
|
||||
// With each pass through the callback, retrieve the next group of nids.
|
||||
$result = db_query_range("SELECT nid FROM {node} WHERE nid > %d ORDER BY nid ASC", $context['sandbox']['current_node'], 0, $limit);
|
||||
while ($row = db_fetch_array($result)) {
|
||||
|
||||
// Here we actually perform our processing on the current node.
|
||||
$node = node_load($row['nid'], NULL, TRUE);
|
||||
$node->value1 = $options1;
|
||||
$node->value2 = $options2;
|
||||
node_save($node);
|
||||
|
||||
// Store some result for post-processing in the finished callback.
|
||||
$context['results'][] = check_plain($node->title);
|
||||
|
||||
// Update our progress information.
|
||||
$context['sandbox']['progress']++;
|
||||
$context['sandbox']['current_node'] = $node->nid;
|
||||
$context['message'] = t('Now processing %node', array('%node' => $node->title));
|
||||
}
|
||||
|
||||
// Inform the batch engine that we are not finished,
|
||||
// and provide an estimation of the completion level we reached.
|
||||
if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
|
||||
$context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete a batch process.
|
||||
*
|
||||
* Callback for batch_set().
|
||||
*
|
||||
* This callback may be specified in a batch to perform clean-up operations, or
|
||||
* to analyze the results of the batch operations.
|
||||
*
|
||||
* @param $success
|
||||
* A boolean indicating whether the batch has completed successfully.
|
||||
* @param $results
|
||||
* The value set in $context['results'] by callback_batch_operation().
|
||||
* @param $operations
|
||||
* If $success is FALSE, contains the operations that remained unprocessed.
|
||||
*/
|
||||
function callback_batch_finished($success, $results, $operations) {
|
||||
if ($success) {
|
||||
// Here we do something meaningful with the results.
|
||||
$message = t("!count items were processed.", array(
|
||||
'!count' => count($results),
|
||||
));
|
||||
$message .= theme('item_list', array('items' => $results));
|
||||
drupal_set_message($message);
|
||||
}
|
||||
else {
|
||||
// An error occurred.
|
||||
// $operations contains the operations that remained unprocessed.
|
||||
$error_operation = reset($operations);
|
||||
$message = t('An error occurred while processing %error_operation with arguments: @arguments', array(
|
||||
'%error_operation' => $error_operation[0],
|
||||
'@arguments' => print_r($error_operation[1], TRUE)
|
||||
));
|
||||
drupal_set_message($message, 'error');
|
||||
}
|
||||
}
|
@@ -56,13 +56,8 @@ function image_gd_settings_validate($form, &$form_state) {
|
||||
* A boolean indicating if the GD toolkit is available on this machine.
|
||||
*/
|
||||
function image_gd_check_settings() {
|
||||
if ($check = get_extension_funcs('gd')) {
|
||||
if (in_array('imagegd2', $check)) {
|
||||
// GD2 support is available.
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
// GD2 support is available.
|
||||
return function_exists('imagegd2');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,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') {
|
||||
@@ -346,7 +372,7 @@ function image_gd_create_tmp(stdClass $image, $width, $height) {
|
||||
*/
|
||||
function image_gd_get_info(stdClass $image) {
|
||||
$details = FALSE;
|
||||
$data = getimagesize($image->source);
|
||||
$data = @getimagesize($image->source);
|
||||
|
||||
if (isset($data) && is_array($data)) {
|
||||
$extensions = array('1' => 'gif', '2' => 'jpg', '3' => 'png');
|
||||
|
@@ -62,16 +62,22 @@ function hook_language_switch_links_alter(array &$links, $type, $path) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow modules to define their own language types.
|
||||
* Define language types.
|
||||
*
|
||||
* @return
|
||||
* An array of language type definitions. Each language type has an identifier
|
||||
* key. The language type definition is an associative array that may contain
|
||||
* the following key-value pairs:
|
||||
* - "name": The human-readable language type identifier.
|
||||
* - "description": A description of the language type.
|
||||
* - "fixed": An array of language provider identifiers. Defining this key
|
||||
* makes the language type non-configurable.
|
||||
* An associative array of language type definitions. The keys are the
|
||||
* identifiers, which are also used as names for global variables representing
|
||||
* the types in the bootstrap phase. The values are associative arrays that
|
||||
* may contain the following elements:
|
||||
* - name: The human-readable language type identifier.
|
||||
* - description: A description of the language type.
|
||||
* - fixed: A fixed array of language negotiation provider identifiers to use
|
||||
* to initialize this language. Defining this key makes the language type
|
||||
* non-configurable, so it will always use the specified providers in the
|
||||
* given priority order. Omit to make the language type configurable.
|
||||
*
|
||||
* @see hook_language_types_info_alter()
|
||||
* @ingroup language_negotiation
|
||||
*/
|
||||
function hook_language_types_info() {
|
||||
return array(
|
||||
@@ -90,6 +96,9 @@ function hook_language_types_info() {
|
||||
*
|
||||
* @param $language_types
|
||||
* Array of language type definitions.
|
||||
*
|
||||
* @see hook_language_types_info()
|
||||
* @ingroup language_negotiation
|
||||
*/
|
||||
function hook_language_types_info_alter(array &$language_types) {
|
||||
if (isset($language_types['custom_language_type'])) {
|
||||
@@ -98,31 +107,35 @@ function hook_language_types_info_alter(array &$language_types) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow modules to define their own language providers.
|
||||
* Define language negotiation providers.
|
||||
*
|
||||
* @return
|
||||
* An array of language provider definitions. Each language provider has an
|
||||
* identifier key. The language provider definition is an associative array
|
||||
* that may contain the following key-value pairs:
|
||||
* - "types": An array of allowed language types. If a language provider does
|
||||
* not specify which language types it should be used with, it will be
|
||||
* available for all the configurable language types.
|
||||
* - "callbacks": An array of functions that will be called to perform various
|
||||
* tasks. Possible key-value pairs are:
|
||||
* - "language": Required. The callback that will determine the language
|
||||
* value.
|
||||
* - "switcher": The callback that will determine the language switch links
|
||||
* associated to the current language provider.
|
||||
* - "url_rewrite": The callback that will provide URL rewriting.
|
||||
* - "file": A file that will be included before the callback is invoked; this
|
||||
* allows callback functions to be in separate files.
|
||||
* - "weight": The default weight the language provider has.
|
||||
* - "name": A human-readable identifier.
|
||||
* - "description": A description of the language provider.
|
||||
* - "config": An internal path pointing to the language provider
|
||||
* configuration page.
|
||||
* - "cache": The value Drupal's page cache should be set to for the current
|
||||
* language provider to be invoked.
|
||||
* An associative array of language negotiation provider definitions. The keys
|
||||
* are provider identifiers, and the values are associative arrays defining
|
||||
* each provider, with the following elements:
|
||||
* - types: An array of allowed language types. If a language negotiation
|
||||
* provider does not specify which language types it should be used with, it
|
||||
* will be available for all the configurable language types.
|
||||
* - callbacks: An associative array of functions that will be called to
|
||||
* perform various tasks. Possible elements are:
|
||||
* - language: (required) Name of the callback function that determines the
|
||||
* language value.
|
||||
* - switcher: (optional) Name of the callback function that determines
|
||||
* links for a language switcher block associated with this provider. See
|
||||
* language_switcher_url() for an example.
|
||||
* - url_rewrite: (optional) Name of the callback function that provides URL
|
||||
* rewriting, if needed by this provider.
|
||||
* - file: The file where callback functions are defined (this file will be
|
||||
* included before the callbacks are invoked).
|
||||
* - weight: The default weight of the provider.
|
||||
* - name: The translated human-readable name for the provider.
|
||||
* - description: A translated longer description of the provider.
|
||||
* - config: An internal path pointing to the provider's configuration page.
|
||||
* - cache: The value Drupal's page cache should be set to for the current
|
||||
* provider to be invoked.
|
||||
*
|
||||
* @see hook_language_negotiation_info_alter()
|
||||
* @ingroup language_negotiation
|
||||
*/
|
||||
function hook_language_negotiation_info() {
|
||||
return array(
|
||||
@@ -135,18 +148,21 @@ function hook_language_negotiation_info() {
|
||||
'file' => drupal_get_path('module', 'custom') . '/custom.module',
|
||||
'weight' => -4,
|
||||
'types' => array('custom_language_type'),
|
||||
'name' => t('Custom language provider'),
|
||||
'description' => t('This is a custom language provider.'),
|
||||
'name' => t('Custom language negotiation provider'),
|
||||
'description' => t('This is a custom language negotiation provider.'),
|
||||
'cache' => 0,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform alterations on language providers.
|
||||
* Perform alterations on language negoiation providers.
|
||||
*
|
||||
* @param $language_providers
|
||||
* Array of language provider definitions.
|
||||
* Array of language negotiation provider definitions.
|
||||
*
|
||||
* @see hook_language_negotiation_info()
|
||||
* @ingroup language_negotiation
|
||||
*/
|
||||
function hook_language_negotiation_info_alter(array &$language_providers) {
|
||||
if (isset($language_providers['custom_language_provider'])) {
|
||||
|
@@ -309,7 +309,7 @@ function system_theme_enable() {
|
||||
}
|
||||
drupal_goto('admin/appearance');
|
||||
}
|
||||
return drupal_access_denied();
|
||||
return MENU_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,7 +337,7 @@ function system_theme_disable() {
|
||||
}
|
||||
drupal_goto('admin/appearance');
|
||||
}
|
||||
return drupal_access_denied();
|
||||
return MENU_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -383,7 +383,7 @@ function system_theme_default() {
|
||||
}
|
||||
drupal_goto('admin/appearance');
|
||||
}
|
||||
return drupal_access_denied();
|
||||
return MENU_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -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) {
|
||||
@@ -995,22 +1001,28 @@ function _system_modules_build_row($info, $extra) {
|
||||
$status_short = '';
|
||||
$status_long = '';
|
||||
|
||||
// Initialize empty arrays of long and short reasons explaining why the
|
||||
// module is incompatible.
|
||||
// Add each reason as a separate element in both the arrays.
|
||||
$reasons_short = array();
|
||||
$reasons_long = array();
|
||||
|
||||
// Check the core compatibility.
|
||||
if (!isset($info['core']) || $info['core'] != DRUPAL_CORE_COMPATIBILITY) {
|
||||
$compatible = FALSE;
|
||||
$status_short .= t('Incompatible with this version of Drupal core.');
|
||||
$status_long .= t('This version is not compatible with Drupal !core_version and should be replaced.', array('!core_version' => DRUPAL_CORE_COMPATIBILITY));
|
||||
$reasons_short[] = t('Incompatible with this version of Drupal core.');
|
||||
$reasons_long[] = t('This version is not compatible with Drupal !core_version and should be replaced.', array('!core_version' => DRUPAL_CORE_COMPATIBILITY));
|
||||
}
|
||||
|
||||
// Ensure this module is compatible with the currently installed version of PHP.
|
||||
if (version_compare(phpversion(), $info['php']) < 0) {
|
||||
$compatible = FALSE;
|
||||
$status_short .= t('Incompatible with this version of PHP');
|
||||
$reasons_short[] = t('Incompatible with this version of PHP');
|
||||
$php_required = $info['php'];
|
||||
if (substr_count($info['php'], '.') < 2) {
|
||||
$php_required .= '.*';
|
||||
}
|
||||
$status_long .= t('This module requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $php_required, '!php_version' => phpversion()));
|
||||
$reasons_long[] = t('This module requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $php_required, '!php_version' => phpversion()));
|
||||
}
|
||||
|
||||
// If this module is compatible, present a checkbox indicating
|
||||
@@ -1026,6 +1038,8 @@ function _system_modules_build_row($info, $extra) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
$status_short = implode(' ', $reasons_short);
|
||||
$status_long = implode(' ', $reasons_long);
|
||||
$form['enable'] = array(
|
||||
'#markup' => theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => $status_short, 'title' => $status_short)),
|
||||
);
|
||||
@@ -1594,6 +1608,7 @@ function system_site_information_settings_validate($form, &$form_state) {
|
||||
* @ingroup forms
|
||||
*/
|
||||
function system_cron_settings() {
|
||||
global $base_url;
|
||||
$form['description'] = array(
|
||||
'#markup' => '<p>' . t('Cron takes care of running periodic tasks like checking for updates and indexing content for search.') . '</p>',
|
||||
);
|
||||
@@ -1606,12 +1621,18 @@ function system_cron_settings() {
|
||||
$form['status'] = array(
|
||||
'#markup' => $status,
|
||||
);
|
||||
|
||||
$form['cron_url'] = array(
|
||||
'#markup' => '<p>' . t('To run cron from outside the site, go to <a href="!cron">!cron</a>', array('!cron' => url($base_url . '/cron.php', array('external' => TRUE, 'query' => array('cron_key' => variable_get('cron_key', 'drupal')))))) . '</p>',
|
||||
);
|
||||
|
||||
$form['cron'] = array(
|
||||
'#type' => 'fieldset',
|
||||
);
|
||||
$form['cron']['cron_safe_threshold'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Run cron every'),
|
||||
'#description' => t('More information about setting up scheduled tasks can be found by <a href="@url">reading the cron tutorial on drupal.org</a>.', array('@url' => url('http://drupal.org/cron'))),
|
||||
'#default_value' => variable_get('cron_safe_threshold', DRUPAL_CRON_DEFAULT_THRESHOLD),
|
||||
'#options' => array(0 => t('Never')) + drupal_map_assoc(array(3600, 10800, 21600, 43200, 86400, 604800), 'format_interval'),
|
||||
);
|
||||
@@ -2569,7 +2590,7 @@ function theme_status_report($variables) {
|
||||
|
||||
foreach ($requirements as $requirement) {
|
||||
if (empty($requirement['#type'])) {
|
||||
$severity = $severities[isset($requirement['severity']) ? (int) $requirement['severity'] : 0];
|
||||
$severity = $severities[isset($requirement['severity']) ? (int) $requirement['severity'] : REQUIREMENT_OK];
|
||||
$severity['icon'] = '<div title="' . $severity['title'] . '"><span class="element-invisible">' . $severity['title'] . '</span></div>';
|
||||
|
||||
// Output table row(s)
|
||||
@@ -2625,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;
|
||||
}
|
||||
|
@@ -84,25 +84,23 @@ function hook_hook_info_alter(&$hooks) {
|
||||
* Defaults to TRUE.
|
||||
* - load hook: The name of the hook which should be invoked by
|
||||
* DrupalDefaultEntityController:attachLoad(), for example 'node_load'.
|
||||
* - uri callback: A function taking an entity as argument and returning the
|
||||
* URI elements of the entity, e.g. 'path' and 'options'. The actual entity
|
||||
* URI can be constructed by passing these elements to url().
|
||||
* - label callback: (optional) A function taking an entity and an entity type
|
||||
* as arguments and returning the label of the entity. The entity label is
|
||||
* the main string associated with an entity; for example, the title of a
|
||||
* node or the subject of a comment. If there is an entity object property
|
||||
* that defines the label, use the 'label' element of the 'entity keys'
|
||||
* return value component to provide this information (see below). If more
|
||||
* complex logic is needed to determine the label of an entity, you can
|
||||
* instead specify a callback function here, which will be called to
|
||||
* determine the entity label. See also the entity_label() function, which
|
||||
* implements this logic.
|
||||
* - language callback: (optional) A function taking an entity and an entity
|
||||
* type as arguments and returning a language code. In most situations, when
|
||||
* needing to determine this value, inspecting a property named after the
|
||||
* 'language' element of the 'entity keys' should be enough. The language
|
||||
* callback is meant to be used primarily for temporary alterations of the
|
||||
* property value: entity-defining modules are encouraged to always define a
|
||||
* - uri callback: The name of an implementation of
|
||||
* callback_entity_info_uri().
|
||||
* - label callback: (optional) The name of an implementation of
|
||||
* callback_entity_info_label(), which returns the label of the entity. The
|
||||
* entity label is the main string associated with an entity; for example,
|
||||
* the title of a node or the subject of a comment. If there is an entity
|
||||
* object property that defines the label, then using the 'label' element of
|
||||
* the 'entity keys' return value component suffices to provide this
|
||||
* information (see below). Alternatively, specifying this callback allows
|
||||
* more complex logic to determine the label of an entity. See also the
|
||||
* entity_label() function, which implements this logic.
|
||||
* - language callback: (optional) The name of an implementation of
|
||||
* callback_entity_info_language(). In most situations, when needing to
|
||||
* determine this value, inspecting a property named after the 'language'
|
||||
* element of the 'entity keys' should be enough. The language callback is
|
||||
* meant to be used primarily for temporary alterations of the property
|
||||
* value: entity-defining modules are encouraged to always define a
|
||||
* language property, instead of using the callback as main entity language
|
||||
* source. In fact not having a language property defined is likely to
|
||||
* prevent an entity from being queried by language. Moreover, given that
|
||||
@@ -154,7 +152,10 @@ function hook_hook_info_alter(&$hooks) {
|
||||
* the name of the bundle object.
|
||||
* - bundles: An array describing all bundles for this object type. Keys are
|
||||
* bundles machine names, as found in the objects' 'bundle' property
|
||||
* (defined in the 'entity keys' entry above). Elements:
|
||||
* (defined in the 'entity keys' entry above). This entry can be omitted if
|
||||
* this entity type exposes a single bundle (all entities have the same
|
||||
* collection of fields). The name of this single bundle will be the same as
|
||||
* the entity type. Elements:
|
||||
* - label: The human-readable name of the bundle.
|
||||
* - uri callback: Same as the 'uri callback' key documented above for the
|
||||
* entity type, but for the bundle only. When determining the URI of an
|
||||
@@ -246,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,
|
||||
),
|
||||
);
|
||||
@@ -605,11 +606,13 @@ 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() in
|
||||
* hook_cron().
|
||||
* - '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
|
||||
* cron runs (for example, if you want to control all queue execution
|
||||
* manually).
|
||||
*
|
||||
* @see hook_cron()
|
||||
* @see hook_cron_queue_info_alter()
|
||||
@@ -640,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.
|
||||
@@ -706,9 +731,10 @@ function hook_element_info_alter(&$type) {
|
||||
/**
|
||||
* Perform cleanup tasks.
|
||||
*
|
||||
* This hook is run at the end of each page request. It is often used for
|
||||
* page logging and specialized cleanup. This hook MUST NOT print anything
|
||||
* because by the time it runs the response is already sent to the browser.
|
||||
* This hook is run at the end of most regular page requests. It is often
|
||||
* used for page logging and specialized cleanup. This hook MUST NOT print
|
||||
* anything because by the time it runs the response is already sent to
|
||||
* the browser.
|
||||
*
|
||||
* Only use this hook if your code must run even for cached page views.
|
||||
* If you have code which must run once on all non-cached pages, use
|
||||
@@ -871,7 +897,7 @@ function hook_css_alter(&$css) {
|
||||
*
|
||||
* @see ajax_render()
|
||||
*/
|
||||
function hook_ajax_render_alter($commands) {
|
||||
function hook_ajax_render_alter(&$commands) {
|
||||
// Inject any new status messages into the content area.
|
||||
$commands[] = ajax_command_prepend('#block-system-main .content', theme('status_messages'));
|
||||
}
|
||||
@@ -955,6 +981,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
|
||||
* paths and whose values are an associative array of properties for each
|
||||
* path. (The complete list of properties is in the return value section below.)
|
||||
*
|
||||
* @section sec_callback_funcs Callback Functions
|
||||
* The definition for each path may include a page callback function, which is
|
||||
* invoked when the registered path is requested. If there is no other
|
||||
* registered path that fits the requested path better, any further path
|
||||
@@ -979,6 +1006,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
|
||||
* $jkl will be 'foo'. Note that this automatic passing of optional path
|
||||
* arguments applies only to page and theme callback functions.
|
||||
*
|
||||
* @subsection sub_callback_arguments Callback Arguments
|
||||
* In addition to optional path arguments, the page callback and other callback
|
||||
* functions may specify argument lists as arrays. These argument lists may
|
||||
* contain both fixed/hard-coded argument values and integers that correspond
|
||||
@@ -1021,6 +1049,8 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
|
||||
* @endcode
|
||||
* See @link form_api Form API documentation @endlink for details.
|
||||
*
|
||||
* @section sec_path_wildcards Wildcards in Paths
|
||||
* @subsection sub_simple_wildcards Simple Wildcards
|
||||
* Wildcards within paths also work with integer substitution. For example,
|
||||
* your module could register path 'my-module/%/edit':
|
||||
* @code
|
||||
@@ -1033,6 +1063,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
|
||||
* with 'foo' and passed to the callback function. Note that wildcards may not
|
||||
* be used as the first component.
|
||||
*
|
||||
* @subsection sub_autoload_wildcards Auto-Loader Wildcards
|
||||
* Registered paths may also contain special "auto-loader" wildcard components
|
||||
* in the form of '%mymodule_abc', where the '%' part means that this path
|
||||
* component is a wildcard, and the 'mymodule_abc' part defines the prefix for a
|
||||
@@ -1064,6 +1095,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
|
||||
* return FALSE for the path 'node/999/edit' if a node with a node ID of 999
|
||||
* does not exist. The menu routing system will return a 404 error in this case.
|
||||
*
|
||||
* @subsection sub_argument_wildcards Argument Wildcards
|
||||
* You can also define a %wildcard_to_arg() function (for the example menu
|
||||
* entry above this would be 'mymodule_abc_to_arg()'). The _to_arg() function
|
||||
* is invoked to retrieve a value that is used in the path in place of the
|
||||
@@ -1088,6 +1120,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
|
||||
* are called when the menu system is generating links to related paths, such
|
||||
* as the tabs for a set of MENU_LOCAL_TASK items.
|
||||
*
|
||||
* @section sec_render_tabs Rendering Menu Items As Tabs
|
||||
* You can also make groups of menu items to be rendered (by default) as tabs
|
||||
* on a page. To do that, first create one menu item of type MENU_NORMAL_ITEM,
|
||||
* with your chosen path, such as 'foo'. Then duplicate that menu item, using a
|
||||
@@ -1201,6 +1234,10 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
|
||||
* same weight are ordered alphabetically.
|
||||
* - "menu_name": Optional. Set this to a custom menu if you don't want your
|
||||
* item to be placed in Navigation.
|
||||
* - "expanded": Optional. If set to TRUE, and if a menu link is provided for
|
||||
* this menu item (as a result of other properties), then the menu link is
|
||||
* always expanded, equivalent to its 'always expanded' checkbox being set
|
||||
* in the UI.
|
||||
* - "context": (optional) Defines the context a tab may appear in. By
|
||||
* default, all tabs are only displayed as local tasks when being rendered
|
||||
* in a page context. All tabs that should be accessible as contextual links
|
||||
@@ -1412,7 +1449,7 @@ function hook_menu_link_delete($link) {
|
||||
* - #link: An associative array containing:
|
||||
* - title: The localized title of the link.
|
||||
* - href: The system path to link to.
|
||||
* - localized_options: An array of options to pass to url().
|
||||
* - localized_options: An array of options to pass to l().
|
||||
* - #active: Whether the link should be marked as 'active'.
|
||||
*
|
||||
* @param $data
|
||||
@@ -1875,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:
|
||||
@@ -1929,8 +1965,9 @@ function hook_image_toolkits() {
|
||||
* The drupal_mail() id of the message. Look at module source code or
|
||||
* drupal_mail() for possible id values.
|
||||
* - 'to':
|
||||
* The address or addresses the message will be sent to. The
|
||||
* formatting of this string must comply with RFC 2822.
|
||||
* The address or addresses the message will be sent to. The formatting of
|
||||
* this string will be validated with the
|
||||
* @link http://php.net/manual/filter.filters.validate.php PHP e-mail validation filter. @endlink
|
||||
* - 'from':
|
||||
* The address the message will be marked as being from, which is
|
||||
* either a custom address or the site-wide default email address.
|
||||
@@ -2093,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.
|
||||
*
|
||||
@@ -2100,7 +2192,9 @@ function hook_permission() {
|
||||
* specify how a particular render array is to be rendered as HTML (this is
|
||||
* usually the case if the theme function is assigned to the render array's
|
||||
* #theme property), or they return the HTML that should be returned by an
|
||||
* invocation of theme().
|
||||
* invocation of theme(). See
|
||||
* @link http://drupal.org/node/933976 Using the theme layer Drupal 7.x @endlink
|
||||
* for more information on how to implement theme hooks.
|
||||
*
|
||||
* The following parameters are all optional.
|
||||
*
|
||||
@@ -2196,6 +2290,8 @@ function hook_permission() {
|
||||
* 'module', 'theme_engine', or 'theme'.
|
||||
* - theme path: (automatically derived) The directory path of the theme or
|
||||
* module, so that it doesn't need to be looked up.
|
||||
*
|
||||
* @see hook_theme_registry_alter()
|
||||
*/
|
||||
function hook_theme($existing, $type, $theme, $path) {
|
||||
return array(
|
||||
@@ -2290,7 +2386,8 @@ function hook_theme_registry_alter(&$theme_registry) {
|
||||
* @return
|
||||
* The machine-readable name of the theme that should be used for the current
|
||||
* page request. The value returned from this function will only have an
|
||||
* effect if it corresponds to a currently-active theme on the site.
|
||||
* effect if it corresponds to a currently-active theme on the site. Do not
|
||||
* return a value if you do not wish to set a custom theme.
|
||||
*/
|
||||
function hook_custom_theme() {
|
||||
// Allow the user to request a particular theme via a query parameter.
|
||||
@@ -2476,8 +2573,9 @@ function hook_watchdog(array $log_entry) {
|
||||
* An array to be filled in. Elements in this array include:
|
||||
* - id: An ID to identify the mail sent. Look at module source code
|
||||
* or drupal_mail() for possible id values.
|
||||
* - to: The address or addresses the message will be sent to. The
|
||||
* formatting of this string must comply with RFC 2822.
|
||||
* - to: The address or addresses the message will be sent to. The formatting
|
||||
* of this string will be validated with the
|
||||
* @link http://php.net/manual/filter.filters.validate.php PHP e-mail validation filter. @endlink
|
||||
* - subject: Subject of the e-mail to be sent. This must not contain any
|
||||
* newline characters, or the mail may not be sent properly. drupal_mail()
|
||||
* sets this to an empty string when the hook is invoked.
|
||||
@@ -2812,7 +2910,15 @@ function hook_file_insert($file) {
|
||||
* @see file_save()
|
||||
*/
|
||||
function hook_file_update($file) {
|
||||
$file_user = user_load($file->uid);
|
||||
// Make sure that the file name starts with the owner's user name.
|
||||
if (strpos($file->filename, $file_user->name) !== 0) {
|
||||
$old_filename = $file->filename;
|
||||
$file->filename = $file_user->name . '_' . $file->filename;
|
||||
$file->save();
|
||||
|
||||
watchdog('file', t('%source has been renamed to %destination', array('%source' => $old_filename, '%destination' => $file->filename)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2826,7 +2932,14 @@ function hook_file_update($file) {
|
||||
* @see file_copy()
|
||||
*/
|
||||
function hook_file_copy($file, $source) {
|
||||
$file_user = user_load($file->uid);
|
||||
// Make sure that the file name starts with the owner's user name.
|
||||
if (strpos($file->filename, $file_user->name) !== 0) {
|
||||
$file->filename = $file_user->name . '_' . $file->filename;
|
||||
$file->save();
|
||||
|
||||
watchdog('file', t('Copied file %source has been renamed to %destination', array('%source' => $source->filename, '%destination' => $file->filename)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2840,7 +2953,14 @@ function hook_file_copy($file, $source) {
|
||||
* @see file_move()
|
||||
*/
|
||||
function hook_file_move($file, $source) {
|
||||
$file_user = user_load($file->uid);
|
||||
// Make sure that the file name starts with the owner's user name.
|
||||
if (strpos($file->filename, $file_user->name) !== 0) {
|
||||
$file->filename = $file_user->name . '_' . $file->filename;
|
||||
$file->save();
|
||||
|
||||
watchdog('file', t('Moved file %source has been renamed to %destination', array('%source' => $source->filename, '%destination' => $file->filename)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2992,8 +3112,9 @@ function hook_file_url_alter(&$uri) {
|
||||
* status report page.
|
||||
*
|
||||
* @return
|
||||
* A keyed array of requirements. Each requirement is itself an array with
|
||||
* the following items:
|
||||
* An associative array where the keys are arbitrary but must be unique (it
|
||||
* is suggested to use the module short name as a prefix) and the values are
|
||||
* themselves associative arrays with the following elements:
|
||||
* - title: The name of the requirement.
|
||||
* - value: The current value (e.g., version, time, level, etc). During
|
||||
* install phase, this should only be used for version numbers, do not set
|
||||
@@ -3055,81 +3176,87 @@ function hook_requirements($phase) {
|
||||
/**
|
||||
* Define the current version of the database schema.
|
||||
*
|
||||
* A Drupal schema definition is an array structure representing one or
|
||||
* more tables and their related keys and indexes. A schema is defined by
|
||||
* A Drupal schema definition is an array structure representing one or more
|
||||
* tables and their related keys and indexes. A schema is defined by
|
||||
* hook_schema() which must live in your module's .install file.
|
||||
*
|
||||
* This hook is called at install and uninstall time, and in the latter
|
||||
* case, it cannot rely on the .module file being loaded or hooks being known.
|
||||
* If the .module file is needed, it may be loaded with drupal_load().
|
||||
* This hook is called at install and uninstall time, and in the latter case, it
|
||||
* cannot rely on the .module file being loaded or hooks being known. If the
|
||||
* .module file is needed, it may be loaded with drupal_load().
|
||||
*
|
||||
* The tables declared by this hook will be automatically created when
|
||||
* the module is first enabled, and removed when the module is uninstalled.
|
||||
* This happens before hook_install() is invoked, and after hook_uninstall()
|
||||
* is invoked, respectively.
|
||||
* The tables declared by this hook will be automatically created when the
|
||||
* module is first enabled, and removed when the module is uninstalled. This
|
||||
* happens before hook_install() is invoked, and after hook_uninstall() is
|
||||
* invoked, respectively.
|
||||
*
|
||||
* By declaring the tables used by your module via an implementation of
|
||||
* hook_schema(), these tables will be available on all supported database
|
||||
* engines. You don't have to deal with the different SQL dialects for table
|
||||
* creation and alteration of the supported database engines.
|
||||
*
|
||||
* See the Schema API Handbook at http://drupal.org/node/146843 for
|
||||
* details on schema definition structures.
|
||||
* See the Schema API Handbook at http://drupal.org/node/146843 for details on
|
||||
* schema definition structures.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* A schema definition structure array. For each element of the
|
||||
* array, the key is a table name and the value is a table structure
|
||||
* definition.
|
||||
*
|
||||
* @see hook_schema_alter()
|
||||
*
|
||||
* @ingroup schemaapi
|
||||
*/
|
||||
function hook_schema() {
|
||||
$schema['node'] = array(
|
||||
// example (partial) specification for table "node"
|
||||
// Example (partial) specification for table "node".
|
||||
'description' => 'The base table for nodes.',
|
||||
'fields' => array(
|
||||
'nid' => array(
|
||||
'description' => 'The primary identifier for a node.',
|
||||
'type' => 'serial',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE),
|
||||
'not null' => TRUE,
|
||||
),
|
||||
'vid' => array(
|
||||
'description' => 'The current {node_revision}.vid version identifier.',
|
||||
'type' => 'int',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
'default' => 0),
|
||||
'default' => 0,
|
||||
),
|
||||
'type' => array(
|
||||
'description' => 'The {node_type} of this node.',
|
||||
'type' => 'varchar',
|
||||
'length' => 32,
|
||||
'not null' => TRUE,
|
||||
'default' => ''),
|
||||
'default' => '',
|
||||
),
|
||||
'title' => array(
|
||||
'description' => 'The title of this node, always treated as non-markup plain text.',
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => ''),
|
||||
'default' => '',
|
||||
),
|
||||
),
|
||||
'indexes' => array(
|
||||
'node_changed' => array('changed'),
|
||||
'node_created' => array('created'),
|
||||
),
|
||||
),
|
||||
'unique keys' => array(
|
||||
'nid_vid' => array('nid', 'vid'),
|
||||
'vid' => array('vid')
|
||||
),
|
||||
'vid' => array('vid'),
|
||||
),
|
||||
'foreign keys' => array(
|
||||
'node_revision' => array(
|
||||
'table' => 'node_revision',
|
||||
'columns' => array('vid' => 'vid'),
|
||||
),
|
||||
),
|
||||
'node_author' => array(
|
||||
'table' => 'users',
|
||||
'columns' => array('uid' => 'uid')
|
||||
),
|
||||
),
|
||||
'columns' => array('uid' => 'uid'),
|
||||
),
|
||||
),
|
||||
'primary key' => array('nid'),
|
||||
);
|
||||
return $schema;
|
||||
@@ -3147,6 +3274,8 @@ function hook_schema() {
|
||||
*
|
||||
* @param $schema
|
||||
* Nested array describing the schemas for all modules.
|
||||
*
|
||||
* @ingroup schemaapi
|
||||
*/
|
||||
function hook_schema_alter(&$schema) {
|
||||
// Add field to existing schema.
|
||||
@@ -3236,8 +3365,7 @@ function hook_query_TAG_alter(QueryAlterableInterface $query) {
|
||||
* a hook_update_N() is added to the module, this function needs to be updated
|
||||
* to reflect the current version of the database schema.
|
||||
*
|
||||
* See the Schema API documentation at
|
||||
* @link http://drupal.org/node/146843 http://drupal.org/node/146843 @endlink
|
||||
* See the @link http://drupal.org/node/146843 Schema API documentation @endlink
|
||||
* for details on hook_schema and how database tables are defined.
|
||||
*
|
||||
* Note that since this function is called from a full bootstrap, all functions
|
||||
@@ -3319,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.
|
||||
@@ -3622,64 +3757,60 @@ function hook_registry_files_alter(&$files, $modules) {
|
||||
* variable_del() before your last task has completed and control is handed
|
||||
* back to the installer.
|
||||
*
|
||||
* @return
|
||||
* @param array $install_state
|
||||
* An array of information about the current installation state.
|
||||
*
|
||||
* @return array
|
||||
* A keyed array of tasks the profile will perform during the final stage of
|
||||
* the installation. Each key represents the name of a function (usually a
|
||||
* function defined by this profile, although that is not strictly required)
|
||||
* that is called when that task is run. The values are associative arrays
|
||||
* containing the following key-value pairs (all of which are optional):
|
||||
* - 'display_name'
|
||||
* The human-readable name of the task. This will be displayed to the
|
||||
* user while the installer is running, along with a list of other tasks
|
||||
* that are being run. Leave this unset to prevent the task from
|
||||
* appearing in the list.
|
||||
* - 'display'
|
||||
* This is a boolean which can be used to provide finer-grained control
|
||||
* over whether or not the task will display. This is mostly useful for
|
||||
* tasks that are intended to display only under certain conditions; for
|
||||
* these tasks, you can set 'display_name' to the name that you want to
|
||||
* display, but then use this boolean to hide the task only when certain
|
||||
* conditions apply.
|
||||
* - 'type'
|
||||
* A string representing the type of task. This parameter has three
|
||||
* possible values:
|
||||
* - 'normal': This indicates that the task will be treated as a regular
|
||||
* callback function, which does its processing and optionally returns
|
||||
* HTML output. This is the default behavior which is used when 'type' is
|
||||
* not set.
|
||||
* - 'batch': This indicates that the task function will return a batch
|
||||
* API definition suitable for batch_set(). The installer will then take
|
||||
* care of automatically running the task via batch processing.
|
||||
* - 'form': This indicates that the task function will return a standard
|
||||
* - display_name: The human-readable name of the task. This will be
|
||||
* displayed to the user while the installer is running, along with a list
|
||||
* of other tasks that are being run. Leave this unset to prevent the task
|
||||
* from appearing in the list.
|
||||
* - display: This is a boolean which can be used to provide finer-grained
|
||||
* control over whether or not the task will display. This is mostly useful
|
||||
* for tasks that are intended to display only under certain conditions;
|
||||
* for these tasks, you can set 'display_name' to the name that you want to
|
||||
* display, but then use this boolean to hide the task only when certain
|
||||
* conditions apply.
|
||||
* - type: A string representing the type of task. This parameter has three
|
||||
* possible values:
|
||||
* - normal: (default) This indicates that the task will be treated as a
|
||||
* regular callback function, which does its processing and optionally
|
||||
* returns HTML output.
|
||||
* - batch: This indicates that the task function will return a batch API
|
||||
* definition suitable for batch_set(). The installer will then take care
|
||||
* of automatically running the task via batch processing.
|
||||
* - form: This indicates that the task function will return a standard
|
||||
* form API definition (and separately define validation and submit
|
||||
* handlers, as appropriate). The installer will then take care of
|
||||
* automatically directing the user through the form submission process.
|
||||
* - 'run'
|
||||
* A constant representing the manner in which the task will be run. This
|
||||
* parameter has three possible values:
|
||||
* - INSTALL_TASK_RUN_IF_NOT_COMPLETED: This indicates that the task will
|
||||
* run once during the installation of the profile. This is the default
|
||||
* behavior which is used when 'run' is not set.
|
||||
* - INSTALL_TASK_SKIP: This indicates that the task will not run during
|
||||
* - run: A constant representing the manner in which the task will be run.
|
||||
* This parameter has three possible values:
|
||||
* - INSTALL_TASK_RUN_IF_NOT_COMPLETED: (default) This indicates that the
|
||||
* task will run once during the installation of the profile.
|
||||
* - INSTALL_TASK_SKIP: This indicates that the task will not run during
|
||||
* the current installation page request. It can be used to skip running
|
||||
* an installation task when certain conditions are met, even though the
|
||||
* task may still show on the list of installation tasks presented to the
|
||||
* user.
|
||||
* - INSTALL_TASK_RUN_IF_REACHED: This indicates that the task will run
|
||||
* on each installation page request that reaches it. This is rarely
|
||||
* - INSTALL_TASK_RUN_IF_REACHED: This indicates that the task will run on
|
||||
* each installation page request that reaches it. This is rarely
|
||||
* necessary for an installation profile to use; it is primarily used by
|
||||
* the Drupal installer for bootstrap-related tasks.
|
||||
* - 'function'
|
||||
* Normally this does not need to be set, but it can be used to force the
|
||||
* installer to call a different function when the task is run (rather
|
||||
* than the function whose name is given by the array key). This could be
|
||||
* used, for example, to allow the same function to be called by two
|
||||
* different tasks.
|
||||
* - function: Normally this does not need to be set, but it can be used to
|
||||
* force the installer to call a different function when the task is run
|
||||
* (rather than the function whose name is given by the array key). This
|
||||
* could be used, for example, to allow the same function to be called by
|
||||
* two different tasks.
|
||||
*
|
||||
* @see install_state_defaults()
|
||||
* @see batch_set()
|
||||
*/
|
||||
function hook_install_tasks() {
|
||||
function hook_install_tasks(&$install_state) {
|
||||
// Here, we define a variable to allow tasks to indicate that a particular,
|
||||
// processor-intensive batch process needs to be triggered later on in the
|
||||
// installation.
|
||||
@@ -4051,7 +4182,7 @@ function hook_date_format_types_alter(&$types) {
|
||||
* declared in an implementation of hook_date_format_types().
|
||||
* - 'format': A PHP date format string to use when formatting dates. It
|
||||
* can contain any of the formatting options described at
|
||||
* http://php.net/manual/en/function.date.php
|
||||
* http://php.net/manual/function.date.php
|
||||
* - 'locales': (optional) An array of 2 and 5 character locale codes,
|
||||
* defining which locales this format applies to (for example, 'en',
|
||||
* 'en-us', etc.). If your date format is not language-specific, leave this
|
||||
@@ -4668,6 +4799,77 @@ function hook_filetransfer_info_alter(&$filetransfer_info) {
|
||||
* @} End of "addtogroup hooks".
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup callbacks
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return the URI for an entity.
|
||||
*
|
||||
* Callback for hook_entity_info().
|
||||
*
|
||||
* @param $entity
|
||||
* The entity to return the URI for.
|
||||
*
|
||||
* @return
|
||||
* An associative array with the following elements:
|
||||
* - 'path': The URL path for the entity.
|
||||
* - 'options': (optional) An array of options for the url() function.
|
||||
* The actual entity URI can be constructed by passing these elements to
|
||||
* url().
|
||||
*/
|
||||
function callback_entity_info_uri($entity) {
|
||||
return array(
|
||||
'path' => 'node/' . $entity->nid,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the label of an entity.
|
||||
*
|
||||
* Callback for hook_entity_info().
|
||||
*
|
||||
* @param $entity
|
||||
* The entity for which to generate the label.
|
||||
* @param $entity_type
|
||||
* The entity type; e.g., 'node' or 'user'.
|
||||
*
|
||||
* @return
|
||||
* An unsanitized string with the label of the entity.
|
||||
*
|
||||
* @see entity_label()
|
||||
*/
|
||||
function callback_entity_info_label($entity, $entity_type) {
|
||||
return empty($entity->title) ? 'Untitled entity' : $entity->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the language code of the entity.
|
||||
*
|
||||
* Callback for hook_entity_info().
|
||||
*
|
||||
* The language callback is meant to be used primarily for temporary alterations
|
||||
* of the property value.
|
||||
*
|
||||
* @param $entity
|
||||
* The entity for which to return the language.
|
||||
* @param $entity_type
|
||||
* The entity type; e.g., 'node' or 'user'.
|
||||
*
|
||||
* @return
|
||||
* The language code for the language of the entity.
|
||||
*
|
||||
* @see entity_language()
|
||||
*/
|
||||
function callback_entity_info_language($entity, $entity_type) {
|
||||
return $entity->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup callbacks".
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup update_api Update versions of API functions
|
||||
* @{
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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;
|
||||
|
@@ -11,3 +11,9 @@ files[] = system.updater.inc
|
||||
files[] = system.test
|
||||
required = TRUE
|
||||
configure = admin/config/system
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
|
||||
|
@@ -6,12 +6,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test and report Drupal installation requirements.
|
||||
*
|
||||
* @param $phase
|
||||
* The current system installation phase.
|
||||
* @return
|
||||
* An array of system requirements.
|
||||
* Implements hook_requirements().
|
||||
*/
|
||||
function system_requirements($phase) {
|
||||
global $base_url;
|
||||
@@ -208,7 +203,7 @@ function system_requirements($phase) {
|
||||
'value' => $memory_limit == -1 ? t('-1 (Unlimited)') : $memory_limit,
|
||||
);
|
||||
|
||||
if ($memory_limit && $memory_limit != -1 && parse_size($memory_limit) < parse_size(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT)) {
|
||||
if (!drupal_check_memory_limit(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT, $memory_limit)) {
|
||||
$description = '';
|
||||
if ($phase == 'install') {
|
||||
$description = $t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the installation process.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));
|
||||
@@ -258,6 +253,39 @@ function system_requirements($phase) {
|
||||
$requirements['settings.php']['title'] = $t('Configuration file');
|
||||
}
|
||||
|
||||
// Test the contents of the .htaccess files.
|
||||
if ($phase == 'runtime') {
|
||||
// Try to write the .htaccess files first, to prevent false alarms in case
|
||||
// (for example) the /tmp directory was wiped.
|
||||
file_ensure_htaccess();
|
||||
$htaccess_files['public://.htaccess'] = array(
|
||||
'title' => $t('Public files directory'),
|
||||
'directory' => variable_get('file_public_path', conf_path() . '/files'),
|
||||
);
|
||||
if ($private_files_directory = variable_get('file_private_path')) {
|
||||
$htaccess_files['private://.htaccess'] = array(
|
||||
'title' => $t('Private files directory'),
|
||||
'directory' => $private_files_directory,
|
||||
);
|
||||
}
|
||||
$htaccess_files['temporary://.htaccess'] = array(
|
||||
'title' => $t('Temporary files directory'),
|
||||
'directory' => variable_get('file_temporary_path', file_directory_temp()),
|
||||
);
|
||||
foreach ($htaccess_files as $htaccess_file => $info) {
|
||||
// Check for the string which was added to the recommended .htaccess file
|
||||
// in the latest security update.
|
||||
if (!file_exists($htaccess_file) || !($contents = @file_get_contents($htaccess_file)) || strpos($contents, 'Drupal_Security_Do_Not_Remove_See_SA_2013_003') === FALSE) {
|
||||
$requirements[$htaccess_file] = array(
|
||||
'title' => $info['title'],
|
||||
'value' => $t('Not fully protected'),
|
||||
'severity' => REQUIREMENT_ERROR,
|
||||
'description' => $t('See <a href="@url">@url</a> for information about the recommended .htaccess file which should be added to the %directory directory to help protect against arbitrary code execution.', array('@url' => 'http://drupal.org/SA-CORE-2013-003', '%directory' => $info['directory'])),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Report cron status.
|
||||
if ($phase == 'runtime') {
|
||||
// Cron warning threshold defaults to two days.
|
||||
@@ -516,7 +544,7 @@ function system_install() {
|
||||
->execute();
|
||||
|
||||
// Populate the cron key variable.
|
||||
$cron_key = drupal_hash_base64(drupal_random_bytes(55));
|
||||
$cron_key = drupal_random_key();
|
||||
variable_set('cron_key', $cron_key);
|
||||
}
|
||||
|
||||
@@ -744,6 +772,7 @@ function system_schema() {
|
||||
'type' => 'varchar',
|
||||
'length' => 100,
|
||||
'not null' => TRUE,
|
||||
'binary' => TRUE,
|
||||
),
|
||||
'type' => array(
|
||||
'description' => 'The date format type, e.g. medium.',
|
||||
@@ -829,6 +858,7 @@ function system_schema() {
|
||||
'filesize' => array(
|
||||
'description' => 'The size of the file in bytes.',
|
||||
'type' => 'int',
|
||||
'size' => 'big',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
@@ -1742,7 +1772,7 @@ function system_update_7000() {
|
||||
* Generate a cron key and save it in the variables table.
|
||||
*/
|
||||
function system_update_7001() {
|
||||
variable_set('cron_key', drupal_hash_base64(drupal_random_bytes(55)));
|
||||
variable_set('cron_key', drupal_random_key());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1889,7 +1919,7 @@ function system_update_7007() {
|
||||
$result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid ASC");
|
||||
$query = db_insert('role_permission')->fields(array('rid', 'permission'));
|
||||
foreach ($result as $role) {
|
||||
foreach (explode(', ', $role->perm) as $perm) {
|
||||
foreach (array_unique(explode(', ', $role->perm)) as $perm) {
|
||||
$query->values(array(
|
||||
'rid' => $role->rid,
|
||||
'permission' => $perm,
|
||||
@@ -1982,7 +2012,7 @@ function system_update_7013() {
|
||||
$timezone = 'UTC';
|
||||
}
|
||||
variable_set('date_default_timezone', $timezone);
|
||||
drupal_set_message('The default time zone has been set to <em>' . check_plain($timezone) . '</em>. Check the ' . l('date and time configuration page', 'admin/config/regional/settings') . ' to configure it correctly.', 'warning');
|
||||
drupal_set_message(format_string('The default time zone has been set to %timezone. Check the <a href="@config-url">date and time configuration page</a> to configure it correctly.', array('%timezone' => $timezone, '@config-url' => url('admin/config/regional/settings'))), 'warning');
|
||||
// Remove temporary override.
|
||||
variable_del('date_temporary_timezone');
|
||||
}
|
||||
@@ -2758,12 +2788,14 @@ function system_update_7061(&$sandbox) {
|
||||
// Retrieve a list of node revisions that have uploaded files attached.
|
||||
// DISTINCT queries are expensive, especially when paged, so we store the
|
||||
// data in its own table for the duration of the update.
|
||||
$table = array(
|
||||
'description' => t('Stores temporary data for system_update_7061.'),
|
||||
'fields' => array('vid' => array('type' => 'int')),
|
||||
'primary key' => array('vid'),
|
||||
);
|
||||
db_create_table('system_update_7061', $table);
|
||||
if (!db_table_exists('system_update_7061')) {
|
||||
$table = array(
|
||||
'description' => t('Stores temporary data for system_update_7061.'),
|
||||
'fields' => array('vid' => array('type' => 'int')),
|
||||
'primary key' => array('vid'),
|
||||
);
|
||||
db_create_table('system_update_7061', $table);
|
||||
}
|
||||
$query = db_select('upload', 'u');
|
||||
$query->distinct();
|
||||
$query->addField('u','vid');
|
||||
@@ -2822,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.
|
||||
@@ -3032,6 +3071,7 @@ function system_update_7073() {
|
||||
'default' => '',
|
||||
'binary' => TRUE,
|
||||
));
|
||||
db_drop_unique_key('file_managed', 'uri');
|
||||
db_change_field('file_managed', 'uri', 'uri', array(
|
||||
'description' => 'The URI to access the file (either local or remote).',
|
||||
'type' => 'varchar',
|
||||
@@ -3040,6 +3080,7 @@ function system_update_7073() {
|
||||
'default' => '',
|
||||
'binary' => TRUE,
|
||||
));
|
||||
db_add_unique_key('file_managed', 'uri', array('uri'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3086,6 +3127,36 @@ function system_update_7077() {
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add binary to {date_formats}.format.
|
||||
*/
|
||||
function system_update_7078() {
|
||||
db_drop_unique_key('date_formats', 'formats');
|
||||
db_change_field('date_formats', 'format', 'format', array(
|
||||
'description' => 'The date format string.',
|
||||
'type' => 'varchar',
|
||||
'length' => 100,
|
||||
'not null' => TRUE,
|
||||
'binary' => TRUE,
|
||||
), array('unique keys' => array('formats' => array('format', 'type'))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the 'filesize' column in {file_managed} to a bigint.
|
||||
*/
|
||||
function system_update_7079() {
|
||||
$spec = array(
|
||||
'description' => 'The size of the file in bytes.',
|
||||
'type' => 'int',
|
||||
'size' => 'big',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
);
|
||||
db_change_field('file_managed', 'filesize', 'filesize', $spec);
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "defgroup updates-7.x-extra".
|
||||
* The next series of updates should start at 8000.
|
||||
|
@@ -31,7 +31,7 @@ class DefaultMailSystem implements MailSystemInterface {
|
||||
/**
|
||||
* Send an e-mail message, using Drupal variables and default settings.
|
||||
*
|
||||
* @see http://php.net/manual/en/function.mail.php
|
||||
* @see http://php.net/manual/function.mail.php
|
||||
* @see drupal_mail()
|
||||
*
|
||||
* @param $message
|
||||
|
@@ -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,
|
||||
@@ -1907,17 +1914,18 @@ function system_init() {
|
||||
|
||||
// Ignore slave database servers for this request.
|
||||
//
|
||||
// In Drupal's distributed database structure, new data is written to the master
|
||||
// and then propagated to the slave servers. This means there is a lag
|
||||
// between when data is written to the master and when it is available on the slave.
|
||||
// At these times, we will want to avoid using a slave server temporarily.
|
||||
// For example, if a user posts a new node then we want to disable the slave
|
||||
// server for that user temporarily to allow the slave server to catch up.
|
||||
// That way, that user will see their changes immediately while for other
|
||||
// users we still get the benefits of having a slave server, just with slightly
|
||||
// stale data. Code that wants to disable the slave server should use the
|
||||
// db_set_ignore_slave() function to set $_SESSION['ignore_slave_server'] to
|
||||
// the timestamp after which the slave can be re-enabled.
|
||||
// In Drupal's distributed database structure, new data is written to the
|
||||
// master and then propagated to the slave servers. This means there is a
|
||||
// lag between when data is written to the master and when it is available on
|
||||
// the slave. At these times, we will want to avoid using a slave server
|
||||
// temporarily. For example, if a user posts a new node then we want to
|
||||
// disable the slave server for that user temporarily to allow the slave
|
||||
// server to catch up. That way, that user will see their changes immediately
|
||||
// while for other users we still get the benefits of having a slave server,
|
||||
// just with slightly stale data. Code that wants to disable the slave
|
||||
// server should use the db_ignore_slave() function to set
|
||||
// $_SESSION['ignore_slave_server'] to the timestamp after which the slave
|
||||
// can be re-enabled.
|
||||
if (isset($_SESSION['ignore_slave_server'])) {
|
||||
if ($_SESSION['ignore_slave_server'] >= REQUEST_TIME) {
|
||||
Database::ignoreTarget('default', 'slave');
|
||||
@@ -2397,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;
|
||||
|
||||
@@ -2535,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';
|
||||
@@ -2729,7 +2745,17 @@ function system_default_region($theme) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add default buttons to a form and set its prefix.
|
||||
* Sets up a form to save information automatically.
|
||||
*
|
||||
* This function adds a submit handler and a submit button to a form array. The
|
||||
* submit function saves all the data in the form, using variable_set(), to
|
||||
* variables named the same as the keys in the form array. Note that this means
|
||||
* you should normally prefix your form array keys with your module name, so
|
||||
* that they are unique when passed into variable_set().
|
||||
*
|
||||
* If you need to manipulate the data in a custom manner, you can either put
|
||||
* your own submission handler in the form array before calling this function,
|
||||
* or just use your own submission handler instead of calling this function.
|
||||
*
|
||||
* @param $form
|
||||
* An associative array containing the structure of the form.
|
||||
@@ -2738,6 +2764,7 @@ function system_default_region($theme) {
|
||||
* The form structure.
|
||||
*
|
||||
* @see system_settings_form_submit()
|
||||
*
|
||||
* @ingroup forms
|
||||
*/
|
||||
function system_settings_form($form) {
|
||||
@@ -2756,7 +2783,7 @@ function system_settings_form($form) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the system_settings_form.
|
||||
* Form submission handler for system_settings_form().
|
||||
*
|
||||
* If you want node type configure style handling of your checkboxes,
|
||||
* add an array_filter value to your form.
|
||||
@@ -3373,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>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3410,30 +3437,32 @@ function system_image_toolkits() {
|
||||
/**
|
||||
* Attempts to get a file using drupal_http_request and to store it locally.
|
||||
*
|
||||
* @param $url
|
||||
* @param string $url
|
||||
* The URL of the file to grab.
|
||||
*
|
||||
* @param $destination
|
||||
* @param string $destination
|
||||
* Stream wrapper URI specifying where the file should be placed. If a
|
||||
* directory path is provided, the file is saved into that directory under
|
||||
* its original name. If the path contains a filename as well, that one will
|
||||
* be used instead.
|
||||
* If this value is omitted, the site's default files scheme will be used,
|
||||
* usually "public://".
|
||||
*
|
||||
* @param $managed boolean
|
||||
* @param bool $managed
|
||||
* If this is set to TRUE, the file API hooks will be invoked and the file is
|
||||
* registered in the database.
|
||||
*
|
||||
* @param $replace boolean
|
||||
* @param int $replace
|
||||
* Replace behavior when the destination file already exists:
|
||||
* - FILE_EXISTS_REPLACE: Replace the existing file.
|
||||
* - FILE_EXISTS_RENAME: Append _{incrementing number} until the filename is
|
||||
* unique.
|
||||
* - FILE_EXISTS_ERROR: Do nothing and return FALSE.
|
||||
*
|
||||
* @return
|
||||
* On success the location the file was saved to, FALSE on failure.
|
||||
* @return mixed
|
||||
* One of these possibilities:
|
||||
* - If it succeeds and $managed is FALSE, the location where the file was
|
||||
* saved.
|
||||
* - If it succeeds and $managed is TRUE, a \Drupal\file\FileInterface
|
||||
* object which describes the file.
|
||||
* - If it fails, FALSE.
|
||||
*/
|
||||
function system_retrieve_file($url, $destination = NULL, $managed = FALSE, $replace = FILE_EXISTS_RENAME) {
|
||||
$parsed_url = parse_url($url);
|
||||
|
@@ -97,13 +97,6 @@ class DrupalQueue {
|
||||
}
|
||||
|
||||
interface DrupalQueueInterface {
|
||||
/**
|
||||
* Start working with a queue.
|
||||
*
|
||||
* @param $name
|
||||
* Arbitrary string. The name of the queue to work with.
|
||||
*/
|
||||
public function __construct($name);
|
||||
|
||||
/**
|
||||
* Add a queue item and store it directly to the queue.
|
||||
@@ -315,6 +308,12 @@ class MemoryQueue implements DrupalQueueInterface {
|
||||
*/
|
||||
protected $id_sequence;
|
||||
|
||||
/**
|
||||
* Start working with a queue.
|
||||
*
|
||||
* @param $name
|
||||
* Arbitrary string. The name of the queue to work with.
|
||||
*/
|
||||
public function __construct($name) {
|
||||
$this->queue = array();
|
||||
$this->id_sequence = 0;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -73,8 +73,12 @@ class ModuleUpdater extends Updater implements DrupalUpdaterInterface {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of post install actions.
|
||||
*/
|
||||
public function postInstallTasks() {
|
||||
return array(
|
||||
l(t('Install another module'), 'admin/modules/install'),
|
||||
l(t('Enable newly added modules'), 'admin/modules'),
|
||||
l(t('Administration pages'), 'admin'),
|
||||
);
|
||||
|
12
modules/system/tests/cron_queue_test.info
Normal file
12
modules/system/tests/cron_queue_test.info
Normal file
@@ -0,0 +1,12 @@
|
||||
name = Cron Queue test
|
||||
description = 'Support module for the cron queue runner.'
|
||||
package = Testing
|
||||
version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
|
15
modules/system/tests/cron_queue_test.module
Normal file
15
modules/system/tests/cron_queue_test.module
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Implements hook_cron_queue_info().
|
||||
*/
|
||||
function cron_queue_test_cron_queue_info() {
|
||||
$queues['cron_queue_test_exception'] = array(
|
||||
'worker callback' => 'cron_queue_test_exception',
|
||||
);
|
||||
return $queues;
|
||||
}
|
||||
|
||||
function cron_queue_test_exception($item) {
|
||||
throw new Exception('That is not supposed to happen.');
|
||||
}
|
@@ -62,6 +62,8 @@
|
||||
*
|
||||
* @see theme()
|
||||
* @see hook_theme()
|
||||
* @see hooks
|
||||
* @see callbacks
|
||||
*
|
||||
* @} End of "defgroup themeable".
|
||||
*/
|
||||
|
Reference in New Issue
Block a user