Tools for developers and administrators

by Gisle Hannemyr

In addition to the WCMS itself, there exists a number of adjunct tools that may be useful for developers, site builders and administrators of websites. These tools may be useful for debugging, for analysing, or for promoting a website. This chapter introduces some of these tools.

noteThis chapter contains links to Wikipedia. While Wikipedia is often helpful by providing definitions, explanations and other useful information in plain language, it is not an authoritative source. Content on Wikipedia may be misleading and erronous. Use Wikipedia to read up on and get acquainted with an unfamiliar subject, but do not rely on it being factual. Citing Wikipedia in essays and other scholarly writings is deprecated.

Table of contents

Drupal projects discussed in this chapter: Composer Manager, Devel, Features, Module Builder.

Introduction

There exists a number of tools that may be useful for the developer and administrator of a website. Such tools are programs to inspect and alter the content of a database, logging tools, miscellaneous debugging tools, and syndication tools. This chapter discusses some of these tools.

I've broken down the tools in the following five categories: CLI tools, LAMP tools, Drupal specific server side tools, client side browser tools, and cloud tools.

Another “tool” that developers and administrator of a free and open source WCMS need to know about, is the community surrounding the tools themselves. Every free and open source tool of note comes with a community. The community is the support organisaton for the tool. It is the place to report bugs and anomalies, to find instrucations and tutorials, and to ask question when you are stuck.

CLI tools

Drupal has a sophisticated web-based graphical user interface (GUI) where both users and administrators interact with the site. However, for speed and concenience, nothing beats the Gnu/Linix command line interface (CLI). This section discusses CLI tools for WCMS development.

Unlike the web-based GUI, which you use by means of a browser, the CLI requires you to use a terminal emulator.

composer

Composer is a dependency and package manager for PHP designed and developed by Nils Aderman and Jordi Boggiano. It is used by the Drupal.org community to manage projects, including a Drupal website. It is such an important tool for Drupal site builders that it has its own chapter.

drush

Drush (Drupal shell) is a Gnu/Linux command line shell and scripting interface for Drupal- It is such an important tool for Drupal site builders that it has its own chapter

fdupes

Fdupes is a program written by Adrián López to scan directories for duplicate files, with options to list, delete or replace the files with hardlinks pointing to the duplicate. It first compares file sizes, partial MD5 signatures, full MD5 signatures, and then performs a byte-by-byte comparison for verification.

To install:

$ sudo apt install fdupes

To recursively scan the directory files for duplicates, do:

$ fdupes -r files/

git

Git is a distributed version control system initially designed and developed by Linus Torvalds for Linux kernel development. It is used by the Drupal.org community of developers to share code with one another. It is such an important tool for Drupal developers that it is described in a own chapter in this ebook.

Linux Malware Detect

Signature-based malware scanner.

To scan the file tree below /var/www for malware, do:

$ sudo maldet -a /var/www

Source: LMD Home page, GitHub repo.

webcheck

Arthur de Jong's webcheck is tool to check websites, inluding a link checker. It requires Python ver. 2.

To install, download the tarball of the latest version (currenty 1.10.4) from downloads and place it in /usr/local/bin. Then do the following:

$ cd /usr/local/bin
$ tar -xzf webcheck…tar.gz
$ mv webcheck… webcheckinst
$ sudo ln -s webcheckinst/webcheck.py webcheck
$ sudo cp webcheckinst/webcheck.1 /usr/share/man/man1/
$ rm webcheck…tar.gz

For a quick overview of the options:

$ webcheck --help

To create a set of reports for a website, skipping all external links, use the following:

$ cd /var/www/example.net/html
$ mkdir webcheck
$ webcheck -o webcheck -f -a http://example.net

Webpack

Webpack is a static module bundler that is part of the Node.js ecosystem. It is described in a own chapter in this ebook.

LAMP tools

The acronym LAMP may refer to one of the most widely used stacks of free software, consisting of Gnu/Linux, Apache, MySQL, and PHP. While Drupal can be used in orther environments, the LAMP stack is by far the most popular.

phpMyAdmin

See the webmaster chapter for the platform you are running for installation instructions.

To find the version of phpMyadmin you're running, you need to log in first. The version number can be seen in the page title tab, as shown below. If the tab is too small, hover over it to get the title displayed as a tooltip.

pma_version.png

The command to drop a database is under the “Operations” tab. However, it is only visible for users with global privilage to drop the database. Most users don't.

Apache logs

In order to manage a web server, it is necessary to get feedback about the activity and performance of the server as well as any problems that may be occuring.

See alsoThe Apache HTTP Server provides very comprehensive and flexible logging capabilities. A full treatment of the Apache logging capabilities is beyond the scope of this book. For an introduction to this topic, see the section on log files in the Apache documentation.

Access log

The server access log records all requests processed by the server.

Error log

The name and location of the Apache server error log is set by the ErrorLog directive. A typical location and name may be /var/log/apache/error_log.

The server error log is the place where Apache will send diagnostic information and record any errors that it encounters in processing requests.

The format of the error log is free-form and descriptive. However, certain information that is contained in most error log entries. For example, here is a typical message. It will appear in the log as a single line, but is here broken down to five separate lines for readability:

[Thu Jul 28 12:30:28 2011]
[error]
[client 127.0.0.1]
PHP Notice:  Undefined variable: path
in /www/www.dpanswers.com/htdocs/adm/functions.inc on line 328

The first item in the log entry is the date and time of the message. The second item lists the severity of the error being reported. The third item gives the IP address of the client that generated the error. Beyond that is the message itself, which in this case indicates that PHP interpreter has encountered an undefined variable and the file system path to the file that generated the error.

Doxygen

Doxygen is a tool for extracting documentation from annotated source code. It is the basis for extracting documentation from source code for documenting the Drupal API.

See alsoThere is a short background article about Doxygen on Wikipedia.

Drupal projects for developers

The following Drupal projects does not provide functionality for end users, but may be useful for developers, site-builders and site administrators.

In addition to those listed below, developers may be interested in the following projects:

Advanced Help
This project allows modules to store and display help documentation as HTML files. Many popular modules, including Views, comes with help files that can be displayed as a pop-up or inline with the module in this package. D9: stable.
Backup and Migrate
This project contains a module that simplifies the task of backing up and restoring your Drupal database. It can also be used to migrate your database from one Drupal site to another. D9: stable.
Clear Cache
This project creates an administrative menu entry to clear the cache. Access is governed by its own permission. It may be used as as a replacment for the core clear cache opeartion when you want to grant a contributor the right to clear the cache without granting him or her the Administer site configuration permis­sion. No D9 release, but Devel provide this from the GUI for development.
Devel
This project is a collection of tools that are useful during site development. It can print a summary of all database queries for each page request. It also provides helper functions that is useful during custom module development. D9: stable.
Devel Node Access
This was part of Devel for D7, but in D9, Devel node access (DNA) is a separate project. It helps you debug access control issues. D8: dev. D9: no.

Feeds

The Feeds project implements several components that let you fetch, parse and process content from external sources for importation into a Drupal website. It is typically used when importing content from foreign and legacy sites into a Drupal website.

It supports several common file formats.

Features

Everything that can be configured through the Drupal administrative GUI can also be implemented in code, as a custom module. The Features project bridges the two. It provides the developer with a tool that gets site configuration settings out of the database and into code, where it can be shared between sites, backed up, version controlled, etc.

More specifically, it exports specific “features” from a Drupal website into a custom project that contains a module that can be used to recreate the exported configuration when installed on another Drupal website.

The most common use of Features is to synchronise configuration settings between sites, for instance between a staging and production site.

However, it is also frequently used to export a custom content type created in the adminstrative GUI using the core FieldUI module to code. For example, the screen shot below shows the an developer about to create a module to generate a custom content type (named Camera) using Features.

features01.png

A project created by Features module is like any other Drupal project. Its components (e.g. views, contexts, fields, etc.) now exists and PHP code and can be maintained as code.

The chapter Content types as code describes how to use Features to export a content type.

Module Builder

Module Builder is created by Joachim Noreiko. It can be installed on a Drupal website and provides a GUI to auto-generates a skeleton or "scaffolding" for a module, along with hints on how to fill them in.

There is a demo on Youtube: Module Builder on Drupal 8 (3.07 min).

It can be used by newbie developers to learn how Drupal code works, and by more experienced developers who are too lazy to look up what arguments a function has to take.

Its generated code is dumped in the web/modules/custom/ directory, so make sure that is writable by the web server.

Client side browser tools

Google Lighthouse

Google provides some tools for web developers. including Lighthouse. It comes as part of Chrome.

Home page: Lighthouse.

Chrome Drupal Themer

There used to be some themer support tools on Drupal.org such as Themer (Drupal 6) and Theme developer (Drupal 7), but these are no longer maintained.

A Chrome extension called Drupal Themer exists in the chrome web store that may fill this niche.

Firefox DevTools

The Firefox DevTools gives the front-end developer access to a pop-up window that let him or her inspect and edit CSS, HTML, and JavaScript in any web page.

They can be activated from the menu Developer » Toggle tools. or via keyboard shortcuts (shown in the menu).

noteIf you're using server side aggregation of css and jaavscript to optimize your website performance, the tools will point you to the aggregated style sheets: sites/default/files/css/css_….css. This is not helpful when you try to figure out where a particular style comes from. When using the tools to debug or customize a theme, always remember to turn aggregation off.

Navigate to Configuration » Development » Performance and make sure all bandwith optimisation boxes are unchecked.

cache setting

[The Firefox DevTools has replaced Firebug. The Firebug plugin does not work with newer versions of Firefox.]

Dreditor

Dreditor (short for "Drupal editor" is browser script for Chrome to help Drupal module and core developers interact with Drupal.org. It provides multiple helper scripts that augments the process of reviewing, commenting on and testing patches posted in issue queues on Drupal.org. The main helpers are:

For example, Dreditor adds a couple of buttons to the Create issue summary user interface, as shown below. Insert template inserts some standard headings from a template. Insert tasks inserts boilerplate text for a core issue.

dreditor02.png

The auto-completion helper detects HTML-tags, usernames, issue URLSs and comment numbers. Pressing the [Tab] key after certain character sequences automatically completes or converts the entered characters into a full string, and moves the cursor to the best input position.

Inspecting cookies

To inspect cookies set by a specific website, use one of the methods indicated below:

In Google Chrome, visit Settings » Security and Privacy » Cookies and other site data » See all cookies and site data, and filter on the name of your Drupal site.

In Firefox, press F12 (Developer Tools), click "Storage" and check under "Cookies". This also specifies duration.

Cookie quick manager

The Cookie Quick Manager is a add-on for Firefox for various tasks related ro cookies, including cookie audit.

To audit cookies for domain set by the currently active tab, click on the cookie quick manager icon, and select “Search cookie for: …”.

Cloud tools

DDecode

Malware is sometimes embedded in Drupal or Wordpress themes, modules, or plugins as encoded strings.

PHP Decoder can be used by site builders to determine what a specific encoded string is doing.

It support things like eval(base64_decode …), eval(gzinflate …), including multiple levels deep of encoding.

Google analytics

Google analytics is a Google-provided cloud service that tracks and reports website traffic.

There is a Drupal project that helps integrate the service into a Drupal site, named Google Analytics.

Google webmaster's tools

Google webmaster's tools is a Google-provided cloud service that allows you to analyse several features of your website based upon how users search for your site.

For more about this tool, see the section in this ebook about Search engines.

Feedburner

FeedBurner is a service for web publishers launched in 2004, it was aquired by Google in 2007, and integrated into the Google suite of services. Services provided include RSS feed management, traffic analysis and advertising.

Enter your email address to subscribe to email updates to this blog:

Delivered by FeedBurner

Postman

Postman is a collaboration platform for API development. Postman's features simplify each step of building an API and streamline collaboration so you can create better APIs faster. How to use it is described in the chapter about RESTful services in this ebook.

Community

As noted in the introduction, every free and open source tool of note comes with a community. If you are developing or adninistrating a WCMS or some other project using free and open source tools, you need to identify and get involved in the relevant communities. The community is the secret ingredient that makes free and open source software such an amazing resource, where a cast of thousands are willing to share their insight and knowledge about the use of the tools.

See alsoFor Drupal developers and administrators, there is a page on the drupal.org website that introduces the Drupal community. The first place to go, if you're new to the Drupal community, is the forum. Make sure you understand the basic posting rules before posting messages in the forum. Also make sure you're a good citizen of a the community. The other members are not paid to assist you. so make sure you're not a help vampire. When you've received some help and gained some knowledge and experience, you should pay it forward by assisting other members of the community.

When engaging with the community, your personality will be judged by your postings. People are more likely to respond to posts that are well-written and to the point. If you're perceived as rambling, rude, nagging or grouchy, the usual online community reaction is to ignore you. If you need a response (for instance when asking the community for assistance), politeness can make a difference.

Final word

[mumble]


Last update: 2021-02-07 [gh].