Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
May 16th, 2013 php|tek 2013 1E-mail: chris@ctankersley.comTwitter: @dragonmantankApp.net: @ctankersleyhttps://joind.in/8153
 ChrisTankersley Doing PHP for 9Years Lots of projects no one uses, and a few thatsome do TL;DR https://github.com/dra...
 Don’t use DrupalMay 16th, 2013 php|tek 2013 3
 Don’t abuse DrupalMay 16th, 2013 php|tek 2013 4
What powers your siteMay 16th, 2013 php|tek 2013 5
 Pre-built *AMP Stack Available for Drupal 6 or 7 Install and Ready to GoMay 16th, 2013 php|tek 2013 6AdvantagesDisadva...
 Best to use for module or themedevelopment I don’t like it for full site developmentMay 16th, 2013 php|tek 2013 7
 Make use of the “Sites” option to helpseparate work On Mac, only the /sites/all/ folder is writable Even Sites you cre...
May 16th, 2013 php|tek 2013 9 Full server to run code Self contained and can be replicated Most modern machines can doV...
 Best to use for full site development Or use it all the time, it’s nice to have anenvironment you controlMay 16th, 2013...
 Try and pick a distro that is close to your productionsetup. If you are running Redhat in production, set upan CentOS bo...
 Run everything off of your local machine! Great if you can do it, I like vagrant betterMay 16th, 2013 php|tek 2013 12
@grmpyprogrammer will track you down if you don’tMay 16th, 2013 php|tek 2013 13
Automatically making sure your code worksMay 16th, 2013 php|tek 2013 14
 Write your tests before you code Watch it fail Write code to make your tests pass Feel betterMay 16th, 2013 php|tek 2...
 Drupal ships with SimpleTest baked in Supports unit testing and functional testing Unit tests are done by extendingDru...
May 16th, 2013 php|tek 2013 17
 Unit tests do not bootstrap Drupal, so arevery quick FunctionalTests bootstrap Drupal, so are veryslowMay 16th, 2013 ph...
 The test runner is AJAX, so it can break veryeasily Debugging can be hard since extra outputbreaks the test runner, and...
Your command line friendMay 16th, 2013 php|tek 2013 20
Dump your database to an SQL file$ drush sql-dump --result-file=/PATH/TO/dump.sqlBack up the entire site to a tarball$ dru...
I couldn’t think of a good tagline that should go hereMay 16th, 2013 php|tek 2013 22
 Allows you to quickly back up the DB andmove it No need to use a DB GUI Can do automatic local or remote backups Usef...
 Exposes a lot of the structure of Drupal Things like nodes can be clicked through to seetheir object structure Can aut...
 Package system for Drupal Takes a lot of stuff in the DB and makes itexportable and portable via code Lot of stuff wor...
Understand it and harness its powerMay 16th, 2013 php|tek 2013 26
 Page caching for full output caching Block caching so that dynamic content canstill update if it needs to You can conf...
 In Full Page Caching, most of the PHP isn’trun Effectively turns your site into a static site (kindof) With block cach...
It’s kind of like nuclear fusion, but without all the explosionsMay 16th, 2013 php|tek 2013 29
 Will group needed JS and CSS filestogether, reducing the number of HTTPrequests Will minify CSS, reducing some of thetr...
 Let Drupal know about your files drupal_add_js() drupal_add_css() Add the files to your .info file Don’t just add JS...
Really, ask.May 16th, 2013 php|tek 2013 32
 Acquia Dev Desktop vagrant Drupal SimpleTest drush Backup and Migrate Devel FeaturesMay 16th, 2013 php|tek 2013 33
May 16th, 2013 php|tek 2013 34E-mail: chris@ctankersley.comTwitter: @dragonmantankApp.net: @ctankersleyhttps://joind.in/8153
Upcoming SlideShare
Loading in …5
×

Drupal Development Tips

1,105 views

Published on

Overview of various tools to help Drupal developers build and develop modules.

Published in: Technology
  • Be the first to comment

Drupal Development Tips

  1. 1. May 16th, 2013 php|tek 2013 1E-mail: chris@ctankersley.comTwitter: @dragonmantankApp.net: @ctankersleyhttps://joind.in/8153
  2. 2.  ChrisTankersley Doing PHP for 9Years Lots of projects no one uses, and a few thatsome do TL;DR https://github.com/dragonmantank Heavy Drupal Development for 2 yearsMay 16th, 2013 php|tek 2013 2
  3. 3.  Don’t use DrupalMay 16th, 2013 php|tek 2013 3
  4. 4.  Don’t abuse DrupalMay 16th, 2013 php|tek 2013 4
  5. 5. What powers your siteMay 16th, 2013 php|tek 2013 5
  6. 6.  Pre-built *AMP Stack Available for Drupal 6 or 7 Install and Ready to GoMay 16th, 2013 php|tek 2013 6AdvantagesDisadvantages Not built for multiple installs Can’t use for existing sites Only forWindows and Mac
  7. 7.  Best to use for module or themedevelopment I don’t like it for full site developmentMay 16th, 2013 php|tek 2013 7
  8. 8.  Make use of the “Sites” option to helpseparate work On Mac, only the /sites/all/ folder is writable Even Sites you create are not writable Don’t put the entire stack inVC, just yourworkMay 16th, 2013 php|tek 2013 8
  9. 9. May 16th, 2013 php|tek 2013 9 Full server to run code Self contained and can be replicated Most modern machines can doVMAdvantagesDisadvantages Uses more resources Easier to break
  10. 10.  Best to use for full site development Or use it all the time, it’s nice to have anenvironment you controlMay 16th, 2013 php|tek 2013 10
  11. 11.  Try and pick a distro that is close to your productionsetup. If you are running Redhat in production, set upan CentOS box Set up the document root for your web server to bethe /vagrant folder (or sub folder, depending on yoursite layout).This way your site will run automatically. If you are running CentOS and Apache, disableSELinux so that Apache will use the /vagrant folder Dont use PHP 5.4 with Drupal 7 or lower Make sure APC, or some opcode cache, is installed Provide lots of RAM, at least 1GBMay 16th, 2013 php|tek 2013 11
  12. 12.  Run everything off of your local machine! Great if you can do it, I like vagrant betterMay 16th, 2013 php|tek 2013 12
  13. 13. @grmpyprogrammer will track you down if you don’tMay 16th, 2013 php|tek 2013 13
  14. 14. Automatically making sure your code worksMay 16th, 2013 php|tek 2013 14
  15. 15.  Write your tests before you code Watch it fail Write code to make your tests pass Feel betterMay 16th, 2013 php|tek 2013 15
  16. 16.  Drupal ships with SimpleTest baked in Supports unit testing and functional testing Unit tests are done by extendingDrupalUnitTestCase Functional tests are done by extendingDrupalWebTestCaseMay 16th, 2013 php|tek 2013 16
  17. 17. May 16th, 2013 php|tek 2013 17
  18. 18.  Unit tests do not bootstrap Drupal, so arevery quick FunctionalTests bootstrap Drupal, so are veryslowMay 16th, 2013 php|tek 2013 18
  19. 19.  The test runner is AJAX, so it can break veryeasily Debugging can be hard since extra outputbreaks the test runner, and since the DB isdestroyed watchdog() is useless You can use $this->verbose(‘message’) ordebug(‘message’) thoughMay 16th, 2013 php|tek 2013 19
  20. 20. Your command line friendMay 16th, 2013 php|tek 2013 20
  21. 21. Dump your database to an SQL file$ drush sql-dump --result-file=/PATH/TO/dump.sqlBack up the entire site to a tarball$ drush archive-dump defaultView watchdog entries$ drush watchdog-listUpdate Drupal and modules$ drush pm-updateDownload module$ drush pm-download [module_name]May 16th, 2013 php|tek 2013 21
  22. 22. I couldn’t think of a good tagline that should go hereMay 16th, 2013 php|tek 2013 22
  23. 23.  Allows you to quickly back up the DB andmove it No need to use a DB GUI Can do automatic local or remote backups Useful for moving databases from one serverto anotherMay 16th, 2013 php|tek 2013 23
  24. 24.  Exposes a lot of the structure of Drupal Things like nodes can be clicked through to seetheir object structure Can auto-generate dummy content Better debugging output dpm() and dvm() for pretty output dpr(), kpr(), and dvr() will dump to the pageheaderMay 16th, 2013 php|tek 2013 24
  25. 25.  Package system for Drupal Takes a lot of stuff in the DB and makes itexportable and portable via code Lot of stuff works out of the box, extramodules like UUID, boxes, and features_extrapick up the slack ftools makes updating features easyMay 16th, 2013 php|tek 2013 25
  26. 26. Understand it and harness its powerMay 16th, 2013 php|tek 2013 26
  27. 27.  Page caching for full output caching Block caching so that dynamic content canstill update if it needs to You can configure how long to cache thingsforMay 16th, 2013 php|tek 2013 27
  28. 28.  In Full Page Caching, most of the PHP isn’trun Effectively turns your site into a static site (kindof) With block caching, not all blocks will cache.What and when to cache is up to the blockMay 16th, 2013 php|tek 2013 28
  29. 29. It’s kind of like nuclear fusion, but without all the explosionsMay 16th, 2013 php|tek 2013 29
  30. 30.  Will group needed JS and CSS filestogether, reducing the number of HTTPrequests Will minify CSS, reducing some of thetransmission sizeYOU have to make your modules takeadvantage of it, thoughMay 16th, 2013 php|tek 2013 30
  31. 31.  Let Drupal know about your files drupal_add_js() drupal_add_css() Add the files to your .info file Don’t just add JS and CSS files via <script>and <style> tags in your themeMay 16th, 2013 php|tek 2013 31
  32. 32. Really, ask.May 16th, 2013 php|tek 2013 32
  33. 33.  Acquia Dev Desktop vagrant Drupal SimpleTest drush Backup and Migrate Devel FeaturesMay 16th, 2013 php|tek 2013 33
  34. 34. May 16th, 2013 php|tek 2013 34E-mail: chris@ctankersley.comTwitter: @dragonmantankApp.net: @ctankersleyhttps://joind.in/8153

×