/** * Returns the status of the plugin * * @return string one of plugin_manager::PLUGIN_STATUS_xxx constants */ public function get_status() { if (is_null($this->versiondb) and is_null($this->versiondisk)) { return plugin_manager::PLUGIN_STATUS_NODB; } else { if (is_null($this->versiondb) and !is_null($this->versiondisk)) { return plugin_manager::PLUGIN_STATUS_NEW; } else { if (!is_null($this->versiondb) and is_null($this->versiondisk)) { if (plugin_manager::is_deleted_standard_plugin($this->type, $this->name)) { return plugin_manager::PLUGIN_STATUS_DELETE; } else { return plugin_manager::PLUGIN_STATUS_MISSING; } } else { if ((string) $this->versiondb === (string) $this->versiondisk) { return plugin_manager::PLUGIN_STATUS_UPTODATE; } else { if ($this->versiondb < $this->versiondisk) { return plugin_manager::PLUGIN_STATUS_UPGRADE; } else { if ($this->versiondb > $this->versiondisk) { return plugin_manager::PLUGIN_STATUS_DOWNGRADE; } else { // $version = pi(); and similar funny jokes - hopefully Donald E. Knuth will never contribute to Moodle ;-) throw new coding_exception('Unable to determine plugin state, check the plugin versions'); } } } } } } }