Merge branch 'MDL-32338' of git://github.com/nebgor/moodle
authorDan Poltawski <dan@moodle.com>
Wed, 23 May 2012 03:27:54 +0000 (11:27 +0800)
committerDan Poltawski <dan@moodle.com>
Wed, 23 May 2012 03:27:54 +0000 (11:27 +0800)
1  2 
lib/pluginlib.php

diff --combined lib/pluginlib.php
@@@ -97,7 -97,6 +97,7 @@@ class plugin_manager 
       *      the values are the corresponding objects extending {@link plugininfo_base}
       */
      public function get_plugins($disablecache=false) {
 +        global $CFG;
  
          if ($disablecache or is_null($this->pluginsinfo)) {
              $this->pluginsinfo = array();
                  $this->pluginsinfo[$plugintype] = $plugins;
              }
  
 -            // TODO: MDL-20438 verify this is the correct solution/replace
 -            if (!during_initial_install()) {
 +            if (empty($CFG->disableupdatenotifications) and !during_initial_install()) {
                  // append the information about available updates provided by {@link available_update_checker()}
                  $provider = available_update_checker::instance();
                  foreach ($this->pluginsinfo as $plugintype => $plugins) {
                  'offline', 'online', 'upload', 'uploadsingle'
              ),
  
 +            'assignsubmission' => array(
 +                'comments', 'file', 'onlinetext'
 +            ),
 +
 +            'assignfeedback' => array(
 +                'comments', 'file'
 +            ),
 +
              'auth' => array(
                  'cas', 'db', 'email', 'fc', 'imap', 'ldap', 'manual', 'mnet',
                  'nntp', 'nologin', 'none', 'pam', 'pop3', 'radius',
                  'social_activities', 'tag_flickr', 'tag_youtube', 'tags'
              ),
  
 +            'booktool' => array(
 +                'exportimscp', 'importhtml', 'print'
 +            ),
 +
              'coursereport' => array(
                  //deprecated!
              ),
              ),
  
              'gradingform' => array(
 -                'rubric'
 +                'rubric', 'guide'
              ),
  
              'local' => array(
              ),
  
              'mod' => array(
 -                'assignment', 'chat', 'choice', 'data', 'feedback', 'folder',
 +                'assign', 'assignment', 'book', 'chat', 'choice', 'data', 'feedback', 'folder',
                  'forum', 'glossary', 'imscp', 'label', 'lesson', 'lti', 'page',
                  'quiz', 'resource', 'scorm', 'survey', 'url', 'wiki', 'workshop'
              ),
              ),
  
              'tool' => array(
 -                'bloglevelupgrade', 'capability', 'customlang', 'dbtransfer', 'generator',
 +                'assignmentupgrade', 'bloglevelupgrade', 'capability', 'customlang', 'dbtransfer', 'generator',
                  'health', 'innodb', 'langimport', 'multilangupgrade', 'phpunit', 'profiling',
                  'qeupgradehelper', 'replace', 'spamcleaner', 'timezoneimport', 'unittest',
                  'uploaduser', 'unsuproles', 'xmldb'
@@@ -1112,12 -1100,12 +1112,12 @@@ class available_update_checker 
       */
      protected function cron_execute() {
  
-         $this->restore_response();
-         $previous = $this->recentresponse;
-         $this->fetch();
-         $this->restore_response(true);
-         $current = $this->recentresponse;
          try {
+             $this->restore_response();
+             $previous = $this->recentresponse;
+             $this->fetch();
+             $this->restore_response(true);
+             $current = $this->recentresponse;
              $changes = $this->compare_responses($previous, $current);
              $notifications = $this->cron_notifications($changes);
              $this->cron_notify($notifications);
@@@ -2300,37 -2288,11 +2300,37 @@@ class plugininfo_enrol extends pluginin
  class plugininfo_message extends plugininfo_base {
  
      public function get_settings_url() {
 +        $processors = get_message_processors();
 +        if (isset($processors[$this->name])) {
 +            $processor = $processors[$this->name];
 +            if ($processor->available && $processor->hassettings) {
 +                return new moodle_url('settings.php', array('section' => 'messagesetting'.$processor->name));
 +            }
 +        }
 +        return parent::get_settings_url();
 +    }
  
 -        if (file_exists($this->full_path('settings.php')) or file_exists($this->full_path('settingstree.php'))) {
 -            return new moodle_url('/admin/settings.php', array('section' => 'messagesetting' . $this->name));
 +    /**
 +     * @see plugintype_interface::is_enabled()
 +     */
 +    public function is_enabled() {
 +        $processors = get_message_processors();
 +        if (isset($processors[$this->name])) {
 +            return $processors[$this->name]->configured && $processors[$this->name]->enabled;
          } else {
 -            return parent::get_settings_url();
 +            return parent::is_enabled();
 +        }
 +    }
 +
 +    /**
 +     * @see plugintype_interface::get_uninstall_url()
 +     */
 +    public function get_uninstall_url() {
 +        $processors = get_message_processors();
 +        if (isset($processors[$this->name])) {
 +            return new moodle_url('message.php', array('uninstall' => $processors[$this->name]->id, 'sesskey' => sesskey()));
 +        } else {
 +            return parent::get_uninstall_url();
          }
      }
  }