Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Eric Rasmussen
UNL-CMS
Commits
93173dc0
Commit
93173dc0
authored
Apr 04, 2013
by
Tim Steiner
Browse files
[gh-660] Upgrade Drupal Core to 7.22
parent
776d2802
Changes
262
Hide whitespace changes
Inline
Side-by-side
.htaccess.sample
View file @
93173dc0
...
...
@@ -3,7 +3,7 @@
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)
(|~|\.sw[op]|\.bak|\.orig|\.save)?
$|^(\..*|Entries.*|Repository|Root|Tag|Template)$
|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$
">
Order allow,deny
</FilesMatch>
...
...
@@ -56,6 +56,13 @@ DirectoryIndex index.php index.html index.htm
<IfModule mod_rewrite.c>
RewriteEngine on
# Set "protossl" to "s" if we were accessed via https://. This is used later
# if you enable "www." stripping or enforcement, in order to ensure that
# you don't bounce between http and https.
RewriteRule ^ - [E=protossl]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=protossl:s]
# THIS SECTION IS FOR UNL SUBSITES
# DO NOT EDIT!!!!
...
...
@@ -95,14 +102,15 @@ DirectoryIndex index.php index.html index.htm
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# uncomment the following:
# RewriteCond %{HTTP_HOST} .
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# RewriteRule ^ http
%{ENV:protossl}
://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
# RewriteRule ^ http
%{ENV:protossl}
://%1%{REQUEST_URI} [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
...
...
CHANGELOG.txt
View file @
93173dc0
Drupal 7.22, 2013-04-03
-----------------------
- Allowed the drupal_http_request() function to be overridden so that
additional HTTP request capabilities can be added by contributed modules.
- Changed the Simpletest module to allow PSR-0 test classes to be used in
Drupal 7.
- Removed an unnecessary "Content-Disposition" header from private file
downloads; it prevented many private files from being viewed inline in a web
browser.
- Changed various field API functions to allow them to optionally act on a
single field within an entity (API addition: http://drupal.org/node/1825844).
- Fixed a bug which prevented Drupal's file transfer functionality from working
on some PHP 5.4 systems.
- Fixed incorrect log message when theme() is called for a theme hook that does
not exist (minor string change).
- Fixed Drupal's token-replacement system to allow spaces in the token value.
- Changed the default behavior after a user creates a node they do not have
access to view. The user will now be redirected to the front page rather than
an access denied page.
- Fixed a bug which prevented empty HTTP headers (such as "0") from being set.
(Minor behavior change: Callers of drupal_add_http_header() must now set
FALSE explicitly to prevent a header from being sent at all; this was already
indicated in the function's documentation.)
- Fixed OpenID errors when more than one module implements hook_openid(). The
behavior is now changed so that if more than one module tries to set the same
parameter, the last module's change takes effect.
- Fixed a serious documentation bug: The $name variable in the
taxonomy-term.tpl.php theme template was incorrectly documented as being
sanitized when in fact it is not.
- Fixed a bug which prevented Drupal 6 to Drupal 7 upgrades on sites which had
duplicate permission names in the User module's database tables.
- Added an empty "datatype" attribute to taxonomy term and username links to
make the RDFa markup upward compatible with RDFa 1.1 (minor markup addition).
- Fixed a bug which caused the denial-of-service protection added in Drupal
7.20 to break certain valid image URLs that had an extra slash in them.
- Fixed a bug with update queries in the SQLite database driver that prevented
Drupal from being installed with SQLite on PHP 5.4.
- Fixed enforced dependencies errors updating to recent versions of Drupal 7 on
certain non-MySQL databases.
- Refactored the Field module's caching behavior to obtain large improvements
in memory usage for sites with many fields and instances (API addition:
http://drupal.org/node/1915646).
- Fixed entity argument not being passed to implementations of
hook_file_download_access_alter(). The fix adds an additional context
parameter that can be passed when calling drupal_alter() for any hook (API
change: http://drupal.org/node/1882722).
- Fixed broken support for translatable comment fields (API change:
http://drupal.org/node/1874724).
- Added an assertThemeOutput() method to Simpletest to allow tests to check
that themed output matches an expected HTML string (API addition).
- Added a link to "Install another module" after a module has been successfully
downloaded via the Update Manager (UI change).
- Added an optional "exclusive" flag to installation profile .info files which
allows Drupal distributions to force a profile to be selected during
installation (API addition).
- Fixed a bug which caused the database API to not properly close database
connections.
- Added a link to the URL for running cron from outside the site to the Cron
settings page (UI change).
- Fixed a bug which prevented image styles from being reverted on PHP 5.4.
- Made the default .htaccess rules protocol sensitive to improve security for
sites which use HTTPS and redirect between "www" and non-"www" versions of
the page.
- Numerous small bug fixes.
- Numerous API documentation improvements.
- Additional automated test coverage.
Drupal 7.21, 2013-03-06
-----------------------
- Allowed sites using the 'image_allow_insecure_derivatives' variable to still
...
...
authorize.php
View file @
93173dc0
...
...
@@ -4,16 +4,16 @@
* @file
* Administrative script for running authorized file operations.
*
* Using this script, the site owner (the user actually owning the files on
*
the
webserver) can authorize certain file-related operations to proceed
*
with
elevated privileges, for example to deploy and upgrade modules or
*
themes.
Users should not visit this page directly, but instead use an
*
administrative
user interface which knows how to redirect the user to this
*
script as part of
a multistep process. This script actually performs the
*
selected operations
without loading all of Drupal, to be able to more
*
gracefully recover from
errors. Access to the script is controlled by a
*
global killswitch in
settings.php ('allow_authorize_operations') and via
*
the 'administer software
updates' permission.
* Using this script, the site owner (the user actually owning the files on
the
* webserver) can authorize certain file-related operations to proceed
with
* elevated privileges, for example to deploy and upgrade modules or
themes.
* Users should not visit this page directly, but instead use an
administrative
* user interface which knows how to redirect the user to this
script as part of
* a multistep process. This script actually performs the
selected operations
* without loading all of Drupal, to be able to more
gracefully recover from
* errors. Access to the script is controlled by a
global killswitch in
* settings.php ('allow_authorize_operations') and via
the 'administer software
* updates' permission.
*
* There are helper functions for setting up an operation to run via this
* system in modules/system/system.module. For more information, see:
...
...
@@ -21,16 +21,17 @@
*/
/**
*
R
oot directory of Drupal installation.
*
Defines the r
oot directory of
the
Drupal installation.
*/
define
(
'DRUPAL_ROOT'
,
getcwd
());
/**
* Global flag to identify update.php and authorize.php runs, and so
* avoid various unwanted operations, such as hook_init() and
* hook_exit() invokes, css/js preprocessing and translation, and
* solve some theming issues. This flag is checked on several places
* in Drupal code (not just authorize.php).
* Global flag to identify update.php and authorize.php runs.
*
* Identifies update.php and authorize.php runs, avoiding unwanted operations
* such as hook_init() and hook_exit() invokes, css/js preprocessing and
* translation, and solves some theming issues. The flag is checked in other
* places in Drupal code (not just authorize.php).
*/
define
(
'MAINTENANCE_MODE'
,
'update'
);
...
...
@@ -51,7 +52,7 @@ function authorize_access_denied_page() {
* have access to the 'administer software updates' permission.
*
* @return
* TRUE if the current user can run authorize.php,
otherwise FALSE
.
* TRUE if the current user can run authorize.php,
and FALSE if not
.
*/
function
authorize_access_allowed
()
{
return
variable_get
(
'allow_authorize_operations'
,
TRUE
)
&&
user_access
(
'administer software updates'
);
...
...
includes/ajax.inc
View file @
93173dc0
...
...
@@ -251,8 +251,8 @@ function ajax_render($commands = array()) {
// reliably diffed with array_diff_key(), since the number can change
// due to factors unrelated to the inline content, so for now, we strip
// the inline items from Ajax responses, and can add support for them
// when drupal_add_css() and drupal_add_js() are changed to us
ing md5()
//
or some other hash
of the inline content.
// when drupal_add_css() and drupal_add_js() are changed to us
e a hash
// of the inline content
as the array key
.
foreach
(
$items
[
$type
]
as
$key
=>
$item
)
{
if
(
is_numeric
(
$key
))
{
unset
(
$items
[
$type
][
$key
]);
...
...
@@ -836,7 +836,8 @@ function ajax_command_insert($selector, $html, $settings = NULL) {
* @return
* An array suitable for use with the ajax_render() function.
*
* See @link http://docs.jquery.com/Manipulation/replaceWith#content jQuery replaceWith command @endlink
* See
* @link http://docs.jquery.com/Manipulation/replaceWith#content jQuery replaceWith command @endlink
*/
function
ajax_command_replace
(
$selector
,
$html
,
$settings
=
NULL
)
{
return
array
(
...
...
includes/bootstrap.inc
View file @
93173dc0
...
...
@@ -8,7 +8,7 @@
/**
* The current system version.
*/
define
(
'VERSION'
,
'7.2
1
'
);
define
(
'VERSION'
,
'7.2
2
'
);
/**
* Core API compatibility.
...
...
@@ -740,7 +740,6 @@ function drupal_settings_initialize() {
if
(
isset
(
$base_url
))
{
// Parse fixed base URL from settings.php.
$parts
=
parse_url
(
$base_url
);
$http_protocol
=
$parts
[
'scheme'
];
if
(
!
isset
(
$parts
[
'path'
]))
{
$parts
[
'path'
]
=
''
;
}
...
...
@@ -835,7 +834,7 @@ function drupal_settings_initialize() {
* than by consulting the database.
*
* @return
* The filename of the requested item.
* The filename of the requested item
or NULL if the item is not found
.
*/
function
drupal_get_filename
(
$type
,
$name
,
$filename
=
NULL
)
{
// The location of files will not change during the request, so do not use
...
...
@@ -1210,10 +1209,11 @@ function _drupal_set_preferred_header_name($name = NULL) {
* Headers are set in drupal_add_http_header(). Default headers are not set
* if they have been replaced or unset using drupal_add_http_header().
*
* @param $default_headers
* An array of headers as name/value pairs.
* @param $single
* If TRUE and headers have already be sent, send only the specified header.
* @param array $default_headers
* (optional) An array of headers as name/value pairs.
* @param bool $only_default
* (optional) If TRUE and headers have already been sent, send only the
* specified headers.
*/
function
drupal_send_headers
(
$default_headers
=
array
(),
$only_default
=
FALSE
)
{
$headers_sent
=
&
drupal_static
(
__FUNCTION__
,
FALSE
);
...
...
@@ -1236,7 +1236,7 @@ function drupal_send_headers($default_headers = array(), $only_default = FALSE)
header
(
$_SERVER
[
'SERVER_PROTOCOL'
]
.
' '
.
$value
);
}
// Skip headers that have been unset.
elseif
(
$value
)
{
elseif
(
$value
!==
FALSE
)
{
header
(
$header_names
[
$name_lower
]
.
': '
.
$value
);
}
}
...
...
@@ -1446,8 +1446,9 @@ function drupal_unpack($obj, $field = 'data') {
* Basically, you can put variables like @name into your string, and t() will
* substitute their sanitized values at translation time. (See the
* Localization API pages referenced above and the documentation of
* format_string() for details.) Translators can then rearrange the string as
* necessary for the language (e.g., in Spanish, it might be "blog de @name").
* format_string() for details about how to define variables in your string.)
* Translators can then rearrange the string as necessary for the language
* (e.g., in Spanish, it might be "blog de @name").
*
* During the Drupal installation phase, some resources used by t() wil not be
* available to code that needs localization. See st() and get_t() for
...
...
@@ -1510,21 +1511,34 @@ function t($string, array $args = array(), array $options = array()) {
}
/**
* Replaces placeholders with sanitized values in a string.
* Formats a string for HTML display by replacing variable placeholders.
*
* This function replaces variable placeholders in a string with the requested
* values and escapes the values so they can be safely displayed as HTML. It
* should be used on any unknown text that is intended to be printed to an HTML
* page (especially text that may have come from untrusted users, since in that
* case it prevents cross-site scripting and other security problems).
*
* In most cases, you should use t() rather than calling this function
* directly, since it will translate the text (on non-English-only sites) in
* addition to formatting it.
*
* @param $string
* A string containing placeholders.
* @param $args
* An associative array of replacements to make. Occurrences in $string of
* any key in $args are replaced with the corresponding value, after
* sanitization. The sanitization function depends on the first character of
* the key:
* - !variable: Inserted as is. Use this for text that has already been
* sanitized.
* - @variable: Escaped to HTML using check_plain(). Use this for anything
* displayed on a page on the site.
* - %variable: Escaped as a placeholder for user-submitted content using
* drupal_placeholder(), which shows up as <em>emphasized</em> text.
* any key in $args are replaced with the corresponding value, after optional
* sanitization and formatting. The type of sanitization and formatting
* depends on the first character of the key:
* - @variable: Escaped to HTML using check_plain(). Use this as the default
* choice for anything displayed on a page on the site.
* - %variable: Escaped to HTML and formatted using drupal_placeholder(),
* which makes it display as <em>emphasized</em> text.
* - !variable: Inserted as is, with no sanitization or formatting. Only use
* this for text that has already been prepared for HTML display (for
* example, user-supplied text that has already been run through
* check_plain() previously, or is expected to contain some limited HTML
* tags and has already been run through filter_xss() previously).
*
* @see t()
* @ingroup sanitization
...
...
includes/cache.inc
View file @
93173dc0
...
...
@@ -80,43 +80,15 @@ function cache_get_multiple(array &$cids, $bin = 'cache') {
* same name. Other implementations might want to store several bins in data
* structures that get flushed together. While it is not a problem for most
* cache bins if the entries in them are flushed before their expire time, some
* might break functionality or are extremely expensive to recalculate. These
* will be marked with a (*). The other bins expired automatically by core.
* Contributed modules can add additional bins and get them expired
* automatically by implementing hook_flush_caches().
*
* - cache: Generic cache storage bin (used for variables, theme registry,
* locale date, list of simpletest tests etc).
*
* - cache_block: Stores the content of various blocks.
*
* - cache field: Stores the field data belonging to a given object.
*
* - cache_filter: Stores filtered pieces of content.
*
* - cache_form(*): Stores multistep forms. Flushing this bin means that some
* forms displayed to users lose their state and the data already submitted
* to them.
*
* - cache_menu: Stores the structure of visible navigation menus per page.
*
* - cache_page: Stores generated pages for anonymous users. It is flushed
* very often, whenever a page changes, at least for every ode and comment
* submission. This is the only bin affected by the page cache setting on
* the administrator panel.
*
* - cache path: Stores the system paths that have an alias.
*
* - cache update(*): Stores available releases. The update server (for
* example, drupal.org) needs to produce the relevant XML for every project
* installed on the current site. As this is different for (almost) every
* site, it's very expensive to recalculate for the update server.
* might break functionality or are extremely expensive to recalculate. The
* other bins are expired automatically by core. Contributed modules can add
* additional bins and get them expired automatically by implementing
* hook_flush_caches().
*
* The reasons for having several bins are as follows:
*
* - smaller bins mean smaller database tables and allow for faster selects and
* inserts
* - we try to put fast changing cache items and rather static ones into
* - Smaller bins mean smaller database tables and allow for faster selects and
* inserts.
* - We try to put fast changing cache items and rather static ones into
* different bins. The effect is that only the fast changing bins will need a
* lot of writes to disk. The more static bins will also be better cacheable
* with MySQL's query cache.
...
...
@@ -125,13 +97,27 @@ function cache_get_multiple(array &$cids, $bin = 'cache') {
* The cache ID of the data to store.
* @param $data
* The data to store in the cache. Complex data types will be automatically
* serialized before insertion.
*
Strings will be stored as plain text and
not serialized.
* serialized before insertion.
Strings will be stored as plain text and are
* not serialized.
* @param $bin
* The cache bin to store the data in. Valid core values are 'cache_block',
* 'cache_bootstrap', 'cache_field', 'cache_filter', 'cache_form',
* 'cache_menu', 'cache_page', 'cache_update' or 'cache' for the default
* cache.
* The cache bin to store the data in. Valid core values are:
* - cache: (default) Generic cache storage bin (used for theme registry,
* locale date, list of simpletest tests, etc.).
* - cache_block: Stores the content of various blocks.
* - cache_bootstrap: Stores the class registry, the system list of modules,
* the list of which modules implement which hooks, and the Drupal variable
* list.
* - cache_field: Stores the field data belonging to a given object.
* - cache_filter: Stores filtered pieces of content.
* - cache_form: Stores multistep forms. Flushing this bin means that some
* forms displayed to users lose their state and the data already submitted
* to them. This bin should not be flushed before its expired time.
* - cache_menu: Stores the structure of visible navigation menus per page.
* - cache_page: Stores generated pages for anonymous users. It is flushed
* very often, whenever a page changes, at least for every node and comment
* submission. This is the only bin affected by the page cache setting on
* the administrator panel.
* - cache_path: Stores the system paths that have an alias.
* @param $expire
* One of the following values:
* - CACHE_PERMANENT: Indicates that the item should never be removed unless
...
...
@@ -141,6 +127,7 @@ function cache_get_multiple(array &$cids, $bin = 'cache') {
* - A Unix timestamp: Indicates that the item should be kept at least until
* the given time, after which it behaves like CACHE_TEMPORARY.
*
* @see _update_cache_set()
* @see cache_get()
*/
function
cache_set
(
$cid
,
$data
,
$bin
=
'cache'
,
$expire
=
CACHE_PERMANENT
)
{
...
...
includes/common.inc
View file @
93173dc0
...
...
@@ -281,7 +281,7 @@ function drupal_get_rdf_namespaces() {
/**
* Adds output to the HEAD tag of the HTML page.
*
* This function can be called as long the headers aren't sent. Pass no
* This function can be called as long
as
the headers aren't sent. Pass no
* arguments (or NULL for both) to retrieve the currently stored elements.
*
* @param $data
...
...
@@ -785,6 +785,13 @@ function drupal_access_denied() {
* - data: A string containing the response body that was received.
*/
function
drupal_http_request
(
$url
,
array
$options
=
array
())
{
// Allow an alternate HTTP client library to replace Drupal's default
// implementation.
$override_function
=
variable_get
(
'drupal_http_request_function'
,
FALSE
);
if
(
!
empty
(
$override_function
)
&&
function_exists
(
$override_function
))
{
return
$override_function
(
$url
,
$options
);
}
$result
=
new
stdClass
();
// Parse the URL and make sure we can handle the schema.
...
...
@@ -1167,7 +1174,8 @@ function fix_gpc_magic() {
/**
* Verifies the syntax of the given e-mail address.
*
* See @link http://tools.ietf.org/html/rfc5321 RFC 5321 @endlink for details.
* This uses the
* @link http://php.net/manual/filter.filters.validate.php PHP e-mail validation filter. @endlink
*
* @param $mail
* A string containing an e-mail address.
...
...
@@ -2382,6 +2390,14 @@ function drupal_attributes(array $attributes = array()) {
* internal links output by modules should be generated by this function if
* possible.
*
* However, for links enclosed in translatable text you should use t() and
* embed the HTML anchor tag directly in the translated string. For example:
* @code
* t('Visit the <a href="@url">settings</a> page', array('@url' => url('admin')));
* @endcode
* This keeps the context of the link title ('settings' in the example) for
* translators.
*
* @param string $text
* The translated link text for the anchor tag.
* @param string $path
...
...
@@ -2782,7 +2798,7 @@ function drupal_set_time_limit($time_limit) {
* The name of the item for which the path is requested.
*
* @return
* The path to the requested item.
* The path to the requested item
or an empty string if the item is not found
.
*/
function
drupal_get_path
(
$type
,
$name
)
{
return
dirname
(
drupal_get_filename
(
$type
,
$name
));
...
...
@@ -3872,7 +3888,16 @@ function drupal_html_id($id) {
// requested id. $_POST['ajax_html_ids'] contains the ids as they were
// returned by this function, potentially with the appended counter, so
// we parse that to reconstruct the $seen_ids array.
foreach
(
$_POST
[
'ajax_html_ids'
]
as
$seen_id
)
{
if
(
is_array
(
$_POST
[
'ajax_html_ids'
]))
{
$ajax_html_ids
=
$_POST
[
'ajax_html_ids'
];
}
else
{
// jquery.form.js may send the server a comma-separated string instead
// of an array (see http://drupal.org/node/1575060), so we need to
// convert it to an array in that case.
$ajax_html_ids
=
explode
(
','
,
$_POST
[
'ajax_html_ids'
]);
}
foreach
(
$ajax_html_ids
as
$seen_id
)
{
// We rely on '--' being used solely for separating a base id from the
// counter, which this function ensures when returning an id.
$parts
=
explode
(
'--'
,
$seen_id
,
2
);
...
...
@@ -5041,6 +5066,11 @@ function drupal_get_private_key() {
*
* @param $value
* An additional value to base the token on.
*
* @return string
* A 43-character URL-safe token for validation, based on the user session ID,
* the global $drupal_hash_salt variable from settings.php, and the
* 'drupal_private_key' configuration variable.
*/
function
drupal_get_token
(
$value
=
''
)
{
return
drupal_hmac_base64
(
$value
,
session_id
()
.
drupal_get_private_key
()
.
drupal_get_hash_salt
());
...
...
@@ -5571,7 +5601,7 @@ function drupal_pre_render_link($element) {
* @code
* $node->content['links'] = array(
* '#theme' => 'links__node',
* '#pre_render' = array('drupal_pre_render_links'),
* '#pre_render' =
>
array('drupal_pre_render_links'),
* 'comment' => array(
* '#theme' => 'links__node__comment',
* '#links' => array(
...
...
includes/database/database.inc
View file @
93173dc0
...
...
@@ -167,7 +167,7 @@
* }
* @endcode
*
* @
link
http://drupal.org/developing/api/database
@endlink
* @
see
http://drupal.org/developing/api/database
*/
...
...
@@ -194,7 +194,7 @@ abstract class DatabaseConnection extends PDO {
/**
* The key representing this connection.
*
*
* The key is a unique string which identifies a database connection. A
* connection can be a single server or a cluster of master and slaves (use
* target to pick between master and slave).
...
...
@@ -303,12 +303,28 @@ abstract class DatabaseConnection extends PDO {
// Call PDO::__construct and PDO::setAttribute.
parent
::
__construct
(
$dsn
,
$username
,
$password
,
$driver_options
);
// Set a
specific PDO
Statement class
if
the driver
requires tha
t.
// Set a Statement class
, unless
the driver
opted ou
t.
if
(
!
empty
(
$this
->
statementClass
))
{
$this
->
setAttribute
(
PDO
::
ATTR_STATEMENT_CLASS
,
array
(
$this
->
statementClass
,
array
(
$this
)));
}
}
/**
* Destroys this Connection object.
*
* PHP does not destruct an object if it is still referenced in other
* variables. In case of PDO database connection objects, PHP only closes the
* connection when the PDO object is destructed, so any references to this
* object may cause the number of maximum allowed connections to be exceeded.
*/
public
function
destroy
()
{
// Destroy all references to this connection by setting them to NULL.
// The Statement class attribute only accepts a new value that presents a
// proper callable, so we reset it to PDOStatement.
$this
->
setAttribute
(
PDO
::
ATTR_STATEMENT_CLASS
,
array
(
'PDOStatement'
,
array
()));
$this
->
schema
=
NULL
;
}
/**
* Returns the default query options for any given query.
*
...
...
@@ -1627,8 +1643,8 @@ abstract class Database {
*/
final
public
static
function
removeConnection
(
$key
)
{
if
(
isset
(
self
::
$databaseInfo
[
$key
]))
{
self
::
closeConnection
(
NULL
,
$key
);
unset
(
self
::
$databaseInfo
[
$key
]);
unset
(
self
::
$connections
[
$key
]);
return
TRUE
;
}
else
{
...
...
@@ -1694,11 +1710,24 @@ abstract class Database {
if
(
!
isset
(
$key
))
{
$key
=
self
::
$activeKey
;
}
// To close the connection, we need to unset the static variable.
// To close a connection, it needs to be set to NULL and removed from the
// static variable. In all cases, closeConnection() might be called for a
// connection that was not opened yet, in which case the key is not defined
// yet and we just ensure that the connection key is undefined.
if
(
isset
(
$target
))
{
if
(
isset
(
self
::
$connections
[
$key
][
$target
]))
{
self
::
$connections
[
$key
][
$target
]
->
destroy
();
self
::
$connections
[
$key
][
$target
]
=
NULL
;
}
unset
(
self
::
$connections
[
$key
][
$target
]);
}
else
{
if
(
isset
(
self
::
$connections
[
$key
]))
{
foreach
(
self
::
$connections
[
$key
]
as
$target
=>
$connection
)
{
self
::
$connections
[
$key
][
$target
]
->
destroy
();
self
::
$connections
[
$key
][
$target
]
=
NULL
;
}
}
unset
(
self
::
$connections
[
$key
]);
}
}
...
...
@@ -1852,8 +1881,8 @@ class DatabaseTransaction {
*/
protected
$name
;
public
function
__construct
(
DatabaseConnection
&
$connection
,
$name
=
NULL
)
{
$this
->
connection
=
&
$connection
;
public
function
__construct
(
DatabaseConnection
$connection
,
$name
=
NULL
)
{
$this
->
connection
=
$connection
;
// If there is no transaction depth, then no transaction has started. Name
// the transaction 'drupal_transaction'.
if
(
!
$depth
=
$connection
->
transactionDepth
())
{
...
...
includes/database/mysql/database.inc
View file @
93173dc0
...
...
@@ -13,11 +13,11 @@
class
DatabaseConnection_mysql
extends
DatabaseConnection
{
/**
* Flag to indicate if
we have registered the nextID cleanup functio
n.
* Flag to indicate if
the cleanup function in __destruct() should ru
n.
*
* @var boolean
*/
protected
$
shutdownRegistered
=
FALSE
;
protected
$
needsCleanup
=
FALSE
;
public
function
__construct
(
array
$connection_options
=
array
())
{
// This driver defaults to transaction support, except if explicitly passed FALSE.
...
...
@@ -78,6 +78,12 @@ class DatabaseConnection_mysql extends DatabaseConnection {
$this
->
exec
(
implode
(
'; '
,
$connection_options
[
'init_commands'
]));
}
public
function
__destruct
()
{
if
(
$this
->
needsCleanup
)
{
$this
->
nextIdDelete
();
}
}
public
function
queryRange
(
$query
,
$from
,
$count
,
array
$args
=
array
(),
array
$options
=
array
())
{
return
$this
->
query
(
$query
.
' LIMIT '
.
(
int
)
$from
.
', '
.
(
int
)
$count
,
$args
,
$options
);
}
...
...
@@ -115,12 +121,7 @@ class DatabaseConnection_mysql extends DatabaseConnection {
$this
->
query
(
'INSERT INTO {sequences} (value) VALUES (:value) ON DUPLICATE KEY UPDATE value = value'
,
array
(
':value'
=>
$existing_id
));
$new_id
=
$this
->
query
(
'INSERT INTO {sequences} () VALUES ()'
,
array
(),
array
(
'return'
=>
Database
::
RETURN_INSERT_ID
));
}
if
(
!
$this
->
shutdownRegistered
)
{
// Use register_shutdown_function() here to keep the database system
// independent of Drupal.
register_shutdown_function
(
array
(
$this
,
'nextIdDelete'
));
$shutdownRegistered
=
TRUE
;
}
$this
->
needsCleanup
=
TRUE
;
return
$new_id
;
}
...
...
includes/database/query.inc
View file @
93173dc0
...
...
@@ -1898,8 +1898,13 @@ class DatabaseCondition implements QueryConditionInterface, Countable {
function
__clone
()
{
$this
->
changed
=
TRUE
;
foreach
(
$this
->
conditions
as
$key
=>
$condition
)
{
if
(
$key
!==
'#conjunction'
&&
$condition
[
'field'
]
instanceOf
QueryConditionInterface
)
{
$this
->
conditions
[
$key
][
'field'
]
=
clone
(
$condition
[
'field'
]);
if
(
$key
!==
'#conjunction'
)
{
if
(
$condition
[
'field'
]
instanceOf
QueryConditionInterface
)
{
$this
->
conditions
[
$key
][
'field'
]
=
clone
(
$condition
[
'field'
]);
}
if
(
$condition
[
'value'
]
instanceOf
SelectQueryInterface
)
{
$this
->
conditions
[
$key
][
'value'
]
=
clone
(
$condition
[
'value'
]);
}
}
}
}
...
...
<