Best Practises for Drupal Maintenance

download Best Practises for Drupal Maintenance

of 37

Transcript of Best Practises for Drupal Maintenance

  • 8/14/2019 Best Practises for Drupal Maintenance

    1/37

    Robert Castelo, Code Positive Ltd.

    Best Practises For

    Dru al Maintenance

  • 8/14/2019 Best Practises for Drupal Maintenance

    2/37

    If Youre In

    Charge Of A Project

  • 8/14/2019 Best Practises for Drupal Maintenance

    3/37

    Get A Good Team

    DeveloperThemer

    Designer

    Configuration(er)

  • 8/14/2019 Best Practises for Drupal Maintenance

    4/37

    How To

    Evaluate Candidates?

  • 8/14/2019 Best Practises for Drupal Maintenance

    5/37

    Look At Involvementwww.drupal.org

    user account

    See: modules themes

    documentation

    years involved

  • 8/14/2019 Best Practises for Drupal Maintenance

    6/37

    Check Work Quality

    Coder module

    tests for compliance with Drupal coding style

    www.drupal.org/project/coder

  • 8/14/2019 Best Practises for Drupal Maintenance

    7/37

    Client Testimonials

    What do heads of

    other Drupal

    projects say about

    the candidate?

  • 8/14/2019 Best Practises for Drupal Maintenance

    8/37

    If Youre Configuring

    A Website

  • 8/14/2019 Best Practises for Drupal Maintenance

    9/37

    Modules & Themes

    modules & themes directories are for core Drupal

    - NEVER install into them

  • 8/14/2019 Best Practises for Drupal Maintenance

    10/37

    Sites Directory

    Every file you add to your

    Drupal site should live in

    the sites directory.

    This makes it easier to keep

    your site updated.

  • 8/14/2019 Best Practises for Drupal Maintenance

    11/37

    Sites Default

    sites/default/modules - used by a single site.

    Recommended in most cases.

  • 8/14/2019 Best Practises for Drupal Maintenance

    12/37

    Sites All

    Installed modules used by multiple sites.

    Only recommended if all sites use the same code base.

  • 8/14/2019 Best Practises for Drupal Maintenance

    13/37

    Modules Sub-directories

    Modules can be separated into contrib and custom

    (internal development) for easier maintenance

  • 8/14/2019 Best Practises for Drupal Maintenance

    14/37

    Update StatusKeep up to date (Drupal 6 & 7 built in)Drupal 5: drupal.org/project/update_status

  • 8/14/2019 Best Practises for Drupal Maintenance

    15/37

    If Youre

    Developing A Site

  • 8/14/2019 Best Practises for Drupal Maintenance

    16/37

    Separate Logic / Presentation

  • 8/14/2019 Best Practises for Drupal Maintenance

    17/37

    Module Theme

  • 8/14/2019 Best Practises for Drupal Maintenance

    18/37

    Modular

    Easier to Code

    Code is Re-usable

    Easier to Maintain

  • 8/14/2019 Best Practises for Drupal Maintenance

    19/37

    Rapid Development

    & Less Maintenance

    Less Code To Create

    Less Code to Maintain

  • 8/14/2019 Best Practises for Drupal Maintenance

    20/37

    Avoid Spaghetti Code

    Standard API

    Strict Formatting

  • 8/14/2019 Best Practises for Drupal Maintenance

    21/37

  • 8/14/2019 Best Practises for Drupal Maintenance

    22/37

    www.drupal.org/coding-standards

  • 8/14/2019 Best Practises for Drupal Maintenance

    23/37

    Code Documentation

    Well documented code improves maintainability

  • 8/14/2019 Best Practises for Drupal Maintenance

    24/37

    API ModuleConvert documentation in code into web pages

    api.drupal.org www.drupal.org/project/api

  • 8/14/2019 Best Practises for Drupal Maintenance

    25/37

    Quick Tips

    t(Example text)Enable interface text to be translated

    l() andurl() for links at end of file

  • 8/14/2019 Best Practises for Drupal Maintenance

    26/37

    Local Module

    Create a Local module to addsmall custom tweeks

  • 8/14/2019 Best Practises for Drupal Maintenance

    27/37

    Views In Module

    Store your custom Views in a module

    improves performance easier to move (dev to live) puts views in version control

    www.mc-kenna.com/drupal/2009/05/managing-drupal-views-the-proper-way

  • 8/14/2019 Best Practises for Drupal Maintenance

    28/37

    Keep PHP Out Of

    The Database Easier to maintain code

    Easier to find Easier to upgrade Under version control

    If you must put PHP in a block, view, node....put code in a function in your Local module

    then just call the function

  • 8/14/2019 Best Practises for Drupal Maintenance

    29/37

    Use Version ControlEnables code to be rolled back,

    and teams to work on same code

    CVShttp://www.nongnu.org/cvs

    SVNhttp://subversion.tigris.org/

    GIThttp://git-scm.com/

    ...

  • 8/14/2019 Best Practises for Drupal Maintenance

    30/37

    Maintenance Tools

    D l M d l

  • 8/14/2019 Best Practises for Drupal Maintenance

    31/37

    Devel ModuleEssential development tools

    http://drupal.org/project/devel

    D l M d l

    http://www.drupal.org/project/coderhttp://www.drupal.org/project/coder
  • 8/14/2019 Best Practises for Drupal Maintenance

    32/37

    Devel ModuleAlso good for theme building

  • 8/14/2019 Best Practises for Drupal Maintenance

    33/37

    Coder ModuleAutomatic validation of module & themes

    www.drupal.org/project/coder

    http://www.drupal.org/project/coderhttp://www.drupal.org/project/coder
  • 8/14/2019 Best Practises for Drupal Maintenance

    34/37

    Simple TestAutomated tests of your code

    check new code doesnt break the oldwww.drupal.org/project/simpletest

    M d M d l

    http://www.drupal.org/project/simpletesthttp://www.drupal.org/project/simpletest
  • 8/14/2019 Best Practises for Drupal Maintenance

    35/37

    Mas uerade ModuleLog in as a different user, test roles

    www.drupal.org/project/masquerade

  • 8/14/2019 Best Practises for Drupal Maintenance

    36/37

    Questions

  • 8/14/2019 Best Practises for Drupal Maintenance

    37/37

    Image Credits

    http://www.iconeden.com/icon/free/get/milky-a-free-vector-iconset

    http://www.flickr.com/photos/elyob/213880107

    http://www.flickr.com/photos/evilerin/3078856253

    http://www.flickr.com/photos/28796269@N05/3225819794

    http://www.flickr.com/photos/egadapparel/3212007816

    http://www.flickr.com/photos/wildcat_dunny/318732519/