? 371235-patched-benchmarks.txt
? 371235-unpatched-benchmarks.txt
? sites/all/modules/cvs
Index: includes/path.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/path.inc,v
retrieving revision 1.32
diff -u -p -r1.32 path.inc
--- includes/path.inc 4 Jan 2009 20:04:32 -0000 1.32
+++ includes/path.inc 25 Feb 2009 23:40:20 -0000
@@ -260,3 +260,31 @@ function drupal_match_path($path, $patte
}
return (bool)preg_match($regexps[$patterns], $path);
}
+
+/*
+ * Extract part of the current Drupal path from a certain 'argument' onward.
+ *
+ * For example, if the path is 'http://example-drupal/blah/foo/foobar/ferzle':
+ * $pos = 0, returns 'blah/foo/foobar/ferzle'
+ * $pos = 2, returns 'foobar/ferzle'
+ * $pos = 4, returns ''
+ *
+ * @param $index
+ * The index of the component, where each component is separated by a '/'
+ * (forward-slash), and where the first component has an index of 0 (zero).
+ * @param $path
+ * The path to operate on, default is $_GET['q'].
+ * @return
+ * The extracted part of the path.
+ */
+function drupal_get_path_segment($index = 0, $path = NULL, $default = '') {
+ if (!isset($path)) {
+ $path = trim($_GET['q']);
+ }
+
+ $path = explode('/', $path, $index + 1);
+ $path = (count($path) > $index ? end($path) : $default);
+
+ return $path;
+}
+
Index: modules/path/path.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.admin.inc,v
retrieving revision 1.17
diff -u -p -r1.17 path.admin.inc
--- modules/path/path.admin.inc 13 Jan 2009 19:27:21 -0000 1.17
+++ modules/path/path.admin.inc 25 Feb 2009 23:40:22 -0000
@@ -11,7 +11,8 @@
* When filter key passed, perform a standard search on the given key,
* and return the list of matching URL aliases.
*/
-function path_admin_overview($keys = NULL) {
+function path_admin_overview() {
+ $keys = drupal_get_path_segment(4);
// Add the filter form above the overview table.
$output = drupal_get_form('path_admin_filter_form', $keys);
// Enable language column if locale is enabled or if we have any alias with language
@@ -239,12 +240,3 @@ function path_admin_filter_form_submit_r
$form_state['redirect'] = 'admin/build/path/list';
}
-
-/**
- * Helper function for grabbing filter keys.
- */
-function path_admin_filter_get_keys() {
- // Extract keys as remainder of path
- $path = explode('/', $_GET['q'], 5);
- return count($path) == 5 ? $path[4] : '';
-}
Index: modules/search/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.module,v
retrieving revision 1.283
diff -u -p -r1.283 search.module
--- modules/search/search.module 4 Jan 2009 16:10:48 -0000 1.283
+++ modules/search/search.module 25 Feb 2009 23:40:24 -0000
@@ -997,21 +997,6 @@ function do_search($keywords, $type, $jo
}
/**
- * Helper function for grabbing search keys.
- */
-function search_get_keys() {
- static $return;
- if (!isset($return)) {
- // Extract keys as remainder of path
- // Note: support old GET format of searches for existing links.
- $path = explode('/', $_GET['q'], 3);
- $keys = empty($_REQUEST['keys']) ? '' : $_REQUEST['keys'];
- $return = count($path) == 3 ? $path[2] : $keys;
- }
- return $return;
-}
-
-/**
* @defgroup search Search interface
* @{
* The Drupal search interface manages a global search mechanism.
Index: modules/search/search.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.pages.inc,v
retrieving revision 1.5
diff -u -p -r1.5 search.pages.inc
--- modules/search/search.pages.inc 14 Apr 2008 17:48:41 -0000 1.5
+++ modules/search/search.pages.inc 25 Feb 2009 23:40:24 -0000
@@ -21,7 +21,7 @@ function search_view($type = 'node') {
drupal_goto('search/node');
}
- $keys = search_get_keys();
+ $keys = drupal_get_path_segment(2, $_GET['q'], empty($_REQUEST['keys']) ? '' : $_REQUEST['keys']);
// Only perform search if there is non-whitespace search term:
$results = '';
if (trim($keys)) {
Index: modules/simpletest/tests/system_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/system_test.module,v
retrieving revision 1.8
diff -u -p -r1.8 system_test.module
--- modules/simpletest/tests/system_test.module 9 Dec 2008 11:09:26 -0000 1.8
+++ modules/simpletest/tests/system_test.module 25 Feb 2009 23:40:24 -0000
@@ -158,16 +158,6 @@ function system_test_boot() {
}
/**
- * Implementation of hook_init().
- */
-function system_test_init() {
- // Used by FrontPageTestCase to get the results of drupal_is_front_page().
- if (variable_get('front_page_output', 0) && drupal_is_front_page()) {
- drupal_set_message(t('On front page.'));
- }
-}
-
-/**
* Implementation of hook_exit().
*/
function system_test_exit() {
Index: modules/system/system.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.test,v
retrieving revision 1.39
diff -u -p -r1.39 system.test
--- modules/system/system.test 11 Feb 2009 05:33:18 -0000 1.39
+++ modules/system/system.test 25 Feb 2009 23:40:29 -0000
@@ -580,125 +580,6 @@ class DateTimeFunctionalTest extends Dru
}
}
-class PageTitleFiltering extends DrupalWebTestCase {
- protected $content_user;
- protected $saved_title;
-
- /**
- * Implementation of getInfo().
- */
- function getInfo() {
- return array(
- 'name' => t('HTML in page titles'),
- 'description' => t('Tests correct handling or conversion by drupal_set_title() and drupal_get_title().'),
- 'group' => t('System')
- );
- }
-
- /**
- * Implementation of setUp().
- */
- function setUp() {
- parent::setUp();
-
- $this->content_user = $this->drupalCreateUser(array('create page content', 'access content'));
- $this->drupalLogin($this->content_user);
- $this->saved_title = drupal_get_title();
- }
-
- /**
- * Reset page title.
- */
- function tearDown() {
- // Restore the page title.
- drupal_set_title($this->saved_title, PASS_THROUGH);
-
- parent::tearDown();
- }
-
- /**
- * Tests the handling of HTML by drupal_set_title() and drupal_get_title()
- */
- function testTitleTags() {
- $title = "string with HTML";
- // drupal_set_title's $filter is CHECK_PLAIN by default, so the title should be
- // returned with check_plain().
- drupal_set_title($title, CHECK_PLAIN);
- $this->assertTrue(strpos(drupal_get_title(), '') === FALSE, t('Tags in title converted to entities when $output is CHECK_PLAIN.'));
- // drupal_set_title's $filter is passed as PASS_THROUGH, so the title should be
- // returned with HTML.
- drupal_set_title($title, PASS_THROUGH);
- $this->assertTrue(strpos(drupal_get_title(), '') !== FALSE, t('Tags in title are not converted to entities when $output is PASS_THROUGH.'));
- // Generate node content.
- $edit = array(
- 'title' => '!SimpleTest! ' . $title . $this->randomName(20),
- 'body' => '!SimpleTest! test body' . $this->randomName(200),
- );
- // Create the node with HTML in the title.
- $this->drupalPost('node/add/page', $edit, t('Save'));
-
- $node = $this->drupalGetNodeByTitle($edit['title']);
- $this->assertNotNull($node, 'Node created and found in database');
- $this->drupalGet("node/" . $node->nid);
- $this->assertText(check_plain($edit['title']), 'Check to make sure tags in the node title are converted.');
- }
-}
-
-/**
- * Test front page functionality and administration.
- */
-class FrontPageTestCase extends DrupalWebTestCase {
-
- function getInfo() {
- return array(
- 'name' => t('Front page'),
- 'description' => t('Tests front page functionality and administration.'),
- 'group' => t('System'),
- );
- }
-
- function setUp() {
- parent::setUp('system_test');
-
- // Create admin user, log in admin user, and create one node.
- $this->admin_user = $this->drupalCreateUser(array('access content', 'administer site configuration'));
- $this->drupalLogin($this->admin_user);
- $this->node_path = "node/" . $this->drupalCreateNode(array('promote' => 1))->nid;
-
- // Enable front page logging in system_test.module.
- variable_set('front_page_output', 1);
- }
-
- /**
- * Test front page functionality.
- */
- function testDrupalIsFrontPage() {
- $this->drupalGet('');
- $this->assertText(t('On front page.'), t('Path is the front page.'));
- $this->drupalGet('node');
- $this->assertText(t('On front page.'), t('Path is the front page.'));
- $this->drupalGet($this->node_path);
- $this->assertNoText(t('On front page.'), t('Path is not the front page.'));
-
- // Change the front page to an invalid path.
- $edit = array('site_frontpage' => 'kittens');
- $this->drupalPost('admin/settings/site-information', $edit, t('Save configuration'));
- $this->assertText(t("The path '@path' is either invalid or you do not have access to it.", array('@path' => $edit['site_frontpage'])));
-
- // Change the front page to a valid path.
- $edit['site_frontpage'] = $this->node_path;
- $this->drupalPost('admin/settings/site-information', $edit, t('Save configuration'));
- $this->assertText(t('The configuration options have been saved.'), t('The front page path has been saved.'));
-
- $this->drupalGet('');
- $this->assertText(t('On front page.'), t('Path is the front page.'));
- $this->drupalGet('node');
- $this->assertNoText(t('On front page.'), t('Path is not the front page.'));
- $this->drupalGet($this->node_path);
- $this->assertText(t('On front page.'), t('Path is the front page.'));
- }
-}
-
class SystemBlockTestCase extends DrupalWebTestCase {
function getInfo() {
return array(
Index: modules/taxonomy/taxonomy.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.pages.inc,v
retrieving revision 1.23
diff -u -p -r1.23 taxonomy.pages.inc
--- modules/taxonomy/taxonomy.pages.inc 27 Jan 2009 00:22:27 -0000 1.23
+++ modules/taxonomy/taxonomy.pages.inc 25 Feb 2009 23:40:31 -0000
@@ -116,7 +116,9 @@ function taxonomy_term_edit($term) {
/**
* Helper function for autocompletion
*/
-function taxonomy_autocomplete($vid, $string = '') {
+function taxonomy_autocomplete($vid) {
+ $string = drupal_get_path_segment(3);
+
// The user enters a comma-separated list of tags. We only autocomplete the last tag.
$array = drupal_explode_tags($string);
Index: modules/simpletest/tests/path.test
===================================================================
RCS file: modules/simpletest/tests/path.test
diff -N modules/simpletest/tests/path.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/path.test 25 Feb 2009 23:40:42 -0000
@@ -0,0 +1,139 @@
+ t('HTML in page titles'),
+ 'description' => t('Tests correct handling or conversion by drupal_set_title() and drupal_get_title().'),
+ 'group' => t('Path')
+ );
+ }
+
+ function setUp() {
+ parent::setUp();
+
+ $this->content_user = $this->drupalCreateUser(array('create page content', 'access content'));
+ $this->drupalLogin($this->content_user);
+ $this->saved_title = drupal_get_title();
+ }
+
+ function tearDown() {
+ // Restore the page title.
+ drupal_set_title($this->saved_title, PASS_THROUGH);
+
+ parent::tearDown();
+ }
+
+ /**
+ * Tests the handling of HTML by drupal_set_title() and drupal_get_title()
+ */
+ function testTitleTags() {
+ $title = "string with HTML";
+ // drupal_set_title's $filter is CHECK_PLAIN by default, so the title should be
+ // returned with check_plain().
+ drupal_set_title($title, CHECK_PLAIN);
+ $this->assertTrue(strpos(drupal_get_title(), '') === FALSE, t('Tags in title converted to entities when $output is CHECK_PLAIN.'));
+ // drupal_set_title's $filter is passed as PASS_THROUGH, so the title should be
+ // returned with HTML.
+ drupal_set_title($title, PASS_THROUGH);
+ $this->assertTrue(strpos(drupal_get_title(), '') !== FALSE, t('Tags in title are not converted to entities when $output is PASS_THROUGH.'));
+ // Generate node content.
+ $edit = array(
+ 'title' => '!SimpleTest! ' . $title . $this->randomName(20),
+ 'body' => '!SimpleTest! test body' . $this->randomName(200),
+ );
+ // Create the node with HTML in the title.
+ $this->drupalPost('node/add/page', $edit, t('Save'));
+
+ $node = $this->drupalGetNodeByTitle($edit['title']);
+ $this->assertNotNull($node, 'Node created and found in database');
+ $this->drupalGet("node/" . $node->nid);
+ $this->assertText(check_plain($edit['title']), 'Check to make sure tags in the node title are converted.');
+ }
+}
+
+/**
+ * Test front page functionality and administration.
+ */
+class IsFrontPageUnitTest extends DrupalWebTestCase {
+ function getInfo() {
+ return array(
+ 'name' => t('Front page'),
+ 'description' => t('Tests front page functionality and administration.'),
+ 'group' => t('Path'),
+ );
+ }
+
+ function setUp() {
+ parent::setUp('path_test');
+
+ // Create admin user, log in admin user, and create one node.
+ $this->admin_user = $this->drupalCreateUser(array('access content', 'administer site configuration'));
+ $this->drupalLogin($this->admin_user);
+ $this->node_path = "node/" . $this->drupalCreateNode(array('promote' => 1))->nid;
+
+ // Enable front page logging in path_test.module.
+ variable_set('front_page_output', 1);
+ }
+
+ /**
+ * Test front page functionality.
+ */
+ function testDrupalIsFrontPage() {
+ $this->drupalGet('');
+ $this->assertText(t('On front page.'), t('Path is the front page.'));
+ $this->drupalGet('node');
+ $this->assertText(t('On front page.'), t('Path is the front page.'));
+ $this->drupalGet($this->node_path);
+ $this->assertNoText(t('On front page.'), t('Path is not the front page.'));
+
+ // Change the front page to an invalid path.
+ $edit = array('site_frontpage' => 'kittens');
+ $this->drupalPost('admin/settings/site-information', $edit, t('Save configuration'));
+ $this->assertText(t("The path '@path' is either invalid or you do not have access to it.", array('@path' => $edit['site_frontpage'])));
+
+ // Change the front page to a valid path.
+ $edit['site_frontpage'] = $this->node_path;
+ $this->drupalPost('admin/settings/site-information', $edit, t('Save configuration'));
+ $this->assertText(t('The configuration options have been saved.'), t('The front page path has been saved.'));
+
+ $this->drupalGet('');
+ $this->assertText(t('On front page.'), t('Path is the front page.'));
+ $this->drupalGet('node');
+ $this->assertNoText(t('On front page.'), t('Path is not the front page.'));
+ $this->drupalGet($this->node_path);
+ $this->assertText(t('On front page.'), t('Path is the front page.'));
+ }
+}
+
+/**
+ * Tests for the drupal_get_path_segment() function.
+ */
+class PathGetSegmentUnitTest extends DrupalWebTestCase {
+ function getInfo() {
+ return array(
+ 'name' => t('Tests for the drupal_get_path_segment() function'),
+ 'description' => t('Confirm that drupal_get_path_segment() works correctly with various input.'),
+ 'group' => t('Path'),
+ );
+ }
+
+ function testPathGetSegment() {
+ $segments = array(
+ 0 => 'test/kittens/drupal is fun?/seriously!',
+ 1 => 'kittens/drupal is fun?/seriously!',
+ 2 => 'drupal is fun?/seriously!',
+ 3 => 'seriously!',
+ 4 => '',
+ );
+
+ foreach ($segments as $pos => $segment) {
+ $this->assertIdentical($segments[$pos], drupal_get_path_segment($pos, $segments[0]));
+ }
+ }
+}
+
Index: modules/simpletest/tests/path_test.info
===================================================================
RCS file: modules/simpletest/tests/path_test.info
diff -N modules/simpletest/tests/path_test.info
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/path_test.info 25 Feb 2009 23:40:42 -0000
@@ -0,0 +1,8 @@
+; $Id$
+name = Path test
+description = Support module for path testing.
+package = Testing
+version = VERSION
+core = 7.x
+files[] = path_test.module
+hidden = TRUE
Index: modules/simpletest/tests/path_test.module
===================================================================
RCS file: modules/simpletest/tests/path_test.module
diff -N modules/simpletest/tests/path_test.module
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/path_test.module 25 Feb 2009 23:40:42 -0000
@@ -0,0 +1,12 @@
+