title: Version control a content management system?
body: <p>I have the following directory structure in the CMS application we have written:</p>
  
  <pre><code>/application
  /modules
     /cms
        /filemanager
        /block
        /pages
        /sitemap
     /youtube
     /rss
  /skin
     /backend
        /default
           /css
           /js
           /images
     /frontend
       /default
           /css
           /js
           /images
  </code></pre>
  
  <p>Application contains code specific to the current CMS implementation, i.e code for this specific cms.
  Modules contain reusable portions of code that we share across projects, such as libraries to work with youtube or rss feeds. We include these as git submodules, so that we can update the module in any website and push the changes back across all other projects. It makes it really easy to apply a change to our code and distribute it. We wanted to turn the CMS into a module so we get the same benefit - we can run the entire project under source control, then update the cms as required through a git-submodule. We have run into a problem however: 
  <strong>the cms requires javascript/images/css in order for it to work correctly.</strong></p>
  
  <p>Things we have thought about:</p>
  
  <ul>
  <li><p>We could create 2 submodules, one for cms-skin and one for cms, but this means you cannot "git pull" one version without having some idea of which versions of skin work with which versions of cms. i.e version 1.2.2 CMS might have issues with 1.0.3 CMS-Skin</p></li>
  <li><p>We could add the skin to the cms module but this has the following problems:</p>
  
  <ol>
  <li>Skin should be available on the document root, module code shouldn't be, and if it is it should probably be secured via .htaccess</li>
  <li>It doesn't seem to make any sense bundling assets with php code</li>
  <li>We could create a symlink between /skin/backend/ to go to /modules/cms/skin but does this cause any security problems, and do we want to require something like a symlink for the application to work?</li>
  <li>We could create a hook for git or a shell script that copies files from modules/cms/skin to skin/backend when an update occurs, but this means we lose the ability to edit CMS core files in a project then push them back</li>
  </ol></li>
  </ul>
  
  <p>How is this typically done in large scale cms's? How is it possible to get the source code for a cms under version control, work on the application for a client, then update the sourcecode as releases and given by the vendor? How do applications like Magento or Drupal do this?</p>