Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Listing and managing modules

From: Simplified Drupal Sites with Drush

Video: Listing and managing modules

The Start Drupal interface for module administration works but doesn't scale well when dealing with large numbers of modules and doesn't allow filtering without a third-party module. Additionally, it won't allow downloading of new modules which I've demonstrated in the previous segment. Drush can also provide a fire hose of information. I'll demonstrate how to control that firehouse. The command, Project Manager List, aliased as PML shows the list of available modules and themes, "drush help pml".

Listing and managing modules

The Start Drupal interface for module administration works but doesn't scale well when dealing with large numbers of modules and doesn't allow filtering without a third-party module. Additionally, it won't allow downloading of new modules which I've demonstrated in the previous segment. Drush can also provide a fire hose of information. I'll demonstrate how to control that firehouse. The command, Project Manager List, aliased as PML shows the list of available modules and themes, "drush help pml".

To be clear this list is what is available in the Drupal installation, not what's available to download on drupal.org. I'll start by listing every single available extension, "drush pml". A fantastic amount of information, the package, name, type, status, and version are shown. Let's filter this down a bit and only show Enabled extension. The option, Status, takes a comma separated list of options including an; Enabled, Disabled, and Not Installed.

I will start with: drush pml status = " not installed", as this requires quotes. The list can also be changed using a comma, to demonstrate this I will show every module that is not installed and/or disabled. So, status = "not installed, disabled". Another useful argument is type which filters by extension type.

There are two options, Module and Theme, I'll list only themes, type=theme. The four core themes are now shown. I will get into theme management in the next segment as it's similar to module management but has enough quirks to set it apart. The next argument I will demonstrate is filtering by package. Before I do that, I'm going to download the develop project, so there will be some variety, "drush dl devel". The develop projects also provides Drush commands if enabled.

In fact, many Drupal projects provide Drush support. Now that devel has been downloaded, list all extensions again, drush pml. I can see that devel is in package development. I'd like to only show extensions in the development package. So I will use "drush pml" with the option package=development, which also takes a comma separated list of package names, case insensitive. The modules in the devel package are now shown.

I just downloaded a new extension devel. But what information can drush tell me about the devel module itself? Two commands are available, the first, Project Manage Info aliased as PMI, "drush pmi devel" can give me some technical information about the module. A second command, Product Manage Release notes, aliased as RLN, "drush rln", will show release notes on a particular package.

Use arrow keys to scroll, press Space to go down a page and then press Q to quit. What if I want to search for a particular package, but I don't know exactly what package it's in? Drush doesn't support this functionality explicitly. But I will show you a trick that's available on UNIX like systems. By piping the output of the package manager list dgrep, I can search using a keyword. Let's say I want to determine whether or not the comment module is enabled. I will start with "drush pml" to get the list, then the pipe character, to send the output of PML to another command.

I will use grep which will filter based on a regular expression which can also be just the word I'm looking for. I will use "Space -i" to make the search case insensitive. I am looking for comment, so I will just type the word "comment". I can see that there is one module named "comment"; by combining the list command with grep I can quickly filter the list of modules. It looks like the comment module is enabled. I don't want anyone commenting on my development site.

So I will just disable it using the Project manager disable command, which can also be shortened to just dis, drush help dis. The Disable command will disable an extension and any dependent extensions if any. So, "drush dis" and then "comment". I'm prompted if I want to disable comment. While I'm sure I want to, I just want to say yes to any prompt that's given to me by Drush. I'll say no for now. Then redo the command, drush dis comment.

But this time with an additional option, -y. Which will say yes to any prompt. Same as using the web interface disabling the module isn't the same as completely uninstalling it. Drush supports this as well with the Project Manager Uninstall command, drush help pm-uninstall. Notice that there's no alias for this command, pm-uninstall takes a list of modules to be uninstalled. I will uninstall the comment module and I will use the same yes option right at the front to show that it doesn't matter where it is.

So, drush -y pm-uninstall comment. The Comment module is now completely disabled and uninstalled. The inverse is also possible using the Command Project Manager enable, aliased as just en, drush help en. Enable will enable the extension along with any dependencies. Enable will by default also download any libraries that may be used by the module. For example, the devel module downloaded earlier can use fire PHP.

Let's enable the devel module now to see the automatic Library download: drush -y en devel. Devel was enabled but if you don't have subversion installed then fire PHP was not downloaded. This is one of the admittedly goofy bits of Drush. I will occasionally find these little weirdnesses like commands not working quite right and it turns out that there's a missing dependency that it doesn't explicitly state. That's why I went through the trouble of making sure you had Wget an Unzip installed, as that's caused problems in the past when I was trying to figure out why it was failing silently.

In this particular case, you can use the package manager of your system to install subversion. In this case, I'm going to use "sudo apt-get install subversion". Then, "drush -y", I am going to disable devel. And then, "drush -y en devel" to enable it. This time fire PHP was installed.

One more trick, were you ever curious how many modules were installed on a site? I will list every extension of type module in package core that is enabled. I will use an additional argument "--pipe" to only show of module names: drush pml --type=module package=core status=enabled, and then, --pipe. As it stands this would work, but I don't want to count each of these lines. I can pipe the results into the WC or Word Count command with the option -l to count the number of lines. So, Space pipe wc -l.

There are 28 modules in core that are enabled right now. This technique is useful, especially when trying to make the case that there are a large number of modules on a site and someone says, "it's not so bad." Now there's a quantifiable number to back up your claims. Now that I've demonstrated the foundation of listing, enabling, and disabling extensions, let's explore theme management and variables.

Show transcript

This video is part of

Image for Simplified Drupal Sites with Drush
Simplified Drupal Sites with Drush

18 video lessons · 4230 viewers

Jon Peck
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Simplified Drupal Sites with Drush.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.