Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
provision
Commits
115d394c
Commit
115d394c
authored
May 08, 2010
by
Neil Drumm
Committed by
Neil Drumm
May 08, 2010
Browse files
Centralize service initialization.
parent
a9b0ef46
Changes
3
Hide whitespace changes
Inline
Side-by-side
db/db.drush.inc
View file @
115d394c
...
...
@@ -8,34 +8,8 @@
* It uses the provision API to tie into the right places in the site creation work flow.
*/
include_once
(
dirname
(
__FILE__
)
.
'/../provision.service.inc'
);
function
db_drush_init
()
{
// todo same as http, consolidate
$command
=
drush_get_command
();
$command
=
explode
(
" "
,
$command
[
'command'
]);
if
(
preg_match
(
"/^provision-/"
,
$command
[
0
]))
{
_provision_context_init
();
if
(
PROVISION_CONTEXT_SERVER
)
{
if
(
!
is_null
(
drush_get_option
(
'init_db'
)))
{
// Bootstrap for alias creation.
include_once
(
drush_get_option
(
'init_db'
)
.
'/'
.
drush_get_option
(
'init_db'
)
.
'_service.inc'
);
$class
=
'provisionService_db_'
.
drush_get_option
(
'init_db'
);
provision_service
(
'db'
,
new
$class
());
}
}
elseif
(
PROVISION_CONTEXT_SITE
)
{
// todo should be constructed based on drush aliases
include_once
(
'mysql/mysql_service.inc'
);
provision_service
(
'db'
,
new
provisionService_db_mysql
());
}
}
// this is where we generate the db service object.
}
function
db_drush_exit
()
{
// determine how to close it too.
provision_service
(
'db'
)
->
close
();
...
...
http/http.drush.inc
View file @
115d394c
...
...
@@ -2,29 +2,6 @@
include_once
(
dirname
(
__FILE__
)
.
'/../provision.service.inc'
);
function
http_drush_init
()
{
// todo same as db, consolidate
$command
=
drush_get_command
();
$command
=
explode
(
" "
,
$command
[
'command'
]);
if
(
preg_match
(
"/^provision-/"
,
$command
[
0
]))
{
_provision_context_init
();
if
(
PROVISION_CONTEXT_SERVER
)
{
if
(
!
is_null
(
drush_get_option
(
'init_http'
)))
{
// Bootstrap for alias creation.
include_once
(
drush_get_option
(
'init_http'
)
.
'/'
.
drush_get_option
(
'init_http'
)
.
'_service.inc'
);
$class
=
'provisionService_http_'
.
drush_get_option
(
'init_http'
);
provision_service
(
'http'
,
new
$class
());
}
}
else
{
// todo should be constructed based on drush aliases
include_once
(
'apache/apache_service.inc'
);
provision_service
(
'http'
,
new
provisionService_http_apache
());
}
}
}
class
provisionService_http
extends
provisionService
{
/**
* Set defaults
...
...
platform/provision_drupal.drush.inc
View file @
115d394c
...
...
@@ -54,7 +54,6 @@ function provision_drupal_drush_init() {
$command
=
drush_get_command
();
$command
=
explode
(
" "
,
$command
[
'command'
]);
if
(
preg_match
(
"/^provision-/"
,
$command
[
0
]))
{
_provision_context_init
();
}
...
...
@@ -86,6 +85,15 @@ function _provision_context_init() {
drush_log
(
dt
(
'Using context @context'
,
array
(
'@context'
=>
$context
)));
// Initialize services.
foreach
(
array
(
'db'
,
'http'
)
as
$service
)
{
if
(
!
is_null
(
drush_get_option
(
'init_'
.
$service
)))
{
include_once
(
drush_get_option
(
'init_'
.
$service
)
.
'/'
.
drush_get_option
(
'init_'
.
$service
)
.
'_service.inc'
);
$class
=
'provisionService_'
.
$service
.
'_'
.
drush_get_option
(
'init_'
.
$service
);
provision_service
(
$service
,
new
$class
());
}
}
$is_run
=
TRUE
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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