Unverified Commit 06d496f7 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3109097 by voleger, longwave: Drupal 9 does not handle db_* functions any more

parent fc46c7f3
Loading
Loading
Loading
Loading
+0 −3
Changes for core/lib/Drupal/Core/Database/Driver/mysql/Schema.php: 0 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -140,9 +140,6 @@ protected function createTableSql($name, $table) {
  /**
   * Create an SQL string for a field to be used in table creation or alteration.
   *
   * Before passing a field out of a schema definition into this function it has
   * to be processed by _db_process_field().
   *
   * @param string $name
   *   Name of the field.
   * @param array $spec
+0 −3
Changes for core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php: 0 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -318,9 +318,6 @@ protected function createTableSql($name, $table) {
   * Create an SQL string for a field to be used in table creation or
   * alteration.
   *
   * Before passing a field out of a schema definition into this
   * function it has to be processed by _db_process_field().
   *
   * @param $name
   *   Name of the field.
   * @param $spec
+5 −6
Changes for core/lib/Drupal/Core/Database/Log.php: 5 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -125,11 +125,10 @@ public function log(StatementInterface $statement, $args, $time) {
   * Determine the routine that called this query.
   *
   * We define "the routine that called this query" as the first entry in
   * the call stack that is not inside the includes/Drupal/Database directory,
   * does not begin with db_ and does have a file (which excludes
   * call_user_func_array(), anonymous functions and similar). That makes the
   * climbing logic very simple, and handles the variable stack depth caused by
   * the query builders.
   * the call stack that is not inside the includes/Drupal/Database directory
   * and does have a file (which excludes call_user_func_array(), anonymous
   * functions and similar). That makes the climbing logic very simple, and
   * handles the variable stack depth caused by the query builders.
   *
   * See the @link http://php.net/debug_backtrace debug_backtrace() @endlink
   * function.
@@ -150,7 +149,7 @@ public function findCaller() {
      if (empty($stack[$i + 1]['class'])) {
        $stack[$i + 1]['class'] = '';
      }
      if (strpos($stack[$i + 1]['class'], __NAMESPACE__) === FALSE && strpos($stack[$i + 1]['function'], 'db_') === FALSE && !empty($stack[$i]['file'])) {
      if (strpos($stack[$i + 1]['class'], __NAMESPACE__) === FALSE && !empty($stack[$i]['file'])) {
        $stack[$i] += ['file' => '?', 'line' => '?', 'args' => []];
        return [
          'file' => $stack[$i]['file'],
+1 −1
Changes for core/lib/Drupal/Core/Pager/PagerManagerInterface.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ interface PagerManagerInterface {
   * you can extend the query object with the 'PagerSelectExtender' extender
   * before executing it. For example:
   * @code
   *   $query = db_select('some_table')
   *   $query = $connection->select('some_table')
   *     ->extend('Drupal\Core\Database\Query\PagerSelectExtender');
   * @endcode
   *
+3 −4
Changes for core/lib/Drupal/Core/Utility/Error.php: 3 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -46,11 +46,10 @@ public static function decodeException($exception) {
    if ($exception instanceof \PDOException || $exception instanceof DatabaseExceptionWrapper) {
      // The first element in the stack is the call, the second element gives us
      // the caller. We skip calls that occurred in one of the classes of the
      // database layer or in one of its global functions.
      $db_functions = ['db_query', 'db_query_range'];
      // database layer.
      while (!empty($backtrace[1]) && ($caller = $backtrace[1]) &&
        ((isset($caller['class']) && (strpos($caller['class'], 'Query') !== FALSE || strpos($caller['class'], 'Database') !== FALSE || strpos($caller['class'], 'PDO') !== FALSE)) ||
          in_array($caller['function'], $db_functions))) {
        ((isset($caller['class']) && (strpos($caller['class'], 'Query') !== FALSE || strpos($caller['class'], 'Database') !== FALSE || strpos($caller['class'], 'PDO') !== FALSE))
        )) {
        // We remove that call.
        array_shift($backtrace);
      }
Loading