- Patch #349504 by keith.smith: clean up sentence spacing in code comments.
parent
ee700371ac
commit
0c63d9e24f
|
@ -8,7 +8,7 @@ the Free Software Foundation.
|
|||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
|
|
|
@ -315,8 +315,8 @@ function timer_stop($name) {
|
|||
* 13. $confdir/default
|
||||
*
|
||||
* If a file named sites.php is present in the $confdir, it will be loaded
|
||||
* prior to scanning for directories. It should define an associative array
|
||||
* named $sites, which maps domains to directories. It should be in the form
|
||||
* prior to scanning for directories. It should define an associative array
|
||||
* named $sites, which maps domains to directories. It should be in the form
|
||||
* of:
|
||||
*
|
||||
* $sites = array(
|
||||
|
@ -334,7 +334,7 @@ function timer_stop($name) {
|
|||
* "example.com" in the sites directory whenever a request comes from
|
||||
* "example.com", "devexample.com", or "localhost/example". That is useful
|
||||
* on development servers, where the domain name may not be the same as the
|
||||
* domain of the live server. Since Drupal stores file paths into the database
|
||||
* domain of the live server. Since Drupal stores file paths into the database
|
||||
* (files, system table, etc.) this will ensure the paths are correct while
|
||||
* accessed on development servers.
|
||||
*
|
||||
|
@ -409,7 +409,7 @@ function drupal_initialize_variables() {
|
|||
* Validate that $_SERVER['HTTP_HOST'] is safe.
|
||||
*
|
||||
* As $_SERVER['HTTP_HOST'] is user input, ensure it only contains characters
|
||||
* allowed in hostnames. See RFC 952 (and RFC 2181). $_SERVER['HTTP_HOST'] is
|
||||
* allowed in hostnames. See RFC 952 (and RFC 2181). $_SERVER['HTTP_HOST'] is
|
||||
* lowercased.
|
||||
*
|
||||
* @return
|
||||
|
@ -548,7 +548,7 @@ function drupal_get_filename($type, $name, $filename = NULL) {
|
|||
// nothing
|
||||
}
|
||||
// Verify that we have an active database connection, before querying
|
||||
// the database. This is required because this function is called both
|
||||
// the database. This is required because this function is called both
|
||||
// before we have a database connection (i.e. during installation) and
|
||||
// when a database connection fails.
|
||||
elseif (db_is_active() && (($file = db_query("SELECT filename FROM {system} WHERE name = :name AND type = :type", array(':name' => $name, ':type' => $type))->fetchField()) && file_exists($file))) {
|
||||
|
@ -708,7 +708,7 @@ function drupal_load($type, $name) {
|
|||
* Set HTTP headers in preparation for a page response.
|
||||
*
|
||||
* Authenticated users are always given a 'no-cache' header, and will
|
||||
* fetch a fresh page on every request. This prevents authenticated
|
||||
* fetch a fresh page on every request. This prevents authenticated
|
||||
* users seeing locally cached pages that show them as logged out.
|
||||
*
|
||||
* @see page_set_cache()
|
||||
|
@ -724,7 +724,7 @@ function drupal_page_header() {
|
|||
* Set HTTP headers in preparation for a cached page response.
|
||||
*
|
||||
* The general approach here is that anonymous users can keep a local
|
||||
* cache of the page, but must revalidate it on every request. Then,
|
||||
* cache of the page, but must revalidate it on every request. Then,
|
||||
* they are given a '304 Not Modified' response as long as they stay
|
||||
* logged out and the page has not been modified.
|
||||
*
|
||||
|
@ -887,8 +887,8 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO
|
|||
|
||||
static $in_error_state = FALSE;
|
||||
|
||||
// It is possible that the error handling will itself trigger an error. In that case, we could
|
||||
// end up in an infinite loop. To avoid that, we implement a simple static semaphore.
|
||||
// It is possible that the error handling will itself trigger an error. In that case, we could
|
||||
// end up in an infinite loop. To avoid that, we implement a simple static semaphore.
|
||||
if (!$in_error_state) {
|
||||
$in_error_state = TRUE;
|
||||
|
||||
|
@ -1064,7 +1064,7 @@ function drupal_bootstrap($phase = NULL) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the current bootstrap phase for this Drupal process. The
|
||||
* Return the current bootstrap phase for this Drupal process. The
|
||||
* current phase is the one most recently completed by
|
||||
* drupal_bootstrap().
|
||||
*
|
||||
|
@ -1101,7 +1101,7 @@ function _drupal_bootstrap($phase) {
|
|||
break;
|
||||
|
||||
case DRUPAL_BOOTSTRAP_DATABASE:
|
||||
// Initialize the database system. Note that the connection
|
||||
// Initialize the database system. Note that the connection
|
||||
// won't be initialized until it is actually requested.
|
||||
require_once DRUPAL_ROOT . '/includes/database/database.inc';
|
||||
// Register autoload functions so that we can access classes and interfaces.
|
||||
|
@ -1268,7 +1268,7 @@ function language_default($property = NULL) {
|
|||
/**
|
||||
* If Drupal is behind a reverse proxy, we use the X-Forwarded-For header
|
||||
* instead of $_SERVER['REMOTE_ADDR'], which would be the IP address of
|
||||
* the proxy server, and not the client's. If Drupal is run in a cluster
|
||||
* the proxy server, and not the client's. If Drupal is run in a cluster
|
||||
* we use the X-Cluster-Client-Ip header instead.
|
||||
*
|
||||
* @param $reset
|
||||
|
@ -1344,7 +1344,7 @@ function drupal_get_schema($table = NULL, $rebuild = FALSE) {
|
|||
// was last called with, which is not always what you want.
|
||||
// module_load_all_includes() calls module_list(), but if this function
|
||||
// is called very early in the bootstrap process then it will be
|
||||
// uninitialized and therefore return no modules. Instead, we have to
|
||||
// uninitialized and therefore return no modules. Instead, we have to
|
||||
// "prime" module_list() here to to values we want, specifically
|
||||
// "yes rebuild the list and don't limit to bootstrap".
|
||||
// TODO: Remove this call after http://drupal.org/node/222109 is fixed.
|
||||
|
|
|
@ -1532,7 +1532,7 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL
|
|||
*
|
||||
* @param $path
|
||||
* The Drupal path being linked to, such as "admin/content/node", or an
|
||||
* existing URL like "http://drupal.org/". The special path
|
||||
* existing URL like "http://drupal.org/". The special path
|
||||
* '<front>' may also be given and will generate the site's base URL.
|
||||
* @param $options
|
||||
* An associative array of additional options, with the following keys:
|
||||
|
@ -2777,7 +2777,7 @@ function drupal_random_bytes($count) {
|
|||
// Note that it may be important that our $random_state is passed
|
||||
// through md5() prior to being rolled into $output, that the two md5()
|
||||
// invocations are different, and that the extra input into the first one -
|
||||
// the microtime() - is prepended rather than appended. This is to avoid
|
||||
// the microtime() - is prepended rather than appended. This is to avoid
|
||||
// directly leaking $random_state via the $output stream, which could
|
||||
// allow for trivial prediction of further "random" numbers.
|
||||
while (strlen($output) < $count) {
|
||||
|
@ -3045,7 +3045,7 @@ function drupal_system_listing($mask, $directory, $key = 'name', $min_depth = 1)
|
|||
$searchdir[] = 'sites/all/' . $directory;
|
||||
|
||||
// The 'profiles' directory contains pristine collections of modules and
|
||||
// themes as organized by a distribution. It is pristine in the same way
|
||||
// themes as organized by a distribution. It is pristine in the same way
|
||||
// that /modules is pristine for core; users should avoid changing anything
|
||||
// there in favor of sites/all or sites/<domain> directories.
|
||||
if (file_exists("profiles/$profile/$directory")) {
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
* Allow the use of different database servers using the same code base.
|
||||
*
|
||||
* Drupal provides a database abstraction layer to provide developers with
|
||||
* the ability to support multiple database servers easily. The intent of
|
||||
* the ability to support multiple database servers easily. The intent of
|
||||
* this layer is to preserve the syntax and power of SQL as much as possible,
|
||||
* but also allow developers a way to leverage more complex functionality in
|
||||
* a unified way. It also provides a structured interface for dynamically
|
||||
* a unified way. It also provides a structured interface for dynamically
|
||||
* constructing queries when appropriate, and enforcing security checks and
|
||||
* similar good practices.
|
||||
*
|
||||
|
@ -48,14 +48,14 @@
|
|||
* Finally, note the PDO-based ability to foreach() over the result set.
|
||||
*
|
||||
*
|
||||
* All queries are passed as a prepared statement string. A
|
||||
* All queries are passed as a prepared statement string. A
|
||||
* prepared statement is a "template" of a query that omits literal or variable
|
||||
* values in favor of placeholders. The values to place into those
|
||||
* values in favor of placeholders. The values to place into those
|
||||
* placeholders are passed separately, and the database driver handles
|
||||
* inserting the values into the query in a secure fashion. That means you
|
||||
* inserting the values into the query in a secure fashion. That means you
|
||||
* should never quote or string-escape a value to be inserted into the query.
|
||||
*
|
||||
* There are two formats for placeholders: named and unnamed. Named placeholders
|
||||
* There are two formats for placeholders: named and unnamed. Named placeholders
|
||||
* are strongly preferred in all cases as they are more flexible and
|
||||
* self-documenting.
|
||||
*
|
||||
|
@ -65,13 +65,13 @@
|
|||
* @endcode
|
||||
*
|
||||
* ":uid" is a placeholder that will be replaced with a literal value when
|
||||
* the query is executed. A given placeholder label cannot be repeated in a
|
||||
* given query, even if the value should be the same. When using named
|
||||
* the query is executed. A given placeholder label cannot be repeated in a
|
||||
* given query, even if the value should be the same. When using named
|
||||
* placeholders, the array of arguments to the query must be an associative
|
||||
* array where keys are a placeholder label (e.g., :uid) and the value is the
|
||||
* corresponding value to use. The array may be in any order.
|
||||
* corresponding value to use. The array may be in any order.
|
||||
*
|
||||
* Unnamed placeholders are simply a question mark. Example:
|
||||
* Unnamed placeholders are simply a question mark. Example:
|
||||
* @code
|
||||
* SELECT nid, title FROM {node} WHERE uid=?
|
||||
* @endcode
|
||||
|
@ -79,9 +79,9 @@
|
|||
* In this case, the array of arguments must be an indexed array of values to
|
||||
* use in the exact same order as the placeholders in the query.
|
||||
*
|
||||
* Note that placeholders should be a "complete" value. For example, when
|
||||
* Note that placeholders should be a "complete" value. For example, when
|
||||
* running a LIKE query the SQL wildcard character, %, should be part of the
|
||||
* value, not the query itself. Thus, the following is incorrect:
|
||||
* value, not the query itself. Thus, the following is incorrect:
|
||||
*
|
||||
* @code
|
||||
* SELECT nid, title FROM {node} WHERE title LIKE :title%
|
||||
|
@ -93,17 +93,17 @@
|
|||
* SELECT nid, title FROM {node} WHERE title LIKE :title
|
||||
* @endcode
|
||||
*
|
||||
* and the value for :title should include a % as appropriate. Again, note the
|
||||
* lack of quotation marks around :title. Because the value is not inserted
|
||||
* and the value for :title should include a % as appropriate. Again, note the
|
||||
* lack of quotation marks around :title. Because the value is not inserted
|
||||
* into the query as one big string but as an explicitly separate value, the
|
||||
* database server knows where the query ends and a value begins. That is
|
||||
* database server knows where the query ends and a value begins. That is
|
||||
* considerably more secure against SQL injection than trying to remember
|
||||
* which values need quotation marks and string escaping and which don't.
|
||||
*
|
||||
*
|
||||
* INSERT, UPDATE, and DELETE queries need special care in order to behave
|
||||
* consistently across all different databases. Therefore, they use a special
|
||||
* object-oriented API for defining a query structurally. For example, rather than
|
||||
* consistently across all different databases. Therefore, they use a special
|
||||
* object-oriented API for defining a query structurally. For example, rather than
|
||||
* @code
|
||||
* INSERT INTO node (nid, title, body) VALUES (1, 'my title', 'my body')
|
||||
* @endcode
|
||||
|
@ -113,7 +113,7 @@
|
|||
* db_insert('my_table')->fields($fields)->execute();
|
||||
* @endcode
|
||||
* This method allows databases that need special data type handling to do so,
|
||||
* while also allowing optimizations such as multi-insert queries. UPDATE and
|
||||
* while also allowing optimizations such as multi-insert queries. UPDATE and
|
||||
* DELETE queries have a similar pattern.
|
||||
*/
|
||||
|
||||
|
@ -250,45 +250,45 @@ abstract class DatabaseConnection extends PDO {
|
|||
* A given query can be customized with a number of option flags in an
|
||||
* associative array.
|
||||
*
|
||||
* target - The database "target" against which to execute a query. Valid
|
||||
* values are "default" or "slave". The system will first try to open a
|
||||
* connection to a database specified with the user-supplied key. If one
|
||||
* target - The database "target" against which to execute a query. Valid
|
||||
* values are "default" or "slave". The system will first try to open a
|
||||
* connection to a database specified with the user-supplied key. If one
|
||||
* is not available, it will silently fall back to the "default" target.
|
||||
* If multiple databases connections are specified with the same target,
|
||||
* one will be selected at random for the duration of the request.
|
||||
*
|
||||
* fetch - This element controls how rows from a result set will be returned.
|
||||
* legal values include PDO::FETCH_ASSOC, PDO::FETCH_BOTH, PDO::FETCH_OBJ,
|
||||
* PDO::FETCH_NUM, or a string representing the name of a class. If a string
|
||||
* PDO::FETCH_NUM, or a string representing the name of a class. If a string
|
||||
* is specified, each record will be fetched into a new object of that class.
|
||||
* The behavior of all other values is defined by PDO. See
|
||||
* The behavior of all other values is defined by PDO. See
|
||||
* http://www.php.net/PDOStatement-fetch
|
||||
*
|
||||
* return - Depending on the type of query, different return values may be
|
||||
* meaningful. This directive instructs the system which type of return
|
||||
* value is desired. The system will generally set the correct value
|
||||
* meaningful. This directive instructs the system which type of return
|
||||
* value is desired. The system will generally set the correct value
|
||||
* automatically, so it is extremely rare that a module developer will ever
|
||||
* need to specify this value. Setting it incorrectly will likely lead to
|
||||
* unpredictable results or fatal errors. Legal values include:
|
||||
* need to specify this value. Setting it incorrectly will likely lead to
|
||||
* unpredictable results or fatal errors. Legal values include:
|
||||
*
|
||||
* Database::RETURN_STATEMENT - Return the prepared statement object for the
|
||||
* query. This is usually only meaningful for SELECT queries, where the
|
||||
* query. This is usually only meaningful for SELECT queries, where the
|
||||
* statement object is how one accesses the result set returned by the query.
|
||||
*
|
||||
* Database::RETURN_AFFECTED - Return the number of rows affected by an
|
||||
* UPDATE or DELETE query. Be aware that means the number of rows
|
||||
* UPDATE or DELETE query. Be aware that means the number of rows
|
||||
* actually changed, not the number of rows matched by the WHERE clause.
|
||||
*
|
||||
* Database::RETURN_INSERT_ID - Return the sequence ID (primary key)
|
||||
* created by an INSERT statement on a table that contains a serial column.
|
||||
*
|
||||
* Database::RETURN_NULL - Do not return anything, as there is no
|
||||
* meaningful value to return. That is the case for INSERT queries on
|
||||
* meaningful value to return. That is the case for INSERT queries on
|
||||
* tables that do not contain a serial column.
|
||||
*
|
||||
* throw_exception - By default, the database system will catch any errors
|
||||
* on a query as an Exception, log it, and then rethrow it so that code
|
||||
* further up the call chain can take an appropriate action. To supress
|
||||
* further up the call chain can take an appropriate action. To supress
|
||||
* that behavior and simply return NULL on failure, set this option to FALSE.
|
||||
*
|
||||
* @return
|
||||
|
@ -344,7 +344,7 @@ abstract class DatabaseConnection extends PDO {
|
|||
* Prepare a query string and return the prepared statement.
|
||||
*
|
||||
* This method caches prepared statements, reusing them when
|
||||
* possible. It also prefixes tables names enclosed in curly-braces.
|
||||
* possible. It also prefixes tables names enclosed in curly-braces.
|
||||
*
|
||||
* @param $query
|
||||
* The query string as SQL, with curly-braces surrounding the
|
||||
|
@ -364,13 +364,13 @@ abstract class DatabaseConnection extends PDO {
|
|||
/**
|
||||
* Tell this connection object what its target value is.
|
||||
*
|
||||
* This is needed for logging and auditing. It's sloppy to do in the
|
||||
* This is needed for logging and auditing. It's sloppy to do in the
|
||||
* constructor because the constructor for child classes has a different
|
||||
* signature. We therefore also ensure that this function is only ever
|
||||
* signature. We therefore also ensure that this function is only ever
|
||||
* called once.
|
||||
*
|
||||
* @param $target
|
||||
* The target this connection is for. Set to NULL (default) to disable
|
||||
* The target this connection is for. Set to NULL (default) to disable
|
||||
* logging entirely.
|
||||
*/
|
||||
public function setTarget($target = NULL) {
|
||||
|
@ -403,7 +403,7 @@ abstract class DatabaseConnection extends PDO {
|
|||
* Get the current logging object for this connection.
|
||||
*
|
||||
* @return
|
||||
* The current logging object for this connection. If there isn't one,
|
||||
* The current logging object for this connection. If there isn't one,
|
||||
* NULL is returned.
|
||||
*/
|
||||
public function getLogger() {
|
||||
|
@ -414,7 +414,7 @@ abstract class DatabaseConnection extends PDO {
|
|||
* Create the appropriate sequence name for a given table and serial field.
|
||||
*
|
||||
* This information is exposed to all database drivers, although it is only
|
||||
* useful on some of them. This method is table prefix-aware.
|
||||
* useful on some of them. This method is table prefix-aware.
|
||||
*
|
||||
* @param $table
|
||||
* The table name to use for the sequence.
|
||||
|
@ -431,32 +431,32 @@ abstract class DatabaseConnection extends PDO {
|
|||
* Executes a query string against the database.
|
||||
*
|
||||
* This method provides a central handler for the actual execution
|
||||
* of every query. All queries executed by Drupal are executed as
|
||||
* of every query. All queries executed by Drupal are executed as
|
||||
* PDO prepared statements.
|
||||
*
|
||||
* @param $query
|
||||
* The query to execute. In most cases this will be a string containing
|
||||
* an SQL query with placeholders. An already-prepared instance of
|
||||
* The query to execute. In most cases this will be a string containing
|
||||
* an SQL query with placeholders. An already-prepared instance of
|
||||
* DatabaseStatementInterface may also be passed in order to allow calling code
|
||||
* to manually bind variables to a query. If a DatabaseStatementInterface
|
||||
* to manually bind variables to a query. If a DatabaseStatementInterface
|
||||
* is passed, the $args array will be ignored.
|
||||
*
|
||||
* It is extremely rare that module code will need to pass a statement
|
||||
* object to this method. It is used primarily for database drivers for
|
||||
* object to this method. It is used primarily for database drivers for
|
||||
* databases that require special LOB field handling.
|
||||
* @param $args
|
||||
* An array of arguments for the prepared statement. If the prepared
|
||||
* An array of arguments for the prepared statement. If the prepared
|
||||
* statement uses ? placeholders, this array must be an indexed array.
|
||||
* If it contains named placeholders, it must be an associative array.
|
||||
* @param $options
|
||||
* An associative array of options to control how the query is run. See
|
||||
* An associative array of options to control how the query is run. See
|
||||
* the documentation for DatabaseConnection::defaultOptions() for details.
|
||||
* @return
|
||||
* This method will return one of: The executed statement, the number of
|
||||
* rows affected by the query (not the number matched), or the generated
|
||||
* insert id of the last query, depending on the value of $options['return'].
|
||||
* Typically that value will be set by default or a query builder and should
|
||||
* not be set by a user. If there is an error, this method will return NULL
|
||||
* not be set by a user. If there is an error, this method will return NULL
|
||||
* and may throw an exception if $options['throw_exception'] is TRUE.
|
||||
*/
|
||||
public function query($query, array $args = array(), $options = array()) {
|
||||
|
@ -513,7 +513,7 @@ abstract class DatabaseConnection extends PDO {
|
|||
* @see SelectQuery
|
||||
* @param $table
|
||||
* The base table for this query, that is, the first table in the FROM
|
||||
* clause. This table will also be used as the "base" table for query_alter
|
||||
* clause. This table will also be used as the "base" table for query_alter
|
||||
* hook implementations.
|
||||
* @param $alias
|
||||
* The alias of the base table of this query.
|
||||
|
@ -653,7 +653,7 @@ abstract class DatabaseConnection extends PDO {
|
|||
*
|
||||
* @param $required
|
||||
* If executing an operation that absolutely must use transactions, specify
|
||||
* TRUE for this parameter. If the connection does not support transactions,
|
||||
* TRUE for this parameter. If the connection does not support transactions,
|
||||
* this method will throw an exception and the operation will not be possible.
|
||||
* @see DatabaseTransaction
|
||||
*/
|
||||
|
@ -715,7 +715,7 @@ abstract class DatabaseConnection extends PDO {
|
|||
* The name of the temporary table to select into. This name will not be
|
||||
* prefixed as there is no risk of collision.
|
||||
* @param $options
|
||||
* An associative array of options to control how the query is run. See
|
||||
* An associative array of options to control how the query is run. See
|
||||
* the documentation for DatabaseConnection::defaultOptions() for details.
|
||||
* @return
|
||||
* A database query result resource, or FALSE if the query was not executed
|
||||
|
@ -750,13 +750,13 @@ abstract class DatabaseConnection extends PDO {
|
|||
* Gets any special processing requirements for the condition operator.
|
||||
*
|
||||
* Some condition types require special processing, such as IN, because
|
||||
* the value data they pass in is not a simple value. This is a simple
|
||||
* overridable lookup function. Database connections should define only
|
||||
* the value data they pass in is not a simple value. This is a simple
|
||||
* overridable lookup function. Database connections should define only
|
||||
* those operators they wish to be handled differently than the default.
|
||||
*
|
||||
* @see DatabaseCondition::compile().
|
||||
* @param $operator
|
||||
* The condition operator, such as "IN", "BETWEEN", etc. Case-sensitive.
|
||||
* The condition operator, such as "IN", "BETWEEN", etc. Case-sensitive.
|
||||
* @return
|
||||
* The extra handling directives for the specified operator, or NULL.
|
||||
*/
|
||||
|
@ -766,7 +766,7 @@ abstract class DatabaseConnection extends PDO {
|
|||
/**
|
||||
* Primary front-controller for the database system.
|
||||
*
|
||||
* This class is uninstantiatable and un-extendable. It acts to encapsulate
|
||||
* This class is uninstantiatable and un-extendable. It acts to encapsulate
|
||||
* all control and shepherding of database connections into a single location
|
||||
* without the use of globals.
|
||||
*
|
||||
|
@ -798,7 +798,7 @@ abstract class Database {
|
|||
const RETURN_INSERT_ID = 3;
|
||||
|
||||
/**
|
||||
* An nested array of all active connections. It is keyed by database name and target.
|
||||
* An nested array of all active connections. It is keyed by database name and target.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
@ -848,7 +848,7 @@ abstract class Database {
|
|||
* @param $key
|
||||
* The database connection key for which we want to log.
|
||||
* @return
|
||||
* The query log object. Note that the log object does support richer
|
||||
* The query log object. Note that the log object does support richer
|
||||
* methods than the few exposed through the Database class, so in some
|
||||
* cases it may be desirable to access it directly.
|
||||
*/
|
||||
|
@ -872,7 +872,7 @@ abstract class Database {
|
|||
/**
|
||||
* Retrieve the queries logged on for given logging key.
|
||||
*
|
||||
* This method also ends logging for the specified key. To get the query log
|
||||
* This method also ends logging for the specified key. To get the query log
|
||||
* to date without ending the logger request the logging object by starting
|
||||
* it again (which does nothing to an open log key) and call methods on it as
|
||||
* desired.
|
||||
|
@ -984,7 +984,7 @@ abstract class Database {
|
|||
foreach ($databaseInfo as $index => $info) {
|
||||
foreach ($databaseInfo[$index] as $target => $value) {
|
||||
// If there is no "driver" property, then we assume it's an array of
|
||||
// possible connections for this target. Pick one at random. That
|
||||
// possible connections for this target. Pick one at random. That
|
||||
// allows us to have, for example, multiple slave servers.
|
||||
if (empty($value['driver'])) {
|
||||
$databaseInfo[$index][$target] = $databaseInfo[$index][$target][mt_rand(0, count($databaseInfo[$index][$target]) - 1)];
|
||||
|
@ -1000,7 +1000,7 @@ abstract class Database {
|
|||
*
|
||||
* This method allows the addition of new connection credentials at runtime.
|
||||
* Under normal circumstances the preferred way to specify database credentials
|
||||
* is via settings.php. However, this method allows them to be added at
|
||||
* is via settings.php. However, this method allows them to be added at
|
||||
* arbitrary times, such as during unit tests, when connecting to admin-defined
|
||||
* third party databases, etc.
|
||||
*
|
||||
|
@ -1042,7 +1042,7 @@ abstract class Database {
|
|||
* Open a connection to the server specified by the given key and target.
|
||||
*
|
||||
* @param $key
|
||||
* The database connection key, as specified in settings.php. The default
|
||||
* The database connection key, as specified in settings.php. The default
|
||||
* is "default".
|
||||
* @param $target
|
||||
* The database target to open.
|
||||
|
@ -1084,7 +1084,7 @@ abstract class Database {
|
|||
}
|
||||
catch (Exception $e) {
|
||||
// It is extremely rare that an exception will be generated here other
|
||||
// than when installing. We therefore intercept it and try the installer,
|
||||
// than when installing. We therefore intercept it and try the installer,
|
||||
// passing on the exception otherwise.
|
||||
_db_check_install_needed();
|
||||
throw $e;
|
||||
|
@ -1094,7 +1094,7 @@ abstract class Database {
|
|||
/**
|
||||
* Instruct the system to temporarily ignore a given key/target.
|
||||
*
|
||||
* At times we need to temporarily disable slave queries. To do so,
|
||||
* At times we need to temporarily disable slave queries. To do so,
|
||||
* call this method with the database key and the target to disable.
|
||||
* That database key will then always fall back to 'default' for that
|
||||
* key, even if it's defined.
|
||||
|
@ -1115,7 +1115,7 @@ abstract class Database {
|
|||
*
|
||||
* This exception will be thrown when a transaction is started that does not
|
||||
* allow for the "silent fallback" of no transaction and the database connection
|
||||
* in use does not support transactions. The calling code must then take
|
||||
* in use does not support transactions. The calling code must then take
|
||||
* appropriate action.
|
||||
*/
|
||||
class TransactionsNotSupportedException extends PDOException { }
|
||||
|
@ -1123,16 +1123,16 @@ class TransactionsNotSupportedException extends PDOException { }
|
|||
/**
|
||||
* A wrapper class for creating and managing database transactions.
|
||||
*
|
||||
* Not all databases or database configurations support transactions. For
|
||||
* example, MySQL MyISAM tables do not. It is also easy to begin a transaction
|
||||
* Not all databases or database configurations support transactions. For
|
||||
* example, MySQL MyISAM tables do not. It is also easy to begin a transaction
|
||||
* and then forget to commit it, which can lead to connection errors when
|
||||
* another transaction is started.
|
||||
*
|
||||
* This class acts as a wrapper for transactions. To begin a transaction,
|
||||
* simply instantiate it. When the object goes out of scope and is destroyed
|
||||
* it will automatically commit. It also will check to see if the specified
|
||||
* connection supports transactions. If not, it will simply skip any transaction
|
||||
* commands, allowing user-space code to proceed normally. The only difference
|
||||
* This class acts as a wrapper for transactions. To begin a transaction,
|
||||
* simply instantiate it. When the object goes out of scope and is destroyed
|
||||
* it will automatically commit. It also will check to see if the specified
|
||||
* connection supports transactions. If not, it will simply skip any transaction
|
||||
* commands, allowing user-space code to proceed normally. The only difference
|
||||
* is that rollbacks won't actually do anything.
|
||||
*
|
||||
* In the vast majority of cases, you should not instantiate this class directly.
|
||||
|
@ -1174,7 +1174,7 @@ class DatabaseTransaction {
|
|||
/**
|
||||
* Track the number of "layers" of transactions currently active.
|
||||
*
|
||||
* On many databases transactions cannot nest. Instead, we track
|
||||
* On many databases transactions cannot nest. Instead, we track
|
||||
* nested calls to transactions and collapse them into a single
|
||||
* transaction.
|
||||
*
|
||||
|
@ -1325,7 +1325,7 @@ interface DatabaseStatementInterface extends Traversable {
|
|||
* Return a single field out of the current
|
||||
*
|
||||
* @param $index
|
||||
* The numeric index of the field to return. Defaults to the first field.
|
||||
* The numeric index of the field to return. Defaults to the first field.
|
||||
* @return
|
||||
* A single field from the next record.
|
||||
*/
|
||||
|
@ -1343,7 +1343,7 @@ interface DatabaseStatementInterface extends Traversable {
|
|||
* Fetches the next row and returns it as an associative array.
|
||||
*
|
||||
* This method corresponds to PDOStatement::fetchObject(),
|
||||
* but for associative arrays. For some reason PDOStatement does
|
||||
* but for associative arrays. For some reason PDOStatement does
|
||||
* not have a corresponding array helper method, so one is added.
|
||||
*
|
||||
* @return
|
||||
|
@ -1407,7 +1407,7 @@ interface DatabaseStatementInterface extends Traversable {
|
|||
* @param $key
|
||||
* The name of the field on which to index the array.
|
||||
* @param $fetch
|
||||
* The fetchmode to use. If set to PDO::FETCH_ASSOC, PDO::FETCH_NUM, or
|
||||
* The fetchmode to use. If set to PDO::FETCH_ASSOC, PDO::FETCH_NUM, or
|
||||
* PDO::FETCH_BOTH the returned value with be an array of arrays. For any
|
||||
* other value it will be an array of objects.
|
||||
* @return
|
||||
|
@ -1420,8 +1420,8 @@ interface DatabaseStatementInterface extends Traversable {
|
|||
* Default implementation of DatabaseStatementInterface.
|
||||
*
|
||||
* PDO allows us to extend the PDOStatement class to provide additional
|
||||
* functionality beyond that offered by default. We do need extra
|
||||
* functionality. By default, this class is not driver-specific. If a given
|
||||
* functionality beyond that offered by default. We do need extra
|
||||
* functionality. By default, this class is not driver-specific. If a given
|
||||
* driver needs to set a custom statement class, it may do so in its constructor.
|
||||
*
|
||||
* @link http://us.php.net/pdostatement
|
||||
|
@ -1523,18 +1523,18 @@ class DatabaseStatementBase extends PDOStatement implements DatabaseStatementInt
|
|||
/**
|
||||
* Execute an arbitrary query string against the active database.
|
||||
*
|
||||
* Do not use this function for INSERT, UPDATE, or DELETE queries. Those should
|
||||
* be handled via the appropriate query builder factory. Use this function for
|
||||
* Do not use this function for INSERT, UPDATE, or DELETE queries. Those should
|
||||
* be handled via the appropriate query builder factory. Use this function for
|
||||
* SELECT queries that do not require a query builder.
|
||||
*
|
||||
* @see DatabaseConnection::defaultOptions()
|
||||
* @param $query
|
||||
* The prepared statement query to run. Although it will accept both
|
||||
* The prepared statement query to run. Although it will accept both
|
||||
* named and unnamed placeholders, named placeholders are strongly preferred
|
||||
* as they are more self-documenting.
|
||||
* @param $args
|
||||
* An array of values to substitute into the query. If the query uses named
|
||||
* placeholders, this is an associative array in any order. If the query uses
|
||||
* An array of values to substitute into the query. If the query uses named
|
||||
* placeholders, this is an associative array in any order. If the query uses
|
||||
* unnamed placeholders (?), this is an indexed array and the order must match
|
||||
* the order of placeholders in the query string.
|
||||
* @param $options
|
||||
|
@ -1557,12 +1557,12 @@ function db_query($query, $args = array(), $options = array()) {
|
|||
*
|
||||
* @see DatabaseConnection::defaultOptions()
|
||||
* @param $query
|
||||
* The prepared statement query to run. Although it will accept both
|
||||
* The prepared statement query to run. Although it will accept both
|
||||
* named and unnamed placeholders, named placeholders are strongly preferred
|
||||
* as they are more self-documenting.
|
||||
* @param $args
|
||||
* An array of values to substitute into the query. If the query uses named
|
||||
* placeholders, this is an associative array in any order. If the query uses
|
||||
* An array of values to substitute into the query. If the query uses named
|
||||
* placeholders, this is an associative array in any order. If the query uses
|
||||
* unnamed placeholders (?), this is an indexed array and the order must match
|
||||
* the order of placeholders in the query string.
|
||||
* @param $from
|
||||
|
@ -1591,12 +1591,12 @@ function db_query_range($query, $args, $from = 0, $count = 0, $options = array()
|
|||
*
|
||||
* @see DatabaseConnection::defaultOptions()
|
||||
* @param $query
|
||||
* The prepared statement query to run. Although it will accept both
|
||||
* The prepared statement query to run. Although it will accept both
|
||||
* named and unnamed placeholders, named placeholders are strongly preferred
|
||||
* as they are more self-documenting.
|
||||
* @param $args
|
||||
* An array of values to substitute into the query. If the query uses named
|
||||
* placeholders, this is an associative array in any order. If the query uses
|
||||
* An array of values to substitute into the query. If the query uses named
|
||||
* placeholders, this is an associative array in any order. If the query uses
|
||||
* unnamed placeholders (?), this is an indexed array and the order must match
|
||||
* the order of placeholders in the query string.
|
||||
* @param $tablename
|
||||
|
@ -1687,8 +1687,8 @@ function db_delete($table, array $options = array()) {
|
|||
* Returns a new SelectQuery object for the active database.
|
||||
*
|
||||
* @param $table
|
||||
* The base table for this query. May be a string or another SelectQuery
|
||||
* object. If a query object is passed, it will be used as a subselect.
|
||||
* The base table for this query. May be a string or another SelectQuery
|
||||
* object. If a query object is passed, it will be used as a subselect.
|
||||
* @param $alias
|
||||
* The alias for the base table of this query.
|
||||
* @param $options
|
||||
|
@ -1746,7 +1746,7 @@ function db_escape_table($table) {
|
|||
* Perform an SQL query and return success or failure.
|
||||
*
|
||||
* @param $sql
|
||||
* A string containing a complete SQL query. %-substitution
|
||||
* A string containing a complete SQL query. %-substitution
|
||||
* parameters are not supported.
|
||||
* @return
|
||||
* An array containing the keys:
|
||||
|
@ -1893,7 +1893,7 @@ function db_type_placeholder($type) {
|
|||
return '\'%s\'';
|
||||
|
||||
case 'numeric':
|
||||
// Numeric values are arbitrary precision numbers. Syntacically, numerics
|
||||
// Numeric values are arbitrary precision numbers. Syntacically, numerics
|
||||
// should be specified directly in SQL. However, without single quotes
|
||||
// the %s placeholder does not protect against non-numeric characters such
|
||||
// as spaces which would expose us to SQL injection.
|
||||
|
@ -1972,7 +1972,7 @@ function db_drop_table(&$ret, $table) {
|
|||
* @param $keys_new
|
||||
* Optional keys and indexes specification to be created on the
|
||||
* table along with adding the field. The format is the same as a
|
||||
* table specification but without the 'fields' element. If you are
|
||||
* table specification but without the 'fields' element. If you are
|
||||
* adding a type 'serial' field, you MUST specify at least one key
|
||||
* or index including it in this array. @see db_change_field for more
|
||||
* explanation why.
|
||||
|
@ -2132,7 +2132,7 @@ function db_drop_index(&$ret, $table, $name) {
|
|||
* );
|
||||
* @endcode
|
||||
* and you want to change foo.bar to be type serial, leaving it as the
|
||||
* primary key. The correct sequence is:
|
||||
* primary key. The correct sequence is:
|
||||
* @code
|
||||
* db_drop_primary_key($ret, 'foo');
|
||||
* db_change_field($ret, 'foo', 'bar', 'bar',
|
||||
|
@ -2147,10 +2147,10 @@ function db_drop_index(&$ret, $table, $name) {
|
|||
* sequences (from serial-type fields) that use the changed field to be dropped.
|
||||
*
|
||||
* On MySQL, all type 'serial' fields must be part of at least one key
|
||||
* or index as soon as they are created. You cannot use
|
||||
* or index as soon as they are created. You cannot use
|
||||
* db_add_{primary_key,unique_key,index}() for this purpose because
|
||||
* the ALTER TABLE command will fail to add the column without a key
|
||||
* or index specification. The solution is to use the optional
|
||||
* or index specification. The solution is to use the optional
|
||||
* $keys_new argument to create the key or index at the same time as
|
||||
* field.
|
||||
*
|
||||
|
@ -2199,7 +2199,7 @@ function _db_error_page($error = '') {
|
|||
* @ingroup database-legacy
|
||||
*
|
||||
* These functions are no longer necessary, as the DatabaseStatementInterface interface
|
||||
* offers this and much more functionality. They are kept temporarily for backward
|
||||
* offers this and much more functionality. They are kept temporarily for backward
|
||||
* compatibility during conversion and should be removed as soon as possible.
|
||||
*
|
||||
* @{
|
||||
|
@ -2234,7 +2234,7 @@ function _db_check_install_needed() {
|
|||
* Backward-compatibility utility.
|
||||
*
|
||||
* This function should be removed after all queries have been converted
|
||||
* to the new API. It is temporary only.
|
||||
* to the new API. It is temporary only.
|
||||
*
|
||||
* @todo Remove this once the query conversion is complete.
|
||||
*/
|
||||
|
@ -2247,7 +2247,7 @@ function _db_query_process_args($query, $args, $options) {
|
|||
$options['target'] = 'default';
|
||||
}
|
||||
|
||||
// Temporary backward-compatibliity hacks. Remove later.
|
||||
// Temporary backward-compatibliity hacks. Remove later.
|
||||
$old_query = $query;
|
||||
$query = str_replace(array('%n', '%d', '%f', '%b', "'%s'", '%s'), '?', $old_query);
|
||||
if ($old_query !== $query) {
|
||||
|
@ -2256,7 +2256,7 @@ function _db_query_process_args($query, $args, $options) {
|
|||
|
||||
// A large number of queries pass FALSE or empty-string for
|
||||
// int/float fields because the previous version of db_query()
|
||||
// casted them to int/float, resulting in 0. MySQL PDO happily
|
||||
// casted them to int/float, resulting in 0. MySQL PDO happily
|
||||
// accepts these values as zero but PostgreSQL PDO does not, and I
|
||||
// do not feel like tracking down and fixing every such query at
|
||||
// this time.
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
* We log queries in a separate object rather than in the connection object
|
||||
* because we want to be able to see all queries sent to a given database, not
|
||||
* database target. If we logged the queries in each connection object we
|
||||
* database target. If we logged the queries in each connection object we
|
||||
* would not be able to track what queries went to which target.
|
||||
*
|
||||
* Every connection has one and only one logging object on it for all targets
|
||||
|
@ -20,7 +20,7 @@
|
|||
class DatabaseLog {
|
||||
|
||||
/**
|
||||
* Cache of logged queries. This will only be used if the query logger is enabled.
|
||||
* Cache of logged queries. This will only be used if the query logger is enabled.
|
||||
*
|
||||
* The structure for the logging array is as follows:
|
||||
*
|
||||
|
@ -58,7 +58,7 @@ class DatabaseLog {
|
|||
* If the specified logging key is already running this method does nothing.
|
||||
*
|
||||
* @param $logging_key
|
||||
* The identification key for this log request. By specifying different
|
||||
* The identification key for this log request. By specifying different
|
||||
* logging keys we are able to start and stop multiple logging runs
|
||||
* simultaneously without them colliding.
|
||||
*/
|
||||
|
@ -83,7 +83,7 @@ class DatabaseLog {
|
|||
/**
|
||||
* Empty the query log for the specified logging key.
|
||||
*
|
||||
* This method does not stop logging, it simply clears the log. To stop
|
||||
* This method does not stop logging, it simply clears the log. To stop
|
||||
* logging, use the end() method.
|
||||
*
|
||||
* @param $logging_key
|
||||
|
@ -129,14 +129,14 @@ class DatabaseLog {
|
|||
* Determine the routine that called this query.
|
||||
*
|
||||
* We define "the routine that called this query" as the first entry in
|
||||
* the call stack that is not inside includes/database. That makes the
|
||||
* the call stack that is not inside includes/database. That makes the
|
||||
* climbing logic very simple, and handles the variable stack depth caused
|
||||
* by the query builders.
|
||||
*
|
||||
* @link http://www.php.net/debug_backtrace
|
||||
* @return
|
||||
* This method returns a stack trace entry similar to that generated by
|
||||
* debug_backtrace(). However, it flattens the trace entry and the trace
|
||||
* debug_backtrace(). However, it flattens the trace entry and the trace
|
||||
* entry before it so that we get the function and args of the function that
|
||||
* called into the database system, not the function and args of the
|
||||
* database call itself.
|
||||
|
|
|
@ -66,7 +66,7 @@ class InsertQuery_mysql extends InsertQuery {
|
|||
}
|
||||
}
|
||||
else {
|
||||
// If there are no values, then this is a default-only query. We still need to handle that.
|
||||
// If there are no values, then this is a default-only query. We still need to handle that.
|
||||
$placeholders = array_fill(0, count($this->defaultFields), 'default');
|
||||
$values[] = '(' . implode(', ', $placeholders) .')';
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ class MergeQuery_mysql extends MergeQuery {
|
|||
|
||||
$max_placeholder = 0;
|
||||
$values = array();
|
||||
// We assume that the order here is the same as in __toString(). If that's
|
||||
// We assume that the order here is the same as in __toString(). If that's
|
||||
// not the case, then we have serious problems.
|
||||
foreach ($insert_fields as $value) {
|
||||
$values[':db_insert_placeholder_' . $max_placeholder++] = $value;
|
||||
|
|
|
@ -136,7 +136,7 @@ class DatabaseSchema_mysql extends DatabaseSchema {
|
|||
}
|
||||
|
||||
public function getFieldTypeMap() {
|
||||
// Put :normal last so it gets preserved by array_flip. This makes
|
||||
// Put :normal last so it gets preserved by array_flip. This makes
|
||||
// it much easier for modules (such as schema.module) to map
|
||||
// database types back into schema types.
|
||||
static $map = array(
|
||||
|
|
|
@ -91,7 +91,7 @@ class DatabaseConnection_pgsql extends DatabaseConnection {
|
|||
|
||||
public function mapConditionOperator($operator) {
|
||||
static $specials = array(
|
||||
// In PostgreSQL, 'LIKE' is case-sensitive. For case-insensitive LIKE
|
||||
// In PostgreSQL, 'LIKE' is case-sensitive. For case-insensitive LIKE
|
||||
// statements, we need to use ILIKE instead.
|
||||
'LIKE' => array('operator' => 'ILIKE'),
|
||||
);
|
||||
|
|
|
@ -96,7 +96,7 @@ class InsertQuery_pgsql extends InsertQuery {
|
|||
}
|
||||
}
|
||||
else {
|
||||
// If there are no values, then this is a default-only query. We still need to handle that.
|
||||
// If there are no values, then this is a default-only query. We still need to handle that.
|
||||
$placeholders = array_fill(0, count($this->defaultFields), 'default');
|
||||
$values[] = '(' . implode(', ', $placeholders) .')';
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
|
|||
* to the engine-specific data type.
|
||||
*/
|
||||
function getFieldTypeMap() {
|
||||
// Put :normal last so it gets preserved by array_flip. This makes
|
||||
// Put :normal last so it gets preserved by array_flip. This makes
|
||||
// it much easier for modules (such as schema.module) to map
|
||||
// database types back into schema types.
|
||||
$map = array(
|
||||
|
@ -235,7 +235,7 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
|
|||
* @param $keys_new
|
||||
* Optional keys and indexes specification to be created on the
|
||||
* table along with adding the field. The format is the same as a
|
||||
* table specification but without the 'fields' element. If you are
|
||||
* table specification but without the 'fields' element. If you are
|
||||
* adding a type 'serial' field, you MUST specify at least one key
|
||||
* or index including it in this array. @see db_change_field for more
|
||||
* explanation why.
|
||||
|
@ -424,7 +424,7 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
|
|||
* );
|
||||
* @endcode
|
||||
* and you want to change foo.bar to be type serial, leaving it as the
|
||||
* primary key. The correct sequence is:
|
||||
* primary key. The correct sequence is:
|
||||
* @code
|
||||
* db_drop_primary_key($ret, 'foo');
|
||||
* db_change_field($ret, 'foo', 'bar', 'bar',
|
||||
|
@ -439,10 +439,10 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
|
|||
* sequences (from serial-type fields) that use the changed field to be dropped.
|
||||
*
|
||||
* On MySQL, all type 'serial' fields must be part of at least one key
|
||||
* or index as soon as they are created. You cannot use
|
||||
* or index as soon as they are created. You cannot use
|
||||
* db_add_{primary_key,unique_key,index}() for this purpose because
|
||||
* the ALTER TABLE command will fail to add the column without a key
|
||||
* or index specification. The solution is to use the optional
|
||||
* or index specification. The solution is to use the optional
|
||||
* $new_keys argument to create the key or index at the same time as
|
||||
* field.
|
||||
*
|
||||
|
|
|
@ -13,21 +13,21 @@ interface QueryConditionInterface {
|
|||
/**
|
||||
* Helper function to build most common conditional clauses.
|
||||
*
|
||||
* This method can take a variable number of parameters. If called with two
|
||||
* This method can take a variable number of parameters. If called with two
|
||||
* parameters, they are taken as $field and $value with $operator having a value
|
||||
* of =.
|
||||
*
|
||||
* @param $field
|
||||
* The name of the field to check.
|
||||
* @param $value
|
||||
* The value to test the field against. In most cases, this is a scalar. For more
|
||||
* complex options, it is an array. The meaning of each element in the array is
|
||||
* The value to test the field against. In most cases, this is a scalar. For more
|
||||
* complex options, it is an array. The meaning of each element in the array is
|
||||
* dependent on the $operator.
|
||||
* @param $operator
|
||||
* The comparison operator, such as =, <, or >=. It also accepts more complex
|
||||
* The comparison operator, such as =, <, or >=. It also accepts more complex
|
||||
* options such as IN, LIKE, or BETWEEN.
|
||||
* @param $num_args
|
||||
* For internal use only. This argument is used to track the recursive calls when
|
||||
* For internal use only. This argument is used to track the recursive calls when
|
||||
* processing complex conditions.
|
||||
* @return
|
||||
* The called object.
|
||||
|
@ -38,7 +38,7 @@ interface QueryConditionInterface {
|
|||
* Add an arbitrary WHERE clause to the query.
|
||||
*
|
||||
* @param $snippet
|
||||
* A portion of a WHERE clause as a prepared statement. It must use named placeholders,
|
||||
* A portion of a WHERE clause as a prepared statement. It must use named placeholders,
|
||||
* not ? placeholders.
|
||||
* @param $args
|
||||
* An associative array of arguments.
|
||||
|
@ -50,7 +50,7 @@ interface QueryConditionInterface {
|
|||
/**
|
||||
* Gets a complete list of all conditions in this conditional clause.
|
||||
*
|
||||
* This method returns by reference. That allows alter hooks to access the
|
||||
* This method returns by reference. That allows alter hooks to access the
|
||||
* data structure directly and manipulate it before it gets compiled.
|
||||
*
|
||||
* The data structure that is returned is an indexed array of entries, where
|
||||
|
@ -100,10 +100,10 @@ interface QueryAlterableInterface {
|
|||
/**
|
||||
* Adds a tag to a query.
|
||||
*
|
||||
* Tags are strings that identify a query. A query may have any number of
|
||||
* tags. Tags are used to mark a query so that alter hooks may decide if they
|
||||
* wish to take action. Tags should be all lower-case and contain only letters,
|
||||
* numbers, and underscore, and start with a letter. That is, they should
|
||||
* Tags are strings that identify a query. A query may have any number of
|
||||
* tags. Tags are used to mark a query so that alter hooks may decide if they
|
||||
* wish to take action. Tags should be all lower-case and contain only letters,
|
||||
* numbers, and underscore, and start with a letter. That is, they should
|
||||
* follow the same rules as PHP identifiers in general.
|
||||
*
|
||||
* @param $tag
|
||||
|
@ -146,14 +146,14 @@ interface QueryAlterableInterface {
|
|||
* Adds additional metadata to the query.
|
||||
*
|
||||
* Often, a query may need to provide additional contextual data to alter
|
||||
* hooks. Alter hooks may then use that information to decide if and how
|
||||
* hooks. Alter hooks may then use that information to decide if and how
|
||||
* to take action.
|
||||
*
|
||||
* @param $key
|
||||
* The unique identifier for this piece of metadata. Must be a string that
|
||||
* The unique identifier for this piece of metadata. Must be a string that
|
||||
* follows the same rules as any other PHP identifier.
|
||||
* @param $object
|
||||
* The additional data to add to the query. May be any valid PHP variable.
|
||||
* The additional data to add to the query. May be any valid PHP variable.
|
||||
*
|
||||
*/
|
||||
public function addMetaData($key, $object);
|
||||
|
@ -219,7 +219,7 @@ class InsertQuery extends Query {
|
|||
protected $table;
|
||||
|
||||
/**
|
||||
* Whether or not this query is "delay-safe". Different database drivers
|
||||
* Whether or not this query is "delay-safe". Different database drivers
|
||||
* may or may not implement this feature in their own ways.
|
||||
*
|
||||
* @var boolean
|
||||
|
@ -243,10 +243,10 @@ class InsertQuery extends Query {
|
|||
/**
|
||||
* A nested array of values to insert.
|
||||
*
|
||||
* $insertValues itself is an array of arrays. Each sub-array is an array of
|
||||
* field names to values to insert. Whether multiple insert sets
|
||||
* $insertValues itself is an array of arrays. Each sub-array is an array of
|
||||
* field names to values to insert. Whether multiple insert sets
|
||||
* will be run in a single query or multiple queries is left to individual drivers
|
||||
* to implement in whatever manner is most efficient. The order of values in each
|
||||
* to implement in whatever manner is most efficient. The order of values in each
|
||||
* sub-array must match the order of fields in $insertFields.
|
||||
*
|
||||
* @var string
|
||||
|
@ -263,18 +263,18 @@ class InsertQuery extends Query {
|
|||
/**
|
||||
* Add a set of field->value pairs to be inserted.
|
||||
*
|
||||
* This method may only be called once. Calling it a second time will be
|
||||
* ignored. To queue up multiple sets of values to be inserted at once,
|
||||
* This method may only be called once. Calling it a second time will be
|
||||
* ignored. To queue up multiple sets of values to be inserted at once,
|
||||
* use the values() method.
|
||||
*
|
||||
* @param $fields
|
||||
* An array of fields on which to insert. This array may be indexed or
|
||||
* associative. If indexed, the array is taken to be the list of fields.
|
||||
* An array of fields on which to insert. This array may be indexed or
|
||||
* associative. If indexed, the array is taken to be the list of fields.
|
||||
* If associative, the keys of the array are taken to be the fields and
|
||||
* the values are taken to be corresponding values to insert. If a
|
||||
* the values are taken to be corresponding values to insert. If a
|
||||
* $values argument is provided, $fields must be indexed.
|
||||
* @param $values
|
||||
* An array of fields to insert into the database. The values must be
|
||||
* An array of fields to insert into the database. The values must be
|
||||
* specified in the same order as the $fields array.
|
||||
* @return
|
||||
* The called object.
|
||||
|
@ -300,7 +300,7 @@ class InsertQuery extends Query {
|
|||
* Add another set of values to the query to be inserted.
|
||||
*
|
||||
* If $values is a numeric array, it will be assumed to be in the same
|
||||
* order as the original fields() call. If it is associative, it may be
|
||||
* order as the original fields() call. If it is associative, it may be
|
||||
* in any order as long as the keys of the array match the names of the
|
||||
* fields.
|
||||
*
|
||||
|
@ -329,7 +329,7 @@ class InsertQuery extends Query {
|
|||
*
|
||||
* If you want to force a given field to use the database-defined default,
|
||||
* not NULL or undefined, use this method to instruct the database to use
|
||||
* default values explicitly. In most cases this will not be necessary
|
||||
* default values explicitly. In most cases this will not be necessary
|
||||
* unless you are inserting a row that is all default values, as you cannot
|
||||
* specify no values in an INSERT query.
|
||||
*
|
||||
|
@ -351,17 +351,17 @@ class InsertQuery extends Query {
|
|||
* Flag this query as being delay-safe or not.
|
||||
*
|
||||
* If this method is never called, it is assumed that the query must be
|
||||
* executed immediately. If delay is set to TRUE, then the query will be
|
||||
* executed immediately. If delay is set to TRUE, then the query will be
|
||||
* flagged to run "delayed" or "low priority" on databases that support such
|
||||
* capabilities. In that case, the database will return immediately and the
|
||||
* query will be run at some point in the future. That makes it useful for
|
||||
* capabilities. In that case, the database will return immediately and the
|
||||
* query will be run at some point in the future. That makes it useful for
|
||||
* logging-style queries.
|
||||
*
|
||||
* If the database does not support delayed INSERT queries, this method
|
||||
* has no effect.
|
||||
*
|
||||
* Note that for a delayed query there is no serial ID returned, as it won't
|
||||
* be created until later when the query runs. It should therefore not be
|
||||
* be created until later when the query runs. It should therefore not be
|
||||
* used if the value of the ID is known.
|
||||
*
|
||||
* @param $delay
|
||||
|
@ -378,9 +378,9 @@ class InsertQuery extends Query {
|
|||
* Executes the insert query.
|
||||
*
|
||||
* @return
|
||||
* The last insert ID of the query, if one exists. If the query
|
||||
* The last insert ID of the query, if one exists. If the query
|
||||
* was given multiple sets of values to insert, the return value is
|
||||
* undefined. If the query is flagged "delayed", then the insert ID
|
||||
* undefined. If the query is flagged "delayed", then the insert ID
|
||||
* won't be created until later when the query actually runs so the
|
||||
* return value is also undefined. If no fields are specified, this
|
||||
* method will do nothing and return NULL. That makes it safe to use
|
||||
|
@ -400,8 +400,8 @@ class InsertQuery extends Query {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// Each insert happens in its own query in the degenerate case. However,
|
||||
// we wrap it in a transaction so that it is atomic where possible. On many
|
||||
// Each insert happens in its own query in the degenerate case. However,
|
||||
// we wrap it in a transaction so that it is atomic where possible. On many
|
||||
// databases, such as SQLite, this is also a notable performance boost.
|
||||
$transaction = $this->connection->startTransaction();
|
||||
$sql = (string)$this;
|
||||
|
@ -495,8 +495,8 @@ class MergeQuery extends Query {
|
|||
/**
|
||||
* Set the field->value pairs to be merged into the table.
|
||||
*
|
||||
* This method should only be called once. It may be called either
|
||||
* with a single associative array or two indexed arrays. If called
|
||||
* This method should only be called once. It may be called either
|
||||
* with a single associative array or two indexed arrays. If called
|
||||
* with an associative array, the keys are taken to be the fields
|
||||
* and the values are taken to be the corresponding values to set.
|
||||
* If called with two arrays, the first array is taken as the fields
|
||||
|
@ -505,7 +505,7 @@ class MergeQuery extends Query {
|
|||
* @param $fields
|
||||
* An array of fields to set.
|
||||
* @param $values
|
||||
* An array of fields to set into the database. The values must be
|
||||
* An array of fields to set into the database. The values must be
|
||||
* specified in the same order as the $fields array.
|
||||
* @return
|
||||
* The called object.
|
||||
|
@ -522,24 +522,24 @@ class MergeQuery extends Query {
|
|||
/**
|
||||
* Set the key field(s) to be used to insert or update into the table.
|
||||
*
|
||||
* This method should only be called once. It may be called either
|
||||
* with a single associative array or two indexed arrays. If called
|
||||
* This method should only be called once. It may be called either
|
||||
* with a single associative array or two indexed arrays. If called
|
||||
* with an associative array, the keys are taken to be the fields
|
||||
* and the values are taken to be the corresponding values to set.
|
||||
* If called with two arrays, the first array is taken as the fields
|
||||
* and the second array is taken as the corresponding values.
|
||||
*
|
||||
* These fields are the "pivot" fields of the query. Typically they
|
||||
* will be the fields of the primary key. If the record does not
|
||||
* These fields are the "pivot" fields of the query. Typically they
|
||||
* will be the fields of the primary key. If the record does not
|
||||
* yet exist, they will be inserted into the table along with the
|
||||
* values set in the fields() method. If the record does exist,
|
||||
* values set in the fields() method. If the record does exist,
|
||||
* these fields will be used in the WHERE clause to select the
|
||||
* record to update.
|
||||
*
|
||||
* @param $fields
|
||||
* An array of fields to set.
|
||||
* @param $values
|
||||
* An array of fields to set into the database. The values must be
|
||||
* An array of fields to set into the database. The values must be
|
||||
* specified in the same order as the $fields array.
|
||||
* @return
|
||||
* The called object.
|
||||
|
@ -557,13 +557,13 @@ class MergeQuery extends Query {
|
|||
* Specify fields to update in case of a duplicate record.
|
||||
*
|
||||
* If a record with the values in keys() already exists, the fields and values
|
||||
* specified here will be updated in that record. If this method is not called,
|
||||
* specified here will be updated in that record. If this method is not called,
|
||||
* it defaults to the same values as were passed to the fields() method.
|
||||
*
|
||||
* @param $fields
|
||||
* An array of fields to set.
|
||||
* @param $values
|
||||
* An array of fields to set into the database. The values must be
|
||||
* An array of fields to set into the database. The values must be
|
||||
* specified in the same order as the $fields array.
|
||||
* @return
|
||||
* The called object.
|
||||
|
@ -586,7 +586,7 @@ class MergeQuery extends Query {
|
|||
* is, calling this method is equivalent to calling update() with identical
|
||||
* parameters as fields() minus the keys specified here.
|
||||
*
|
||||
* The update() method takes precedent over this method. If update() is called,
|
||||
* The update() method takes precedent over this method. If update() is called,
|
||||
* this method has no effect.
|
||||
*
|
||||
* @param $exclude_fields
|
||||
|
@ -609,14 +609,14 @@ class MergeQuery extends Query {
|
|||
/**
|
||||
* Specify fields to be updated as an expression.
|
||||
*
|
||||
* Expression fields are cases such as counter=counter+1. This method only
|
||||
* applies if a duplicate key is detected. This method takes precedent over
|
||||
* Expression fields are cases such as counter=counter+1. This method only
|
||||
* applies if a duplicate key is detected. This method takes precedent over
|
||||
* both update() and updateExcept().
|
||||
*
|
||||
* @param $field
|
||||
* The field to set.
|
||||
* @param $expression
|
||||
* The field will be set to the value of this expression. This parameter
|
||||
* The field will be set to the value of this expression. This parameter
|
||||
* may include named placeholders.
|
||||
* @param $arguments
|
||||
* If specified, this is an array of key/value pairs for named placeholders
|
||||
|
@ -638,7 +638,7 @@ class MergeQuery extends Query {
|
|||
// In the degenerate case of this query type, we have to run multiple
|
||||
// queries as there is no universal single-query mechanism that will work.
|
||||
// Our degenerate case is not designed for performance efficiency but
|
||||
// for comprehensibility. Any practical database driver will override
|
||||
// for comprehensibility. Any practical database driver will override
|
||||
// this method with database-specific logic, so this function serves only
|
||||
// as a fallback to aid developers of new drivers.
|
||||
|
||||
|
@ -712,7 +712,7 @@ class DeleteQuery extends Query implements QueryConditionInterface {
|
|||
protected $table;
|
||||
|
||||
/**
|
||||
* The condition object for this query. Condition handling is handled via
|
||||
* The condition object for this query. Condition handling is handled via
|
||||
* composition.
|
||||
*
|
||||
* @var DatabaseCondition
|
||||
|
@ -803,7 +803,7 @@ class UpdateQuery extends Query implements QueryConditionInterface {
|
|||
protected $arguments = array();
|
||||
|
||||
/**
|
||||
* The condition object for this query. Condition handling is handled via
|
||||
* The condition object for this query. Condition handling is handled via
|
||||
* composition.
|
||||
*
|
||||
* @var DatabaseCondition
|
||||
|
@ -861,7 +861,7 @@ class UpdateQuery extends Query implements QueryConditionInterface {
|
|||
* Add a set of field->value pairs to be updated.
|
||||
*
|
||||
* @param $fields
|
||||
* An associative array of fields to write into the database. The array keys
|
||||
* An associative array of fields to write into the database. The array keys
|
||||
* are the field names while the values are the values to which to set them.
|
||||
* @return
|
||||
* The called object.
|
||||
|
@ -874,13 +874,13 @@ class UpdateQuery extends Query implements QueryConditionInterface {
|
|||
/**
|
||||
* Specify fields to be updated as an expression.
|
||||
*
|
||||
* Expression fields are cases such as counter=counter+1. This method takes
|
||||
* Expression fields are cases such as counter=counter+1. This method takes
|
||||
* precedence over fields().
|
||||
*
|
||||
* @param $field
|
||||
* The field to set.
|
||||
* @param $expression
|
||||
* The field will be set to the value of this expression. This parameter
|
||||
* The field will be set to the value of this expression. This parameter
|
||||
* may include named placeholders.
|
||||
* @param $arguments
|
||||
* If specified, this is an array of key/value pairs for named placeholders
|
||||
|
@ -968,7 +968,7 @@ class DatabaseCondition implements QueryConditionInterface, Countable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the size of this conditional. This is part of the Countable interface.
|
||||
* Return the size of this conditional. This is part of the Countable interface.
|
||||
*
|
||||
* The size of the conditional is the size of its conditional array minus
|
||||
* one, because one element is the the conjunction.
|
||||
|
@ -1014,9 +1014,9 @@ class DatabaseCondition implements QueryConditionInterface, Countable {
|
|||
|
||||
public function compile(DatabaseConnection $connection) {
|
||||
// This value is static, so it will increment across the entire request
|
||||
// rather than just this query. That is OK, because we only need definitive
|
||||
// rather than just this query. That is OK, because we only need definitive
|
||||
// placeholder names if we're going to use them for _alter hooks, which we
|
||||
// are not. The alter hook would intervene before compilation.
|
||||
// are not. The alter hook would intervene before compilation.
|
||||
static $next_placeholder = 1;
|
||||
|
||||
if ($this->changed) {
|
||||
|
@ -1061,7 +1061,7 @@ class DatabaseCondition implements QueryConditionInterface, Countable {
|
|||
$arguments += $condition['value']->arguments();
|
||||
}
|
||||
// We assume that if there is a delimiter, then the value is an
|
||||
// array. If not, it is a scalar. For simplicity, we first convert
|
||||
// array. If not, it is a scalar. For simplicity, we first convert
|
||||
// up to an array so that we can build the placeholders in the same way.
|
||||
elseif (!$operator['delimiter']) {
|
||||
$condition['value'] = array($condition['value']);
|
||||
|
@ -1096,11 +1096,11 @@ class DatabaseCondition implements QueryConditionInterface, Countable {
|
|||
* Gets any special processing requirements for the condition operator.
|
||||
*
|
||||
* Some condition types require special processing, such as IN, because
|
||||
* the value data they pass in is not a simple value. This is a simple
|
||||
* the value data they pass in is not a simple value. This is a simple
|
||||
* overridable lookup function.
|
||||
*
|
||||
* @param $operator
|
||||
* The condition operator, such as "IN", "BETWEEN", etc. Case-sensitive.
|
||||
* The condition operator, such as "IN", "BETWEEN", etc. Case-sensitive.
|
||||
* @return
|
||||
* The extra handling directives for the specified operator, or NULL.
|
||||
*/
|
||||
|
|
|
@ -27,25 +27,25 @@
|
|||
*
|
||||
* - 'description': A string describing this table and its purpose.
|
||||
* References to other tables should be enclosed in
|
||||
* curly-brackets. For example, the node_revisions table
|
||||
* curly-brackets. For example, the node_revisions table
|
||||
* description field might contain "Stores per-revision title and
|
||||
* body data for each {node}."
|
||||
* - 'fields': An associative array ('fieldname' => specification)
|
||||
* that describes the table's database columns. The specification
|
||||
* is also an array. The following specification parameters are defined:
|
||||
* that describes the table's database columns. The specification
|
||||
* is also an array. The following specification parameters are defined:
|
||||
*
|
||||
* - 'description': A string describing this field and its purpose.
|
||||
* References to other tables should be enclosed in
|
||||
* curly-brackets. For example, the node table vid field
|
||||
* curly-brackets. For example, the node table vid field
|
||||
* description might contain "Always holds the largest (most
|
||||
* recent) {node_revision}.vid value for this nid."
|
||||
* - 'type': The generic datatype: 'varchar', 'int', 'serial'
|
||||
* 'float', 'numeric', 'text', 'blob' or 'datetime'. Most types
|
||||
* 'float', 'numeric', 'text', 'blob' or 'datetime'. Most types
|
||||
* just map to the according database engine specific
|
||||
* datatypes. Use 'serial' for auto incrementing fields. This
|
||||
* datatypes. Use 'serial' for auto incrementing fields. This
|
||||
* will expand to 'int auto_increment' on mysql.
|
||||
* - 'size': The data size: 'tiny', 'small', 'medium', 'normal',
|
||||
* 'big'. This is a hint about the largest value the field will
|
||||
* 'big'. This is a hint about the largest value the field will
|
||||
* store and determines which of the database engine specific
|
||||
* datatypes will be used (e.g. on MySQL, TINYINT vs. INT vs. BIGINT).
|
||||
* 'normal', the default, selects the base type (e.g. on MySQL,
|
||||
|
@ -54,21 +54,21 @@
|
|||
* Not all sizes are available for all data types. See
|
||||
* db_type_map() for possible combinations.
|
||||
* - 'not null': If true, no NULL values will be allowed in this
|
||||
* database column. Defaults to false.
|
||||
* - 'default': The field's default value. The PHP type of the
|
||||
* value matters: '', '0', and 0 are all different. If you
|
||||
* database column. Defaults to false.
|
||||
* - 'default': The field's default value. The PHP type of the
|
||||
* value matters: '', '0', and 0 are all different. If you
|
||||
* specify '0' as the default value for a type 'int' field it
|
||||
* will not work because '0' is a string containing the
|
||||
* character "zero", not an integer.
|
||||
* - 'length': The maximal length of a type 'varchar' or 'text'
|
||||
* field. Ignored for other field types.
|
||||
* field. Ignored for other field types.
|
||||
* - 'unsigned': A boolean indicating whether a type 'int', 'float'
|
||||
* and 'numeric' only is signed or unsigned. Defaults to
|
||||
* FALSE. Ignored for other field types.
|
||||
* and 'numeric' only is signed or unsigned. Defaults to
|
||||
* FALSE. Ignored for other field types.
|
||||
* - 'precision', 'scale': For type 'numeric' fields, indicates
|
||||
* the precision (total number of significant digits) and scale
|
||||
* (decimal digits right of the decimal point). Both values are
|
||||
* mandatory. Ignored for other field types.
|
||||
* (decimal digits right of the decimal point). Both values are
|
||||
* mandatory. Ignored for other field types.
|
||||
*
|
||||
* All parameters apart from 'type' are optional except that type
|
||||
* 'numeric' columns must specify 'precision' and 'scale'.
|
||||
|
@ -76,10 +76,10 @@
|
|||
* - 'primary key': An array of one or more key column specifiers (see below)
|
||||
* that form the primary key.
|
||||
* - 'unique key': An associative array of unique keys ('keyname' =>
|
||||
* specification). Each specification is an array of one or more
|
||||
* specification). Each specification is an array of one or more
|
||||
* key column specifiers (see below) that form a unique key on the table.
|
||||
* - 'indexes': An associative array of indexes ('indexame' =>
|
||||
* specification). Each specification is an array of one or more
|
||||
* specification). Each specification is an array of one or more
|
||||
* key column specifiers (see below) that form an index on the
|
||||
* table.
|
||||
*
|
||||
|
@ -88,7 +88,7 @@
|
|||
* of the named column.
|
||||
*
|
||||
* As an example, here is a SUBSET of the schema definition for
|
||||
* Drupal's 'node' table. It show four fields (nid, vid, type, and
|
||||
* Drupal's 'node' table. It show four fields (nid, vid, type, and
|
||||
* title), the primary key on field 'nid', a unique key named 'vid' on
|
||||
* field 'vid', and two indexes, one named 'nid' on field 'nid' and
|
||||
* one named 'node_title_type' on the field 'title' and the first four
|
||||
|
@ -180,7 +180,7 @@ abstract class DatabaseSchema {
|
|||
* @param $keys_new
|
||||
* Optional keys and indexes specification to be created on the
|
||||
* table along with adding the field. The format is the same as a
|
||||
* table specification but without the 'fields' element. If you are
|
||||
* table specification but without the 'fields' element. If you are
|
||||
* adding a type 'serial' field, you MUST specify at least one key
|
||||
* or index including it in this array. @see db_change_field for more
|
||||
* explanation why.
|
||||
|
@ -321,7 +321,7 @@ abstract class DatabaseSchema {
|
|||
* );
|
||||
* @endcode
|
||||
* and you want to change foo.bar to be type serial, leaving it as the
|
||||
* primary key. The correct sequence is:
|
||||
* primary key. The correct sequence is:
|
||||
* @code
|
||||
* db_drop_primary_key($ret, 'foo');
|
||||
* db_change_field($ret, 'foo', 'bar', 'bar',
|
||||
|
@ -336,10 +336,10 @@ abstract class DatabaseSchema {
|
|||
* sequences (from serial-type fields) that use the changed field to be dropped.
|
||||
*
|
||||
* On MySQL, all type 'serial' fields must be part of at least one key
|
||||
* or index as soon as they are created. You cannot use
|
||||
* or index as soon as they are created. You cannot use
|
||||
* db_add_{primary_key,unique_key,index}() for this purpose because
|
||||
* the ALTER TABLE command will fail to add the column without a key
|
||||
* or index specification. The solution is to use the optional
|
||||
* or index specification. The solution is to use the optional
|
||||
* $keys_new argument to create the key or index at the same time as
|
||||
* field.
|
||||
*
|
||||
|
|
|
@ -28,8 +28,8 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
/**
|
||||
* The tables against which to JOIN.
|
||||
*
|
||||
* This property is a nested array. Each entry is an array representing
|
||||
* a single table against which to join. The structure of each entry is:
|
||||
* This property is a nested array. Each entry is an array representing
|
||||
* a single table against which to join. The structure of each entry is:
|
||||
*
|
||||
* array(
|
||||
* 'type' => $join_type (one of INNER, LEFT OUTER, RIGHT OUTER),
|
||||
|
@ -40,7 +40,7 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* 'all_fields' => TRUE to SELECT $alias.*, FALSE or NULL otherwise.
|
||||
* )
|
||||
*
|
||||
* If $table is a string, it is taken as the name of a table. If it is
|
||||
* If $table is a string, it is taken as the name of a table. If it is
|
||||
* a SelectQuery object, it is taken as a subquery.
|
||||
*
|
||||
* @var array
|
||||
|
@ -50,7 +50,7 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
/**
|
||||
* The fields by which to order this query.
|
||||
*
|
||||
* This is an associative array. The keys are the fields to order, and the value
|
||||
* This is an associative array. The keys are the fields to order, and the value
|
||||
* is the direction to order, either ASC or DESC.
|
||||
*
|
||||
* @var array
|
||||
|
@ -186,7 +186,7 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* Returns a reference to the fields array for this query.
|
||||
*
|
||||
* Because this method returns by reference, alter hooks may edit the fields
|
||||
* array directly to make their changes. If just adding fields, however, the
|
||||
* array directly to make their changes. If just adding fields, however, the
|
||||
* use of addField() is preferred.
|
||||
*
|
||||
* Note that this method must be called by reference as well:
|
||||
|
@ -206,7 +206,7 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* Returns a reference to the expressions array for this query.
|
||||
*
|
||||
* Because this method returns by reference, alter hooks may edit the expressions
|
||||
* array directly to make their changes. If just adding expressions, however, the
|
||||
* array directly to make their changes. If just adding expressions, however, the
|
||||
* use of addExpression() is preferred.
|
||||
*
|
||||
* Note that this method must be called by reference as well:
|
||||
|
@ -226,7 +226,7 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* Returns a reference to the order by array for this query.
|
||||
*
|
||||
* Because this method returns by reference, alter hooks may edit the order-by
|
||||
* array directly to make their changes. If just adding additional ordering
|
||||
* array directly to make their changes. If just adding additional ordering
|
||||
* fields, however, the use of orderBy() is preferred.
|
||||
*
|
||||
* Note that this method must be called by reference as well:
|
||||
|
@ -246,7 +246,7 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* Returns a reference to the tables array for this query.
|
||||
*
|
||||
* Because this method returns by reference, alter hooks may edit the tables
|
||||
* array directly to make their changes. If just adding tables, however, the
|
||||
* array directly to make their changes. If just adding tables, however, the
|
||||
* use of the join() methods is preferred.
|
||||
*
|
||||
* Note that this method must be called by reference as well:
|
||||
|
@ -318,14 +318,14 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* Adds a field to the list to be SELECTed.
|
||||
*
|
||||
* @param $table_alias
|
||||
* The name of the table from which the field comes, as an alias. Generally
|
||||
* The name of the table from which the field comes, as an alias. Generally
|
||||
* you will want to use the return value of join() here to ensure that it is
|
||||
* valid.
|
||||
* @param $field
|
||||
* The name of the field.
|
||||
* @param $alias
|
||||
* The alias for this field. If not specified, one will be generated
|
||||
* automatically based on the $table_alias and $field. The alias will be
|
||||
* The alias for this field. If not specified, one will be generated
|
||||
* automatically based on the $table_alias and $field. The alias will be
|
||||
* checked for uniqueness, so the requested alias may not be the alias
|
||||
* that is assigned in all cases.
|
||||
* @return
|
||||
|
@ -362,20 +362,20 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
/**
|
||||
* Add multiple fields from the same table to be SELECTed.
|
||||
*
|
||||
* This method does not return the aliases set for the passed fields. In the
|
||||
* This method does not return the aliases set for the passed fields. In the
|
||||
* majority of cases that is not a problem, as the alias will be the field
|
||||
* name. However, if you do need to know the alias you can call getFields()
|
||||
* and examine the result to determine what alias was created. Alternatively,
|
||||
* name. However, if you do need to know the alias you can call getFields()
|
||||
* and examine the result to determine what alias was created. Alternatively,
|
||||
* simply use addField() for the few fields you care about and this method for
|
||||
* the rest.
|
||||
*
|
||||
* @param $table_alias
|
||||
* The name of the table from which the field comes, as an alias. Generally
|
||||
* The name of the table from which the field comes, as an alias. Generally
|
||||
* you will want to use the return value of join() here to ensure that it is
|
||||
* valid.
|
||||
* @param $fields
|
||||
* An indexed array of fields present in the specified table that should be
|
||||
* included in this query. If not specified, $table_alias.* will be generated
|
||||
* included in this query. If not specified, $table_alias.* will be generated
|
||||
* without any aliases.
|
||||
* @return
|
||||
* The called object.
|
||||
|
@ -406,15 +406,15 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
/**
|
||||
* Adds an expression to the list of "fields" to be SELECTed.
|
||||
*
|
||||
* An expression can be any arbitrary string that is valid SQL. That includes
|
||||
* various functions, which may in some cases be database-dependant. This
|
||||
* An expression can be any arbitrary string that is valid SQL. That includes
|
||||
* various functions, which may in some cases be database-dependant. This
|
||||
* method makes no effort to correct for database-specific functions.
|
||||
*
|
||||
* @param $expression
|
||||
* The expression string. May contain placeholders.
|
||||
* The expression string. May contain placeholders.
|
||||
* @param $alias
|
||||
* The alias for this expression. If not specified, one will be generated
|
||||
* automatically in the form "expression_#". The alias will be checked for
|
||||
* The alias for this expression. If not specified, one will be generated
|
||||
* automatically in the form "expression_#". The alias will be checked for
|
||||
* uniqueness, so the requested alias may not be the alias that is assigned
|
||||
* in all cases.
|
||||
* @param $arguments
|
||||
|
@ -451,12 +451,12 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* @param $table
|
||||
* The table against which to join.
|
||||
* @param $alias
|
||||
* The alias for the table. In most cases this should be the first letter
|
||||
* The alias for the table. In most cases this should be the first letter
|
||||
* of the table, or the first letter of each "word" in the table.
|
||||
* @param $condition
|
||||
* The condition on which to join this table. If the join requires values,
|
||||
* The condition on which to join this table. If the join requires values,
|
||||
* this clause should use a named placeholder and the value or values to
|
||||
* insert should be passed in the 4th parameter. For the first table joined
|
||||
* insert should be passed in the 4th parameter. For the first table joined
|
||||
* on a query, this value is ignored as the first table is taken as the base
|
||||
* table.
|
||||
* @param $arguments
|
||||
|
@ -474,12 +474,12 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* @param $table
|
||||
* The table against which to join.
|
||||
* @param $alias
|
||||
* The alias for the table. In most cases this should be the first letter
|
||||
* The alias for the table. In most cases this should be the first letter
|
||||
* of the table, or the first letter of each "word" in the table.
|
||||
* @param $condition
|
||||
* The condition on which to join this table. If the join requires values,
|
||||
* The condition on which to join this table. If the join requires values,
|
||||
* this clause should use a named placeholder and the value or values to
|
||||
* insert should be passed in the 4th parameter. For the first table joined
|
||||
* insert should be passed in the 4th parameter. For the first table joined
|
||||
* on a query, this value is ignored as the first table is taken as the base
|
||||
* table.
|
||||
* @param $arguments
|
||||
|
@ -497,12 +497,12 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* @param $table
|
||||
* The table against which to join.
|
||||
* @param $alias
|
||||
* The alias for the table. In most cases this should be the first letter
|
||||
* The alias for the table. In most cases this should be the first letter
|
||||
* of the table, or the first letter of each "word" in the table.
|
||||
* @param $condition
|
||||
* The condition on which to join this table. If the join requires values,
|
||||
* The condition on which to join this table. If the join requires values,
|
||||
* this clause should use a named placeholder and the value or values to
|
||||
* insert should be passed in the 4th parameter. For the first table joined
|
||||
* insert should be passed in the 4th parameter. For the first table joined
|
||||
* on a query, this value is ignored as the first table is taken as the base
|
||||
* table.
|
||||
* @param $arguments
|
||||
|
@ -520,12 +520,12 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* @param $table
|
||||
* The table against which to join.
|
||||
* @param $alias
|
||||
* The alias for the table. In most cases this should be the first letter
|
||||
* The alias for the table. In most cases this should be the first letter
|
||||
* of the table, or the first letter of each "word" in the table.
|
||||
* @param $condition
|
||||
* The condition on which to join this table. If the join requires values,
|
||||
* The condition on which to join this table. If the join requires values,
|
||||
* this clause should use a named placeholder and the value or values to
|
||||
* insert should be passed in the 4th parameter. For the first table joined
|
||||
* insert should be passed in the 4th parameter. For the first table joined
|
||||
* on a query, this value is ignored as the first table is taken as the base
|
||||
* table.
|
||||
* @param $arguments
|
||||
|
@ -545,18 +545,18 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* fields on which to join.
|
||||
*
|
||||
* @param $type
|
||||
* The type of join. Typically one one of INNER, LEFT OUTER, and RIGHT OUTER.
|
||||
* The type of join. Typically one one of INNER, LEFT OUTER, and RIGHT OUTER.
|
||||
* @param $table
|
||||
* The table against which to join. May be a string or another SelectQuery
|
||||
* object. If a query object is passed, it will be used as a subselect.
|
||||
* The table against which to join. May be a string or another SelectQuery
|
||||
* object. If a query object is passed, it will be used as a subselect.
|
||||
* @param $alias
|
||||
* The alias for the table. In most cases this should be the first letter
|
||||
* of the table, or the first letter of each "word" in the table. If omitted,
|
||||
* The alias for the table. In most cases this should be the first letter
|
||||
* of the table, or the first letter of each "word" in the table. If omitted,
|
||||
* one will be dynamically generated.
|
||||
* @param $condition
|
||||
* The condition on which to join this table. If the join requires values,
|
||||
* The condition on which to join this table. If the join requires values,
|
||||
* this clause should use a named placeholder and the value or values to
|
||||
* insert should be passed in the 4th parameter. For the first table joined
|
||||
* insert should be passed in the 4th parameter. For the first table joined
|
||||
* on a query, this value is ignored as the first table is taken as the base
|
||||
* table.
|
||||
* @param $argments
|
||||
|
@ -602,7 +602,7 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* @param $field
|
||||
* The field on which to order.
|
||||
* @param $direction
|
||||
* The direction to sort. Legal values are "ASC" and "DESC".
|
||||
* The direction to sort. Legal values are "ASC" and "DESC".
|
||||
* @return
|
||||
* The called object.
|
||||
*/
|
||||
|
@ -618,7 +618,7 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* directives that have been set.
|
||||
*
|
||||
* @param $start
|
||||
* The first record from the result set to return. If NULL, removes any
|
||||
* The first record from the result set to return. If NULL, removes any
|
||||
* range directives that are set.
|
||||
* @param $limit
|
||||
* The number of records to return from the result set.
|
||||
|
@ -634,7 +634,7 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* Groups the result set by the specified field.
|
||||
*
|
||||
* @param $field
|
||||
* The field on which to group. This should be the field as aliased.
|
||||
* The field on which to group. This should be the field as aliased.
|
||||
* @return
|
||||
* The called object.
|
||||
*/
|
||||
|
@ -649,7 +649,7 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
* A new SelectQuery object with no fields or expressions besides COUNT(*).
|
||||
*/
|
||||
public function countQuery() {
|
||||
// Shallow-clone this query. We don't want to duplicate any of the
|
||||
// Shallow-clone this query. We don't want to duplicate any of the
|
||||
// referenced objects, so a shallow query is all we need.
|
||||
$count = clone($this);
|
||||
|
||||
|
@ -756,7 +756,7 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab
|
|||
}
|
||||
|
||||
public function __clone() {
|
||||
// On cloning, also clone the conditional objects. However, we do not
|
||||
// On cloning, also clone the conditional objects. However, we do not
|
||||
// want to clone the database connection object as that would duplicate the
|
||||
// connection itself.
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
*
|
||||
* Image toolkits are discovered based on the associated module's
|
||||
* hook_image_toolkits. Additionally the image toolkit include file
|
||||
* must be identified in the files array in the module.info file. The
|
||||
* must be identified in the files array in the module.info file. The
|
||||
* toolkit must then be enabled using the admin/settings/image-toolkit
|
||||
* form.
|
||||
*
|
||||
|
@ -139,7 +139,7 @@ function image_get_info($file) {
|
|||
/**
|
||||
* Scales an image to the exact width and height given. Achieves the
|
||||
* target aspect ratio by cropping the original image equally on both
|
||||
* sides, or equally on the top and bottom. This function is, for
|
||||
* sides, or equally on the top and bottom. This function is, for
|
||||
* example, useful to create uniform sized avatars from larger images.
|
||||
*
|
||||
* The resulting image always has the exact target dimensions.
|
||||
|
|
|
@ -207,7 +207,7 @@ function drupal_detect_database_types() {
|
|||
$databases = array();
|
||||
|
||||
// We define a driver as a directory in /includes/database that in turn
|
||||
// contains a database.inc file. That allows us to drop in additional drivers
|
||||
// contains a database.inc file. That allows us to drop in additional drivers
|
||||
// without modifying the installer.
|
||||
// Because we have no registry yet, we need to also include the install.inc
|
||||
// file for the driver explicitly.
|
||||
|
|
|
@ -239,9 +239,9 @@ define('MENU_MAX_DEPTH', 9);
|
|||
* part of the path. If the bit is 1, then it represents the original
|
||||
* value while 0 means wildcard. If the path is node/12/edit/foo
|
||||
* then the 1011 bitstring represents node/%/edit/foo where % means that
|
||||
* any argument matches that part. We limit ourselves to using binary
|
||||
* any argument matches that part. We limit ourselves to using binary
|
||||
* numbers that correspond the patterns of wildcards of router items that
|
||||
* actually exists. This list of 'masks' is built in menu_rebuild().
|
||||
* actually exists. This list of 'masks' is built in menu_rebuild().
|
||||
*
|
||||
* @param $parts
|
||||
* An array of path parts, for the above example
|
||||
|
@ -822,7 +822,7 @@ function menu_tree_output($tree) {
|
|||
* @param $menu_name
|
||||
* The named menu links to return
|
||||
* @param $item
|
||||
* A fully loaded menu link, or NULL. If a link is supplied, only the
|
||||
* A fully loaded menu link, or NULL. If a link is supplied, only the
|
||||
* path to root will be included in the returned tree- as if this link
|
||||
* represented the current page in a visible menu.
|
||||
* @return
|
||||
|
@ -887,7 +887,7 @@ function menu_tree_all_data($menu_name = 'navigation', $item = NULL) {
|
|||
// Get all links in this menu.
|
||||
$parents = array();
|
||||
}
|
||||
// Select the links from the table, and recursively build the tree. We
|
||||
// Select the links from the table, and recursively build the tree. We
|
||||
// LEFT JOIN since there is no match in {menu_router} for an external
|
||||
// link.
|
||||
$data['tree'] = menu_tree_data($query->execute(), $parents);
|
||||
|
@ -1621,7 +1621,7 @@ function menu_set_active_trail($new_trail = NULL) {
|
|||
if ($item['tab_parent']) {
|
||||
// The title of a local task is used for the tab, never the page title.
|
||||
// Thus, replace it with the item corresponding to the root path to get
|
||||
// the relevant href and title. For example, the menu item corresponding
|
||||
// the relevant href and title. For example, the menu item corresponding
|
||||
// to 'admin' is used when on the 'By module' tab at 'admin/by-module'.
|
||||
$parts = explode('/', $item['tab_root']);
|
||||
$args = arg();
|
||||
|
@ -1759,7 +1759,7 @@ function menu_cache_clear($menu_name = 'navigation') {
|
|||
}
|
||||
|
||||
/**
|
||||
* Clears all cached menu data. This should be called any time broad changes
|
||||
* Clears all cached menu data. This should be called any time broad changes
|
||||
* might have been made to the router items or menu links.
|
||||
*/
|
||||
function menu_cache_clear_all() {
|
||||
|
|
|
@ -392,7 +392,7 @@ function module_hook($module, $hook) {
|
|||
* MODULE_IMPLEMENTS_WRITE_CACHE: Write the stored list of hook
|
||||
* implementations into the cache_registry table.
|
||||
* @param $sort
|
||||
* By default, modules are ordered by weight and filename. By setting this
|
||||
* By default, modules are ordered by weight and filename. By setting this
|
||||
* option to TRUE, modules will be ordered by module name.
|
||||
* @return
|
||||
* An array with the names of the modules which are implementing this hook.
|
||||
|
|
|
@ -218,7 +218,7 @@ function user_check_password($password, $account) {
|
|||
* Check whether a user's hashed password needs to be replaced with a new hash.
|
||||
*
|
||||
* This is typically called during the login process when the plain text
|
||||
* password is available. A new hash is needed when the desired iteration count
|
||||
* password is available. A new hash is needed when the desired iteration count
|
||||
* has changed through a change in the variable password_count_log2 or
|
||||
* DRUPAL_HASH_COUNT or if the user's password hash was generated in an update
|
||||
* like user_update_7000().
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
function _registry_rebuild() {
|
||||
|
||||
// The registry serves as a central autoloader for all classes, including
|
||||
// the database query builders. However, the registry rebuild process
|
||||
// the database query builders. However, the registry rebuild process
|
||||
// requires write ability to the database, which means having access to the
|
||||
// query builders that require the registry in order to be loaded. That
|
||||
// causes a fatal race condition. Therefore we manually include the
|
||||
// query builders that require the registry in order to be loaded. That
|
||||
// causes a fatal race condition. Therefore we manually include the
|
||||
// appropriate query builders for the currently active database before the
|
||||
// registry rebuild process runs.
|
||||
$connection_info = Database::getConnectionInfo();
|
||||
|
@ -173,7 +173,7 @@ function _registry_parse_file($filename, $contents, $module = '', $weight = 0) {
|
|||
);
|
||||
// Because some systems, such as cache, currently use duplicate function
|
||||
// names in separate files an insert query cannot be used here as it
|
||||
// would cause a key constraint violation. Instead we use a merge query.
|
||||
// would cause a key constraint violation. Instead we use a merge query.
|
||||
// In practice this should not be an issue as those systems all initialize
|
||||
// pre-registry and therefore are never loaded by the registry so it
|
||||
// doesn't matter if those records in the registry table point to one
|
||||
|
|
|
@ -26,7 +26,7 @@ define('MAINTENANCE_MODE', 'install');
|
|||
*/
|
||||
function install_main() {
|
||||
// The user agent header is used to pass a database prefix in the request when
|
||||
// running tests. However, for security reasons, it is imperative that no
|
||||
// running tests. However, for security reasons, it is imperative that no
|
||||
// installation be permitted using such a prefix.
|
||||
if (preg_match("/^simpletest\d+$/", $_SERVER['HTTP_USER_AGENT'])) {
|
||||
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
|
||||
|
@ -69,7 +69,7 @@ function install_main() {
|
|||
require_once DRUPAL_ROOT . '/includes/cache.inc';
|
||||
$conf['cache_inc'] = 'includes/cache.inc';
|
||||
|
||||
// Initialize the database system. Note that the connection
|
||||
// Initialize the database system. Note that the connection
|
||||
// won't be initialized until it is actually requested.
|
||||
require_once DRUPAL_ROOT . '/includes/database/database.inc';
|
||||
|
||||
|
@ -741,7 +741,7 @@ if (Drupal.jsEnabled) {
|
|||
// Build menu to allow clean URL check.
|
||||
menu_rebuild();
|
||||
|
||||
// Cache a fully-built schema. This is necessary for any
|
||||
// Cache a fully-built schema. This is necessary for any
|
||||
// invocation of index.php because: (1) setting cache table
|
||||
// entries requires schema information, (2) that occurs during
|
||||
// bootstrap before any module are loaded, so (3) if there is no
|
||||
|
|
|
@ -9,7 +9,7 @@ Drupal.behaviors.textarea = {
|
|||
}
|
||||
var textarea = $(this).addClass('textarea-processed'), staticOffset = null;
|
||||
|
||||
// When wrapping the text area, work around an IE margin bug. See:
|
||||
// When wrapping the text area, work around an IE margin bug. See:
|
||||
// http://jaspan.com/ie-inherited-margin-bug-form-elements-and-haslayout
|
||||
$(this).wrap('<div class="resizable-textarea"><span></span></div>')
|
||||
.parent().append($('<div class="grippie"></div>').mousedown(startDrag));
|
||||
|
|
|
@ -47,7 +47,7 @@ function _book_install_type_create() {
|
|||
* Drupal 5.x to 6.x update.
|
||||
*
|
||||
* This function moves any existing book hierarchy into the new structure used
|
||||
* in the 6.x module. Rather than storing the hierarchy in the {book} table,
|
||||
* in the 6.x module. Rather than storing the hierarchy in the {book} table,
|
||||
* the menu API is used to store the hierarchy in the {menu_links} table and the
|
||||
* {book} table serves to uniquely connect a node to a menu link.
|
||||
*
|
||||
|
|
|
@ -575,7 +575,7 @@ function book_update_bid($book_link) {
|
|||
* @return
|
||||
* A linear array of menu links in the order that the links are shown in the
|
||||
* menu, so the previous and next pages are the elements before and after the
|
||||
* element corresponding to $node. The children of $node (if any) will come
|
||||
* element corresponding to $node. The children of $node (if any) will come
|
||||
* immediately after it in the array.
|
||||
*/
|
||||
function book_get_flat_menu($book_link) {
|
||||
|
@ -963,7 +963,7 @@ function _book_toc_recurse($tree, $indent, &$toc, $exclude, $depth_limit) {
|
|||
* @param $bid
|
||||
* The ID of the book whose pages are to be listed.
|
||||
* @param $exclude
|
||||
* Optional array of mlid values. Any link whose mlid is in this array
|
||||
* Optional array of mlid values. Any link whose mlid is in this array
|
||||
* will be excluded (along with its children).
|
||||
* @param $depth_limit
|
||||
* Any link deeper than this value will be excluded (along with its children).
|
||||
|
|
|
@ -221,7 +221,7 @@ function book_remove_form_submit($form, &$form_state) {
|
|||
/**
|
||||
* AJAX callback to replace the book parent select options.
|
||||
*
|
||||
* This function is called when the selected book is changed. It updates the
|
||||
* This function is called when the selected book is changed. It updates the
|
||||
* cached form (either the node form or the book outline form) and returns
|
||||
* rendered output to be used to replace the select containing the possible
|
||||
* parent pages in the newly selected book.
|
||||
|
|
|
@ -1508,7 +1508,7 @@ function comment_form(&$form_state, $edit, $title = NULL) {
|
|||
);
|
||||
|
||||
// Only show the save button if comment previews are optional or if we are
|
||||
// already previewing the submission. However, if there are form errors,
|
||||
// already previewing the submission. However, if there are form errors,
|
||||
// we hide the save button no matter what, so that optional form elements
|
||||
// (e.g., captchas) can be updated.
|
||||
if (!form_get_errors() && ((variable_get('comment_preview_' . $node->type, COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview')) || ($op == t('Save')))) {
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
* @param $text
|
||||
* The content to filter (applies to 'prepare' and 'process').
|
||||
* @param $langcode
|
||||
* The language code associated with the content, e.g. 'en' for English. This
|
||||
* The language code associated with the content, e.g. 'en' for English. This
|
||||
* enables filters to be language aware and can be used to implement language
|
||||
* specific text replacements.
|
||||
* @param $cache_id
|
||||
|
|
|
@ -412,7 +412,7 @@ function filter_list_format($format) {
|
|||
* the default format.
|
||||
* @param $langcode
|
||||
* Optional: the language code of the text to be filtered, e.g. 'en' for
|
||||
* English. This allows filters to be language aware so language specific
|
||||
* English. This allows filters to be language aware so language specific
|
||||
* text replacement can be implemented.
|
||||
* @param $check
|
||||
* Whether to check the $format with filter_access() first. Defaults to TRUE.
|
||||
|
|
|
@ -42,7 +42,7 @@ function filter_tips_long() {
|
|||
* @param $long
|
||||
* (optional) Whether the passed in filter tips contain extended explanations,
|
||||
* i.e. intended to be output on the path 'filter/tips' (TRUE), or are in a
|
||||
* short format, i.e. suitable to be displayed below a form element. Defaults
|
||||
* short format, i.e. suitable to be displayed below a form element. Defaults
|
||||
* to FALSE.
|
||||
*
|
||||
* @see _filter_tips()
|
||||
|
|
|
@ -103,7 +103,7 @@ function forum_schema() {
|
|||
/**
|
||||
* Create the forum vocabulary if does not exist. Assign the
|
||||
* vocabulary a low weight so it will appear first in forum topic
|
||||
* create and edit forms. Do not just call forum_enable() because in
|
||||
* create and edit forms. Do not just call forum_enable() because in
|
||||
* future versions it might do something different.
|
||||
*/
|
||||
function forum_update_6000() {
|
||||
|
|
|
@ -165,7 +165,7 @@ function forum_init() {
|
|||
*/
|
||||
function _forum_nodeapi_check_node_type($node, $vocabulary) {
|
||||
// We are going to return if $node->type is not one of the node
|
||||
// types assigned to the forum vocabulary. If forum_nav_vocabulary
|
||||
// types assigned to the forum vocabulary. If forum_nav_vocabulary
|
||||
// is undefined or the vocabulary does not exist, it clearly cannot
|
||||
// be assigned to $node->type, so return to avoid E_ALL warnings.
|
||||
if (empty($vocabulary)) {
|
||||
|
|
|
@ -34,11 +34,11 @@
|
|||
* An array that corresponds to the return of the arg() function - if a module
|
||||
* needs to provide help for a page with additional parameters after the
|
||||
* Drupal path or help for a specific value for a wildcard in the path, then
|
||||
* the values in this array can be referenced. For example you could provide
|
||||
* help for user/1 by looking for the path user/% and $arg[1] == '1'. This
|
||||
* the values in this array can be referenced. For example you could provide
|
||||
* help for user/1 by looking for the path user/% and $arg[1] == '1'. This
|
||||
* array should always be used rather than directly invoking arg(). 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.
|
||||
* empty strings. Regardless, $arg[0] to $arg[11] will always be set.
|
||||
* @return
|
||||
* A localized string containing the help text. Every web link, l(), or
|
||||
* url() must be replaced with %something and put into the final t()
|
||||
|
|
|
@ -117,7 +117,7 @@ function locale_update_6000() {
|
|||
/**
|
||||
* Change locale column to language. The language column is added by
|
||||
* update_fix_d6_requirements() in update.php to avoid a large number
|
||||
* of error messages from update.php. All we need to do here is copy
|
||||
* of error messages from update.php. All we need to do here is copy
|
||||
* locale to language and then drop locale.
|
||||
*/
|
||||
function locale_update_6001() {
|
||||
|
|
|
@ -5,7 +5,7 @@ class LocaleTestCase extends DrupalWebTestCase {
|
|||
function getInfo() {
|
||||
return array(
|
||||
'name' => t('String translate and validate'),
|
||||
'description' => 'Adds a new locale and translates its name. Checks the validation of translation strings.',
|
||||
'description' => 'Adds a new locale and translates its name. Checks the validation of translation strings.',
|
||||
'group' => 'Locale',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* visits the path. If omitted, the parent menu item's callback will be used
|
||||
* instead.
|
||||
* - "page arguments": An array of arguments to pass to the page callback
|
||||
* function. Integer values pass the corresponding URL component (see arg()).
|
||||
* function. Integer values pass the corresponding URL component (see arg()).
|
||||
* - "access callback": A function returning a boolean value that determines
|
||||
* whether the user has access rights to this menu item. Defaults to
|
||||
* user_access() unless a value is inherited from a parent menu item..
|
||||
|
@ -85,8 +85,8 @@ function hook_menu() {
|
|||
* Alter the data being saved to the {menu_router} table after hook_menu is invoked.
|
||||
*
|
||||
* This hook is invoked by menu_router_build(). The menu definitions are passed
|
||||
* in by reference. Each element of the $callbacks array is one item returned
|
||||
* by a module from hook_menu. Additional items may be added, or existing items
|
||||
* in by reference. Each element of the $callbacks array is one item returned
|
||||
* by a module from hook_menu. Additional items may be added, or existing items
|
||||
* altered.
|
||||
*
|
||||
* @param $callbacks
|
||||
|
@ -125,7 +125,7 @@ function hook_menu_link_alter(&$item, $menu) {
|
|||
*
|
||||
* This hook may be used, for example, to add a page-specific query string.
|
||||
* For performance reasons, only links that have $item['options']['alter'] == TRUE
|
||||
* will be passed into this hook. The $item['options']['alter'] flag should
|
||||
* will be passed into this hook. The $item['options']['alter'] flag should
|
||||
* generally be set using hook_menu_link_alter().
|
||||
*
|
||||
* @param $item
|
||||
|
|
|
@ -54,7 +54,7 @@ function theme_node_admin_overview($name, $type) {
|
|||
function node_type_form(&$form_state, $type = NULL) {
|
||||
drupal_add_js(drupal_get_path('module', 'node') .'/content_types.js');
|
||||
if (!isset($type->type)) {
|
||||
// This is a new type. Node module managed types are custom and unlocked.
|
||||
// This is a new type. Node module managed types are custom and unlocked.
|
||||
$type = node_type_set_defaults(array('custom' => 1, 'locked' => 0));
|
||||
}
|
||||
|
||||
|
|
|
@ -561,7 +561,7 @@ function node_admin_nodes_submit($form, &$form_state) {
|
|||
cache_clear_all();
|
||||
}
|
||||
else {
|
||||
// We need to rebuild the form to go to a second step. For example, to
|
||||
// We need to rebuild the form to go to a second step. For example, to
|
||||
// show the confirmation form for the deletion of nodes.
|
||||
$form_state['rebuild'] = TRUE;
|
||||
}
|
||||
|
|
|
@ -739,8 +739,8 @@ function hook_update($node) {
|
|||
* this module), use hook_nodeapi() instead.
|
||||
*
|
||||
* Changes made to the $node object within a hook_validate() function will
|
||||
* have no effect. The preferred method to change a node's content is to use
|
||||
* hook_submit() or hook_nodeapi($op='submit') instead. If it is really
|
||||
* have no effect. The preferred method to change a node's content is to use
|
||||
* hook_submit() or hook_nodeapi($op='submit') instead. If it is really
|
||||
* necessary to change the node at the validate stage, you can use function
|
||||
* form_set_value().
|
||||
*
|
||||
|
|
|
@ -382,7 +382,7 @@ function node_teaser($body, $format = NULL, $size = NULL) {
|
|||
// Initialize it to maximum in order to find the minimum.
|
||||
$min_rpos = $max_rpos;
|
||||
|
||||
// Store the reverse of the teaser. We use strpos on the reversed needle and
|
||||
// Store the reverse of the teaser. We use strpos on the reversed needle and
|
||||
// haystack for speed and convenience.
|
||||
$reversed = strrev($teaser);
|
||||
|
||||
|
@ -417,7 +417,7 @@ function node_teaser($body, $format = NULL, $size = NULL) {
|
|||
|
||||
// If a break point was found in this group, slice and return the teaser.
|
||||
if ($min_rpos !== $max_rpos) {
|
||||
// Don't slice with length 0. Length must be <0 to slice from RHS.
|
||||
// Don't slice with length 0. Length must be <0 to slice from RHS.
|
||||
return ($min_rpos === 0) ? $teaser : substr($teaser, 0, 0 - $min_rpos);
|
||||
}
|
||||
}
|
||||
|
@ -1003,7 +1003,7 @@ function node_save(&$node) {
|
|||
|
||||
// When inserting a node, $node->log must be set because
|
||||
// {node_revision}.log does not (and cannot) have a default
|
||||
// value. If the user does not have permission to create
|
||||
// value. If the user does not have permission to create
|
||||
// revisions, however, the form will not contain an element for
|
||||
// log so $node->log will be unset at this point.
|
||||
if (!isset($node->log)) {
|
||||
|
@ -1011,7 +1011,7 @@ function node_save(&$node) {
|
|||
}
|
||||
|
||||
// For the same reasons, make sure we have $node->teaser and
|
||||
// $node->body. We should consider making these fields nullable
|
||||
// $node->body. We should consider making these fields nullable
|
||||
// in a future version since node types are not required to use them.
|
||||
if (!isset($node->teaser)) {
|
||||
$node->teaser = '';
|
||||
|
@ -3012,4 +3012,4 @@ function node_elements() {
|
|||
*/
|
||||
function theme_node_links($element) {
|
||||
return theme('links', $element['#value'], array('class' => 'links inline'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -434,7 +434,7 @@ function search_index($sid, $type, $text) {
|
|||
global $base_url;
|
||||
$node_regexp = '@href=[\'"]?(?:' . preg_quote($base_url, '@') . '/|' . preg_quote(base_path(), '@') . ')(?:\?q=)?/?((?![a-z]+:)[^\'">]+)[\'">]@i';
|
||||
|
||||
// Multipliers for scores of words inside certain HTML tags. The weights are stored
|
||||
// Multipliers for scores of words inside certain HTML tags. The weights are stored
|
||||
// in a variable so that modules can overwrite the default weights.
|
||||
// Note: 'a' must be included for link ranking to work.
|
||||
$tags = variable_get('search_tag_weights', array(
|
||||
|
@ -585,7 +585,7 @@ function search_index($sid, $type, $text) {
|
|||
// Insert results into search index
|
||||
foreach ($results[0] as $word => $score) {
|
||||
// If a word already exists in the database, its score gets increased
|
||||
// appropriately. If not, we create a new record with the appropriate
|
||||
// appropriately. If not, we create a new record with the appropriate
|
||||
// starting score.
|
||||
db_merge('search_index')->key(array(
|
||||
'word' => $word,
|
||||
|
@ -656,7 +656,7 @@ function search_nodeapi_update_index($node) {
|
|||
* Implementation of hook_nodeapi_update().
|
||||
*/
|
||||
function search_nodeapi_update($node) {
|
||||
// Reindex the node when it is updated. The node is automatically indexed
|
||||
// Reindex the node when it is updated. The node is automatically indexed
|
||||
// when it is added, simply by being added to the node table.
|
||||
search_touch_node($node->nid);
|
||||
}
|
||||
|
@ -880,7 +880,7 @@ function _search_parse_query(&$word, &$scores, $not = FALSE) {
|
|||
* indexed search (and thus, implements hook_update_index()).
|
||||
*
|
||||
* Results are retrieved in two logical passes. However, the two passes are
|
||||
* joined together into a single query. And in the case of most simple
|
||||
* joined together into a single query. And in the case of most simple
|
||||
* queries the second pass is not even used.
|
||||
*
|
||||
* The first pass selects a set of all possible matches, which has the benefit
|
||||
|
|
|
@ -806,7 +806,7 @@ class DrupalWebTestCase {
|
|||
drupal_install_modules($modules);
|
||||
|
||||
// Because the schema is static cached, we need to flush
|
||||
// it between each run. If we don't, then it will contain
|
||||
// it between each run. If we don't, then it will contain
|
||||
// stale data for the previous run's database prefix and all
|
||||
// calls to it will fail.
|
||||
drupal_get_schema(NULL, TRUE);
|
||||
|
@ -1033,8 +1033,8 @@ class DrupalWebTestCase {
|
|||
protected function drupalGet($path, array $options = array(), array $headers = array()) {
|
||||
$options['absolute'] = TRUE;
|
||||
|
||||
// We re-using a CURL connection here. If that connection still has certain
|
||||
// options set, it might change the GET into a POST. Make sure we clear out
|
||||
// We re-using a CURL connection here. If that connection still has certain
|
||||
// options set, it might change the GET into a POST. Make sure we clear out
|
||||
// previous options.
|
||||
$out = $this->curlExec(array(CURLOPT_HTTPGET => TRUE, CURLOPT_URL => url($path, $options), CURLOPT_NOBODY => FALSE, CURLOPT_HTTPHEADER => $headers));
|
||||
$this->refreshVariables(); // Ensure that any changes to variables in the other thread are picked up.
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Dummy class for fetching into a class.
|
||||
*
|
||||
* PDO supports using a new instance of an arbitrary class for records
|
||||
* rather than just a stdClass or array. This class is for testing that
|
||||
* functionality. (See testQueryFetchClass() below)
|
||||
* rather than just a stdClass or array. This class is for testing that
|
||||
* functionality. (See testQueryFetchClass() below)
|
||||
*/
|
||||
class FakeRecord { }
|
||||
|
||||
|
@ -941,7 +941,7 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
|
|||
// This is a very contrived example, as I have no idea why you'd want to
|
||||
// change age this way, but that's beside the point.
|
||||
// Note that we are also double-setting age here, once as a literal and
|
||||
// once as an expression. This test will only pass if the expression wins,
|
||||
// once as an expression. This test will only pass if the expression wins,
|
||||
// which is what is supposed to happen.
|
||||
db_merge('test_people')
|
||||
->key(array('job' => 'Speaker'))
|
||||
|
@ -1446,7 +1446,7 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
|
|||
function testNestedConditions() {
|
||||
// This query should translate to:
|
||||
// "SELECT job FROM {test} WHERE name = 'Paul' AND (age = 26 OR age = 27)"
|
||||
// That should find only one record. Yes it's a non-optimal way of writing
|
||||
// That should find only one record. Yes it's a non-optimal way of writing
|
||||
// that query but that's not the point!
|
||||
$query = db_select('test');
|
||||
$query->addField('test', 'job');
|
||||
|
|
|
@ -1300,7 +1300,7 @@ function hook_requirements($phase) {
|
|||
* details on schema definition structures.
|
||||
*
|
||||
* @return
|
||||
* A schema definition structure array. For each element of the
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1330,7 +1330,7 @@ function system_update_6000() {
|
|||
function system_update_6001() {
|
||||
$ret = array();
|
||||
|
||||
// Add vid to term-node relation. The schema says it is unsigned.
|
||||
// Add vid to term-node relation. The schema says it is unsigned.
|
||||
db_add_field($ret, 'term_node', 'vid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
|
||||
db_drop_primary_key($ret, 'term_node');
|
||||
db_add_primary_key($ret, 'term_node', array('vid', 'tid', 'nid'));
|
||||
|
@ -1362,13 +1362,13 @@ function system_update_6003() {
|
|||
|
||||
/**
|
||||
* This update used to add an index on users created column (#127941).
|
||||
* However, system_update_1022() does the same thing. This update
|
||||
* However, system_update_1022() does the same thing. This update
|
||||
* tried to detect if 1022 had already run but failed to do so,
|
||||
* resulting in an "index already exists" error.
|
||||
*
|
||||
* Adding the index here is never necessary. Sites installed before
|
||||
* 1022 will run 1022, getting the update. Sites installed on/after 1022
|
||||
* got the index when the table was first created. Therefore, this
|
||||
* Adding the index here is never necessary. Sites installed before
|
||||
* 1022 will run 1022, getting the update. Sites installed on/after 1022
|
||||
* got the index when the table was first created. Therefore, this
|
||||
* function is now a no-op.
|
||||
*/
|
||||
function system_update_6004() {
|
||||
|
@ -1386,16 +1386,16 @@ function system_update_6005() {
|
|||
|
||||
// As of system.install:1.85 (before the new language
|
||||
// subsystem), new installs got a unique key named
|
||||
// url_alias_dst_key on url_alias.dst. Unfortunately,
|
||||
// url_alias_dst_key on url_alias.dst. Unfortunately,
|
||||
// system_update_162 created a unique key inconsistently named
|
||||
// url_alias_dst_idx on url_alias.dst (keys should have the _key
|
||||
// suffix, indexes the _idx suffix). Therefore, sites installed
|
||||
// suffix, indexes the _idx suffix). Therefore, sites installed
|
||||
// before system_update_162 have a unique key with a different
|
||||
// name than sites installed after system_update_162(). Now, we
|
||||
// name than sites installed after system_update_162(). Now, we
|
||||
// want to drop the unique key on dst which may have either one
|
||||
// of two names and create a new unique key on (dst, language).
|
||||
// There is no way to know which key name exists so we have to
|
||||
// drop both, causing an SQL error. Thus, we just hide the
|
||||
// drop both, causing an SQL error. Thus, we just hide the
|
||||
// error and only report the update_sql results that work.
|
||||
$err = error_reporting(0);
|
||||
$ret1 = update_sql('DROP INDEX {url_alias}_dst_idx');
|
||||
|
@ -1456,9 +1456,9 @@ function system_update_6007() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add info files to themes. The info and owner columns are added by
|
||||
* Add info files to themes. The info and owner columns are added by
|
||||
* update_fix_d6_requirements() in update.php to avoid a large number
|
||||
* of error messages from update.php. All we need to do here is copy
|
||||
* of error messages from update.php. All we need to do here is copy
|
||||
* description to owner and then drop description.
|
||||
*/
|
||||
function system_update_6008() {
|
||||
|
@ -1527,7 +1527,7 @@ function system_update_6011() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add serialized field to cache tables. This is now handled directly
|
||||
* Add serialized field to cache tables. This is now handled directly
|
||||
* by update.php, so this function is a no-op.
|
||||
*/
|
||||
function system_update_6012() {
|
||||
|
@ -1690,11 +1690,11 @@ function system_update_6018() {
|
|||
* and pgsql schemas so they are the same and can be represented by a
|
||||
* single schema structure.
|
||||
*
|
||||
* Note that the mysql and pgsql cases make different changes. This
|
||||
* Note that the mysql and pgsql cases make different changes. This
|
||||
* is because each schema needs to be tweaked in different ways to
|
||||
* conform to the new schema structure. Also, since they operate on
|
||||
* conform to the new schema structure. Also, since they operate on
|
||||
* tables defined by many optional core modules which may not ever
|
||||
* have been installed, they must test each table for existence. If
|
||||
* have been installed, they must test each table for existence. If
|
||||
* the modules are first installed after this update exists the tables
|
||||
* will be created from the schema structure and will start out
|
||||
* correct.
|
||||
|
@ -1728,10 +1728,10 @@ function system_update_6019() {
|
|||
db_change_field($ret, 'search_total', 'count', 'count', array('type' => 'float'));
|
||||
}
|
||||
|
||||
// Replace unique index dst_language with a unique constraint. The
|
||||
// Replace unique index dst_language with a unique constraint. The
|
||||
// result is the same but the unique key fits our current schema
|
||||
// structure. Also, the postgres documentation implies that
|
||||
// unique constraints are preferable to unique indexes. See
|
||||
// structure. Also, the postgres documentation implies that
|
||||
// unique constraints are preferable to unique indexes. See
|
||||
// http://www.postgresql.org/docs/8.2/interactive/indexes-unique.html.
|
||||
if (db_table_exists('url_alias')) {
|
||||
db_drop_index($ret, 'url_alias', 'dst_language');
|
||||
|
@ -2015,7 +2015,7 @@ function system_update_6021() {
|
|||
$menu_primary_menu = variable_get('menu_primary_menu', 0);
|
||||
// Ensure that we wind up with a system menu named 'primary-links'.
|
||||
if (isset($_SESSION['menu_menu_map'][2])) {
|
||||
// The primary links menu that ships with Drupal 5 has mid = 2. If this
|
||||
// The primary links menu that ships with Drupal 5 has mid = 2. If this
|
||||
// menu hasn't been deleted by the site admin, we use that.
|
||||
$updated_primary_links_menu = 2;
|
||||
}
|
||||
|
@ -2232,14 +2232,14 @@ function system_update_6028() {
|
|||
function system_update_6029() {
|
||||
// The watchdog table is now owned by dblog, which is not yet
|
||||
// "installed" according to the system table, but the table already
|
||||
// exists. We set the module as "installed" here to avoid an error
|
||||
// exists. We set the module as "installed" here to avoid an error
|
||||
// later.
|
||||
//
|
||||
// Although not the case for the initial D6 release, it is likely
|
||||
// that dblog.install will have its own update functions eventually.
|
||||
// However, dblog did not exist in D5 and this update is part of the
|
||||
// initial D6 release, so we know that dblog is not installed yet.
|
||||
// It is therefore correct to install it as version 0. If
|
||||
// It is therefore correct to install it as version 0. If
|
||||
// dblog updates exist, the next run of update.php will get them.
|
||||
drupal_set_installed_schema_version('dblog', 0);
|
||||
module_enable(array('dblog'));
|
||||
|
@ -2313,7 +2313,7 @@ function system_update_6033() {
|
|||
if (db_table_exists('node_comment_statistics')) {
|
||||
// On pgsql but not mysql, db_change_field() drops all keys
|
||||
// involving the changed field, which in this case is the primary
|
||||
// key. The normal approach is explicitly drop the pkey, change the
|
||||
// key. The normal approach is explicitly drop the pkey, change the
|
||||
// field, and re-create the pkey.
|
||||
//
|
||||
// Unfortunately, in this case that won't work on mysql; we CANNOT
|
||||
|
@ -2321,7 +2321,7 @@ function system_update_6033() {
|
|||
// included in at least one key or index.
|
||||
//
|
||||
// Since we cannot drop the pkey before db_change_field(), after
|
||||
// db_change_field() we may or may not still have a pkey. The
|
||||
// db_change_field() we may or may not still have a pkey. The
|
||||
// simple way out is to re-create the pkey only when using pgsql.
|
||||
// Realistic requirements trump idealistic purity.
|
||||
db_change_field($ret, 'node_comment_statistics', 'nid', 'nid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
|
||||
|
@ -2519,7 +2519,7 @@ function system_update_6043() {
|
|||
db_add_index($ret, 'flood', 'allow', array('event', 'hostname', 'timestamp'));
|
||||
db_add_index($ret, 'history', 'nid', array('nid'));
|
||||
// Change length of theme field in {blocks} to be consistent with module, and
|
||||
// to avoid a MySQL error regarding a too-long index. Also add new indices.
|
||||
// to avoid a MySQL error regarding a too-long index. Also add new indices.
|
||||
db_change_field($ret, 'blocks', 'theme', 'theme', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''),array(
|
||||
'unique keys' => array('tmd' => array('theme', 'module', 'delta'),),
|
||||
'indexes' => array('list' => array('theme', 'status', 'region', 'weight', 'module'),),));
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
* following key-value pairs:
|
||||
* - 'type': (required) the type is determined by what object the action
|
||||
* acts on. Possible choices are node, user, comment, and system. Or
|
||||
* whatever your own custom type is. So, for the nodequeue module, the
|
||||
* whatever your own custom type is. So, for the nodequeue module, the
|
||||
* type might be set to 'nodequeue' if the action would be performed on a
|
||||
* nodequeue.
|
||||
* - 'description': (required) The human-readable name of the action.
|
||||
* - 'configurable': (required) If FALSE, then the action doesn't require
|
||||
* any extra configuration. If TRUE, then you should define a form
|
||||
* any extra configuration. If TRUE, then you should define a form
|
||||
* function with the same name as the key, but with '_form' appended to
|
||||
* it (i.e., the form for 'node_assign_owner_action' is
|
||||
* 'node_assign_owner_action_form'.)
|
||||
|
@ -41,22 +41,22 @@
|
|||
* paired with the usual _submit function, and possibly a _validate
|
||||
* function.
|
||||
* - 'hooks': (required) An array of all of the operations this action is
|
||||
* appropriate for, keyed by hook name. The trigger module uses this to
|
||||
* appropriate for, keyed by hook name. The trigger module uses this to
|
||||
* filter out inappropriate actions when presenting the interface for
|
||||
* assigning actions to events. If you are writing actions in your own
|
||||
* assigning actions to events. If you are writing actions in your own
|
||||
* modules and you simply want to declare support for all possible hooks,
|
||||
* you can set 'hooks' => array('any' => TRUE). Common hooks are 'user',
|
||||
* you can set 'hooks' => array('any' => TRUE). Common hooks are 'user',
|
||||
* 'nodeapi', 'comment', or 'taxonomy'. Any hook that has been described
|
||||
* to Drupal in hook_hook_info() will work is a possiblity.
|
||||
* - 'behavior': (optional) Human-readable array of behavior descriptions.
|
||||
* The only one we have now is 'changes node property'. You will almost
|
||||
* The only one we have now is 'changes node property'. You will almost
|
||||
* certainly never have to return this in your own implementations of this
|
||||
* hook.
|
||||
*
|
||||
* The function that is called when the action is triggered is passed two
|
||||
* parameters - an object of the same type as the 'type' value of the
|
||||
* hook_action_info array, and a context variable that contains the context
|
||||
* under which the action is currently running, sent as an array. For example,
|
||||
* under which the action is currently running, sent as an array. For example,
|
||||
* the actions module sets the 'hook' and 'op' keys of the context array (so,
|
||||
* 'hook' may be 'nodeapi' and 'op' may be 'insert').
|
||||
*/
|
||||
|
@ -113,8 +113,8 @@ function hook_action_info_alter(&$actions) {
|
|||
* See also hook_action_info().
|
||||
*
|
||||
* @return
|
||||
* - A nested array. The outermost key defines the module that the triggers
|
||||
* are from. The menu system will use the key to look at the .info file of
|
||||
* - A nested array. The outermost key defines the module that the triggers
|
||||
* are from. The menu system will use the key to look at the .info file of
|
||||
* the module and make a local task (a tab) in the trigger UI.
|
||||
* - The next key defines the hook being described.
|
||||
* - Inside of that array are a list of arrays keyed by hook operation.
|
||||
|
@ -122,8 +122,8 @@ function hook_action_info_alter(&$actions) {
|
|||
* an English description of the hook.
|
||||
*
|
||||
* For example, the node_hook_info implementation has 'node' as the outermost
|
||||
* key, as that's the module it's in. Next it has 'nodeapi' as the next key,
|
||||
* as hook_nodeapi() is what applies to changes in nodes. Finally the keys
|
||||
* key, as that's the module it's in. Next it has 'nodeapi' as the next key,
|
||||
* as hook_nodeapi() is what applies to changes in nodes. Finally the keys
|
||||
* after that are the various operations for hook_nodeapi() that the node module
|
||||
* is exposing as triggers.
|
||||
*/
|
||||
|
|
|
@ -444,7 +444,7 @@ function update_calculate_project_data($available) {
|
|||
|
||||
// If we're running a dev snapshot and have a timestamp, stop
|
||||
// searching for security updates once we hit an official release
|
||||
// older than what we've got. Allow 100 seconds of leeway to handle
|
||||
// older than what we've got. Allow 100 seconds of leeway to handle
|
||||
// differences between the datestamp in the .info file and the
|
||||
// timestamp of the tarball itself (which are usually off by 1 or 2
|
||||
// seconds) so that we don't flag that as a new release.
|
||||
|
@ -579,7 +579,7 @@ function update_calculate_project_data($available) {
|
|||
function update_project_cache($cid) {
|
||||
$projects = array();
|
||||
|
||||
// In some cases, we must clear the cache. Rather than do so on a time
|
||||
// In some cases, we must clear the cache. Rather than do so on a time
|
||||
// basis, we check for specific paths.
|
||||
$q = $_GET['q'];
|
||||
$paths = array('admin/build/modules', 'admin/build/themes', 'admin/reports', 'admin/reports/updates', 'admin/reports/status', 'admin/reports/updates/check');
|
||||
|
|
|
@ -203,7 +203,7 @@ function user_load($array = array()) {
|
|||
*
|
||||
* @param $edit
|
||||
* An array of fields and values to save. For example array('name'
|
||||
* => 'My name'). Keys that do not belong to columns in the user-related
|
||||
* => 'My name'). Keys that do not belong to columns in the user-related
|
||||
* tables are added to the a serialized array in the 'data' column
|
||||
* and will be loaded in the $user->data array by user_load().
|
||||
* Setting a field to NULL deletes it from the data column.
|
||||
|
@ -840,7 +840,7 @@ function user_block_view($delta = '') {
|
|||
// Count users active within the defined period.
|
||||
$interval = REQUEST_TIME - variable_get('user_block_seconds_online', 900);
|
||||
|
||||
// Perform database queries to gather online user lists. We use s.timestamp
|
||||
// Perform database queries to gather online user lists. We use s.timestamp
|
||||
// rather than u.access because it is much faster.
|
||||
$anonymous_count = drupal_session_count($interval);
|
||||
$authenticated_count = db_query("SELECT COUNT(DISTINCT s.uid) FROM {sessions} s WHERE s.timestamp >= :timestamp AND s.uid > 0", array(':timestamp' => $interval))->fetchField();
|
||||
|
@ -2072,7 +2072,7 @@ function theme_user_signature($signature) {
|
|||
* Return an array of token to value mappings for user e-mail messages.
|
||||
*
|
||||
* @param $account
|
||||
* The user object of the account being notified. Must contain at
|
||||
* The user object of the account being notified. Must contain at
|
||||
* least the fields 'uid', 'name', and 'mail'.
|
||||
* @param $language
|
||||
* Language object to generate the tokens with.
|
||||
|
@ -2129,7 +2129,7 @@ function user_preferred_language($account, $default = NULL) {
|
|||
* @see drupal_mail()
|
||||
*
|
||||
* @param $op
|
||||
* The operation being performed on the account. Possible values:
|
||||
* The operation being performed on the account. Possible values:
|
||||
* 'register_admin_created': Welcome message for user created by the admin
|
||||
* 'register_no_approval_required': Welcome message when user self-registers
|
||||
* 'register_pending_approval': Welcome message, user pending admin approval
|
||||
|
@ -2139,7 +2139,7 @@ function user_preferred_language($account, $default = NULL) {
|
|||
* 'status_deleted': Account deleted
|
||||
*
|
||||
* @param $account
|
||||
* The user object of the account being notified. Must contain at
|
||||
* The user object of the account being notified. Must contain at
|
||||
* least the fields 'uid', 'name', and 'mail'.
|
||||
* @param $language
|
||||
* Optional language to use for the notification, overriding account language.
|
||||
|
|
|
@ -181,7 +181,7 @@ code-style.pl - Review drupal code for style
|
|||
=head1 DESCRIPTION
|
||||
|
||||
Originally written for Drupal (http://drupal.org/) to ensure stylish
|
||||
code. This program reviews PHP code, and tries to show as many code
|
||||
code. This program reviews PHP code, and tries to show as many code
|
||||
improvements as possible with no false positives.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
|
|
@ -36,15 +36,15 @@ All arguments are long options.
|
|||
produce errors from setting the session.
|
||||
|
||||
URI The URI to execute, i.e. http://default/foo/bar for executing
|
||||
the path '/foo/bar' in your site 'default'. URI has to be
|
||||
the path '/foo/bar' in your site 'default'. URI has to be
|
||||
enclosed by quotation marks if there are ampersands in it
|
||||
(f.e. index.php?q=node&foo=bar). Prefix 'http://' is required,
|
||||
(f.e. index.php?q=node&foo=bar). Prefix 'http://' is required,
|
||||
and the domain must exist in Drupal's sites-directory.
|
||||
|
||||
If the given path and file exists it will be executed directly,
|
||||
i.e. if URI is set to http://default/bar/foo.php
|
||||
and bar/foo.php exists, this script will be executed without
|
||||
bootstrapping Drupal. To execute Drupal's cron.php, specify
|
||||
bootstrapping Drupal. To execute Drupal's cron.php, specify
|
||||
http://default/cron.php as the URI.
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ if (version_compare(PHP_VERSION, "5.2.0", "<")) {
|
|||
$version = PHP_VERSION;
|
||||
echo <<<EOF
|
||||
|
||||
ERROR: This script requires at least PHP version 5.2.0. You invoked it with
|
||||
ERROR: This script requires at least PHP version 5.2.0. You invoked it with
|
||||
PHP version {$version}.
|
||||
\n
|
||||
EOF;
|
||||
|
|
|
@ -133,13 +133,13 @@ All arguments are long options.
|
|||
|
||||
<test1>[,<test2>[,<test3> ...]]
|
||||
|
||||
One or more tests to be run. By default, these are interpreted
|
||||
One or more tests to be run. By default, these are interpreted
|
||||
as the names of test groups as shown at ?q=admin/build/testing.
|
||||
These group names typically correspond to module names like "User"
|
||||
or "Profile" or "System", but there is also a group "XML-RPC".
|
||||
If --class is specified then these are interpreted as the names of
|
||||
specific test classes whose test methods will be run. Tests must
|
||||
be separated by commas. Ignored if --all is specified.
|
||||
specific test classes whose test methods will be run. Tests must
|
||||
be separated by commas. Ignored if --all is specified.
|
||||
|
||||
To run this script you will normally invoke it from the root directory of your
|
||||
Drupal installation as the webserver user (differs per configuration), or root:
|
||||
|
|
|
@ -524,11 +524,11 @@ function update_check_incompatibility($name, $type = 'module') {
|
|||
* to function properly.
|
||||
*
|
||||
* This function runs when update.php is run the first time for 6.x,
|
||||
* even before updates are selected or performed. It is important
|
||||
* even before updates are selected or performed. It is important
|
||||
* that if updates are not ultimately performed that no changes are
|
||||
* made which make it impossible to continue using the prior version.
|
||||
* Just adding columns is safe. However, renaming the
|
||||
* system.description column to owner is not. Therefore, we add the
|
||||
* Just adding columns is safe. However, renaming the
|
||||
* system.description column to owner is not. Therefore, we add the
|
||||
* system.owner column and leave it to system_update_6008() to copy
|
||||
* the data from description and remove description. The same for
|
||||
* renaming locales_target.locale to locales_target.language, which
|
||||
|
|
Loading…
Reference in New Issue