-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwatershednow.profile
83 lines (71 loc) · 3.07 KB
/
watershednow.profile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* ## Install Workflow
* 1. User is asked what profile they would like, user picks Watershed Now
* 2. Dependencies are loaded, user puts in database credentials
* 3. Dependencies are installed
* 4. profiler_profile_tasks (in profiler_api.inc) is called and the following is done:
* 1. all db blocks are disabled
* 2. profiler components are run
* 3. hook_install() is run
* 4. menu_rebuild();
* 5. module_rebuild_cache(); to detect the newly added bootstrap modules
* 6. node_access_rebuild();
* 7. drupal_get_schema('system', TRUE); // Clear schema DB cache
* 8. drupal_flush_all_caches();
* 9. profiler_install_configure($config);
* 5. All modules specified in the watershednow.info are installed.
* 6. _watershednow_configure() is called
*/
require_once('watershednow.inc');
$path = dirname(__FILE__).'/';
require_once( $path . 'libraries/profiler/profiler.inc');
require_once( $path . 'libraries/profiler/profiler_api.inc');
require_once( $path . 'libraries/profiler/profiler_module.inc');
// Bootstrap Profiler module. See: http:drupal.org/project/profiler for more info.
profiler_v2('watershednow');
function watershednow_profile_tasks(&$task, $url) {
$config = profiler_v2_load_config('watershednow');
if ( $task == 'profile' ) {
profiler_profile_tasks($config, $task, $url);
_watershednow_profile_task_profile($task, $url);
}
if( $task == 'watershednow-configure' ) {
_watershednow_configure($config);
drupal_flush_all_caches();
/*
* Enable all watershed themes
* this must happen after clearing caches due to static variable
* that can not be reset. Extra steps included to add theme variables to variables table.
*/
_watershednow_install_themes( $config );
// Add homepage callout sample node and feed node. Note: needs to be called after clearing cache.
_watershednow_add_sample_update_feed( $config['feeds'] );
_watershednow_add_callouts();
$task = 'profile-finished'; //hand control back to the installer
}
return '';
}
function _watershednow_profile_task_profile(&$task, $url) {
$config = profiler_v2_load_config('watershednow');
$modules = array_merge($config['modules']['core'], $config['modules']['contrib'], $config['features']);
$files = module_rebuild_cache();
$operations = array();
foreach ($modules as $module) {
$operations[] = array('_install_module_batch', array($module, $files[$module]->info['name']));
}
$batch = array(
'operations' => $operations,
'finished' => '_watershed_module_install_finished',
'title' => st('Installing @drupal', array('@drupal' => drupal_install_profile_name())),
'error_message' => st('The installation has encountered an error.'),
);
// Start a batch, switch to 'profile-install-batch' task. We need to
// set the variable here, because batch_process() redirects.
variable_set('install_task', 'profile-install-batch');
batch_set($batch);
batch_process($url,$url);
}
function _watershed_module_install_finished($success, $results) {
variable_set('install_task', 'watershednow-configure');
}