Commit bd108c7f authored by Dries's avatar Dries

- Patch #299778 by hswong3i, Arancaytar, Dave Reid et al: code clean-up.

parent ea02bd1d
......@@ -299,7 +299,7 @@ public function dropIndex(&$ret, $table, $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));
$sql = 'ALTER TABLE {' . $table . '} CHANGE `' . $field . '` ' . $this->createFieldSql($field_new, $this->processField($spec));
if (count($keys_new)) {
$sql .= ', ADD ' . implode(', ADD ', $this->createKeysSql($keys_new));
}
......
......@@ -88,7 +88,7 @@ function drupal_load_updates() {
* @param $module
* A module name.
* @return
* If the module has updates, an array of available updates sorted by version.
* If the module has updates, an array of available updates sorted by version.
* Otherwise, FALSE.
*/
function drupal_get_schema_versions($module) {
......@@ -105,10 +105,10 @@ function drupal_get_schema_versions($module) {
if (count($updates) == 0) {
return FALSE;
}
// Make sure updates are run in numeric order, not in definition order.
sort($updates, SORT_NUMERIC);
return $updates;
}
......@@ -213,8 +213,8 @@ function drupal_detect_database_types() {
// file for the driver explicitly.
foreach (file_scan_directory(DRUPAL_ROOT . '/includes/database', '/^[a-z]*$/i', array('.', '..', 'CVS'), 0, FALSE) as $file) {
include_once "{$file->filename}/install.inc";
include_once "{$file->filename}/database.inc";
include_once "{$file->filename}/install.inc";
include_once "{$file->filename}/database.inc";
$drivers[$file->basename] = $file->filename;
}
......@@ -232,7 +232,7 @@ function drupal_detect_database_types() {
unset($databases['mysql']);
$databases = array('mysql' => $mysql_database) + $databases;
}
return $databases;
}
......@@ -466,7 +466,7 @@ function drupal_verify_profile($profile, $locale) {
$missing_modules = array_diff($module_list, $present_modules);
$requirements = array();
if (count($missing_modules)) {
$modules = array();
foreach ($missing_modules as $module) {
......@@ -544,7 +544,7 @@ function _drupal_install_module($module) {
*/
function drupal_install_init_database() {
static $included = FALSE;
if (!$included) {
$connection_info = Database::getConnectionInfo();
$driver = $connection_info['default']['driver'];
......@@ -568,7 +568,7 @@ function drupal_install_system() {
require_once DRUPAL_ROOT . '/' . $system_path . '/system.install';
drupal_install_init_database();
module_invoke('system', 'install');
$system_versions = drupal_get_schema_versions('system');
$system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED;
db_query("INSERT INTO {system} (filename, name, type, owner, status, bootstrap, schema_version) VALUES('%s', '%s', '%s', '%s', %d, %d, %d)", $system_path . '/system.module', 'system', 'module', '', 1, 0, $system_version);
......@@ -828,7 +828,7 @@ function drupal_install_fix_file($file, $mask, $message = TRUE) {
/**
* Send the user to a different installer page.
* Send the user to a different installer page.
*
* This issues an on-site HTTP redirect. Messages (and errors) are erased.
*
......@@ -927,7 +927,7 @@ function drupal_check_profile($profile) {
* Extract highest severity from requirements array.
*
* @param $requirements
* An array of requirements, in the same format as is returned by
* An array of requirements, in the same format as is returned by
* hook_requirements().
* @return
* The highest severity in the array.
......
......@@ -97,7 +97,7 @@ function theme_locale_languages_overview_form($form) {
$header = array(array('data' => t('English name')), array('data' => t('Native name')), array('data' => t('Code')), array('data' => t('Direction')), array('data' => t('Enabled')), array('data' => t('Default')), array('data' => t('Weight')), array('data' => t('Operations')));
$output = theme('table', $header, $rows, array('id' => 'language-order'));
$output .= drupal_render($form);
drupal_add_tabledrag('language-order', 'order', 'sibling', 'language-order-weight');
return $output;
......
......@@ -1886,7 +1886,7 @@ function _menu_delete_item($item, $force = FALSE) {
* - plid The mlid of the parent.
* - router_path The path of the relevant router item.
* @return
* The mlid of the saved menu link, or FALSE if the menu link could not be
* The mlid of the saved menu link, or FALSE if the menu link could not be
* saved.
*/
function menu_link_save(&$item) {
......@@ -2040,7 +2040,7 @@ function menu_link_save(&$item) {
if ($existing_item && $menu_name != $existing_item['menu_name']) {
menu_cache_clear($existing_item['menu_name']);
}
_menu_clear_page_cache();
}
return $item['mlid'];
......
......@@ -229,7 +229,7 @@ function drupal_session_destroy_uid($uid) {
*
* @param int $lifetime
* The value of session.gc_maxlifetime, passed by PHP.
* Sessions not updated for more than $lifetime seconds will be removed.
* Sessions not updated for more than $lifetime seconds will be removed.
*/
function _sess_gc($lifetime) {
// Be sure to adjust 'php_value session.gc_maxlifetime' to a large enough
......
......@@ -469,7 +469,7 @@ function aggregator_save_feed($edit) {
'image' => '',
))
->execute();
}
if (!empty($edit['title'])) {
// The feed is being saved, save the categories as well.
......@@ -501,7 +501,7 @@ function aggregator_remove($feed) {
->condition('iid', $iids, 'IN')
->execute();
}
db_delete('aggregator_item')
->condition('fid', $feed['fid'])
->execute();
......
......@@ -279,7 +279,7 @@ class UpdateFeedTestCase extends AggregatorTestCase {
$remamining_fields = array('title', 'url', '');
foreach ($remamining_fields as $same_field) {
$feed = $this->createFeed();
// Get new feed data array and modify newly created feed.
$edit = $this->getFeedEditArray();
$edit['refresh'] = 1800; // Change refresh value.
......@@ -469,7 +469,7 @@ class CategorizeFeedItemTestCase extends AggregatorTestCase {
->countQuery()
->execute()
->fetchField();
$this->assertEqual($feed->item_count, $categorized_count, t('Total items in feed equal to the total categorized feed items in database'));
}
}
......
......@@ -328,7 +328,7 @@ function blogapi_blogger_get_post($appkey, $postid, $username, $password) {
* TRUE if no error, or the blogapi_error().
*/
function blogapi_status_error_check($node, $original_status) {
$node = (object) $node;
$node_type_default = variable_get('node_options_'. $node->type, array('status', 'promote'));
......
......@@ -321,7 +321,7 @@ class CommentInterfaceTest extends CommentHelperCase {
$this->assertText('This discussion is closed', t('Posting to node with comments disabled'));
$this->assertNoField('edit-comment', t('Comment body field found.'));
// Attempt to post to node with read-only comments.
// Attempt to post to node with read-only comments.
$this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_READ_ONLY));
$this->assertTrue($this->node, t('Article node created.'));
$this->drupalGet('comment/reply/' . $this->node->nid);
......@@ -462,14 +462,14 @@ class CommentAnonymous extends CommentHelperCase {
$this->drupalLogin($this->admin_user);
$this->setAnonymousUserComment(FALSE, FALSE);
// Attempt to view comments while disallowed.
// Attempt to view comments while disallowed.
// NOTE: if authenticated user has permission to post comments, then a
// "Login or register to post comments" type link may be shown.
$this->drupalLogout();
$this->drupalGet('node/' . $this->node->nid);
$this->assertNoRaw('<div id="comments">', t('Comments were not displayed.'));
$this->assertNoLink('Add new comment', t('Link to add comment was found.'));
// Attempt to view node-comment form while disallowed.
$this->drupalGet('comment/reply/' . $this->node->nid);
$this->assertText('You are not authorized to view comments', t('Error attempting to post comment.'));
......
......@@ -1031,7 +1031,7 @@ function _filter_xss_split($m, $store = FALSE) {
// Is there a closing XHTML slash at the end of the attributes?
$attrlist = preg_replace('%(\s?)/\s*$%', '\1', $attrlist, -1, $count);
$xhtml_slash = $count ? ' /' : '';
// Clean up attributes
$attr2 = implode(' ', _filter_xss_attributes($attrlist));
$attr2 = preg_replace('/[<>]/', '', $attr2);
......
......@@ -156,9 +156,9 @@ function forum_init() {
}
/**
* _forum_nodeapi_check_node_type
*
* @param mixed $node
* _forum_nodeapi_check_node_type
*
* @param mixed $node
* @param mixed $vocabulary
* @access protected
* @return bool
......@@ -235,7 +235,7 @@ function forum_nodeapi_prepare(&$node, $teaser, $page) {
/**
* Implementation of hook_nodeapi_validate().
*
*
* Check in particular that only a "leaf" term in the associated taxonomy.
*/
function forum_nodeapi_validate(&$node, $teaser, $page) {
......
......@@ -579,8 +579,8 @@ 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
// If a word already exists in the database, its score gets increased
// appropriately. If not, we create a new record with the appropriate
// starting score.
db_merge('search_index')->key(array(
'word' => $word,
......
......@@ -215,7 +215,7 @@ function taxonomy_vocabulary_save($vocabulary) {
if (empty($vocabulary->nodes)) {
$vocabulary->nodes = array();
}
if (!empty($vocabulary->name)) {
// Prevent leading and trailing spaces in vocabulary names.
$vocabulary->name = trim($vocabulary->name);
......
......@@ -251,7 +251,7 @@ function translation_nodeapi_delete(&$node, $teaser, $page) {
translation_remove_from_set($node);
}
}
/**
* Remove a node from its translation set (if any)
* and update the set accordingly.
......
......@@ -202,7 +202,7 @@ function _trigger_normalize_node_context($type, $node) {
/**
* Simple wrapper function to make user hooks work with new entry points.
*
* @TODO: Take advantage of the new API and reorganise/remove this function.
* @TODO: Take advantage of the new API and reorganise/remove this function.
*/
function _trigger_nodeapi(&$node, $op, $a3, $a4) {
// Keep objects for reuse so that changes actions make to objects can persist.
......@@ -241,7 +241,7 @@ function _trigger_nodeapi(&$node, $op, $a3, $a4) {
}
}
}
/**
* Implementation of hook_nodeapi_view().
*/
......@@ -384,51 +384,51 @@ function _trigger_normalize_user_context($type, $account) {
}
/**
* trigger_user_login
* trigger_user_login
*/
function trigger_user_login(&$edit, &$account, $category) {
_trigger_user('login', $edit, $account, $category);
_trigger_user('login', $edit, $account, $category);
}
/**
* Implementation of hook_user_logout().
*/
function trigger_user_logout(&$edit, &$account) {
_trigger_user('logout', $edit, $account);
_trigger_user('logout', $edit, $account);
}
/**
* Implementation of hook_user_insert().
*/
function trigger_user_insert(&$edit, &$account, $category) {
_trigger_user('insert', $edit, $account, $category);
_trigger_user('insert', $edit, $account, $category);
}
/**
* Implementation of hook_user_update().
*/
function trigger_user_update(&$edit, &$account, $category) {
_trigger_user('update', $edit, $account, $category);
_trigger_user('update', $edit, $account, $category);
}
/**
* Implementation of hook_user_delete().
*/
function trigger_user_delete(&$edit, &$account, $category) {
_trigger_user('delete', $edit, $account, $category);
_trigger_user('delete', $edit, $account, $category);
}
/**
* Implementation of hook_user_view().
*/
function trigger_user_view(&$edit, &$account, $category) {
_trigger_user('view', $edit, $account, $category);
_trigger_user('view', $edit, $account, $category);
}
/**
* Simple wrapper function to make user hooks work with new entry points.
*
* @TODO: Take advantage of the new API and reorganise/remove this function.
* @TODO: Take advantage of the new API and reorganise/remove this function.
*/
function _trigger_user($op, &$edit, &$account, $category = NULL) {
// Keep objects for reuse so that changes actions make to objects can persist.
......
......@@ -111,19 +111,19 @@ function simpletest_script_help() {
--url Immediately preceeds a URL to set the host and path. You will
need this parameter if Drupal is in a subdirectory on your
localhost and you have not set \$base_url in settings.php.
--php The absolute path to the PHP executable. Usually not needed.
--concurrency [num]
Run tests in parallel, up to [num] tests at a time. This requires
the Process Control Extension (PCNTL) to be compiled in PHP, not
the Process Control Extension (PCNTL) to be compiled in PHP, not
supported under Windows.
--all Run all available tests.
--class Run tests identified by specific class names, instead of group names.
--file Run tests identifiled by specific file names, instead of group names.
Specify the path and the extension (i.e. 'modules/user/user.test').
......@@ -391,7 +391,7 @@ function simpletest_script_get_test_list() {
foreach ($args['test_names'] as $file) {
$files[realpath($file)] = 1;
}
// Check for valid class names.
foreach ($all_tests as $class_name => $instance) {
$refclass = new ReflectionClass($class_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment