Ejemplo n.º 1
0
 /**
  * Can the upgrade of the existing plugin be cancelled?
  *
  * Subplugins can be cancelled only via their parent plugin, not separately
  * (they are considered as implicit requirements if distributed together
  * with the main package).
  *
  * @param \core\plugininfo\base $plugin
  * @return bool
  */
 public function can_cancel_plugin_upgrade(\core\plugininfo\base $plugin)
 {
     global $CFG;
     if (!empty($CFG->disableupdateautodeploy)) {
         // Cancelling the plugin upgrade is actually installation of the
         // previously archived version.
         return false;
     }
     if (empty($plugin) or $plugin->is_standard() or $plugin->is_subplugin() or !$this->is_plugin_folder_removable($plugin->component)) {
         return false;
     }
     if ($plugin->get_status() === self::PLUGIN_STATUS_UPGRADE) {
         if ($this->get_code_manager()->get_archived_plugin_version($plugin->component, $plugin->versiondb)) {
             return true;
         }
     }
     return false;
 }