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

Diff of /contributions/modules/og_collections/og_collections.install

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

revision 1.2.2.6, Sat Apr 12 04:35:07 2008 UTC revision 1.2.2.7, Thu Apr 17 21:16:42 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: og_collections.install,v 1.2.2.4 2008/04/07 02:25:27 sdboyer Exp $  // $Id: og_collections.install,v 1.2.2.6 2008/04/12 04:35:07 sdboyer Exp $
3    
4  function og_collections_install() {  function og_collections_install() {
5    switch ($GLOBALS['db_type']) {    switch ($GLOBALS['db_type']) {
# Line 188  function og_collections_enable() { Line 188  function og_collections_enable() {
188  }  }
189    
190  function og_collections_update_5002() {  function og_collections_update_5002() {
191      $ret = array();
192    if (module_exists('og_blueprints')) {    if (module_exists('og_blueprints')) {
193      $bp_fields = array(      $bp_fields = array(
194        'bpid' => '%d',        'bpid' => '%d',
# Line 207  function og_collections_update_5002() { Line 208  function og_collections_update_5002() {
208      while ($row = db_fetch_array($result)) {      while ($row = db_fetch_array($result)) {
209        if ($row['grouptype'] != 'default') {        if ($row['grouptype'] != 'default') {
210          $bid = db_next_id('{og_bundle}_bid');          $bid = db_next_id('{og_bundle}_bid');
211          db_query("INSERT INTO {og_bundle} (grouptype, bid) VALUES ('%s', %d)", $row['grouptype'], $bid);          $ret[] = _og_blueprints_update_sql("INSERT INTO {og_bundle} (grouptype, bid) VALUES ('%s', %d)", $row['grouptype'], $bid);
212          db_query("INSERT INTO {og_bundle_revision} (bid) VALUES (%d)", $bid);          $ret[] = _og_blueprints_update_sql("INSERT INTO {og_bundle_revision} (bid) VALUES (%d)", $bid);
213          $vid = db_result(db_query("SELECT vid FROM {og_bundle_revision} ORDER BY vid DESC LIMIT 1"));          $vid = db_result(db_query("SELECT vid FROM {og_bundle_revision} ORDER BY vid DESC LIMIT 1"));
214        }        }
215        else {        else {
216          $bid = $vid = 1;          $bid = $vid = 1;
217            $row['grouptype'] = 'master';
218        }        }
219        db_query("UPDATE {og_bundle} SET vid = %d WHERE bid = %d", $vid, $bid);        db_query("UPDATE {og_bundle} SET vid = %d WHERE bid = %d", $vid, $bid);
220    
# Line 223  function og_collections_update_5002() { Line 225  function og_collections_update_5002() {
225          $settings = unserialize($value);          $settings = unserialize($value);
226          $settings['bpid'] = (int) substr($field, 6);          $settings['bpid'] = (int) substr($field, 6);
227          $settings['bpname'] = 'blueprint_'. $settings['bpid'];          $settings['bpname'] = 'blueprint_'. $settings['bpid'];
228          $settings['enabled'] = $settings['active'];          $settings['enabled'] = isset($settings['active']) ? $settings['active'] : 0;
229          $settings['linked'] = $settings['usedef'];          $settings['linked'] = isset($settings['usedef']) ? $settings['usedef'] : 1;
230          $settings['bid'] = $bid;          $settings['bid'] = $bid;
231          $settings['vid'] = $vid;          $settings['vid'] = $vid;
232    
# Line 233  function og_collections_update_5002() { Line 235  function og_collections_update_5002() {
235            $q[] = $value;            $q[] = $value;
236            $v[] = $settings[$field];            $v[] = $settings[$field];
237          }          }
238          db_query("INSERT INTO {og_blueprint} (". implode(', ', $f) .") VALUES (". implode(', ', $q) .")", $v);          $ret[] = _og_blueprints_update_sql("INSERT INTO {og_blueprint} (". implode(', ', $f) .") VALUES (". implode(', ', $q) .")", $v);
239          unset ($f, $q, $v);          unset ($f, $q, $v);
240        }        }
241      }      }
# Line 242  function og_collections_update_5002() { Line 244  function og_collections_update_5002() {
244        db_next_id("{og_blueprint}_bpid");        db_next_id("{og_blueprint}_bpid");
245      }      }
246    }    }
247      return $ret;
248  }  }
249    
250  /**  /**

Legend:
Removed from v.1.2.2.6  
changed lines
  Added in v.1.2.2.7

  ViewVC Help
Powered by ViewVC 1.1.2