You are here

function coder_upgrade_upgrade_regex_alter in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_upgrade/conversions/regex.inc \coder_upgrade_upgrade_regex_alter()

Implements hook_upgrade_regex_alter().

Upgrades text using simple regular expressions.

File

coder_upgrade/conversions/regex.inc, line 63
Miscellaneous conversion routine file for the coder_upgrade module. These routines upgrade text using simple regular expressions.

Code

function coder_upgrade_upgrade_regex_alter(&$file) {
  cdp("inside " . __FUNCTION__);
  $hook = 'regex_simple_changes';
  $cur = $file;
  $new = $cur;
  $from = array();
  $to = array();
  coder_upgrade_upgrade_admin_path_changes($from, $to);

  // TODO Intend to do all of these when converting db_query calls.
  coder_upgrade_upgrade_database_tables($from, $to);

  // Replace "use PHP for block visibility" with "use PHP for settings."
  $from[] = '/(\'|")use PHP for block visibility(\'|")/';
  $to[] = "\$1use PHP for settings\$1";

  // FILE_STATUS_TEMPORARY has been removed.
  $from[] = "/FILE_STATUS_TEMPORARY/";
  $to[] = "~FILE_STATUS_PERMANENT";

  // Renamed WATCHDOG_EMERG to WATCHDOG_EMERGENCY.
  $from[] = '@WATCHDOG_EMERG([^\\w])@';
  $to[] = 'WATCHDOG_EMERGENCY$1';

  // $form['#redirect'] and $_REQUEST['destination'] are no longer supported.
  $from[] = '/\\$form\\[[\'"]#redirect[\'"]\\]/';
  $to[] = '$form_state[\'#redirect\']';
  $from[] = '/\\$_REQUEST\\[[\'"]destination[\'"]\\]/';
  $to[] = '$_GET[\'destination\']';
  coder_upgrade_do_conversions($from, $to, $new);
  coder_upgrade_save_changes($cur, $new, $file, $hook);
}