You are here

function persiantools_sort_fix_submit in PersianTools 7

Same name and namespace in other branches
  1. 8 persiantools.module \persiantools_sort_fix_submit()
1 string reference to 'persiantools_sort_fix_submit'
persiantools_admin_settings in ./persiantools.admin.inc
Form builder. Configure persiantools settings.

File

./persiantools.admin.inc, line 53
Administration page callbacks for the persiantools module.

Code

function persiantools_sort_fix_submit() {
  global $databases;
  $dbname = $databases['default']['default']['database'];
  db_query('alter database ' . $dbname . ' DEFAULT CHARACTER SET utf8 COLLATE utf8_persian_ci');
  $table_ref = "Tables_in_{$dbname}";
  $result = db_query("SHOW TABLES");
  foreach ($result as $tableinfo) {
    $tablename = $tableinfo->{$table_ref};
    db_query('alter table ' . $tablename . ' convert to character set utf8 collate utf8_persian_ci');
  }
  drupal_set_message(t('Default database collation, and collation for all tables changed to persian (utf8_persian_ci).'), 'status', FALSE);
}