/[drupal]/contributions/modules/provision/platform/verify.provision.inc
ViewVC logotype

Contents of /contributions/modules/provision/platform/verify.provision.inc

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


Revision 1.24 - (show annotations) (download) (as text)
Thu Nov 5 12:41:40 2009 UTC (3 weeks ago) by adrian
Branch: MAIN
Changes since 1.23: +2 -5 lines
File MIME type: text/x-php
Abstracted the functionality to prepare the $_SERVER variable into provision_prepare_environment() and additionally fix migrations
1 <?php
2
3 /**
4 * Provision verify command
5 *
6 * Disable an enabled and installed site
7 */
8 function drush_provision_drupal_provision_verify_validate($url = null) {
9 if ($url) {
10 drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_SITE);
11 provision_prepare_environment();
12
13 _provision_drupal_create_settings_file($url);
14 drush_errors_on();
15 drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_FULL);
16 }
17
18 // This will not have an effect if you are running it on a platform, just tests that if a site is provided it is an existing one
19 _provision_drupal_valid_site();
20 }
21
22
23 /**
24 * implementation of provision_verify
25 */
26 function drush_provision_drupal_provision_verify($url = null) {
27 if (PROVISION_CONTEXT_PLATFORM) {
28 _provision_create_dir(drush_get_option('config_path'), dt('Provision configuration'), 0711);
29 _provision_create_dir(drush_get_option('config_path') . '/includes', dt('Provision PHP configuration'), 0711);
30 if (!provision_path('exists', drush_get_option('config_path') . '/includes/global.inc', TRUE, dt("Global configuration file exists"))) {
31 # create an empty global.inc so the include doesn't fail with
32 # open_basedir restrictions
33 if (!$file = fopen(drush_get_option('config_path') . '/includes/global.inc', 'a')) {
34 drush_set_error('PROVISION_FRAMEWORK_ERROR', dt('Cannot create global settings configuration'));
35 } else {
36 fwrite($file, "<?php # global settings.php");
37 fclose($file);
38 }
39 }
40 _provision_create_dir(drush_get_option('backup_path'), dt('Backup'), 0700);
41 provision_path("writable", drush_get_option('sites_path'), TRUE, dt("Drupal sites directory is writable by the provisioning script"),
42 dt("Drupal sites directory is not writable by the provisioning script"), 'PROVISION_SITES_DIR_NOT_WRITABLE');
43
44 drush_set_option('sites', array_keys((array) provision_drupal_find_sites()), 'drupal');
45 drush_log(dt("This platform is running @short_name @version", array('@short_name' => 'drupal', '@version' => VERSION)));
46 drush_set_option('packages', _scrub_object(provision_find_packages()), 'drupal');
47 }
48 else {
49 drush_set_option('packages', _scrub_object(provision_drupal_system_map()), 'site');
50 // This is the actual drupal provisioning requirements.
51 _provision_drupal_create_directories($url);
52 _provision_drupal_maintain_aliases($url);
53 // Requires at least the database settings to complete.
54 _provision_drupal_create_settings_file($url);
55 }
56
57 }
58
59
60 /**
61 * Implementation of hook_provision_post_verify
62 */
63 function drush_provision_drupal_post_provision_verify($url = NULL) {
64 if (PROVISION_CONTEXT_SITE) {
65 _provision_drupal_rebuild_caches($url);
66 drush_set_option('aliases', drush_get_option('aliases'), 'site');
67 drush_set_option('redirection', drush_get_option('redirection'), 'site');
68 drush_set_option('installed', TRUE, 'site');
69 }
70 }
71
72 /**
73 * Inject the relevant .htacces configuration into the global apache configuration
74 */
75 function provision_drupal_provision_apache_dir_config($data = null) {
76 return <<<EOF
77 #
78 # Apache/PHP/Drupal settings:
79 #
80
81 # Protect files and directories from prying eyes.
82 <FilesMatch "\.(engine|inc|info|install|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
83 Order allow,deny
84 </FilesMatch>
85
86 # Don't show directory listings for URLs which map to a directory.
87 Options -Indexes
88
89 # Follow symbolic links in this directory.
90 Options +FollowSymLinks
91
92 # Make Drupal handle any 404 errors.
93 ErrorDocument 404 /index.php
94
95 # Force simple error message for requests for non-existent favicon.ico.
96 <Files favicon.ico>
97 # There is no end quote below, for compatibility with Apache 1.3.
98 ErrorDocument 404 "The requested file favicon.ico was not found.
99 </Files>
100
101 # Set the default handler.
102 DirectoryIndex index.php
103
104 # Override PHP settings. More in sites/default/settings.php
105 # but the following cannot be changed at runtime.
106
107 # PHP 4, Apache 1.
108 <IfModule mod_php4.c>
109 php_value magic_quotes_gpc 0
110 php_value register_globals 0
111 php_value session.auto_start 0
112 php_value mbstring.http_input pass
113 php_value mbstring.http_output pass
114 php_value mbstring.encoding_translation 0
115 </IfModule>
116
117 # PHP 4, Apache 2.
118 <IfModule sapi_apache2.c>
119 php_value magic_quotes_gpc 0
120 php_value register_globals 0
121 php_value session.auto_start 0
122 php_value mbstring.http_input pass
123 php_value mbstring.http_output pass
124 php_value mbstring.encoding_translation 0
125 </IfModule>
126
127 # PHP 5, Apache 1 and 2.
128 <IfModule mod_php5.c>
129 php_value magic_quotes_gpc 0
130 php_value register_globals 0
131 php_value session.auto_start 0
132 php_value mbstring.http_input pass
133 php_value mbstring.http_output pass
134 php_value mbstring.encoding_translation 0
135 </IfModule>
136
137 # Requires mod_expires to be enabled.
138 <IfModule mod_expires.c>
139 # Enable expirations.
140 ExpiresActive On
141
142 # Cache all files for 2 weeks after access (A).
143 ExpiresDefault A1209600
144
145 # Do not cache dynamically generated pages.
146 ExpiresByType text/html A1
147 </IfModule>
148
149 # Various rewrite rules.
150 <IfModule mod_rewrite.c>
151 RewriteEngine on
152
153 # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
154 RewriteCond %{REQUEST_FILENAME} !-f
155 RewriteCond %{REQUEST_FILENAME} !-d
156 RewriteCond %{REQUEST_URI} !=/favicon.ico
157 RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
158 </IfModule>
159
160 # Do not read the platform's .htaccess
161 AllowOverride none
162
163 EOF;
164 }

  ViewVC Help
Powered by ViewVC 1.1.2