/[drupal]/contributions/modules/invite/invite.install
ViewVC logotype

Diff of /contributions/modules/invite/invite.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.13.2.2, Mon Oct 6 13:03:08 2008 UTC revision 1.13.2.3, Sun Oct 4 12:34:24 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: invite.install,v 1.13.2.1 2008/09/04 18:01:28 smk Exp $  // $Id: invite.install,v 1.13.2.2 2008/10/06 13:03:08 smk Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 169  function _invite_add_permission($rid, $p Line 169  function _invite_add_permission($rid, $p
169    }    }
170  }  }
171    
172    /**
173     * Helper function to update a variable name using role name to role id.
174     */
175    function _invite_update_role_name_to_id($variable) {
176      $result = db_query("SELECT * FROM {role} ORDER BY name ASC");
177      while ($role = db_fetch_object($result)) {
178        // Look for both a translated (D6) and untranslated (D5) variables.
179        // A translated one is newer and has therefore precendence.
180        $translated_role = str_replace(' ', '_', t($role->name));
181        $value = variable_get($variable .'_'. $translated_role, NULL);
182        if (is_null($value)) {
183          $untranslated_role = str_replace(' ', '_', $role->name);
184          $value = variable_get($variable .'_'. $untranslated_role, NULL);
185        }
186        if (!is_null($value)) {
187          variable_set($variable .'_'. $role->rid, $value);
188          db_query("DELETE FROM {variable} WHERE name IN('%s', '%s')", $variable .'_'. $translated_role, $variable .'_'. $untranslated_role);
189        }
190      }
191    }
192    
193  /**  /**
194   * Switch to token.module.   * Switch to token.module.
# Line 362  function invite_update_202() { Line 382  function invite_update_202() {
382    return $ret;    return $ret;
383  }  }
384    
385    /**
386     * Update variable names to use role id instead of translated role name.
387     * @see #322748
388     */
389    function invite_update_203() {
390      $ret = array();
391      _invite_update_role_name_to_id('invite_maxnum');
392      _invite_update_role_name_to_id('invite_target_role');
393      return $ret;
394    }
395    

Legend:
Removed from v.1.13.2.2  
changed lines
  Added in v.1.13.2.3

  ViewVC Help
Powered by ViewVC 1.1.2