You are here

function spaces_og_enable in Spaces 6.3

Same name and namespace in other branches
  1. 5.2 spaces_og.install \spaces_og_enable()
  2. 6 spaces_og/spaces_og.install \spaces_og_enable()
  3. 6.2 spaces_og/spaces_og.install \spaces_og_enable()
  4. 7.3 spaces_og/spaces_og.module \spaces_og_enable()
  5. 7 spaces_og/spaces_og.module \spaces_og_enable()

Implementaton of hook_enable().

File

spaces_og/spaces_og.module, line 18

Code

function spaces_og_enable() {

  // Configure purl, grab OG method, set to path if not configured.
  $purl_types = variable_get('purl_types', array());
  if (!variable_get('purl_method_spaces_og', FALSE)) {
    $purl_types['path'] = 'path';
    variable_set('purl_types', $purl_types);
    variable_set('purl_method_spaces_og', 'path');
  }

  // The next 2 lines are for Simpletest, it won't have it otherwise.
  // variable_get up top retrieves the settings from the host, while
  // variable_set here writes into the test site. As a result,
  // variable_get('purl_method_spaces_og') will retrieve the value of the host
  // site. If it is present in the host site, the initial configuration is not
  // being executed and the tests fail.
  variable_set('purl_types', $purl_types);
  variable_set('purl_method_spaces_og', variable_get('purl_method_spaces_og', FALSE));

  // Weight spaces_og to be after OG
  $weight = db_result(db_query("SELECT weight FROM {system} WHERE type = 'module' AND name = 'og'"));
  db_query("UPDATE {system} SET weight = %d WHERE name = 'spaces_og'", $weight + 1);
}