cobalt_update.inc.php 847 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. function cobalt_js_update() {
  3. $settings = array();
  4. $out = 'Updating the following: <ul>';
  5. for ($i=2; arg($i); $i+=3) {
  6. $module = arg($i);
  7. $from = arg($i+1);
  8. $to = arg($i+2);
  9. $settings[$module] = array($from, $to);
  10. $up_file = drupal_get_path('module', $module) . '/' . $module . '_update.inc.php';
  11. if (file_exists($up_file)) {
  12. require_once($up_file);
  13. }
  14. $up_function = $module . '_cobalt_js_update';
  15. if (is_callable($up_function)) {
  16. call_user_func($up_function, $from, $to);
  17. }
  18. $out .= "<li>{$module} from {$from} to {$to}</li>";
  19. }
  20. $out .= '</ul>';
  21. drupal_add_js(array('cobalt' => array('update' => $settings)), 'setting');
  22. return $out;
  23. }
  24. function cobalt_cobalt_js_update($from, $to) {
  25. drupal_add_js(drupal_get_path('module', 'cobalt') . '/js/cobalt.update.js');
  26. }