Drush - rebuild node access permissions
How do you rebuild node access permissions using CLI?
To rebuild permissions from the command-line using Drush:
drush php-eval 'node_access_rebuild();'
Or using Drupal Console:
drupal node:access:rebuild
User options - login, logout and user details
For an introduction into setting up RESTful hal+json refer to the set-up documentation. Also see the Query - user screen.
x-csrf token
To get the X-CSRF token, first, you need to login as a member. Follow the steps outlined under User options - login, logout and user details.
Calling a query
The query string is: {domain}/rest/session/token
Setting up for hal_json RESTful services
The development version of the app database is held on the staging site. Note all development and testing will be completed on the staging site.
Drupal 9 uses:
- HAL : Serializes entities using Hypertext Application Language.
- RESTful Web Services
For testing purposes you can use either of the following Chrome extensions:
- Postman;
- DHC
RESTful query user - Drupal
The user parameters provides details about a specific user based on the following parameters:
- User uid;
The output of this query will return user profile data only of the fields containing data. An example of the data returned includes, but is not limited to the following:
REST API Drupal user
The user API, was originally created under the General Documenation area (see Query - user). I'm creating a new user API document under the API documentation area.
Calling a query
To call a user query the details are required:
Importing and Exporting a MySQL database with Drush
These steps are for Drupal 8 and 9.
Export your database
Order here is important. First you want to clear all the Drupal caches. Then export / dump the db the sql database to a file in your home directory.
drush cr
drush sql-dump > path/to/your/file/ourpout/sql-dump-file-name.sql
or
git commit tag steps
Adding git tag to your actions.
The regular process that I work to is
git add -A
git commit -m "some comment"
git push
With git tag, whilst there are many options for how you can apply git tag, this initial step I'll keep simple. As follows:
VS Code - Unable to locate phpcs
phpcs issue in Visual Studio Code, I'm receiving this warning in VS Code:
phpcs: Unable to locate phpcs. Please add phpcs to your global path or use composer decency manager to install it in your project locally.
How to fix
You can install phpcs by using composer global command:
composer global require squizlabs/php_codesniffer
Then in VS Code, go to
The provided host name is not valid for this server
Issue
Trying to run a Drupal 9 localhost site on a Mac through Docker that uses a Wodby base.
Normally when using Docker and it's correctly set-up you don't need to add to the etc/hosts file. However, reading through the Wodby local domains content, it seems this step is required.
Off to the /etc/hosts file