How to check the Drupal version of your project?

To check the Drupal version of your project, you can use a variety of methods. Here are the different ways to determine the Drupal version across platforms and tools, including Drush, the admin interface, and different local development environments like Docksal, Lando, and DDEV.

1. Using Drush

Drush is a command-line utility for managing Drupal.

    drush status        

Look for the line that shows:

    Drupal version: 10.x.x        

This command works across all platforms where Drush is installed.

Alternative Drush Command:

If you have Drush 9+ installed, use:

    drush core-status --field=drupal-version        

This will only output the Drupal version directly.

2. Through the Admin Interface

You can check the version directly from the Drupal admin UI.

Path:

Go to Admin > Reports > Status report:

URL: /admin/reports/status

On this page, you'll find a line called Drupal version that shows the current version.

3. Check CHANGELOG.txt

Another way to find the Drupal version is by checking the CHANGELOG.txt file.

Path:

Open the file located at the root of the Drupal project:

[Drupal project root]/core/CHANGELOG.txt

The first few lines of this file will indicate the version.

4. Using Composer

If your project uses Composer (common for Drupal 8 and later), you can check the Drupal version with Composer.

    composer show drupal/core | grep versions        

This will output something like:

    versions : * 10.x.x        

5. In Codebase: Check core/lib/Drupal.php

You can check the version in the core PHP file.

Open the file:

[Drupal project root]/core/lib/Drupal.php

Look for the constant:

    const VERSION = '10.x.x';        

6.Environment-Specific Ways

Docksal

Docksal uses fin as its CLI tool.

    fin drush status        

This will show the status of the Drupal project, including the Drupal version.

Alternatively, run Composer commands within Docksal:

    fin composer show drupal/core | grep versions        

Lando

Lando also uses Drush and Composer commands within its container.

    lando drush status        

Or, using Composer:

    lando composer show drupal/core | grep versions        

DDEV

DDEV is another local development environment.

    ddev drush status        

Or, using Composer:

    ddev composer show drupal/core | grep versions        

7. Using Web Browser

If you don’t have access to the command line but can access the website:

Visit the /core/misc/drupal.js URL.

Search for a comment line at the top that may indicate the version, though this isn't always reliable due to caching or access restrictions.

8. Using Database Table (key_value)

If you have direct access to the database:

Run the following SQL query:

    SELECT value FROM key_value WHERE collection = 'system.schema' AND name = 'system';        

It will show the major version of Drupal.

9. Checking Version on Pantheon, Acquia, or Other Hosting Platforms

Pantheon: You can use the Pantheon Dashboard to check the Drupal version.

Acquia: Use the Acquia Cloud UI or the Acquia CLI with Drush commands to check the version.

For other platforms, you might use SSH access to run Drush commands directly.


要查看或添加评论,请登录

Saroj K.的更多文章

  • Building a Custom Form in Drupal

    Building a Custom Form in Drupal

    When tasked with creating a dynamic custom form in Drupal, one of the significant challenges I faced was enabling the…

    1 条评论

社区洞察

其他会员也浏览了