set_priority.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Changes the load priority of a plugin.
  4. *
  5. * Plugin priority affects view, action, and page handler
  6. * overriding as well as the order of view extensions. Plugins with higher
  7. * priority are loaded after and override plugins with lower priorities.
  8. *
  9. * NOTE: When viewing the plugin admin page, plugins LOWER on the page
  10. * have HIGHER priority and will override views, etc from plugins above them.
  11. *
  12. * @package Elgg.Core
  13. * @subpackage Administration.Plugins
  14. */
  15. $plugin_guid = get_input('plugin_guid');
  16. $priority = get_input('priority');
  17. $plugin = get_entity($plugin_guid);
  18. if (!($plugin instanceof ElggPlugin)) {
  19. register_error(elgg_echo('admin:plugins:set_priority:no', array($plugin_guid)));
  20. forward(REFERER);
  21. }
  22. if ($plugin->setPriority($priority)) {
  23. //system_message(elgg_echo('admin:plugins:set_priority:yes', array($plugin->getManifest()->getName())));
  24. } else {
  25. $msg = $plugin->getError();
  26. $string = ($msg) ? 'admin:plugins:set_priority:no_with_msg' : 'admin:plugins:set_priority:no';
  27. register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError())));
  28. }
  29. // don't regenerate the simplecache because the plugin won't be
  30. // loaded until next run. Just invalidate and let it regnerate as needed
  31. elgg_flush_caches();
  32. forward(REFERER);