[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/strongarm/ -> strongarm.install (source)

   1  <?php
   2  // $Id: strongarm.install,v 1.1.2.1.2.3 2010/02/04 02:46:03 yhahn Exp $
   3  
   4  /**
   5   * Implementation of hook_enable().
   6   */
   7  function strongarm_enable() {
   8    // Weight strongarm exceptionally light.
   9    db_query("UPDATE {system} SET weight = -1000 WHERE name = 'strongarm' AND type = 'module'");
  10  }
  11  
  12  /**
  13   * Update 6100: Weight strongarm exceptionally light.
  14   */
  15  function strongarm_update_6100() {
  16    $ret = array();
  17    $ret[] = update_sql("UPDATE {system} SET weight = -1000 WHERE name = 'strongarm' AND type = 'module'");
  18    return $ret;
  19  }
  20  
  21  /**
  22   * Update 6200: Install CTools
  23   */
  24  function strongarm_update_6200() {
  25    drupal_install_modules(array('ctools'));
  26    $modules = module_list();
  27    if (!isset($modules['ctools'])) {
  28      return array('#abort' => array('success' => FALSE, 'query' => 'Could not enable CTools.'));
  29    }
  30    return array(array('success' => TRUE, 'query' => 'Enabled CTools successfully.'));
  31  }
  32  
  33  /**
  34   * Update 6201: Set all strongarm 1.x variables that are not already set.
  35   */
  36  function strongarm_update_6201() {
  37    $ret = array();
  38    $modules = module_implements('strongarm');
  39    foreach ($modules as $module) {
  40      $variables = module_invoke($module, 'strongarm');
  41      foreach ($variables as $variable => $value) {
  42        $exists = db_result(db_query("SELECT name FROM {variable} WHERE name = '%s'", $variable));
  43        if (!$exists && !(is_object($value) && isset($value->api_version))) {
  44          variable_set($variable, $value);
  45          $ret[] = array('success' => TRUE, 'query' => "Set 1.x strongarmed variable {$variable} in the database.");
  46        }
  47      }
  48    }
  49    return $ret;
  50  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7