function drush_prod_monitor_fetch in Production check & Production monitor 6
Same name and namespace in other branches
- 7 prod_monitor/prod_monitor.drush.inc \drush_prod_monitor_fetch()
Fetch data callback.
1 string reference to 'drush_prod_monitor_fetch'
- prod_monitor_drush_command in prod_monitor/
prod_monitor.drush.inc - Implementation of hook_drush_command().
File
- prod_monitor/
prod_monitor.drush.inc, line 60
Code
function drush_prod_monitor_fetch() {
$args = func_get_args();
// Fetch ALL.
if (empty($args)) {
if (!drush_confirm(dt('Do you really want to fetch the data for ALL remote sites?'))) {
drush_set_error('prod_monitor', dt('Aborting.'));
return;
}
else {
module_load_include('inc', 'prod_monitor', 'includes/prod_monitor.admin');
// Batch process data fetching.
_prod_monitor_fetch_all_data_batcher_create(TRUE, FALSE, FALSE);
drush_backend_batch_process();
}
}
else {
foreach ($args as $arg) {
$site = _prod_monitor_get_site($arg);
if (!empty($site['url'])) {
$result = _prod_monitor_retrieve_data($arg, $site);
$site['url'] = _prod_monitor_sanitize_url(rtrim($site['url'], '/'));
if ($result === FALSE) {
drush_print("\33[1;31m" . dt('Error:') . " \33[0m" . dt('Unable to fetch data for') . ' ' . $site['url'] . '!');
}
else {
_prod_monitor_db_connect_check($arg, $site);
drush_print(dt('Sucessfully fetched data for') . ' ' . $site['url'] . '.');
}
}
else {
drush_print("\33[1;31m" . dt('Error:') . " \33[0m" . dt('No site found with ID') . ' ' . $arg . '!');
}
}
}
}