Showing posts with label drush. Show all posts
Showing posts with label drush. Show all posts

Drupal drush

Drush is a command line shell and Unix scripting interface for Drupal. Drush core ships with lots of useful commands and generators. Similarly, it runs update.php, executes SQL queries, runs content migrations, and misc utilities like cron or cache rebuild. Drush can be extended by 3rd party commandfiles.

Using Drush to rebuild or clear the cache

Use the command drush cache:rebuild to clear and rebuild all cached data for a site. After running this command, you will see the output message "Cache rebuild complete."

Use the command drush cache:clear to see a list of individual caches and then choose the specific cache you would like to clear. Running this command should produce output like the following:

> drush cache:clear
Enter a number to choose which cache to clear.
 [0]  :  Cancel
 [1]  :  drush
 [2]  :  theme-registry
 [3]  :  menu
 [4]  :  css-js
 [5]  :  block
 [6]  :  module-list
 [7]  :  theme-list
 [8]  :  render
 [9]  :  views

put your site in maintenance mode

drush eval 'variable_set('site_offline', 1)'

and to put it back on line

drush eval 'variable_set('site_offline', 0)'


Get or set your site uuid with drush in Drupal 8

From time to time it comes in quite handy to import configuration from other websites into yours. You site uuid is unique though, with the following snippet you get yours.

drush config-get "system.site" uuid

To set the uuid in drush:

drush cset system.site uuid 9b13adbf-0da5-4937-a731-xxxxxxxxxxx -y

Write a program in PHP to reverse a number

A number can be written in reverse order. For example 12345 = 54321 <?php   $ num = 23456;   $ revnum = 0;   while ($ num > 1)   {   $...