@@ -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 definining
|
||||
* 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:
|
||||
* - negotiation: (required) Name of the callback function that determines
|
||||
* the language value.
|
||||
* - language_switch: (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'])) {
|
||||
|
@@ -1594,6 +1594,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,6 +1607,11 @@ 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',
|
||||
);
|
||||
|
@@ -154,7 +154,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
|
||||
@@ -1201,6 +1204,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 +1419,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
|
||||
@@ -1929,8 +1936,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.
|
||||
@@ -2100,7 +2108,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 +2206,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 +2302,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 +2489,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.
|
||||
@@ -3092,44 +3106,48 @@ function hook_schema() {
|
||||
'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;
|
||||
@@ -3236,8 +3254,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
|
||||
@@ -3621,6 +3638,9 @@ function hook_registry_files_alter(&$files, $modules) {
|
||||
* inspect later. It is important to remove any temporary variables using
|
||||
* variable_del() before your last task has completed and control is handed
|
||||
* back to the installer.
|
||||
*
|
||||
* @param array $install_state
|
||||
* An array of information about the current installation state.
|
||||
*
|
||||
* @return
|
||||
* A keyed array of tasks the profile will perform during the final stage of
|
||||
@@ -3679,7 +3699,7 @@ function hook_registry_files_alter(&$files, $modules) {
|
||||
* @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.
|
||||
|
@@ -12,8 +12,8 @@ files[] = system.test
|
||||
required = TRUE
|
||||
configure = admin/config/system
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -744,6 +744,7 @@ function system_schema() {
|
||||
'type' => 'varchar',
|
||||
'length' => 100,
|
||||
'not null' => TRUE,
|
||||
'binary' => TRUE,
|
||||
),
|
||||
'type' => array(
|
||||
'description' => 'The date format type, e.g. medium.',
|
||||
@@ -1889,7 +1890,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,
|
||||
@@ -2758,12 +2759,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');
|
||||
@@ -3032,6 +3035,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 +3044,7 @@ function system_update_7073() {
|
||||
'default' => '',
|
||||
'binary' => TRUE,
|
||||
));
|
||||
db_add_unique_key('file_managed', 'uri', array('uri'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3086,6 +3091,21 @@ 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'))));
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "defgroup updates-7.x-extra".
|
||||
* The next series of updates should start at 8000.
|
||||
|
@@ -1907,17 +1907,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');
|
||||
|
@@ -2681,3 +2681,34 @@ class SystemIndexPhpTest extends DrupalWebTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test token replacement in strings.
|
||||
*/
|
||||
class TokenScanTest extends DrupalWebTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Token scanning',
|
||||
'description' => 'Scan token-like patterns in a dummy text to check token scanning.',
|
||||
'group' => 'System',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans dummy text, then tests the output.
|
||||
*/
|
||||
function testTokenScan() {
|
||||
// Define text with valid and not valid, fake and existing token-like
|
||||
// strings.
|
||||
$text = 'First a [valid:simple], but dummy token, and a dummy [valid:token with: spaces].';
|
||||
$text .= 'Then a [not valid:token].';
|
||||
$text .= 'Last an existing token: [node:author:name].';
|
||||
$token_wannabes = token_scan($text);
|
||||
|
||||
$this->assertTrue(isset($token_wannabes['valid']['simple']), 'A simple valid token has been matched.');
|
||||
$this->assertTrue(isset($token_wannabes['valid']['token with: spaces']), 'A valid token with space characters in the token name has been matched.');
|
||||
$this->assertFalse(isset($token_wannabes['not valid']), 'An invalid token with spaces in the token type has not been matched.');
|
||||
$this->assertTrue(isset($token_wannabes['node']), 'An existing valid token has been matched.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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'),
|
||||
);
|
||||
|
Reference in New Issue
Block a user