You are here

function pm_update_7300 in Drupal PM (Project Management) 7.3

Same name and namespace in other branches
  1. 8 pm.install \pm_update_7300()

Include pmpermission module into core.

File

./pm.install, line 100
Install, update and uninstall functions for the Project Management module.

Code

function pm_update_7300() {

  // Rename all pmpermission_* variable to pm_permission_*.
  $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'pmpermission_%'");
  foreach ($result as $record) {
    $str = $record->name;
    $prefix = 'pmpermission';
    if (substr($str, 0, strlen($prefix)) == $prefix) {
      $str = substr($str, strlen($prefix));
    }
    $old_variable = $record->name;
    $new_variable = 'pm_permission' . $str;
    variable_set($new_variable, variable_get($old_variable, ''));
    variable_del($old_variable);
  }
}