11
How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work done with Jeff Trudeau

How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work

Embed Size (px)

Citation preview

Page 1: How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work

How to extend and configureDrupal without user interaction

or database dump

By Damien Snoeckfor Switzerland Romandy Drupal Group

January 27, 2010

Work done with Jeff Trudeau

Page 2: How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work

Key Points

Pros and Cons

Development environment and tools

Custom modules

Features module

Page 3: How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work

Pros and Cons

+ Ease the production server update

+ No database dump

+ No SQL diff

+ No core files in your code repository

+ Fast deployment

- Need a lot of more time !

Page 4: How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work

Files Structure

Page 5: How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work

Dev tools

Drush: command line toolsh tools/drush -c files/drushrc.php make files/Makefile drupal/

Drush Make: drush extensioncore = 6.x

projects[] = drupal

projects[drupal] = 6.15

# Advanced help

projects[] = advanced_help

projects[advanced_help][subdir] = "contrib"

projects[advanced_help][version] = 1.2

Page 6: How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work

Drupal Install Script

1. Reset Environment

2. Download and extract drush and drush make

3. Run drush make to create environment

4. Create symbolic links between drupal~ and drupal

5. Apply local patches

6. Other initialization tasks

Page 7: How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work

Custom Modules

Base module Define dependencies Setting Drupal variables Adding new language Use custom theme Enable/Disable default blocks Translation files *.fr.po

Page 8: How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work

Comparison

1. Administer › User management › User settings › uncheck Require e-mail verification

2. Administer › Site configuration › Languages › Add language

3. Administer › Site Bulding › Theme › Enable theme

4. Administer › Site Bulding › Blocks › Configure a block

1. variable_set('user_email_verification', FALSE);

2. locale_add_language('fr', 'French', 'Français');

3. global $custom_theme; $custom_theme = 'mmio_base';

4. drupal_write_record('blocks', array('bid'=>18, 'pages'=>'admin*', visibility=>1), 'bid');

Page 9: How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work

Custom Menu Module

Use of hook_menu()

$items['companies'] = array(

'title' => 'Companies',

'description' => 'List of companies',

'menu_name' => 'en-menu1',

'access arguments' => array('access content'),

'page callback' => 'companies',

'weight' => 0,

'options' => array(

'attributes' => array('title' => 'Companies'),

'langcode' => 'en'

),

'type' => MENU_NORMAL_ITEM,

'file' => 'mymodule_menu.inc.php',

);

Page 10: How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work

Features Module

Can be exported as module: Content type (with image presets) Permissions Views Dependencies Feeds

Integration with Drush

Page 11: How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work

Live Demo