diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-09-15 20:48:10 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-09-15 20:48:10 +0000 |
commit | 161a9970f77ce6813e710e08076f5d4fc494259a (patch) | |
tree | 3d349326150a59d58bbaf868148fd197e8ca903c /includes | |
parent | cf987be12d600a513f5efa779602ad4b6682e147 (diff) | |
download | brdo-161a9970f77ce6813e710e08076f5d4fc494259a.tar.gz brdo-161a9970f77ce6813e710e08076f5d4fc494259a.tar.bz2 |
#308534 by Dave Reid: Remove stray whitespace core-wide.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/database/mysql/query.inc | 24 | ||||
-rw-r--r-- | includes/database/mysql/schema.inc | 66 | ||||
-rw-r--r-- | includes/database/pgsql/database.inc | 6 | ||||
-rw-r--r-- | includes/database/pgsql/query.inc | 26 | ||||
-rw-r--r-- | includes/database/pgsql/schema.inc | 2 | ||||
-rw-r--r-- | includes/locale.inc | 10 | ||||
-rw-r--r-- | includes/session.inc | 56 | ||||
-rw-r--r-- | includes/theme.inc | 11 |
8 files changed, 100 insertions, 101 deletions
diff --git a/includes/database/mysql/query.inc b/includes/database/mysql/query.inc index 60eb73c42..ed32411a4 100644 --- a/includes/database/mysql/query.inc +++ b/includes/database/mysql/query.inc @@ -9,13 +9,13 @@ class InsertQuery_mysql extends InsertQuery { public function execute() { - + // Confirm that the user did not try to specify an identical // field and default field. if (array_intersect($this->insertFields, $this->defaultFields)) { throw new PDOException('You may not specify the same field to have a value and a schema-default value.'); } - + $last_insert_id = 0; $max_placeholder = 0; @@ -37,10 +37,10 @@ class InsertQuery_mysql extends InsertQuery { public function __toString() { $delay = $this->queryOptions['delay'] ? 'DELAYED' : ''; - + // Default fields are always placed first for consistency. $insert_fields = array_merge($this->defaultFields, $this->insertFields); - + $query = "INSERT $delay INTO {" . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES '; $max_placeholder = 0; @@ -48,11 +48,11 @@ class InsertQuery_mysql extends InsertQuery { if (count($this->insertValues)) { foreach ($this->insertValues as $insert_values) { $placeholders = array(); - + // Default fields aren't really placeholders, but this is the most convenient // way to handle them. $placeholders = array_pad($placeholders, count($this->defaultFields), 'default'); - + $new_placeholder = $max_placeholder + count($insert_values); for ($i = $max_placeholder; $i < $new_placeholder; ++$i) { $placeholders[] = ':db_insert_placeholder_'. $i; @@ -87,7 +87,7 @@ class MergeQuery_mysql extends MergeQuery { unset($update_fields[$exclude_field]); } } - + $insert_fields = $this->insertFields + $this->keyFields; $max_placeholder = 0; @@ -106,7 +106,7 @@ class MergeQuery_mysql extends MergeQuery { } unset($update_fields[$field]); } - + // Because we filter $fields the same way here and in __toString(), the // placeholders will all match up properly. $max_placeholder = 0; @@ -119,7 +119,7 @@ class MergeQuery_mysql extends MergeQuery { return $last_insert_id; } - + public function __toString() { // Set defaults. @@ -134,7 +134,7 @@ class MergeQuery_mysql extends MergeQuery { unset($update_fields[$exclude_field]); } } - + $insert_fields = $this->insertFields + $this->keyFields; $query = "INSERT INTO {" . $this->table . '} (' . implode(', ', array_keys($insert_fields)) . ') VALUES '; @@ -147,7 +147,7 @@ class MergeQuery_mysql extends MergeQuery { } $query .= '(' . implode(', ', $values) . ') ON DUPLICATE KEY UPDATE '; - + // Expressions take priority over literal fields, so we process those first // and remove any literal fields that conflict. $max_placeholder = 0; @@ -160,7 +160,7 @@ class MergeQuery_mysql extends MergeQuery { foreach ($update_fields as $field => $value) { $update[] = ($field . '=:db_update_placeholder_' . $max_placeholder++); } - + $query .= implode(', ', $update); return $query; diff --git a/includes/database/mysql/schema.inc b/includes/database/mysql/schema.inc index 969912cdf..afea775df 100644 --- a/includes/database/mysql/schema.inc +++ b/includes/database/mysql/schema.inc @@ -17,7 +17,7 @@ class DatabaseSchema_mysql extends DatabaseSchema { public function tableExists($table) { return (bool) $this->connection->query("SHOW TABLES LIKE '{" . $table . "}'", array(), array())->fetchField(); } - + public function columnExists($table, $column) { return (bool) $this->connection->query("SHOW COLUMNS FROM {" . $this->escapeTable($table) . "} LIKE '" . $this->escapeTable($column) . "'", array(), array())->fetchField(); } @@ -37,25 +37,25 @@ class DatabaseSchema_mysql extends DatabaseSchema { if (empty($table['mysql_suffix'])) { $table['mysql_suffix'] = "/*!40100 DEFAULT CHARACTER SET UTF8 */"; } - + $sql = "CREATE TABLE {" . $name . "} (\n"; - + // Add the SQL statement for each field. foreach ($table['fields'] as $field_name => $field) { $sql .= $this->createFieldSql($field_name, $this->processField($field)) . ", \n"; } - + // Process keys & indexes. $keys = $this->createKeysSql($table); if (count($keys)) { $sql .= implode(", \n", $keys) . ", \n"; } - + // Remove the last comma and space. $sql = substr($sql, 0, -3) . "\n) "; - + $sql .= $table['mysql_suffix']; - + return array($sql); } @@ -72,40 +72,40 @@ class DatabaseSchema_mysql extends DatabaseSchema { */ protected function createFieldSql($name, $spec) { $sql = "`" . $name . "` " . $spec['mysql_type']; - + if (isset($spec['length'])) { $sql .= '(' . $spec['length'] . ')'; } elseif (isset($spec['precision']) && isset($spec['scale'])) { $sql .= '(' . $spec['precision'] . ', ' . $spec['scale'] . ')'; } - + if (!empty($spec['unsigned'])) { $sql .= ' unsigned'; } - + if (!empty($spec['not null'])) { $sql .= ' NOT NULL'; } - + if (!empty($spec['auto_increment'])) { $sql .= ' auto_increment'; } - + if (isset($spec['default'])) { if (is_string($spec['default'])) { $spec['default'] = "'" . $spec['default'] . "'"; } $sql .= ' DEFAULT ' . $spec['default']; } - + if (empty($spec['not null']) && !isset($spec['default'])) { $sql .= ' DEFAULT NULL'; } - + return $sql; } - + /** * Set database-engine specific properties for a field. * @@ -113,21 +113,21 @@ class DatabaseSchema_mysql extends DatabaseSchema { * A field description array, as specified in the schema documentation. */ protected function processField($field) { - + if (!isset($field['size'])) { $field['size'] = 'normal'; } - + // Set the correct database-engine specific datatype. if (!isset($field['mysql_type'])) { $map = db_type_map(); $field['mysql_type'] = $map[$field['type'] . ':' . $field['size']]; } - + if ($field['type'] == 'serial') { $field['auto_increment'] = TRUE; } - + return $field; } @@ -138,41 +138,41 @@ class DatabaseSchema_mysql extends DatabaseSchema { static $map = array( 'varchar:normal' => 'VARCHAR', 'char:normal' => 'CHAR', - + 'text:tiny' => 'TINYTEXT', 'text:small' => 'TINYTEXT', 'text:medium' => 'MEDIUMTEXT', 'text:big' => 'LONGTEXT', 'text:normal' => 'TEXT', - + 'serial:tiny' => 'TINYINT', 'serial:small' => 'SMALLINT', 'serial:medium' => 'MEDIUMINT', 'serial:big' => 'BIGINT', 'serial:normal' => 'INT', - + 'int:tiny' => 'TINYINT', 'int:small' => 'SMALLINT', 'int:medium' => 'MEDIUMINT', 'int:big' => 'BIGINT', 'int:normal' => 'INT', - + 'float:tiny' => 'FLOAT', 'float:small' => 'FLOAT', 'float:medium' => 'FLOAT', 'float:big' => 'DOUBLE', 'float:normal' => 'FLOAT', - + 'numeric:normal' => 'DECIMAL', - + 'blob:big' => 'LONGBLOB', 'blob:normal' => 'BLOB', - + 'datetime:normal' => 'DATETIME', ); return $map; } - + @@ -195,7 +195,7 @@ class DatabaseSchema_mysql extends DatabaseSchema { return $keys; } - + protected function createKeySql($fields) { $ret = array(); foreach ($fields as $field) { @@ -225,7 +225,7 @@ class DatabaseSchema_mysql extends DatabaseSchema { public function renameTable(&$ret, $table, $new_name) { $ret[] = update_sql('ALTER TABLE {' . $table . '} RENAME TO {' . $new_name . '}'); } - + public function dropTable(&$ret, $table) { $ret[] = update_sql('DROP TABLE {' . $table . '}'); } @@ -265,7 +265,7 @@ class DatabaseSchema_mysql extends DatabaseSchema { else { $default = is_string($default) ? "'$default'" : $default; } - + $ret[] = update_sql('ALTER TABLE {' . $table . '} ALTER COLUMN ' . $field . ' SET DEFAULT ' . $default); } @@ -276,7 +276,7 @@ class DatabaseSchema_mysql extends DatabaseSchema { public function addPrimaryKey(&$ret, $table, $fields) { $ret[] = update_sql('ALTER TABLE {' . $table . '} ADD PRIMARY KEY (' . $this->createKeySql($fields) . ')'); } - + public function dropPrimaryKey(&$ret, $table) { $ret[] = update_sql('ALTER TABLE {' . $table . '} DROP PRIMARY KEY'); } @@ -288,7 +288,7 @@ class DatabaseSchema_mysql extends DatabaseSchema { public function dropUniqueKey(&$ret, $table, $name) { $ret[] = update_sql('ALTER TABLE {' . $table . '} DROP KEY ' . $name); } - + public function addIndex(&$ret, $table, $name, $fields) { $query = 'ALTER TABLE {' . $table . '} ADD INDEX ' . $name . ' (' . $this->createKeySql($fields) . ')'; $ret[] = update_sql($query); @@ -297,7 +297,7 @@ class DatabaseSchema_mysql extends DatabaseSchema { public function dropIndex(&$ret, $table, $name) { $ret[] = update_sql('ALTER TABLE {' . $table . '} DROP INDEX ' . $name); } - + public function changeField(&$ret, $table, $field, $field_new, $spec, $keys_new = array()) { $sql = 'ALTER TABLE {' . $table . '} CHANGE ' . $field . ' ' . $this->createFieldSql($field_new, $this->processField($spec)); if (count($keys_new)) { diff --git a/includes/database/pgsql/database.inc b/includes/database/pgsql/database.inc index 85a8e8315..166811235 100644 --- a/includes/database/pgsql/database.inc +++ b/includes/database/pgsql/database.inc @@ -33,7 +33,7 @@ class DatabaseConnection_pgsql extends DatabaseConnection { public function query($query, Array $args = array(), $options = array()) { $options += $this->defaultOptions(); - + try { if ($query instanceof DatabaseStatement) { $stmt = $query; @@ -43,7 +43,7 @@ class DatabaseConnection_pgsql extends DatabaseConnection { $stmt = $this->prepareQuery($query); $stmt->execute($args, $options); } - + switch ($options['return']) { case Database::RETURN_STATEMENT: return $stmt; @@ -74,7 +74,7 @@ class DatabaseConnection_pgsql extends DatabaseConnection { return NULL; } } - + public function queryRange($query, Array $args, $from, $count, Array $options) { // Backward compatibility hack, temporary. $query = str_replace(array('%d' , '%f' , '%b' , "'%s'"), '?', $query); diff --git a/includes/database/pgsql/query.inc b/includes/database/pgsql/query.inc index 4f3a08da6..dc9054a99 100644 --- a/includes/database/pgsql/query.inc +++ b/includes/database/pgsql/query.inc @@ -13,9 +13,9 @@ class InsertQuery_pgsql extends InsertQuery { parent::__construct($connection, $table, $options); $this->queryOptions['return'] = Database::RETURN_NULL; } - + public function execute() { - + // Confirm that the user did not try to specify an identical // field and default field. if (array_intersect($this->insertFields, $this->defaultFields)) { @@ -53,13 +53,13 @@ class InsertQuery_pgsql extends InsertQuery { // when requesting the last insert ID, so we pass that in via // the options array. $options = $this->queryOptions; - + if ($schema['fields'][$schema['primary key'][0]]['type'] == 'serial') { $options['sequence_name'] = $this->connection->makeSequenceName($this->table, $schema['primary key'][0]); $options['return'] = Database::RETURN_INSERT_ID; } $last_insert_id = $this->connection->query($stmt, array(), $options); - + // Re-initialize the values array so that we can re-use this query. $this->insertValues = array(); @@ -67,7 +67,7 @@ class InsertQuery_pgsql extends InsertQuery { } public function __toString() { - + // Default fields are always placed first for consistency. $insert_fields = array_merge($this->defaultFields, $this->insertFields); @@ -78,11 +78,11 @@ class InsertQuery_pgsql extends InsertQuery { if (count($this->insertValues)) { foreach ($this->insertValues as $insert_values) { $placeholders = array(); - + // Default fields aren't really placeholders, but this is the most convenient // way to handle them. $placeholders = array_pad($placeholders, count($this->defaultFields), 'default'); - + $new_placeholder = $max_placeholder + count($insert_values); for ($i = $max_placeholder; $i < $new_placeholder; ++$i) { $placeholders[] = ':db_insert_placeholder_' . $i; @@ -103,18 +103,18 @@ class InsertQuery_pgsql extends InsertQuery { } } -class UpdateQuery_pgsql extends UpdateQuery { +class UpdateQuery_pgsql extends UpdateQuery { public function execute() { $max_placeholder = 0; $blobs = array(); $blob_count = 0; - + $schema = drupal_get_schema($this->table); - + // Because we filter $fields the same way here and in __toString(), the // placeholders will all match up properly. $stmt = $this->connection->prepareQuery((string)$this); - + // Expressions take priority over literal fields, so we process those first // and remove any literal fields that conflict. $fields = $this->fields; @@ -130,7 +130,7 @@ class UpdateQuery_pgsql extends UpdateQuery { } unset($fields[$field]); } - + foreach ($fields as $field => &$value) { $placeholder = ':db_update_placeholder_' . ($max_placeholder++); @@ -160,7 +160,7 @@ class UpdateQuery_pgsql extends UpdateQuery { $options = $this->queryOptions; $options['already_prepared'] = TRUE; $this->connection->query($stmt, $options); - + //$stmt->execute(NULL, $this->queryOptions); return $stmt->rowCount(); } diff --git a/includes/database/pgsql/schema.inc b/includes/database/pgsql/schema.inc index fa817c4d1..c98818a26 100644 --- a/includes/database/pgsql/schema.inc +++ b/includes/database/pgsql/schema.inc @@ -16,7 +16,7 @@ class DatabaseSchema_pgsql extends DatabaseSchema { public function tableExists($table) { return (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '{" . db_escape_table($table) . "}'")); } - + public function columnExists($table, $column) { return (bool) db_result(db_query("SELECT COUNT(pg_attribute.attname) FROM pg_class, pg_attribute WHERE pg_attribute.attrelid = pg_class.oid AND pg_class.relname = '{" . db_escape_table($table) . "}' AND attname = '" . db_escape_table($column) . "'")); } diff --git a/includes/locale.inc b/includes/locale.inc index 72a41c7f9..31c88317f 100644 --- a/includes/locale.inc +++ b/includes/locale.inc @@ -2092,11 +2092,11 @@ function _locale_rebuild_js($langcode = NULL) { // Construct the array for JavaScript translations. // We sort on plural so that we have all plural forms before singular forms. - $result = db_query("SELECT s.lid, s.source, t.plid, t.plural, t.translation - FROM {locales_source} s - LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language - WHERE s.location LIKE '%.js%' - AND s.textgroup = 'default' + $result = db_query("SELECT s.lid, s.source, t.plid, t.plural, t.translation + FROM {locales_source} s + LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language + WHERE s.location LIKE '%.js%' + AND s.textgroup = 'default' ORDER BY t.plural DESC", array(':language' => $language->language)); $translations = $plurals = array(); diff --git a/includes/session.inc b/includes/session.inc index 705fc18b0..0a64c1d6f 100644 --- a/includes/session.inc +++ b/includes/session.inc @@ -10,69 +10,69 @@ * - _sess_close() * - _sess_read() * - _sess_write() - * are assigned by session_set_save_handler() in bootstrap.inc and are called - * automatically by PHP. These functions should not be called directly. Session + * are assigned by session_set_save_handler() in bootstrap.inc and are called + * automatically by PHP. These functions should not be called directly. Session * data should instead be accessed via the $_SESSION superglobal. * * The user-level session storage handlers: * - sess_destroy_sid() * - sess_gc() - * are assigned by session_set_save_handler() in bootstrap.inc and are called + * are assigned by session_set_save_handler() in bootstrap.inc and are called * automatically by PHP, but they may safely be called directly. */ /** * Session handler assigned by session_set_save_handler(). - * - * This function is used to handle any initialization, such as file paths or - * database connections, that is needed before accessing session data. Drupal + * + * This function is used to handle any initialization, such as file paths or + * database connections, that is needed before accessing session data. Drupal * does not need to initialize anything in this function. * * This function should not be called directly. * * @return * This function will always return TRUE. - */ + */ function _sess_open() { return TRUE; } /** * Session handler assigned by session_set_save_handler(). - * - * This function is used to close the current session. Because Drupal stores - * session data in the database immediately on write, this function does + * + * This function is used to close the current session. Because Drupal stores + * session data in the database immediately on write, this function does * not need to do anything. * * This function should not be called directly. * * @return * This function will always return TRUE. - */ + */ function _sess_close() { return TRUE; } /** * Session handler assigned by session_set_save_handler(). - * - * This function will be called by PHP to retrieve the current user's - * session data, which is stored in the database. It also loads the + * + * This function will be called by PHP to retrieve the current user's + * session data, which is stored in the database. It also loads the * current user's appropriate roles into the user object. * - * This function should not be called directly. Session data should + * This function should not be called directly. Session data should * instead be accessed via the $_SESSION superglobal. * * @param $key * Session ID * @return - * Either an array of the session data, or an empty string, if no data + * Either an array of the session data, or an empty string, if no data * was found or the user is anonymous. */ function _sess_read($key) { global $user; - // Write and Close handlers are called after destructing objects + // Write and Close handlers are called after destructing objects // since PHP 5.0.5. // Thus destructors can use sessions but session handler can't use objects. // So we are moving session closure before destructing objects. @@ -85,7 +85,7 @@ function _sess_read($key) { return ''; } - // Otherwise, if the session is still active, we have a record of the + // Otherwise, if the session is still active, we have a record of the // client's session in the database. $user = db_fetch_object(db_query("SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = '%s'", $key)); @@ -102,7 +102,7 @@ function _sess_read($key) { $user->roles[$role->rid] = $role->name; } } - // We didn't find the client's record (session has expired), or they + // We didn't find the client's record (session has expired), or they // are an anonymous user. else { $session = isset($user->session) ? $user->session : ''; @@ -114,11 +114,11 @@ function _sess_read($key) { /** * Session handler assigned by session_set_save_handler(). - * - * This function will be called by PHP to store the current user's + * + * This function will be called by PHP to store the current user's * session, which Drupal saves to the database. * - * This function should not be called directly. Session data should + * This function should not be called directly. Session data should * instead be accessed via the $_SESSION superglobal. * * @param $key @@ -177,7 +177,7 @@ function drupal_session_regenerate() { } /** - * Counts how many users have sessions. Can count either anonymous sessions, + * Counts how many users have sessions. Can count either anonymous sessions, * authenticated sessions, or both. * * @param int $timestamp @@ -196,7 +196,7 @@ function drupal_session_count($timestamp = 0, $anonymous = true) { /** * Session handler assigned by session_set_save_handler(). - * + * * Cleanup a specific session. * * @param string $sid @@ -218,7 +218,7 @@ function drupal_session_destroy_uid($uid) { /** * Session handler assigned by session_set_save_handler(). - * + * * Cleanup stalled sessions. */ function _sess_gc($lifetime) { @@ -235,13 +235,13 @@ function _sess_gc($lifetime) { /** * Determine whether to save session data of the current request. * - * This function allows the caller to temporarily disable writing of - * session data, should the request end while performing potentially + * This function allows the caller to temporarily disable writing of + * session data, should the request end while performing potentially * dangerous operations, such as manipulating the global $user object. * See http://drupal.org/node/218104 for usage * * @param $status - * Disables writing of session data when FALSE, (re-)enables + * Disables writing of session data when FALSE, (re-)enables * writing when TRUE. * @return * FALSE if writing session data has been disabled. Otherwise, TRUE. diff --git a/includes/theme.inc b/includes/theme.inc index 4c20aaf6e..4121937e4 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -197,8 +197,8 @@ function _init_theme($theme, $base_theme = array(), $registry_callback = '_theme /** * Get the theme registry. - * @return - * The theme registry array if it has been stored in memory, NULL otherwise. + * @return + * The theme registry array if it has been stored in memory, NULL otherwise. */ function theme_get_registry() { return _theme_set_registry(); @@ -208,16 +208,16 @@ function theme_get_registry() { * Store the theme registry in memory. * @param $registry * A registry array as returned by _theme_build_registry() - * @return + * @return * The theme registry array stored in memory */ function _theme_set_registry($registry = NULL) { static $theme_registry = NULL; - + if (isset($registry)) { $theme_registry = $registry; } - + return $theme_registry; } @@ -2001,4 +2001,3 @@ function template_preprocess_block(&$variables) { $variables['template_files'][] = 'block-' . $variables['block']->module; $variables['template_files'][] = 'block-' . $variables['block']->module . '-' . $variables['block']->delta; } - |