SlideShare a Scribd company logo
Drupal Version Control & File System Basics
Julia Kulla-Mader
Triangle Drupal User’s Group
March 17, 2010
http://www.juliakm.com
@juliakm
What is version control?

• A way of managing changes to documents, programs, or other data stored as
  computer files. (Wikipedia)
What are some version control systems?
Why use version control?

• Real world scenarios
Why am I getting a white screen of death?

• Version control lets you see what the most recent code change was on your
  site.
Can I get rid of that white screen of death?

• Version control lets you roll back to a previous version.
My client decided that they prefer a way earlier
version of my module

• Version control lets you roll back a specific file to any point in time (when it
  was under version control).
I really want to use this new module but I'm afraid
it's going to destroy my site.

• Using version control, you can maintain multiple versions of your code. For
  example, you can create a sandbox (“trunk”) just for testing out experimental
  modules.
My co-worker and I are editing the same page.
What if we overwrite one another?

• Version control lets you merge changes when conflicts arise.
Why the heck did I make this change last year?

• Version control lets you record log messages over time so that you can
  communicate with your old self.
Who was the last person to touch this module?

• Version control lets to see the last person who edited a file.
I want to quickly deploy my code on a new server.

• Version control makes it easy to quickly grab a repository and put in on your
  local computer or a new server.
I'm sick of copying files from my computer to the
server.

• Using “hooks” you can set up you server to automatically reflect a new
  change to your site made on your local computer.
What Does Version Control Look Like In Practice?

• Example: Association for the Advancement of Sustainability in Higher
  Education


• Version Control System: Subversion
How is AASHE’s repository set up?

• Trunk: the latest, least stable version of our code


• Branch: the working version of code, very similar to live code


• Tags: each new version of the site is tagged
What does this look like when we are coding?

• If we are testing out new modules or major upgrades, we work in trunk first.
   • Commits to trunk show up at dev.aashe.org


• If we are fixing bugs or updating code, we work in the current branch first.
   • Commits to the current branch show up at stage.aashe.org


• We never touch the releases, we just create a new one when the branch code
  is tested.
   • We have a release script for making a new release.
What does the release script do?

• Creates the next tag.
  svn copy file://$path/www/branches/branch-3.0/ file://$path/www/releases/release-$release -m "$commit"




• Creates an export of the branch repository.
  svn export --force file://$path/www/releases/release-$release /var/www/aashe.org/releases/release-$release




• Creates a symlink from the public folder to the new release.
  rm /var/www/aashe.org/public
  ln -s /var/www/aashe.org/releases/release-$release /var/www/aashe.org/public




• Creates symlinks to the file directories (explanation to follow)
What are some version control hurdles specific to
Drupal?
Updating Modules

• We use drush to update Drupal modules locally, then commit to the staging
  site (unless it’s Views or CCK, then trunk)


  • drush is a command line shell and Unix scripting interface for Drupal, a
    veritable Swiss Army knife designed to make life easier for those of us who
    spend some of our working hours hacking away at the command prompt.


drush up mymodulename
Updating Core

• We download the version of Drupal we are using from Drupal.org and the
  latest version, unzip them, and create a patch file using the diff command


  wget http://ftp.drupal.org/files/projects/drupal-6.16.tar.gz
  tar -xzf drupal-6.16.tar.gz
  wget http://ftp.drupal.org/files/projects/drupal-6.15.tar.gz
  tar -xzf drupal-6.15.tar.gz
  diff -Naur drupal-6.15 drupal-6.16 > drupal-current-to-drupal-latest.patch


• Next, we test to see if there are any conflicts by doing a dry run from the root
  Drupal directory
 patch -p1 --dry-run < drupal-current-to-drupal-latest.patch




• Last, we apply the patch file for real from the root directory
 patch -p1 < drupal-current-to-drupal-latest.patch
Preventing Files From Being Accidentally Deleted
or Versioned

• We store our files at the same level as our public directory and create a
  symlink to it




• Our release script rebuilds these symlinks each time there is a new release
 ln -s /var/www/aashe.org/files /var/www/aashe.org/public/files
 ln -s /var/www/aashe.org/documents /var/www/aashe.org/public/documents
Next Steps

• Pick your favorite version control system


• Research your version control system of choice


• If you don’t want to mess with the command-line, look for a GUI tool like
  TortiseSVN, Versions, SvnX, or a code editor like Eclipse, Textmate


• Decide on your repository structure


• Start writing versioned code
Next Up: Mastering the Drupal Database

• Hello Allen

More Related Content

PDF
De-centralised Version Control with Bazaar
PPT
Subversion Saves The Day
PDF
Capistrano
PDF
Composer intro
PDF
PHP Deployment With SVN
PDF
Version Control With Subversion
PPTX
Integration Of Mulesoft and Apache Active MQ
PPTX
SVN Basics
De-centralised Version Control with Bazaar
Subversion Saves The Day
Capistrano
Composer intro
PHP Deployment With SVN
Version Control With Subversion
Integration Of Mulesoft and Apache Active MQ
SVN Basics

What's hot (20)

PPTX
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
PPTX
Introduction to Go
PPTX
Managing your Drupal project with Composer
PDF
Mini Training Flyway
PDF
Symfony4 - Deep dive
PPTX
Varying wordpressdevelopmentenvironment wp-campus2016
PPTX
Version Control and Continuous Integration
PPTX
Tuenti Release Workflow
PPT
Workshop For pycon13
PDF
Open shift intro for Philly PUG
PDF
NCUG 2019: Super charge your API’s with Reactive streams
PDF
MySQL 5.5 Replication Enhancements – An Overview (FOSDEM 2011)
PDF
Configuration Management - Finding the tool to fit your needs
PDF
JUST EAT: Tools we use to enable our culture
PPTX
Source version control using subversion
PDF
SDN TEST Suite
PDF
Keynote - Fluentd meetup v14
PPTX
Creating your own AtoM demo data set for re-use with Vagrant
PPTX
Instruction to build Apache CloudStack docs with Sphinx
PDF
All of the thing about Postman
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
Introduction to Go
Managing your Drupal project with Composer
Mini Training Flyway
Symfony4 - Deep dive
Varying wordpressdevelopmentenvironment wp-campus2016
Version Control and Continuous Integration
Tuenti Release Workflow
Workshop For pycon13
Open shift intro for Philly PUG
NCUG 2019: Super charge your API’s with Reactive streams
MySQL 5.5 Replication Enhancements – An Overview (FOSDEM 2011)
Configuration Management - Finding the tool to fit your needs
JUST EAT: Tools we use to enable our culture
Source version control using subversion
SDN TEST Suite
Keynote - Fluentd meetup v14
Creating your own AtoM demo data set for re-use with Vagrant
Instruction to build Apache CloudStack docs with Sphinx
All of the thing about Postman
Ad

Viewers also liked (14)

PDF
Presentation7
PDF
Git Makes Me Angry Inside
PDF
Intro to Theming Drupal, FOSSLC Summer Camp 2010
PPTX
Monitoring Processes
PPT
Communications 2 0
PPT
Flatstanleyprjct
PDF
Journey to the Center of Drupal: How I learned to build Drupal sites the ‘rig...
PDF
Moving from a Static Site to a CMS or from one CMS to Another Without Losing ...
POTX
Nc tech4 good_presentation_2014_up
PDF
Effectively Engaging Stakeholders in Drupal Projects
PDF
Building a Drupal Forum
PDF
Drupalcon report
PDF
China corea y japon rol de la mujer
PPT
Contratos De Compra Y Venta Internacional
Presentation7
Git Makes Me Angry Inside
Intro to Theming Drupal, FOSSLC Summer Camp 2010
Monitoring Processes
Communications 2 0
Flatstanleyprjct
Journey to the Center of Drupal: How I learned to build Drupal sites the ‘rig...
Moving from a Static Site to a CMS or from one CMS to Another Without Losing ...
Nc tech4 good_presentation_2014_up
Effectively Engaging Stakeholders in Drupal Projects
Building a Drupal Forum
Drupalcon report
China corea y japon rol de la mujer
Contratos De Compra Y Venta Internacional
Ad

Similar to Drupal Version Control & File System Basics (20)

ODP
Intro To Version Control
PDF
VersionEEring
PDF
Intro to Git for Drupal 7
PPTX
Git Going w/ Git
PPTX
Subversion
PDF
Git sourcecontrolpreso
PPT
Contributing to Drupal
PDF
Digital Fabrication Studio 0.3 Information
ODP
Practical SVN for PHP Developers
PDF
Version Uncontrolled - How to Manage Your Version Control (whitepaper)
PPTX
Version control
PPTX
Slide set 7 (Source Code Management History Overview) - Copy.pptx
PDF
Versioning for Developers
KEY
Drupal Meetup Lisbon
PDF
Modernize Your Drupal Development
PDF
Svn tutorial
PDF
Version Control - Hem Shrestha
PPT
Totalsvn Usage And Administration By Gopi
PDF
Svn tutorial
PDF
Svn tutorial
Intro To Version Control
VersionEEring
Intro to Git for Drupal 7
Git Going w/ Git
Subversion
Git sourcecontrolpreso
Contributing to Drupal
Digital Fabrication Studio 0.3 Information
Practical SVN for PHP Developers
Version Uncontrolled - How to Manage Your Version Control (whitepaper)
Version control
Slide set 7 (Source Code Management History Overview) - Copy.pptx
Versioning for Developers
Drupal Meetup Lisbon
Modernize Your Drupal Development
Svn tutorial
Version Control - Hem Shrestha
Totalsvn Usage And Administration By Gopi
Svn tutorial
Svn tutorial

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
KodekX | Application Modernization Development
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Encapsulation theory and applications.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Chapter 3 Spatial Domain Image Processing.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
20250228 LYD VKU AI Blended-Learning.pptx
KodekX | Application Modernization Development
Unlocking AI with Model Context Protocol (MCP)
Digital-Transformation-Roadmap-for-Companies.pptx
Big Data Technologies - Introduction.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Network Security Unit 5.pdf for BCA BBA.
Dropbox Q2 2025 Financial Results & Investor Presentation
Encapsulation theory and applications.pdf
Electronic commerce courselecture one. Pdf
Encapsulation_ Review paper, used for researhc scholars
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Chapter 3 Spatial Domain Image Processing.pdf

Drupal Version Control & File System Basics

  • 1. Drupal Version Control & File System Basics Julia Kulla-Mader Triangle Drupal User’s Group March 17, 2010 http://www.juliakm.com @juliakm
  • 2. What is version control? • A way of managing changes to documents, programs, or other data stored as computer files. (Wikipedia)
  • 3. What are some version control systems?
  • 4. Why use version control? • Real world scenarios
  • 5. Why am I getting a white screen of death? • Version control lets you see what the most recent code change was on your site.
  • 6. Can I get rid of that white screen of death? • Version control lets you roll back to a previous version.
  • 7. My client decided that they prefer a way earlier version of my module • Version control lets you roll back a specific file to any point in time (when it was under version control).
  • 8. I really want to use this new module but I'm afraid it's going to destroy my site. • Using version control, you can maintain multiple versions of your code. For example, you can create a sandbox (“trunk”) just for testing out experimental modules.
  • 9. My co-worker and I are editing the same page. What if we overwrite one another? • Version control lets you merge changes when conflicts arise.
  • 10. Why the heck did I make this change last year? • Version control lets you record log messages over time so that you can communicate with your old self.
  • 11. Who was the last person to touch this module? • Version control lets to see the last person who edited a file.
  • 12. I want to quickly deploy my code on a new server. • Version control makes it easy to quickly grab a repository and put in on your local computer or a new server.
  • 13. I'm sick of copying files from my computer to the server. • Using “hooks” you can set up you server to automatically reflect a new change to your site made on your local computer.
  • 14. What Does Version Control Look Like In Practice? • Example: Association for the Advancement of Sustainability in Higher Education • Version Control System: Subversion
  • 15. How is AASHE’s repository set up? • Trunk: the latest, least stable version of our code • Branch: the working version of code, very similar to live code • Tags: each new version of the site is tagged
  • 16. What does this look like when we are coding? • If we are testing out new modules or major upgrades, we work in trunk first. • Commits to trunk show up at dev.aashe.org • If we are fixing bugs or updating code, we work in the current branch first. • Commits to the current branch show up at stage.aashe.org • We never touch the releases, we just create a new one when the branch code is tested. • We have a release script for making a new release.
  • 17. What does the release script do? • Creates the next tag. svn copy file://$path/www/branches/branch-3.0/ file://$path/www/releases/release-$release -m "$commit" • Creates an export of the branch repository. svn export --force file://$path/www/releases/release-$release /var/www/aashe.org/releases/release-$release • Creates a symlink from the public folder to the new release. rm /var/www/aashe.org/public ln -s /var/www/aashe.org/releases/release-$release /var/www/aashe.org/public • Creates symlinks to the file directories (explanation to follow)
  • 18. What are some version control hurdles specific to Drupal?
  • 19. Updating Modules • We use drush to update Drupal modules locally, then commit to the staging site (unless it’s Views or CCK, then trunk) • drush is a command line shell and Unix scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt. drush up mymodulename
  • 20. Updating Core • We download the version of Drupal we are using from Drupal.org and the latest version, unzip them, and create a patch file using the diff command wget http://ftp.drupal.org/files/projects/drupal-6.16.tar.gz tar -xzf drupal-6.16.tar.gz wget http://ftp.drupal.org/files/projects/drupal-6.15.tar.gz tar -xzf drupal-6.15.tar.gz diff -Naur drupal-6.15 drupal-6.16 > drupal-current-to-drupal-latest.patch • Next, we test to see if there are any conflicts by doing a dry run from the root Drupal directory patch -p1 --dry-run < drupal-current-to-drupal-latest.patch • Last, we apply the patch file for real from the root directory patch -p1 < drupal-current-to-drupal-latest.patch
  • 21. Preventing Files From Being Accidentally Deleted or Versioned • We store our files at the same level as our public directory and create a symlink to it • Our release script rebuilds these symlinks each time there is a new release ln -s /var/www/aashe.org/files /var/www/aashe.org/public/files ln -s /var/www/aashe.org/documents /var/www/aashe.org/public/documents
  • 22. Next Steps • Pick your favorite version control system • Research your version control system of choice • If you don’t want to mess with the command-line, look for a GUI tool like TortiseSVN, Versions, SvnX, or a code editor like Eclipse, Textmate • Decide on your repository structure • Start writing versioned code
  • 23. Next Up: Mastering the Drupal Database • Hello Allen