Drush intro – Drupal

Drush is a command-line shell interface for Drupal. It lets you do almost anything you would do through the Drupal admin interface — enabling modules, clearing caches, running cron, backing up the site — all from the terminal.

Installation

The preferred way to install Drush is via the official PEAR channel, but it can also be installed manually on a shared server.

Backup and restore

archive-dump backs up the codebase, files, and database into a single file:

drush archive-dump
drush archive-restore

Common commands

drush pm-download 
drush pm-enable 
drush pm-disable 
drush cc all
drush cron
drush sql-dump
drush uli

Enjoy!

Mediawiki: disable account creation

When you install MediaWiki, new user registration is enabled by default. Anyone can create an account and start editing. That’s fine for a public wiki, but not always what you want — especially for a private or company wiki where you want to control who has access.

There’s no toggle for this in the settings UI, but it’s a single line in the config file.

Disable registration

Add this line to your LocalSettings.php file:

$wgGroupPermissions['*']['createaccount'] = false;

This tells MediaWiki to deny the createaccount permission to the * group (which means all users, including unauthenticated visitors).

Allow only certain users to create accounts

If you want only logged-in users to be able to create new accounts (for example, so existing users can invite others):

$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['user']['createaccount'] = true;

Or if you want only sysops (admins) to create accounts:

$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['sysop']['createaccount'] = true;

After making the change, clear the MediaWiki cache if needed (php maintenance/runJobs.php) and the login/register page will immediately reflect the new permissions.

Enjoy!

How to create a simple WordPress Child Theme

A child theme lets you customise an existing WordPress theme without losing your changes when the parent theme updates. Every time the parent theme is updated, any files you edited directly get overwritten. A child theme avoids this.

Start by creating a folder and a style.css file that declares the parent theme:

/*
Theme Name:     My Twenty Ten Child
Theme URI:      https://www.opensourceisbetter.com/
Description:    Child theme for the Twenty Ten theme
Author:         Andrea
Template:       twentyten
*/

The Template line must match the folder name of the parent theme exactly. Activate the child theme from Appearance > Themes.

For the styles to work, create a functions.php file to enqueue the parent styles:

function my_theme_enqueue_styles() {
    wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
}
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');

Now you can edit the child theme files freely. Add custom CSS to style.css, override template files by copying them from the parent theme, and add functionality through functions.php — all without touching the parent theme.

That is it!