2014070600-1.9.0_rc.3-river_enabled_col-bef9e6f0533ac338.php 692 B

123456789101112131415161718192021222324
  1. <?php
  2. /**
  3. * Elgg 1.9.0-rc.3 upgrade 2014070600
  4. * river_enabled_col
  5. *
  6. * Add an 'enabled' column to the river table
  7. */
  8. $dbprefix = elgg_get_config('dbprefix');
  9. $q1 = "ALTER TABLE {$dbprefix}river ADD enabled ENUM( 'yes', 'no' ) NOT NULL DEFAULT 'yes';";
  10. update_data($q1);
  11. // update any river entries that need to be disabled
  12. $q2 = <<<Q2
  13. UPDATE {$dbprefix}river AS rv
  14. LEFT JOIN {$dbprefix}entities AS se ON se.guid = rv.subject_guid
  15. LEFT JOIN {$dbprefix}entities AS te ON te.guid = rv.target_guid
  16. LEFT JOIN {$dbprefix}entities AS oe ON oe.guid = rv.object_guid
  17. SET rv.enabled = 'no'
  18. WHERE (se.enabled = 'no' OR te.enabled = 'no' OR oe.enabled = 'no');
  19. Q2;
  20. update_data($q2);