Created
August 30, 2012 08:53
-
-
Save kalabro/3524426 to your computer and use it in GitHub Desktop.
Drupal 7: Only CIS countries for http://drupal.org/project/countries module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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