security update core+modules
This commit is contained in:
@@ -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
|
||||
* @{
|
||||
|
Reference in New Issue
Block a user