Drupal 9 compatibility and remove deprecated function calls

Created on 29 April 2021, over 3 years ago
Updated 19 March 2023, over 1 year ago

Problem/Motivation

Need to remove deprecated function calls to make module compatible with Drupal 9.

Adding the list of deprecated function calls.


autoslave.cache.inc:
┌──────────┬──────┬─────────────────────────────────────────────────────────────┐
│  STATUS  │ LINE │                           MESSAGE                           │
├──────────┼──────┼─────────────────────────────────────────────────────────────┤
│ Check    │      │ Reflection error: Drupal\autoslave\DrupalCacheInterface not │
│ manually │      │ found.                                                      │
│          │      │                                                             │
└──────────┴──────┴─────────────────────────────────────────────────────────────┘

autoslave.cachesafe.inc:
┌──────────┬──────┬───────────────────────────────────────────────────┐
│  STATUS  │ LINE │                      MESSAGE                      │
├──────────┼──────┼───────────────────────────────────────────────────┤
│ Check    │      │ Reflection error: DrupalCacheInterface not found. │
│ manually │      │                                                   │
│ Check    │ 17   │ Reflection error: DrupalCacheInterface not found. │
│ manually │      │                                                   │
└──────────┴──────┴───────────────────────────────────────────────────┘

lib\Drupal\autoslave\Database\Driver\autoslave\Connection.php:
┌─────────┬──────┬──────────────────────────────────────────────────────────────┐
│ STATUS  │ LINE │                           MESSAGE                            │
├─────────┼──────┼──────────────────────────────────────────────────────────────┤
│ Fix now │ 641  │ Call to deprecated function drupal_set_message(). Deprecated │
│         │      │ in drupal:8.5.0 and is removed from drupal:9.0.0.   Use      │
│         │      │ Drupal\Core\Messenger\MessengerInterface::addMessage()       │
│         │      │ instead.                                                     │
│         │      │                                                              │
└─────────┴──────┴──────────────────────────────────────────────────────────────┘

lib\Drupal\autoslave\Database\Driver\autoslave\Transaction.php:
┌──────────┬──────┬─────────────────────────────────────────────────────────────┐
│  STATUS  │ LINE │                           MESSAGE                           │
├──────────┼──────┼─────────────────────────────────────────────────────────────┤
│ Check    │      │ Reflection error: Drupal\autoslave\DrupalCacheInterface not │
│ manually │      │ found.                                                      │
│          │      │                                                             │
└──────────┴──────┴─────────────────────────────────────────────────────────────┘

src\Controller\AutoslaveController.php:
┌─────────┬──────┬──────────────────────────────────────────────────────────────┐
│ STATUS  │ LINE │                           MESSAGE                            │
├─────────┼──────┼──────────────────────────────────────────────────────────────┤
│ Fix now │ 21   │ Call to deprecated function drupal_set_message(). Deprecated │
│         │      │ in drupal:8.5.0 and is removed from drupal:9.0.0.   Use      │
│         │      │ Drupal\Core\Messenger\MessengerInterface::addMessage()       │
│         │      │ instead.                                                     │
│         │      │                                                              │
│ Fix now │ 56   │ Call to deprecated function drupal_set_message(). Deprecated │
│         │      │ in drupal:8.5.0 and is removed from drupal:9.0.0.   Use      │
│         │      │ Drupal\Core\Messenger\MessengerInterface::addMessage()       │
│         │      │ instead.                                                     │
│         │      │                                                              │
│ Fix now │ 103  │ Call to deprecated function drupal_set_message(). Deprecated │
│         │      │ in drupal:8.5.0 and is removed from drupal:9.0.0.   Use      │
│         │      │ Drupal\Core\Messenger\MessengerInterface::addMessage()       │
│         │      │ instead.                                                     │
│         │      │                                                              │
└─────────┴──────┴──────────────────────────────────────────────────────────────┘

src\Controller\AutoslaveDashboardController.php:
┌─────────┬──────┬──────────────────────────────────────────────────────────────┐
│ STATUS  │ LINE │                           MESSAGE                            │
├─────────┼──────┼──────────────────────────────────────────────────────────────┤
│ Fix now │ 32   │ Call to deprecated function drupal_set_message(). Deprecated │
│         │      │ in drupal:8.5.0 and is removed from drupal:9.0.0.   Use      │
│         │      │ Drupal\Core\Messenger\MessengerInterface::addMessage()       │
│         │      │ instead.                                                     │
│         │      │                                                              │
│ Fix now │ 52   │ Call to deprecated function db_select(). Deprecated in       │
│         │      │ drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get  │
│         │      │  a database connection injected into your service from the   │
│         │      │ container and   call select() on it. For example,            │
│         │      │ $injected_database->select($table, $alias, $options);        │
│         │      │                                                              │
│ Fix now │ 67   │ Call to deprecated function db_select(). Deprecated in       │
│         │      │ drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get  │
│         │      │  a database connection injected into your service from the   │
│         │      │ container and   call select() on it. For example,            │
│         │      │ $injected_database->select($table, $alias, $options);        │
│         │      │                                                              │
│ Fix now │ 77   │ Call to deprecated function db_select(). Deprecated in       │
│         │      │ drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get  │
│         │      │  a database connection injected into your service from the   │
│         │      │ container and   call select() on it. For example,            │
│         │      │ $injected_database->select($table, $alias, $options);        │
│         │      │                                                              │
│ Fix now │ 101  │ Call to deprecated function db_select(). Deprecated in       │
│         │      │ drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get  │
│         │      │  a database connection injected into your service from the   │
│         │      │ container and   call select() on it. For example,            │
│         │      │ $injected_database->select($table, $alias, $options);        │
│         │      │                                                              │
│ Fix now │ 172  │ Call to deprecated function drupal_set_message(). Deprecated │
│         │      │ in drupal:8.5.0 and is removed from drupal:9.0.0.   Use      │
│         │      │ Drupal\Core\Messenger\MessengerInterface::addMessage()       │
│         │      │ instead.                                                     │
│         │      │                                                              │
│ Fix now │ 303  │ Call to deprecated function drupal_set_message(). Deprecated │
│         │      │ in drupal:8.5.0 and is removed from drupal:9.0.0.   Use      │
│         │      │ Drupal\Core\Messenger\MessengerInterface::addMessage()       │
│         │      │ instead.                                                     │
│         │      │                                                              │
│ Fix now │ 378  │ Call to deprecated function drupal_set_message(). Deprecated │
│         │      │ in drupal:8.5.0 and is removed from drupal:9.0.0.   Use      │
│         │      │ Drupal\Core\Messenger\MessengerInterface::addMessage()       │
│         │      │ instead.                                                     │
│         │      │                                                              │
│ Fix now │ 412  │ Call to deprecated function db_insert(). Deprecated in       │
│         │      │ drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get  │
│         │      │  a database connection injected into your service from the   │
│         │      │ container and   call insert() on it. For example,            │
│         │      │ $injected_database->insert($table, $options);                │
│         │      │                                                              │
│ Fix now │ 435  │ Call to deprecated function db_delete(). Deprecated in       │
│         │      │ drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get  │
│         │      │  a database connection injected into your service from the   │
│         │      │ container and   call delete() on it. For example,            │
│         │      │ $injected_database->delete($table, $options);                │
│         │      │                                                              │
│ Fix now │ 449  │ Call to deprecated function db_delete(). Deprecated in       │
│         │      │ drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get  │
│         │      │  a database connection injected into your service from the   │
│         │      │ container and   call delete() on it. For example,            │
│         │      │ $injected_database->delete($table, $options);                │
│         │      │                                                              │
│ Fix now │ 525  │ Call to deprecated function db_insert(). Deprecated in       │
│         │      │ drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get  │
│         │      │  a database connection injected into your service from the   │
│         │      │ container and   call insert() on it. For example,            │
│         │      │ $injected_database->insert($table, $options);                │
│         │      │                                                              │
│ Fix now │ 557  │ Call to deprecated function drupal_set_message(). Deprecated │
│         │      │ in drupal:8.5.0 and is removed from drupal:9.0.0.   Use      │
│         │      │ Drupal\Core\Messenger\MessengerInterface::addMessage()       │
│         │      │ instead.                                                     │
│         │      │                                                              │
│ Fix now │ 596  │ Call to deprecated function drupal_set_message(). Deprecated │
│         │      │ in drupal:8.5.0 and is removed from drupal:9.0.0.   Use      │
│         │      │ Drupal\Core\Messenger\MessengerInterface::addMessage()       │
│         │      │ instead.                                                     │
│         │      │                                                              │
│ Fix now │ 675  │ Call to deprecated function drupal_set_message(). Deprecated │
│         │      │ in drupal:8.5.0 and is removed from drupal:9.0.0.   Use      │
│         │      │ Drupal\Core\Messenger\MessengerInterface::addMessage()       │
│         │      │ instead.                                                     │
│         │      │                                                              │
└─────────┴──────┴──────────────────────────────────────────────────────────────┘

src\Form\AutoslaveSettingsForm.php:
┌─────────┬──────┬──────────────────────────────────────────────────────────────┐
│ STATUS  │ LINE │                           MESSAGE                            │
├─────────┼──────┼──────────────────────────────────────────────────────────────┤
│ Fix now │ 34   │ Call to deprecated function drupal_set_message(). Deprecated │
│         │      │ in drupal:8.5.0 and is removed from drupal:9.0.0.   Use      │
│         │      │ Drupal\Core\Messenger\MessengerInterface::addMessage()       │
│         │      │ instead.                                                     │
│         │      │                                                              │
└─────────┴──────┴──────────────────────────────────────────────────────────────┘

autoslave.info.yml:
┌──────────┬──────┬──────────────────────────────────────────────────────────────┐
│  STATUS  │ LINE │                           MESSAGE                            │
├──────────┼──────┼──────────────────────────────────────────────────────────────┤
│ Check    │ 0    │ Add core_version_requirement: ^8 || ^9 to designate that the │
│ manually │      │ module is compatible with Drupal 9. See                      │
│          │      │ https://drupal.org/node/3070687.                             │
│          │      │                                                              │
└──────────┴──────┴──────────────────────────────────────────────────────────────┘

📌 Task
Status

Needs review

Version

3.0

Component

Code

Created by

🇮🇳India gautam_sharan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024