Skip to content

Instantly share code, notes, and snippets.

@kalabro
Created August 30, 2012 08:53
Show Gist options
  • Save kalabro/3524426 to your computer and use it in GitHub Desktop.
Save kalabro/3524426 to your computer and use it in GitHub Desktop.
Drupal 7: Only CIS countries for http://drupal.org/project/countries module.
#!/usr/bin/env drush
<?php
/**
* This is Drush script.
* Only CIS countries for http://drupal.org/project/countries module.
* Оставить включенными только страны СНГ в модуле Сountries 7.x-2.x.
*/
// Disable all counties.
$cnt = db_update('countries_country')
->fields(array('enabled' => 0))
->execute();
drush_log(dt('Disabled @cnt countries.', array('@cnt' => $cnt)), 'ok');
// Enable CIS countries.
$iso_codes = array(
'AZE', 'ARM', 'BLR', 'KAZ', 'KGZ', 'MDA', 'RUS', 'TJK', 'TKM', 'UZB', 'UKR',
);
$cnt = db_update('countries_country')
->condition('iso3', $iso_codes, 'IN')
->fields(array('enabled' => 1))
->execute();
drush_log(dt('Enabled @cnt from @cnt_cis CIS countries.', array('@cnt' => $cnt, '@cnt_cis' => count($iso_codes))), 'completed');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment