De Les Tutoriaux du WebMestre
Aller à : navigation, rechercher

Usage de la commande help

Le Help général

  • pour connaître les commandes associées à Drush, taper:
jpmena@jpmena-HP:~/RIF/drupal-8.0.2/vendor/drush/drush$ php drush.php help
Execute a drush command. Run `drush help [command]` to view command-specific help.  Run `drush topic` to read even more documentation.

Global options (see `drush topic core-global-options` for the full list):
 -d, --debug                               Display even more information, including internal messages.                                                 
 -h, --help                                This help system.                                                                                           
 -n, --no                                  Assume 'no' as answer to all prompts.                                                                       
 -r <path>, --root=<path>                  Drupal root directory to use (default: current directory).                                                  
 -s, --simulate                            Simulate all relevant actions (don't actually change the system).                                           
 -l <http://example.com:8888>,             URI of the drupal site to use (only needed in multisite environments or when running on an alternate port). 
 -v, --verbose                             Display extra information about the command.                                                                
 -y, --yes                                 Assume 'yes' as answer to all prompts.

Core Drush commands: (core)
 archive-dump (ard,    Backup your code, files, and database into a single file.                                      
 archive-backup, arb)                                                                                                 
 archive-restore       Expand a site archive into a Drupal web site.                                                  
 browse                Display a link to a given path or open link in a browser.                                      
 core-cli (php)        Open an interactive shell on a Drupal site.                                                    
 core-config (conf,    Edit drushrc, site alias, and Drupal settings.php files.                                       
 core-cron (cron)      Run all cron hooks in all active modules for specified site.                                   
 core-execute (exec,   Execute a shell command. Usually used with a site alias.                                       
 core-init (init)      Enrich the bash startup file with completion and aliases. Copy .drushrc file to ~/.drush       
 core-quick-drupal     Download, install, serve and login to Drupal with minimal configuration and dependencies.      
 (qd, cutie)                                                                                                          
 core-requirements     Provides information about things that may be wrong in your Drupal installation, if any.       
 (status-report, rq)                                                                                                  
 core-rsync (rsync)    Rsync the Drupal tree to/from another server using ssh.                                        
 core-status (status,  Provides a birds-eye view of the current Drupal installation, if any.                          
 core-topic (topic)    Read detailed documentation on a given topic.                                                  
 drupal-directory      Return the filesystem path for modules/themes and other key folders.                           
 entity-updates        Apply pending entity schema updates.                                                           
 help                  Print this help message. See `drush help help` for more options.                               
 image-derive (id)     Create an image derivative.                                                                    
 image-flush (if)      Flush all derived images for a given style.                                                    
 php-eval (eval, ev)   Evaluate arbitrary php code after bootstrapping Drupal (if available).                         
 php-script (scr)      Run php script(s).                                                                             
 queue-list            Returns a list of all defined queues                                                           
 queue-run             Run a specific queue by name                                                                   
 shell-alias (sha)     Print all known shell alias records.                                                           
 site-alias (sa)       Print site alias records for all known site aliases and local sites.                           
 site-install (si)     Install Drupal along with modules/themes/configuration using the specified install profile.    
 site-set (use)        Set a site alias to work on that will persist for the current session.                         
 site-ssh (ssh)        Connect to a Drupal site's server via SSH for an interactive session or to run a shell command 
 twig-compile (twigc)  Compile all Twig template(s).                                                                  
 updatedb (updb)       Apply any database updates required (as with running update.php).                              
 updatedb-status       List any pending database updates.                                                             
 variable-delete       Delete a variable.                                                                             
 variable-get (vget)   Get a list of some or all site variables and values.                                           
 variable-set (vset)   Set a variable.                                                                                
 version               Show drush version.
Cache commands: (cache)
 cache-clear (cc)      Clear a specific cache, or all drupal caches.             
 cache-get (cg)        Fetch a cached object and display it.                     
 cache-rebuild (cr,    Rebuild a Drupal 8 site and clear all its caches.         
 cache-set (cs)        Cache an object expressed in JSON or var_export() format.
Config commands: (config)
 config-edit (cedit)   Open a config file in a text editor. Edits are imported into active configration after closing editor. 
 config-export (cex)   Export configuration to a directory.                                                                   
 config-get (cget)     Display a config value, or a whole configuration object.                                               
 config-import (cim)   Import config from a config directory.                                                                 
 config-list (cli)     List config names by prefix.                                                                           
 config-pull (cpull)   Export and transfer config from one environment to another.                                            
 config-set (cset)     Set config value directly.
Field commands: (field)
 field-clone           Clone a field and all its instances.                         
 field-create          Create fields and instances. Returns urls for field editing. 
 field-delete          Delete a field and its instances.                            
 field-info            View information about fields, field_types, and widgets.     
 field-update          Return URL for field editing web page.
Interface translation: (locale)
 locale-check          Checks for available translation updates. 
 locale-update         Updates the available translations.
Make commands: (make)
 make                  Turns a makefile into a working Drupal codebase.                                                                  
 make-convert          Convert a legacy makefile into YAML format.                                                                       
 make-generate         Generate a makefile from the current Drupal site.                                                                 
 make-lock             Process a makefile and outputs an equivalent makefile with projects version *resolved*. Respects pinned versions. 
 make-update           Process a makefile and outputs an equivalent makefile with projects version resolved to latest available.
Project manager commands: (pm)
 pm-disable (dis)      Disable one or more extensions (modules or themes).                                                                
 pm-download (dl)      Download projects from drupal.org or other sources.                                                                
 pm-enable (en)        Enable one or more extensions (modules or themes).                                                                 
 pm-info (pmi)         Show detailed info for one or more extensions (modules or themes).                                                 
 pm-list (pml)         Show a list of available extensions (modules and themes).                                                          
 pm-projectinfo        Show a report of available projects and their extensions.                                                          
 pm-refresh (rf)       Refresh update status information.                                                                                 
 pm-releasenotes       Print release notes for given projects.                                                                            
 pm-releases (rl)      Print release information for given projects.                                                                      
 pm-uninstall (pmu)    Uninstall one or more modules.                                                                                     
 pm-update (up)        Update Drupal core and contrib projects and apply any pending database updates (Same as pm-updatecode + updatedb). 
 pm-updatecode (upc)   Update Drupal core and contrib projects to latest recommended releases.                                            
 pm-updatestatus       Show a report of available minor updates to Drupal core and contrib projects.                                      
Role commands: (role)
 role-add-perm (rap)   Grant specified permission(s) to a role.                                                                                                                                         
 role-create (rcrt)    Create a new role.                                                                                                                                                               
 role-delete (rdel)    Delete a role.                                                                                                                                                                   
 role-list (rls)       Display a list of all roles defined on the system.  If a role name is provided as an argument, then all of the permissions of that role will be listed.  If a permission name is 
                       provided as an option, then all of the roles that have been granted that permission will be listed.                                                                              
 role-remove-perm      Remove specified permission(s) from a role.                                                                                                                                      
Runserver commands: (runserver)
 runserver (rs)        Runs PHP's built-in http server for development.
SQL commands: (sql)
 sql-cli (sqlc)        Open a SQL command-line interface using Drupal's credentials.                                            
 sql-connect           A string for connecting to the DB.                                                                       
 sql-create            Create a database.                                                                                       
 sql-drop              Drop all tables in a given database.                                                                     
 sql-dump              Exports the Drupal DB as SQL using mysqldump or equivalent.                                              
 sql-query (sqlq)      Execute a query against a database.                                                                      
 sql-sanitize          Run sanitization operations on the current database.                                                     
 sql-sync              Copies the database contents from a source site to a target site. Transfers the database dump via rsync.
Search commands: (search)
 search-index          Index the remaining search items without wiping the index. 
 search-reindex        Force the search index to be rebuilt.                      
 search-status         Show how many items remain to be indexed out of the total.
State commands: (state)
 state-delete (sdel)   Delete a state value.  
 state-get (sget)      Display a state value. 
 state-set (sset)      Set a state value.
User commands: (user)
 user-add-role (urol)  Add a role to the specified user accounts.                                    
 user-block (ublk)     Block the specified user(s).                                                  
 user-cancel (ucan)    Cancel a user account with the specified name.                                
 user-create (ucrt)    Create a user account with the specified name.                                
 user-information      Print information about the specified user(s).                                
 user-login (uli)      Display a one time login link for the given user account (defaults to uid 1). 
 user-password (upwd)  (Re)Set the password for the user account with the specified name.            
 user-remove-role      Remove a role from the specified user accounts.                               
 user-unblock (uublk)  Unblock the specified user(s).
Views commands: (views)
 views-analyze (va)    Get a list of all Views analyze warnings                  
 views-dev (vd)        Set the Views settings to more developer-oriented values. 
 views-disable (vdis)  Disable the specified views.                              
 views-enable (ven)    Enable the specified views.                               
 views-execute (vex)   Execute a view and get the results.                       
 views-list (vl)       Get a list of all views in the system.
Watchdog commands: (watchdog)
 watchdog-delete      Delete watchdog messages.                                                                                   
 (wd-del, wd-delete)                                                                                                              
 watchdog-list        Show available message types and severity levels. A prompt will ask for a choice to show watchdog messages. 
 watchdog-show        Show watchdog messages.                                                                                     
 (wd-show, ws)
  • on nous dit de faire suivre le nom de la commande qui nous intéresse à help pour en savoir plus sur cette dernière.

L'aide des commandes relatives à l'installation d'un module

  • Dans le cas de l'administration Drupal, nous allons être confrontés à l'ajout de modules et/où de thèmes ce qui donne:
#télécharger un module/thème
jpmena@jpmena-HP:~/RIF/drupal-8.0.2/vendor/drush/drush$ php drush.php help dl
Download Drupal core or projects from drupal.org (Drupal core, modules, themes
or profiles) and other sources. It will automatically figure out which project
version you want based on its recommended release, or you may specify a
particular version.

If no --destination is provided, then destination depends on the project type:
  - Profiles will be downloaded to profiles/ in your Drupal root.
  - Modules and themes will be downloaded to the site specific directory
(sites/example.com/modules|themes) if available, or to the site wide directory
  - If you're downloading drupal core or you are not running the command within
a bootstrapped drupal site, the default location is the current directory.
  - Drush commands will be relocated to /usr/share/drush/commands (if available)
or ~/.drush. Relocation is determined once the project is downloaded by
examining its content. Note you can provide your own function in a commandfile
to determine the relocation of any project.

 drush dl drupal                           Download latest recommended release  
                                           of Drupal core.                      
 drush dl drupal-7.x                       Download latest 7.x development      
                                           version of Drupal core.              
 drush dl drupal-6                         Download latest recommended release  
                                           of Drupal 6.x.                       
 drush dl cck zen                          Download latest versions of CCK and  
                                           Zen projects.                        
 drush dl og-1.3                           Download a specfic version of        
                                           Organic groups module for my version 
                                           of Drupal.                           
 drush dl diff-6.x-2.x                     Download a specific development      
                                           branch of diff module for a specific 
                                           Drupal version.                      
 drush dl views --select                   Show a list of recent releases of    
                                           the views project, prompt for which  
                                           one to download.                     
 drush dl webform --dev                    Download the latest dev release of   
 drush dl webform --cache                  Download webform. Fetch and populate 
                                           the download cache as needed.

 projects                                  A comma delimited list of drupal.org 
                                           project names, with optional         
                                           version. Defaults to 'drupal'

 --cache                                   Cache release XML and tarballs or    
                                           git clones. Git clones use git's     
                                           --reference option. Defaults to 1    
                                           for downloads, and 0 for git.        
   --cache-duration-releasexml             Expire duration (in seconds) for     
                                           release XML. Defaults to 86400 (24   
 --default-major=<7>                       Specify the default major version of 
                                           modules to download when there is no 
                                           bootstrapped Drupal site.  Defaults  
                                           to "8".                              
 --destination=<path>                      Path to which the project will be    
                                           copied. If you're providing a        
                                           relative path, note it is relative   
                                           to the drupal root (if               
 --dev                                     Work with development releases       
 --drupal-project-rename                   Alternate name for "drupal-x.y"      
                                           directory when downloading Drupal    
                                           project. Defaults to "drupal".       
 --notes                                   Show release notes after each        
                                           project is downloaded.               
 --pipe                                    Returns a list of the names of the   
                                           extensions (modules and themes)      
                                           contained in the downloaded          
 --select                                  Select the version to download       
                                           interactively from a list of         
                                           available releases.                  
   --all                                   Shows all available releases instead 
                                           of a short list of recent releases.  
 --skip                                    Skip automatic downloading of        
                                           libraries (c.f. devel).              
 --source                                  The base URL which provides project  
                                           release history in XML. Defaults to  
 --use-site-dir                            Force to use the site specific       
                                           directory. It will create the        
                                           directory if it doesn't exist. If    
                                           --destination is also present this   
                                           option will be ignored.              
 --variant=<full>                          Only useful for install profiles.    
                                           Possible values: 'full', 'projects', 
 --package-handler=wget                    Download project packages using wget 
                                           or curl.                             
   --no-md5                                Skip md5 validation of downloads.    
 --package-handler=git_drupalorg           Use git.drupal.org to checkout and   
                                           update projects.                     
   --gitusername                           Your git username as shown on        
                                           user/[uid]/edit/git. Typically, this 
                                           is set this in drushrc.php. Omitting 
                                           this prevents users from pushing     
                                           changes back to git.drupal.org.      
   --gitsubmodule                          Use git submodules for checking out  
                                           new projects. Existing git checkouts 
                                           are unaffected, and will continue to 
                                           (not) use submodules regardless of   
                                           this setting.                        
     --gitsubmoduleaddparams               Add options to the `git submodule    
                                           add` command.                        
   --gitcheckoutparams                     Add options to the `git checkout`    
   --gitcloneparams                        Add options to the `git clone`       
   --gitfetchparams                        Add options to the `git fetch`       
   --gitpullparams                         Add options to the `git pull`        
   --gitinfofile                           Inject version info into each .info  
 --version-control=svn                     Quickly add/remove/commit your       
                                           project changes to Subversion.       
   --svnsync                               Automatically add new files to the   
                                           SVN repository and remove deleted    
                                           files. Caution.                      
   --svncommit                             Automatically commit changes to SVN  
                                           repository. You must also using the  
                                           --svnsync option.                    
     --svnmessage                          Override default commit message      
                                           which is: Drush automatic commit:    
                                           <the drush command line used>        
   --svnstatusparams                       Add options to the 'svn status'      
   --svnaddparams                          Add options to the `svn add` command 
   --svnremoveparams                       Add options to the `svn remove`      
   --svnrevertparams                       Add options to the `svn revert`      
   --svncommitparams                       Add options to the `svn commit`      
 --version-control=backup                  Backup all project files before      
   --no-backup                             Do not perform backups.              
   --backup-dir                            Specify a directory to backup        
                                           projects into. Defaults to           
                                           drush-backups within the home        
                                           directory of the user running the    
                                           command. It is forbidden to specify  
                                           a directory inside your drupal root. 
 --version-control=bzr                     Quickly add/remove/commit your       
                                           project changes to Bazaar.           
   --bzrsync                               Automatically add new files to the   
                                           Bazaar repository and remove deleted 
                                           files. Caution.                      
   --bzrcommit                             Automatically commit changes to      
                                           Bazaar repository. You must also use 
                                           the --bzrsync option.                
     --bzrmessage                          Override default commit message      
                                           which is: Drush automatic commit.    
                                           Project <name> <type> Command: <the  
                                           drush command line used>

Aliases: dl
#télécharger et activer un module/thème
jpmena@jpmena-HP:~/RIF/drupal-8.0.2/vendor/drush/drush$ php drush.php help en
Enable one or more extensions (modules or themes). Enable dependant extensions
as well.

 extensions                                A list of modules or themes. You can 
                                           use the * wildcard at the end of     
                                           extension names to enable all        

 --resolve-dependencies                    Attempt to download any missing   
                                           dependencies. At the moment, only 
                                           works when the module name is the 
                                           same as the project name.         
 --skip                                    Skip automatic downloading of     
                                           libraries (c.f. devel).

Aliases: en

L'aide relative à la reconstruction du Cache Druapl

  • Quand on passe d'un environnement à un autre, une commande fréquente consiste à demander à Drupal de reconstruire tout son cache!!!
    • (Attention à ne pas supprimer à la main le contenu de sites/default/files, en Drupal8 il y a synchronisation entre le cache en base et celui sur le filesystem!!!)
#reconstuire tous les caches en une seule fois
jpmena@jpmena-HP:~/RIF/drupal-8.0.2/vendor/drush/drush$ php drush.php help cr
Rebuild a Drupal 8 site and clear all its caches.

Aliases: cr, rebuild
#reconstruire un cache particulier:
jpmena@jpmena-HP:~/RIF/drupal-8.0.2/vendor/drush/drush$ php drush.php help cc
Clear a specific cache, or all drupal caches.

 type                                      The particular cache to clear. Omit 
                                           this argument to choose from        
                                           available caches.

Aliases: cc

L'aide relative à la restauration / sauvegarde

  • le backup et la restauration d'un site sont aussi des opérations courantes,
  • le backup se fait via la commande ard ou arb de Drush ...
  • grâce la commande help ard on connaît les options possibles pour la sauvegarde via drush
jpmena@jpmena-HP:~/RIF/drupal-8.0.2/vendor/drush/drush$ php drush.php help ard
Backup your code, files, and database into a single file.

 drush archive-dump                        Write an archive containing 3 sites  
 default,example.com,foo.com               in it.                               
 drush archive-dump @sites                 Save archive containing all sites in 
                                           a multi-site.                        
 drush archive-dump default                Save archive to custom location.     
 drush archive-dump                        Omits any .git directories found in  
 --tar-options="--exclude=.git             the tree as well as                  
 --exclude=sites/default/files"            sites/default/files.                 
 drush archive-dump                        Placeholder %files is replaced with  
 --tar-options="--exclude=%files"          the real path for the current site,  
                                           and that path is excluded.

 sites                                     Optional. Site specifications,       
                                           delimited by commas. Typically, list 
                                           subdirectory name(s) under /sites.

 --description                             Describe the archive contents.       
 --destination                             The full path and filename in which  
                                           the archive should be stored. If     
                                           omitted, it will be saved to the     
                                           drush-backups directory and a        
                                           filename will be generated.          
 --generator                               The generator name to store in the   
                                           MANIFEST file. The default is "Drush 
 --generatorversion                        The generator version number to      
                                           store in the MANIFEST file. The      
                                           default is 8.0.2.                    
 --no-core                                 Exclude Drupal core, so the backup   
                                           only contains the site specific      
 --overwrite                               Do not fail if the destination file  
                                           exists; overwrite it instead.        
                                           Default is --no-overwrite.           
 --pipe                                    Only print the destination of the    
                                           archive. Useful for scripts that     
                                           don't pass --destination.            
 --preserve-symlinks                       Preserve symbolic links.             
 --tags                                    Add tags to the archive manifest.    
                                           Delimit multiple by commas.          
 --tar-options                             Options passed thru to the tar       

Aliases: ard, archive-backup, arb