/[drupal]/contributions/modules/cdn/README.txt
ViewVC logotype

Diff of /contributions/modules/cdn/README.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.5, Tue Jan 8 02:45:40 2008 UTC revision 1.6, Tue Jan 8 10:16:29 2008 UTC
# Line 1  Line 1 
1  // $Id: README.txt,v 1.4 2008/01/06 23:39:52 wimleers Exp $  // $Id: README.txt,v 1.5 2008/01/08 02:45:40 wimleers Exp $
2    
3    Description
4    -----------
5    The aim of this module to provide easy Content Delivery Network integration
6    for Drupal sites. Obviously it has to patch Drupal core to rewrite the URLs,
7    not only to serve them from another domain, but also to make the filenames
8    unique.
9    
10    It has synchronization plugins, so it allows you to use any protocol or
11    algorithm to synchronize your files. Currently however, only one plugin is
12    available: FTP. Since proper usage of a CDN demands unique filenames for each
13    version of a file, we can optimize a lot: to validate a file on the CDN while
14    synchronizing, we must only know if it 1) exists and 2) has the correct size.
15    
16    Which files and directories should be synchronized can be configured very
17    precisely. Consult the README for details about that.
18    
19    The FTP synchronization plugin allows you to use a $15 per month CDN (thus
20    making CDNs accessible to *a lot* Drupal users) with no effort after the
21    installation!
22    For those who know of the infamous YSlow test: if you install and configure
23    this module and apply the core patch that also adds Javascript aggregation,
24    you will score 98. Almost the maximum! The remainder of points is due to the
25    lack Javascript minification (compression).
26    
27    This module was developed for http://driverpacks.net/.
28    
29    
30    Installation
31    ------------
32    1) Place this module in your modules directory (this will usually be
33    "sites/all/modules/").
34    
35    2) Enable the module.
36    
37    3) Apply the Drupal core patch. See below.
38    
39    4) Apply the theme patch to every theme. See below.
40    
41    5) Read how to configure the CDN synchronization filters. See below.
42    
43    6) Configure the $conf array in settings.php See below.
44    
45    7) Copy cdn_cron.php to your Drupal root directory.
46    
47    8) Configure cdn_cron.php like Drupal's cron.php. See http://drupal.org/cron.
48    
49    9) Go to admin/logs/status. If the CDN integration module is installed
50    correctly or not, it will report so here.
51    
52    
53    Usage
54    -----
55    When the module is installed properly (see step 9 of the installation), you
56    can check the site-wide statistics at admin/settings/cdn. At that same page,
57    you can enable the per-page statistics as well. This will show the number of
58    files served from the CDN at the bottom of each page, as well as a list of
59    files that haven't been synchronized to the CDN yet, to users with the
60    "administer site configuration" permission.
61    
62    
63  Applying the Drupal core patch  Applying the Drupal core patch
64  ------------------------------  ------------------------------
   
65  You *must* apply this patch!  You *must* apply this patch!
66    
67  First, change the directory to the Drupal root directory.  First, change the directory to the Drupal root directory.
# Line 20  patches separately, you will get a confl Line 79  patches separately, you will get a confl
79    
80  Applying the theme patch  Applying the theme patch
81  ------------------------  ------------------------
   
82  You *must* apply this patch to *every* theme that's being used on your website!  You *must* apply this patch to *every* theme that's being used on your website!
83    
84  Repeat this process for every theme: first, change the directory to the  Repeat this process for every theme: first, change the directory to the
# Line 28  directory of the theme. Applying the pat Line 86  directory of the theme. Applying the pat
86  only with a different filename.  only with a different filename.
87    
88    
89  Setting up CDN sync filters  Setting up CDN synchronization filters
90  ---------------------------  --------------------------------------
91    First of all: each filter works *recursively*! Now, the explanations:
92  - paths: This is an array of paths (each path being relative to the Drupal  - paths: This is an array of paths (each path being relative to the Drupal
93           root directory) on which this filter should be applied.           root directory) on which this filter should be applied.
94  - pattern: A regular expression that will be used to filter the files in each  - pattern: Regular expression that will be used to filter the files in each
95             directory. Like the $mask parameter in file_scan_directory().             directory. Like the $mask parameter in file_scan_directory().
96  - ignored_dirs: An array of directories that should be ignored in each  - ignored_dirs: Array of directories that should be ignored in each directory.
97                  directory. Like the $nomask parameter in file_scan_directory().                  Like the $nomask parameter in file_scan_directory().
98  - unique: Determines how the uniqueness will be applied. You can set it to  - unique: Determines how the uniqueness will be applied. You can set it to
99            'filename', which will alter the filename, or 'common parent            'filename', which will alter the filename, or 'common parent
100            directory', which will alter the path of the file. The latter is            directory', which will alter the path of the file. The latter is
# Line 51  Setting up CDN sync filters Line 110  Setting up CDN sync filters
110    
111  Configuring the $conf array in settings.php  Configuring the $conf array in settings.php
112  -------------------------------------------  -------------------------------------------
   
113  This is my configuration:  This is my configuration:
114    
115  $conf = array(  $conf = array(
116    'cdn_url' => 'http://wimleers.cachefly.com/wimleers.com',    'cdn_url' => 'http://wimleers.cachefly.com/wimleers.com',
117    'cdn_sync_filters' => array(    'cdn_sync_filters' => array(
118    'cdn_sync_filters' => array(      // Add all Javascript, CSS, image and flash files from the most common
119        // directories in Drupal.
120      0 => array(      0 => array(
121        'paths' => array('misc', 'profiles', 'modules', 'sites/all/modules', 'sites/default/modules'),        'paths' => array('misc', 'profiles', 'modules', 'sites/all/modules', 'sites/default/modules'),
122        'pattern' => '.*\.(js|css|gif|png|jpg|jpeg|svg|swf)$',        'pattern' => '.*\.(js|css|gif|png|jpg|jpeg|svg|swf)$',
# Line 65  $conf = array( Line 124  $conf = array(
124        'unique' => 'filename',        'unique' => 'filename',
125        'unique_method' => 'mtime',        'unique_method' => 'mtime',
126      ),      ),
127    
128        // We want to add *everything* in the files directory. Except for the
129        // files in the CSS directory, because they need special treatment.
130      1 => array(      1 => array(
131        'paths' => array('sites/wimleers.com/files'),        'paths' => array('sites/wimleers.com/files'),
132        'pattern' => '.*',        'pattern' => '.*',
# Line 72  $conf = array( Line 134  $conf = array(
134        'unique' => 'filename',        'unique' => 'filename',
135        'unique_method' => 'mtime',        'unique_method' => 'mtime',
136      ),      ),
137    
138        // Add all files in the files/css directory, *but* update the URLs in the
139        // files. This is only necessary if we use CSS aggregation.
140      2 => array(      2 => array(
141        'paths' => array('sites/wimleers.com/files/css'),        'paths' => array('sites/wimleers.com/files/css'),
142        'pattern' => '.*',        'pattern' => '.*',
# Line 80  $conf = array( Line 145  $conf = array(
145        'unique_method' => 'mtime',        'unique_method' => 'mtime',
146        'update_urls_in_files' => TRUE,        'update_urls_in_files' => TRUE,
147      ),      ),
148    
149        // Add all Javascript, CSS, image and font files from our themes. But
150        // make sure the URLs don't break when CSS aggregation is disabled, by
151        // using the "common parent directory" unique level and the "md5 of mtimes"
152        // uniqueness method. We can revert to normal values if we have CSS
153        // aggregation enabled.
154      3 => array(      3 => array(
155        'paths' => array('sites/default/themes/garland-customized'),        'paths' => array('sites/default/themes/garland-customized'),
156        'pattern' => '.*\.(js|css|gif|png|jpg|jpeg|otf)$',        'pattern' => '.*\.(js|css|gif|png|jpg|jpeg|otf)$',
# Line 97  $conf = array( Line 168  $conf = array(
168      'pass' => 'pass',      'pass' => 'pass',
169    ),    ),
170  );  );
171    
172    
173    Author
174    ------
175    Wim Leers
176    
177    * mail: work@wimleers.com
178    * website: http://wimleers.com/work
179    
180    The author can be contacted for paid customizations of this module as well as
181    Drupal consulting, development and installation.

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.2