Problem/Motivation

Drupal 9 has removed functional wrapers of DB API. So logger has to not expect db_* functions from stack trace.
Also, there are mentions of _db_process_field() function in the documentation which existed only in Drupal 6.

Proposed resolution

Remove related check.
Update relate documentation.

Comments

voleger created an issue. See original summary.

voleger’s picture

Status: Needs work » Needs review
StatusFileSize
new2.93 KB

Here the patch.

voleger’s picture

Title: Drupal 9 not expect to handle db_* functions no more » Drupal 9 not handle db_* functions no more
voleger’s picture

Assigned: voleger » Unassigned
longwave’s picture

Title: Drupal 9 not handle db_* functions no more » Drupal 9 not handle db_* functions any more
Status: Needs review » Needs work

Nice find! I found a few more with grep, we should probably do all these together:

A reference in \Drupal\Core\Utility\Error::decodeException():

      $db_functions = ['db_query', 'db_query_range'];

A comment in \Drupal\Core\Pager\PagerManagerInterface:

   *   $query = db_select('some_table')
   *     ->extend('Drupal\Core\Database\Query\PagerSelectExtender');

An assertion in \Drupal\Tests\node\Kernel\NodeAccessLanguageAwareTest::testNodeAccessLanguageAware():

    $this->assertEqual(count($nids), 3, 'db_select() returns 3 nodes when no langcode is specified.');

A comment in \Drupal\views\Plugin\views\query\Sql::query():

    // db_select doesn't support to specify the key, so use getConnection directly.
longwave’s picture

Title: Drupal 9 not handle db_* functions any more » Drupal 9 does not handle db_* functions any more
andypost’s picture

Log is blocker?

voleger’s picture

Status: Needs work » Needs review
StatusFileSize
new6.7 KB
new3.26 KB

Thanks @longwave, addressed new finds.

longwave’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/modules/views/src/Plugin/views/query/Sql.php
@@ -1296,7 +1296,7 @@ public function query($get_count = FALSE) {
+    // $connection->select doesn't support to specify the key, so use getConnection directly.

I am not sure we need this comment at all any more, but other than that this looks great, so RTBC from me.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Nice tidy up! @andypost I don't think that #2999962: Unify Database/Log::findCaller and Utility/Error::getLastCaller is a blocker.

Committed 06d496f and pushed to 9.0.x. Thanks!

I agree with @longwave - that comment is unnecessary.

diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php
index b5aa3776b3..59b9eb7e83 100644
--- a/core/modules/views/src/Plugin/views/query/Sql.php
+++ b/core/modules/views/src/Plugin/views/query/Sql.php
@@ -1296,7 +1296,6 @@ public function query($get_count = FALSE) {
     }
 
     // Go ahead and build the query.
-    // $connection->select doesn't support to specify the key, so use getConnection directly.
     $query = Database::getConnection($target, $key)
       ->select($this->view->storage->get('base_table'), $this->view->storage->get('base_table'), $options)
       ->addTag('views')

Removed on commit.

  • alexpott committed 06d496f on 9.0.x
    Issue #3109097 by voleger, longwave: Drupal 9 does not handle db_*...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.