Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
P
provision
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Drupal.org issue queue
Drupal.org issue queue
Security & Compliance
Security & Compliance
Dependency List
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
project
provision
Commits
1917196e
Commit
1917196e
authored
Feb 03, 2009
by
Adrian Rossouw
Committed by
adrian
Feb 03, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed any drupal api calls from all commands.
parent
509edf38
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
35 deletions
+59
-35
platform/provision_drupal.drush.inc
platform/provision_drupal.drush.inc
+1
-1
provision.drush.inc
provision.drush.inc
+21
-14
provision.inc
provision.inc
+36
-19
web_server/provision_apache.drush.inc
web_server/provision_apache.drush.inc
+1
-1
No files found.
platform/provision_drupal.drush.inc
View file @
1917196e
...
...
@@ -147,7 +147,7 @@ function _provision_drupal_create_settings_file(&$data, $url = NULL) {
$fp
=
fopen
(
"sites/
$url
/settings.php"
,
"w"
);
$text
=
variable_get
(
'provision_drupal_settings_template'
,
_provision_drupal_default_template
()
);
$text
=
_provision_drupal_default_template
(
);
fwrite
(
$fp
,
"<?php
\n
"
.
provision_render_config
(
$text
,
$data
));
fclose
(
$fp
);
...
...
provision.drush.inc
View file @
1917196e
...
...
@@ -120,7 +120,7 @@ function provision_drush_command() {
'callback arguments'
=>
array
(
'install'
),
'arguments'
=>
array
(
'domain.com'
=>
dt
(
'The domain of the site to install.'
)),
'description'
=>
dt
(
'Provision a new site using the provided data.'
),
'bootstrap'
=>
DRUPAL_BOOTSTRAP_CONFIGURATION
'bootstrap'
=>
-
1
);
$items
[
'provision import'
]
=
array
(
...
...
@@ -128,14 +128,15 @@ function provision_drush_command() {
'callback arguments'
=>
array
(
'import'
),
'arguments'
=>
array
(
'domain.com'
=>
dt
(
'The domain of the site to import.'
)),
'description'
=>
dt
(
'Turn an already running site into a provisioned site.'
),
'bootstrap'
=>
DRUPAL_BOOTSTRAP_CONFIGURATION
'bootstrap'
=>
-
1
);
$items
[
'provision update'
]
=
array
(
'callback'
=>
'provision_command'
,
'callback arguments'
=>
array
(
'update'
),
'arguments'
=>
array
(
'domain.com'
=>
dt
(
'The domain of the site to update.'
)),
'description'
=>
dt
(
'Run any outstanding updates on the site.'
)
'description'
=>
dt
(
'Run any outstanding updates on the site.'
),
'bootstrap'
=>
-
1
);
$items
[
'provision backup'
]
=
array
(
...
...
@@ -143,20 +144,23 @@ function provision_drush_command() {
'callback arguments'
=>
array
(
'backup'
),
'arguments'
=>
array
(
'domain.com'
=>
dt
(
'The domain of the site to back up.'
)),
'optional arguments'
=>
array
(
'backup-file'
=>
dt
(
'The file to save the backup to. This will be a gzipped tarball.'
)),
'description'
=>
dt
(
'Generate a back up for the site.'
)
'description'
=>
dt
(
'Generate a back up for the site.'
),
'bootstrap'
=>
-
1
);
$items
[
'provision enable'
]
=
array
(
'callback'
=>
'provision_command'
,
'callback arguments'
=>
array
(
'enable'
),
'arguments'
=>
array
(
'domain.com'
=>
dt
(
'The domain of the site to enable (only if enabled).'
)),
'description'
=>
'Enable a disabled site.'
'description'
=>
'Enable a disabled site.'
,
'bootstrap'
=>
-
1
);
$items
[
'provision disable'
]
=
array
(
'callback'
=>
'provision_command'
,
'callback arguments'
=>
array
(
'disable'
),
'arguments'
=>
array
(
'domain.com'
=>
dt
(
'The domain of the site to disable (only if disabled).'
)),
'description'
=>
'Disable a site.'
'description'
=>
'Disable a site.'
,
'bootstrap'
=>
-
1
);
$items
[
'provision verify'
]
=
array
(
...
...
@@ -164,7 +168,7 @@ function provision_drush_command() {
'callback arguments'
=>
array
(
'verify'
),
'arguments'
=>
array
(
'domain.com'
=>
dt
(
'The domain of the site to verify).'
)),
'description'
=>
'Verify that the provisioning framework is correctly installed.'
,
'bootstrap'
=>
DRUPAL_BOOTSTRAP_CONFIGURATION
,
'bootstrap'
=>
-
1
);
$items
[
'provision restore'
]
=
array
(
...
...
@@ -172,26 +176,30 @@ function provision_drush_command() {
'callback arguments'
=>
array
(
'restore'
),
'description'
=>
'Restore the site to a previous backup. This will also generate a backup of the site as it was.'
,
'arguments'
=>
array
(
'domain.com'
=>
dt
(
'The domain of the site to be restored'
),
'site_backup.tar.gz'
=>
dt
(
'The backup to restore the site to.'
))
'site_backup.tar.gz'
=>
dt
(
'The backup to restore the site to.'
)),
'bootstrap'
=>
-
1
);
$items
[
'provision delete'
]
=
array
(
'callback'
=>
'provision_command'
,
'callback arguments'
=>
array
(
'delete'
),
'description'
=>
'Delete a site.'
'description'
=>
'Delete a site.'
,
'bootstrap'
=>
-
1
);
$items
[
'provision cron'
]
=
array
(
'callback'
=>
'provision_command'
,
'callback arguments'
=>
array
(
'cron'
),
'description'
=>
'Run cron process for site.'
,
'arguments'
=>
array
(
'domain.com'
=>
dt
(
'The domain of the site to be processed'
))
'arguments'
=>
array
(
'domain.com'
=>
dt
(
'The domain of the site to be processed'
)),
'bootstrap'
=>
-
1
);
if
(
!
function_exists
(
'hosting_setup'
))
{
$items
[
'provision setup'
]
=
array
(
'callback'
=>
'_provision_setup_cmd'
,
'description'
=>
'Initialize this platform to be able to create hosted sites.'
,
'bootstrap'
=>
-
1
);
}
...
...
@@ -210,7 +218,8 @@ function provision_drush_command() {
*/
function
_provision_setup
()
{
$success
=
TRUE
;
$drush_path
=
sprintf
(
"%s/%s/drush.php"
,
PROVISION_DOCROOT_PATH
,
drupal_get_path
(
'module'
,
'drush'
));
$drush_path
=
realpath
(
$_SERVER
[
'argv'
][
0
]);
$success
&=
provision_path
(
'symlink'
,
$drush_path
,
PROVISION_DOCROOT_PATH
.
'/drush.php'
,
dt
(
'Created symlink for drush.php file'
),
...
...
@@ -225,9 +234,7 @@ function _provision_setup() {
* Drush command wrapper for the setup of the platform
*/
function
_provision_setup_cmd
()
{
if
(
_provision_setup
())
{
variable_set
(
'provision_setup'
,
TRUE
);
}
_provision_setup
();
// @TODO use provision_output for this, but we need pretty print first.
$logs
=
provision_get_log
();
...
...
provision.inc
View file @
1917196e
...
...
@@ -111,21 +111,23 @@ function provision_command($hook, $arg1 = NULL, $arg2 = NULL, $arg3 = NULL, $arg
* Turn drupal_set_message errors into provision_log errors
*/
function
_provision_log_messages
()
{
$messages
=
drupal_get_messages
();
if
(
function_exists
(
'drupal_get_messages'
))
{
//Drupal message errors.
foreach
((
array
)
$messages
[
'error'
]
as
$error
)
{
if
(
preg_match
(
'/^warning:/'
,
$error
))
{
provision_log
(
'warning'
,
ereg_replace
(
'/^warning: /'
,
''
,
$error
));
}
elseif
(
preg_match
(
'/^user warning:/'
,
$error
))
{
provision_log
(
"error"
,
ereg_replace
(
'/^user warning: /'
,
''
,
$error
));
}
else
{
provision_log
(
'error'
,
$error
);
$messages
=
drupal_get_messages
();
//Drupal message errors.
foreach
((
array
)
$messages
[
'error'
]
as
$error
)
{
if
(
preg_match
(
'/^warning:/'
,
$error
))
{
provision_log
(
'warning'
,
ereg_replace
(
'/^warning: /'
,
''
,
$error
));
}
elseif
(
preg_match
(
'/^user warning:/'
,
$error
))
{
provision_log
(
"error"
,
ereg_replace
(
'/^user warning: /'
,
''
,
$error
));
}
else
{
provision_log
(
'error'
,
$error
);
}
}
}
}
function
provision_parse_output
(
$string
)
{
...
...
@@ -177,7 +179,6 @@ function provision_output($data = array()) {
}
$return
[
'error_status'
]
=
$error
;
// error code being returned
$return
[
'log'
]
=
provision_get_log
();
// Append logging information
$return
[
'messages'
]
=
drupal_get_messages
();
if
(
PROVISION_DRUSH_BACKEND
)
{
printf
(
PROVISION_OUTPUT
,
serialize
(
$return
));
}
...
...
@@ -337,9 +338,9 @@ function provision_get_site_data($url) {
$site_data
[
'task_type'
]
=
$args
[
'commands'
][
1
];
$site_data
[
'task_id'
]
=
drush_get_option
(
'task_id'
,
NULL
);
$site_data
[
'publish_path'
]
=
PROVISION_DOCROOT_PATH
;
$site_data
[
'profile'
]
=
(
$site_data
[
'profile'
])
?
$site_data
[
'profile'
]
:
variable_get
(
'provision_default_profile'
,
'default'
)
;
$site_data
[
'site_ip'
]
=
variable_get
(
'provision_apache_server_ip'
,
'127.0.0.1'
)
;
$site_data
[
'site_port'
]
=
variable_get
(
'provision_apache_server_ip'
,
80
)
;
$site_data
[
'profile'
]
=
(
$site_data
[
'profile'
])
?
$site_data
[
'profile'
]
:
'default'
;
$site_data
[
'site_ip'
]
=
(
$site_data
[
'site_ip'
])
?
$site_data
[
'site_ip'
]
:
'127.0.0.1'
;
$site_data
[
'site_port'
]
=
(
$site_data
[
'site_port'
])
?
$site_data
[
'site_port'
]
:
'80'
;
//Default to english language
$site_data
[
'language'
]
=
$site_data
[
'language'
]
?
$site_data
[
'language'
]
:
'en'
;
...
...
@@ -504,7 +505,7 @@ function _provision_recursive_delete($path) {
while
((
$entry
=
$d
->
read
())
!==
FALSE
)
{
if
(
$entry
==
'.'
||
$entry
==
'..'
)
continue
;
$entry_path
=
$path
.
'/'
.
$entry
;
if
(
file_check_location
(
$entry_path
,
$path
))
{
if
(
_provision_
file_check_location
(
$entry_path
,
$path
))
{
$ret
=
_provision_recursive_delete
(
$entry_path
);
}
else
{
...
...
@@ -526,6 +527,22 @@ function _provision_recursive_delete($path) {
return
$ret
;
}
function
_provision_file_check_location
(
$source
,
$directory
=
''
)
{
$check
=
realpath
(
$source
);
if
(
$check
)
{
$source
=
$check
;
}
else
{
// This file does not yet exist
$source
=
realpath
(
dirname
(
$source
))
.
'/'
.
basename
(
$source
);
}
$directory
=
realpath
(
$directory
);
if
(
$directory
&&
strpos
(
$source
,
$directory
)
!==
0
)
{
return
0
;
}
return
$source
;
}
/**
* Wrapper around drush_shell_exec to provide sprintf functionality with some more safety.
*
...
...
@@ -735,12 +752,12 @@ function pt($string, $args = array()) {
switch
(
$key
[
0
])
{
// Escaped only
case
'@'
:
$args
[
$key
]
=
check_plain
(
$value
);
$args
[
$key
]
=
htmlspecialchars
(
$value
,
ENT_QUOTES
);
break
;
// Escaped and placeholder
case
'%'
:
default
:
$args
[
$key
]
=
'<em>'
.
check_plain
(
$value
)
.
'</em>'
;
$args
[
$key
]
=
'<em>'
.
htmlspecialchars
(
$value
,
ENT_QUOTES
)
.
'</em>'
;
break
;
// Pass-through
case
'!'
:
...
...
web_server/provision_apache.drush.inc
View file @
1917196e
...
...
@@ -37,7 +37,7 @@ function _provision_apache_delete_vhost_config($url, $data) {
*/
function
_provision_apache_create_vhost_config
(
$data
,
$url
,
$template
=
NULL
)
{
if
(
is_null
(
$template
))
{
$template
=
variable_get
(
'provision_apache_vhost_template'
,
_provision_apache_default_template
()
);
$template
=
_provision_apache_default_template
(
);
}
provision_log
(
"Notice"
,
dt
(
"Generate virtual host configuration file."
));
$writable
=
provision_path
(
"writable"
,
PROVISION_VHOST_PATH
,
TRUE
,
NULL
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment