reverted: --- b/core/modules/statistics/lib/Drupal/statistics/Plugin/views/field/AccesslogPath.php +++ /dev/null @@ -1,82 +0,0 @@ -options['display_as_link'])) { - $this->additional_fields['path'] = 'path'; - } - } - - /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::defineOptions(). - */ - protected function defineOptions() { - $options = parent::defineOptions(); - - $options['display_as_link'] = array('default' => TRUE, 'bool' => TRUE); - - return $options; - } - - /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::buildOptionsForm(). - */ - public function buildOptionsForm(&$form, &$form_state) { - parent::buildOptionsForm($form, $form_state); - - $form['display_as_link'] = array( - '#title' => t('Display as link'), - '#type' => 'checkbox', - '#default_value' => !empty($this->options['display_as_link']), - ); - } - - /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render(). - */ - public function render($values) { - $value = $this->get_value($values); - return $this->render_link($this->sanitizeValue($value), $values); - } - - /** - * Modify the advanced render options to display output as a link. - */ - protected function render_link($data, $values) { - if (!empty($this->options['display_as_link'])) { - $this->options['alter']['make_link'] = TRUE; - $this->options['alter']['path'] = $this->get_value($values, 'path'); - $this->options['alter']['html'] = TRUE; - } - - return $data; - } - -} reverted: --- b/core/modules/statistics/lib/Drupal/statistics/Tests/Views/AccessLogPathTest.php +++ /dev/null @@ -1,90 +0,0 @@ - 'Statistics: accesslog path handler', - 'description' => 'Tests the accesslog path field handler.', - 'group' => 'Views Modules', - ); - } - - protected function setUp() { - parent::setUp(); - - ViewTestData::importTestViews(get_class($this), array('statistics_test_views')); - - // Create a new user for viewing nodes. - $this->webUser = $this->drupalCreateUser(array('access content')); - - $this->node = $this->drupalCreateNode(array('type' => 'page')); - - // Enable access logging. - config('statistics.settings') - ->set('access_log.enabled', 1) - ->set('count_content_views', 1) - ->save(); - - $this->drupalLogin($this->webUser); - } - - /** - * Tests the AcessLogPath field handler. - */ - public function testHandler() { - $view = views_get_view('test_statistics_accesslog_integration'); - $this->executeView($view); - - $this->drupalGet('test_statistics_accesslog_integration'); - - foreach ($view->result as $result) { - // There should be lo link matching the path, but still raw text. - $this->assertNoLink($result->accesslog_path); - $this->assertText($result->accesslog_path); - } - - // Test the display_as_link option can be turned off. - $fields = $view->display_handler->getOption('fields'); - $fields['path']['display_as_link'] = TRUE; - $view->display_handler->setOption('fields', $fields); - $view->save(); - $this->executeView($view); - - $this->drupalGet('test_statistics_accesslog_integration'); - - foreach ($view->result as $result) { - // The link should match the accesslog path value. - $this->assertLinkbyHref($result->accesslog_path); - $this->assertText($result->accesslog_path); - } - } - -} reverted: --- b/core/modules/statistics/lib/Drupal/statistics/Tests/Views/IntegrationTest.php +++ /dev/null @@ -1,119 +0,0 @@ - 'Statistics: Integration tests', - 'description' => 'Tests basic integeration of views data from the statistics module.', - 'group' => 'Views Modules', - ); - } - - protected function setUp() { - parent::setUp(); - - ViewTestData::importTestViews(get_class($this), array('statistics_test_views')); - - // Create a new user for viewing nodes. - $this->webUser = $this->drupalCreateUser(array('access content')); - - $this->node = $this->drupalCreateNode(array('type' => 'page')); - - // Enable access logging. - config('statistics.settings') - ->set('access_log.enabled', 1) - ->set('count_content_views', 1) - ->save(); - - $this->drupalLogin($this->webUser); - } - - /** - * Tests the integration of node_counter views data. - */ - public function testNodeCounterIntegration() { - $this->drupalGet('node/' . $this->node->id()); - // Manually calling statistics.php, simulating ajax behavior. - // @see \Drupal\statistics\Tests\StatisticsLoggingTest::testLogging(). - $post = http_build_query(array('nid' => $this->node->id())); - $headers = array('Content-Type' => 'application/x-www-form-urlencoded'); - global $base_url; - $stats_path = $base_url . '/' . drupal_get_path('module', 'statistics'). '/statistics.php'; - drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000)); - - $this->drupalGet('test_statistics_integration'); - - $expected = statistics_get($this->node->id()); - // Convert the timestamp to year, to match the expected output of the date - // handler. - $expected['timestamp'] = date('Y', $expected['timestamp']); - - foreach ($expected as $field => $value) { - $xpath = "//div[contains(@class, views-field-$field)]/span[@class = 'field-content']"; - $this->assertFieldByXpath($xpath, $value, "The $field output matches the expected."); - } - } - - /** - * [textAccessLogIntegration description] - */ - public function testAccessLogIntegration() { - // Get the expected before requesting the page. - $results = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC); - - $this->drupalGet('test_statistics_accesslog_integration'); - - // Test we have all the results results. - $elements = $this->xpath("//div[@class = 'view-content']/div[contains(@class, views-row)]"); - $this->assertEqual(count($elements), count($results)); - - $expected = reset($results); - // Convert the expected timestamp to year. - $expected['timestamp'] = date('Y', $expected['timestamp']); - // uid is not needed. - unset($expected['uid']); - - // Test the first row values. - foreach ($expected as $field => $value) { - $xpath = "//div[@class = 'view-content']/div[contains(@class, views-row-1)]/div[contains(@class, views-field-$field)]/span[@class = 'field-content']"; - $this->assertFieldByXpath($xpath ,$value, "Value $value is correct for $field field."); - } - } - -} reverted: --- b/core/modules/statistics/statistics.views.inc +++ /dev/null @@ -1,259 +0,0 @@ - array( - 'left_field' => 'nid', - 'field' => 'nid', - ), - ); - - // totalcount - $data['node_counter']['totalcount'] = array( - 'title' => t('Total views'), - 'help' => t('The total number of times the node has been viewed.'), - - 'field' => array( - 'id' => 'numeric', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'id' => 'numeric', - ), - 'sort' => array( - 'id' => 'standard', - ), - ); - - // daycount - $data['node_counter']['daycount'] = array( - 'title' => t('Views today'), - 'help' => t('The total number of times the node has been viewed today.'), - - 'field' => array( - 'id' => 'numeric', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'id' => 'numeric', - ), - 'sort' => array( - 'id' => 'standard', - ), - ); - - // timestamp - $data['node_counter']['timestamp'] = array( - 'title' => t('Most recent view'), - 'help' => t('The most recent time the node has been viewed.'), - - 'field' => array( - 'id' => 'date', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'id' => 'date', - ), - 'sort' => array( - 'id' => 'standard', - ), - ); - - // accesslog table - - $data['accesslog']['table']['group'] = t('Access log'); - - // Advertise this table as a possible base table - $data['accesslog']['table']['base'] = array( - 'field' => 'aid', - 'title' => t('Access log'), - 'help' => t('Stores site access information.'), - 'weight' => 10, - ); - - // For other base tables, explain how we join - $data['accesslog']['table']['join'] = array( - 'users' => array( - 'field' => 'uid', - 'left_field' => 'uid', - ), - ); - - // accesslog.aid - $data['accesslog']['aid'] = array( - 'title' => t('Aid'), - 'help' => t('Unique access event ID.'), - 'field' => array( - 'id' => 'numeric', - 'click sortable' => TRUE, - ), - 'argument' => array( - 'id' => 'numeric', - 'name field' => 'wid', - 'numeric' => TRUE, - ), - 'filter' => array( - 'id' => 'numeric', - ), - 'sort' => array( - 'id' => 'standard', - ), - ); - - // session id - $data['accesslog']['sid'] = array( - 'title' => t('Session ID'), - 'help' => t('Browser session ID of user that visited page.'), - - 'field' => array( - 'id' => 'standard', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'id' => 'string', - ), - 'argument' => array( - 'id' => 'string', - ), - 'sort' => array( - 'id' => 'standard', - ), - ); - - // title - $data['accesslog']['title'] = array( - 'title' => t('Page title'), - 'help' => t('Title of page visited.'), - - 'field' => array( - 'id' => 'accesslog_path', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'id' => 'string', - ), - 'sort' => array( - 'id' => 'standard', - ), - 'argument' => array( - 'id' => 'standard', - ), - ); - - // path - $data['accesslog']['path'] = array( - 'title' => t('Path'), - 'help' => t('Internal path to page visited (relative to Drupal root.)'), - - 'field' => array( - 'id' => 'accesslog_path', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'id' => 'string', - ), - 'sort' => array( - 'id' => 'standard', - ), - //No argument here. Can't send forward slashes as arguments. - //Can be worked around by node ID. - //(but what about aliases?) - ); - - // referrer - $data['accesslog']['url'] = array( - 'title' => t('Referrer'), - 'help' => t('Referrer URI.'), - 'field' => array( - 'id' => 'url', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'id' => 'string', - ), - 'sort' => array( - 'id' => 'standard', - ), - ); - - // hostname - $data['accesslog']['hostname'] = array( - 'title' => t('Hostname'), - 'help' => t('Hostname of user that visited the page.'), - 'field' => array( - 'id' => 'standard', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'id' => 'string', - ), - 'sort' => array( - 'id' => 'standard', - ), - 'argument' => array( - 'id' => 'string', - ), - ); - - // user - $data['accesslog']['uid'] = array( - 'title' => t('User'), - 'help' => t('The user who visited the site.'), - 'relationship' => array( - 'id' => 'standard', - 'base' => 'users', - 'base field' => 'uid', - ), - ); - - // timer - $data['accesslog']['timer'] = array( - 'title' => t('Timer'), - 'help' => t('Time in milliseconds that the page took to load.'), - 'field' => array( - 'id' => 'numeric', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'id' => 'numeric', - ), - 'sort' => array( - 'id' => 'standard', - ), - ); - - // timestamp - $data['accesslog']['timestamp'] = array( - 'title' => t('Timestamp'), - 'help' => t('Timestamp of when the page was visited.'), - 'field' => array( - 'id' => 'date', - 'click sortable' => TRUE, - ), - 'sort' => array( - 'id' => 'standard', - ), - 'filter' => array( - 'id' => 'date', - ), - ); - - return $data; -} reverted: --- b/core/modules/statistics/tests/modules/statistics_test_views/statistics_test_views.info +++ /dev/null @@ -1,8 +0,0 @@ -name = Statistics test views -description = Provides default views for views statistics tests. -package = Testing -version = VERSION -core = 8.x -dependencies[] = statistics -dependencies[] = views -hidden = TRUE reverted: --- b/core/modules/statistics/tests/modules/statistics_test_views/test_views/views.view.test_statistics_accesslog_integration.yml +++ /dev/null @@ -1,399 +0,0 @@ -api_version: '3.0' -base_field: aid -base_table: accesslog -core: 8.x -description: '' -disabled: '0' -display: - default: - display_plugin: default - id: default - display_title: Master - position: '' - display_options: - access: - type: none - cache: - type: none - query: - type: views_query - exposed_form: - type: basic - pager: - type: none - options: - items_per_page: '0' - style: - type: default - row: - type: fields - fields: - aid: - table: accesslog - field: aid - id: aid - hostname: - id: hostname - table: accesslog - field: hostname - relationship: none - group_type: group - admin_label: '' - label: Hostname - exclude: '0' - alter: - alter_text: '0' - text: '' - make_link: '0' - path: '' - absolute: '0' - external: '0' - replace_spaces: '0' - path_case: none - trim_whitespace: '0' - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: '0' - max_length: '' - word_boundary: '1' - ellipsis: '1' - more_link: '0' - more_link_text: '' - more_link_path: '' - strip_tags: '0' - trim: '0' - preserve_tags: '' - html: '0' - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: '1' - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: '1' - empty: '' - hide_empty: '0' - empty_zero: '0' - hide_alter_empty: '1' - title: - id: title - table: accesslog - field: title - relationship: none - group_type: group - admin_label: '' - label: 'Page title' - exclude: '0' - alter: - alter_text: '0' - text: '' - make_link: '0' - path: '' - absolute: '0' - external: '0' - replace_spaces: '0' - path_case: none - trim_whitespace: '0' - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: '0' - max_length: '' - word_boundary: '1' - ellipsis: '1' - more_link: '0' - more_link_text: '' - more_link_path: '' - strip_tags: '0' - trim: '0' - preserve_tags: '' - html: '0' - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: '1' - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: '1' - empty: '' - hide_empty: '0' - empty_zero: '0' - hide_alter_empty: '1' - display_as_link: '0' - path: - id: path - table: accesslog - field: path - relationship: none - group_type: group - admin_label: '' - label: Path - exclude: '0' - alter: - alter_text: '0' - text: '' - make_link: '0' - path: '' - absolute: '0' - external: '0' - replace_spaces: '0' - path_case: none - trim_whitespace: '0' - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: '0' - max_length: '' - word_boundary: '1' - ellipsis: '1' - more_link: '0' - more_link_text: '' - more_link_path: '' - strip_tags: '0' - trim: '0' - preserve_tags: '' - html: '0' - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: '1' - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: '1' - empty: '' - hide_empty: '0' - empty_zero: '0' - hide_alter_empty: '1' - display_as_link: '0' - url: - id: url - table: accesslog - field: url - relationship: none - group_type: group - admin_label: '' - label: Referrer - exclude: '0' - alter: - alter_text: '0' - text: '' - make_link: '0' - path: '' - absolute: '0' - external: '0' - replace_spaces: '0' - path_case: none - trim_whitespace: '0' - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: '0' - max_length: '' - word_boundary: '1' - ellipsis: '1' - more_link: '0' - more_link_text: '' - more_link_path: '' - strip_tags: '0' - trim: '0' - preserve_tags: '' - html: '0' - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: '1' - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: '1' - empty: '' - hide_empty: '0' - empty_zero: '0' - hide_alter_empty: '1' - display_as_link: '0' - sid: - id: sid - table: accesslog - field: sid - relationship: none - group_type: group - admin_label: '' - label: 'Session ID' - exclude: '0' - alter: - alter_text: '0' - text: '' - make_link: '0' - path: '' - absolute: '0' - external: '0' - replace_spaces: '0' - path_case: none - trim_whitespace: '0' - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: '0' - max_length: '' - word_boundary: '1' - ellipsis: '1' - more_link: '0' - more_link_text: '' - more_link_path: '' - strip_tags: '0' - trim: '0' - preserve_tags: '' - html: '0' - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: '1' - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: '1' - empty: '' - hide_empty: '0' - empty_zero: '0' - hide_alter_empty: '1' - timer: - id: timer - table: accesslog - field: timer - relationship: none - group_type: group - admin_label: '' - label: Timer - exclude: '0' - alter: - alter_text: '0' - text: '' - make_link: '0' - path: '' - absolute: '0' - external: '0' - replace_spaces: '0' - path_case: none - trim_whitespace: '0' - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: '0' - max_length: '' - word_boundary: '1' - ellipsis: '1' - more_link: '0' - more_link_text: '' - more_link_path: '' - strip_tags: '0' - trim: '0' - preserve_tags: '' - html: '0' - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: '1' - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: '1' - empty: '' - hide_empty: '0' - empty_zero: '0' - hide_alter_empty: '1' - set_precision: '0' - precision: '0' - decimal: . - separator: '' - format_plural: '0' - format_plural_singular: '1' - format_plural_plural: '@count' - prefix: '' - suffix: '' - timestamp: - id: timestamp - table: accesslog - field: timestamp - relationship: none - group_type: group - admin_label: '' - label: Timestamp - exclude: '0' - alter: - alter_text: '0' - text: '' - make_link: '0' - path: '' - absolute: '0' - external: '0' - replace_spaces: '0' - path_case: none - trim_whitespace: '0' - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: '0' - max_length: '' - word_boundary: '1' - ellipsis: '1' - more_link: '0' - more_link_text: '' - more_link_path: '' - strip_tags: '0' - trim: '0' - preserve_tags: '' - html: '0' - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: '1' - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: '1' - empty: '' - hide_empty: '0' - empty_zero: '0' - hide_alter_empty: '1' - date_format: html_year - custom_date_format: '' - timezone: '' - filters: { } - sorts: { } - title: 'Test statistics accesslog integration' - page_1: - display_plugin: page - id: page_1 - display_title: Page - position: '' - display_options: - path: test_statistics_accesslog_integration -human_name: 'Test statistics accesslog integration' -module: views -name: test_statistics_accesslog_integration -tag: '' reverted: --- b/core/modules/statistics/tests/modules/statistics_test_views/test_views/views.view.test_statistics_integration.yml +++ /dev/null @@ -1,238 +0,0 @@ -api_version: '3.0' -base_field: nid -base_table: node -core: 8.x -description: '' -disabled: '0' -display: - default: - display_plugin: default - id: default - display_title: Master - position: '' - display_options: - access: - type: perm - cache: - type: none - query: - type: views_query - exposed_form: - type: basic - pager: - type: none - options: - offset: '0' - style: - type: default - row: - type: fields - fields: - title: - id: title - table: node - field: title - label: '' - alter: - alter_text: '0' - make_link: '0' - absolute: '0' - trim: '0' - word_boundary: '0' - ellipsis: '0' - strip_tags: '0' - html: '0' - hide_empty: '0' - empty_zero: '0' - link_to_node: '1' - timestamp: - id: timestamp - table: node_counter - field: timestamp - relationship: none - group_type: group - admin_label: '' - label: 'Most recent view' - exclude: '0' - alter: - alter_text: '0' - text: '' - make_link: '0' - path: '' - absolute: '0' - external: '0' - replace_spaces: '0' - path_case: none - trim_whitespace: '0' - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: '0' - max_length: '' - word_boundary: '1' - ellipsis: '1' - more_link: '0' - more_link_text: '' - more_link_path: '' - strip_tags: '0' - trim: '0' - preserve_tags: '' - html: '0' - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: '1' - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: '1' - empty: '' - hide_empty: '0' - empty_zero: '0' - hide_alter_empty: '1' - date_format: html_year - custom_date_format: '' - timezone: '' - totalcount: - id: totalcount - table: node_counter - field: totalcount - relationship: none - group_type: group - admin_label: '' - label: 'Total views' - exclude: '0' - alter: - alter_text: '0' - text: '' - make_link: '0' - path: '' - absolute: '0' - external: '0' - replace_spaces: '0' - path_case: none - trim_whitespace: '0' - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: '0' - max_length: '' - word_boundary: '1' - ellipsis: '1' - more_link: '0' - more_link_text: '' - more_link_path: '' - strip_tags: '0' - trim: '0' - preserve_tags: '' - html: '0' - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: '1' - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: '1' - empty: '' - hide_empty: '0' - empty_zero: '0' - hide_alter_empty: '1' - set_precision: '0' - precision: '0' - decimal: . - separator: '' - format_plural: '0' - format_plural_singular: '1' - format_plural_plural: '@count' - prefix: '' - suffix: '' - daycount: - id: daycount - table: node_counter - field: daycount - relationship: none - group_type: group - admin_label: '' - label: 'Views today' - exclude: '0' - alter: - alter_text: '0' - text: '' - make_link: '0' - path: '' - absolute: '0' - external: '0' - replace_spaces: '0' - path_case: none - trim_whitespace: '0' - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: '0' - max_length: '' - word_boundary: '1' - ellipsis: '1' - more_link: '0' - more_link_text: '' - more_link_path: '' - strip_tags: '0' - trim: '0' - preserve_tags: '' - html: '0' - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: '1' - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: '1' - empty: '' - hide_empty: '0' - empty_zero: '0' - hide_alter_empty: '1' - set_precision: '0' - precision: '0' - decimal: . - separator: '' - format_plural: '0' - format_plural_singular: '1' - format_plural_plural: '@count' - prefix: '' - suffix: '' - filters: - status: - value: '1' - table: node - field: status - id: status - expose: - operator: '0' - group: '1' - sorts: - created: - id: created - table: node - field: created - order: DESC - page_1: - display_plugin: page - id: page_1 - display_title: Page - position: '' - display_options: - path: test_statistics_integration -human_name: 'Test statistics integration' -module: views -name: test_statistics_integration -tag: '' only in patch2: unchanged: --- /dev/null +++ b/core/modules/search/lib/Drupal/search/Tests/Views/BackLinksViewTest.php @@ -0,0 +1,44 @@ + 'Search: backlinks view', + 'description' => 'Tests the backlinks view.', + 'group' => 'Views Modules', + ); + } + + /** + * Tests the backlinks view. + */ + protected function testBacklinksView() { + $view = views_get_view('backlinks'); + $this->executeView($view, array(1)); + + $this->assertEqual(count($view->result), 9, 'The expected amount of results got returned.'); + $node_one_found = FALSE; + foreach ($view->result as $row) { + if ($row->nid == 1) { + break; + $node_one_found = TRUE; + } + } + $this->assertFalse($node_one_found, 'The first node does not reference itself.'); + + } + +} only in patch2: unchanged: --- /dev/null +++ b/core/modules/search/lib/Drupal/search/Tests/Views/SearchTestBase.php @@ -0,0 +1,40 @@ +drupalCreateNode(); + $node->body[LANGUAGE_NOT_SPECIFIED][0]['value'] = $i != 0 ? l('Node ' . 1, 'node/' . 1) : ''; + $node->save(); + + search_index($node->nid, 'node', $node->body[LANGUAGE_NOT_SPECIFIED][0]['value'], LANGUAGE_NOT_SPECIFIED); + } + } + +} only in patch2: unchanged: --- /dev/null +++ b/core/modules/search/search.views.inc @@ -0,0 +1,129 @@ + array( + 'left_field' => 'nid', + 'field' => 'sid', + ), + ); + + $data['search_total']['table']['join'] = array( + 'node' => array( + 'left_table' => 'search_index', + 'left_field' => 'word', + 'field' => 'word', + ), + 'users' => array( + 'left_table' => 'search_index', + 'left_field' => 'word', + 'field' => 'word', + ) + ); + + $data['search_dataset']['table']['join'] = array( + 'node' => array( + 'left_table' => 'search_index', + 'left_field' => 'sid', + 'field' => 'sid', + 'extra' => 'search_index.type = search_dataset.type', + 'type' => 'INNER', + ), + 'users' => array( + 'left_table' => 'search_index', + 'left_field' => 'sid', + 'field' => 'sid', + 'extra' => 'search_index.type = search_dataset.type', + 'type' => 'INNER', + ), + ); + + $data['search_index']['score'] = array( + 'title' => t('Score'), + 'help' => t('The score of the search item. This will not be used if the search filter is not also present.'), + 'field' => array( + 'id' => 'search_score', + 'click sortable' => TRUE, + 'float' => TRUE, + 'no group by' => TRUE, + ), + 'sort' => array( + 'id' => 'search_score', + 'no group by' => TRUE, + ), + ); + + $data['search_node_links_from']['table']['group'] = t('Search'); + $data['search_node_links_from']['table']['join'] = array( + 'node' => array( + 'arguments' => array( + 'table' => 'search_node_links', + 'left_table' => 'node', + 'field' => 'nid', + 'left_field' => 'nid', + 'type' => 'INNER' + ), + ), + ); + $data['search_node_links_from']['sid'] = array( + 'title' => t('Links from'), + 'help' => t('Other nodes that are linked from the node.'), + 'argument' => array( + 'id' => 'node_nid', + ), + 'filter' => array( + 'id' => 'equality', + ), + ); + + $data['search_node_links_to']['table']['group'] = t('Search'); + $data['search_node_links_to']['table']['join'] = array( + 'node' => array( + 'arguments' => array( + 'table' => 'search_node_links', + 'left_table' => 'node', + 'field' => 'sid', + 'left_field' => 'nid', + 'type' => 'INNER' + ), + ), + ); + $data['search_node_links_to']['nid'] = array( + 'title' => t('Links to'), + 'help' => t('Other nodes that link to the node.'), + 'argument' => array( + 'id' => 'node_nid', + ), + 'filter' => array( + 'id' => 'equality', + ), + ); + + $data['search_index']['keys'] = array( + 'title' => t('Search Terms'), + 'help' => t('The terms to search for.'), + 'filter' => array( + 'id' => 'search', + 'no group by' => TRUE, + ), + 'argument' => array( + 'id' => 'search', + 'no group by' => TRUE, + ), + ); + + return $data; +} only in patch2: unchanged: --- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php @@ -20,7 +20,7 @@ class DefaultViewsTest extends WebTestBase { * * @var array */ - public static $modules = array('views', 'node', 'search', 'comment', 'taxonomy', 'block'); + public static $modules = array('views', 'node', 'comment', 'taxonomy', 'block'); /** * An array of argument arrays to use for default views. @@ -99,12 +99,9 @@ protected function setUp() { if ($i % 2) { $values['promote'] = TRUE; } - $values['body'][LANGUAGE_NOT_SPECIFIED][]['value'] = l('Node ' . 1, 'node/' . 1); $node = $this->drupalCreateNode($values); - search_index($node->nid, 'node', $node->body[LANGUAGE_NOT_SPECIFIED][0]['value'], LANGUAGE_NOT_SPECIFIED); - $comment = array( 'uid' => $user->uid, 'nid' => $node->nid,