1. 09 Oct, 2015 24 commits
    • David Mudrák's avatar
      MDL-49329 admin: Improve plugins overview page rendering · 44371554
      David Mudrák authored
      Provides a bit more compact layout. Finally cleans up the relevant LESS
      files and makes available updates info boxes consistent across all
      screens where they are displayed.
      44371554
    • David Mudrák's avatar
      MDL-49329 admin: Add core_plugin_manager::available_updates() method · cc5bc55e
      David Mudrák authored
      The new method is going to be used to support the "Update all plugins"
      feature.
      cc5bc55e
    • David Mudrák's avatar
      MDL-49329 admin: Get rid of mdeploy and \core\update\deployer class · 3bca7dbf
      David Mudrák authored
      The mdeploy.php standalone script (used to download and unzip plugins
      into the dirroot) and the \core\update\deployer class (as a
      communication bridge between the core and the mdeploy.php) was
      originally designed and implemented with the assumption that it would be
      eventually used for updating the Moodle core itself, too. Therefore it
      was written as standalone utility without dependency on the Moodle core
      libraries.
      
      However, it never happened and there is no real demand for that. So now
      there is no need to have and maintain a completely parallel solution for
      common things like fetching and unzipping plugin ZIPs.
      
      Additional reasoning for mdeploy.php was that the core is not very
      reliable during the core upgrade and we could run into various troubles.
      This does not seem to be that bad. We rely on a lot of core
      functionality (such as output rendering, DB access etc) and plugins
      deployment seems to work well (and better) with common core libraries.
      
      So long mdeploy, and thanks for all the hard work you did for us.
      3bca7dbf
    • David Mudrák's avatar
      MDL-49329 admin: Fix plugins check page if no plugins require attention · 228cbda3
      David Mudrák authored
      A legacy undefined variable was used here and there was no way to get to
      the full list mode view.
      228cbda3
    • David Mudrák's avatar
      MDL-49329 admin: Clean up core_plugin unit tests · d2283521
      David Mudrák authored
      As a first step for removing the \core\update\deployer and mdeploy.php,
      this patch fixes existing tests.
      d2283521
    • David Mudrák's avatar
    • David Mudrák's avatar
      f65d3370
    • David Mudrák's avatar
      MDL-49329 admin: Fix report on required core version in missing plugins · 4441d5e5
      David Mudrák authored
      If the plugin was missing from disk, the required core version was
      displayed as "Moodle {$a}" because the core dependency resolver always
      returns an object.
      4441d5e5
    • David Mudrák's avatar
      MDL-49329 admin: Fix the API for getting remote plugin info · 35f2b674
      David Mudrák authored
      The previous version of the plugin manager's method
      get_remote_plugin_info() was suitable for installing missing
      dependencies only. To make use of for installing new plugins and/or
      available updates, it must be clear that we are requesting information
      for the particular plugin version only, not "given or higher" version.
      35f2b674
    • David Mudrák's avatar
      MDL-49329 admin: Validate pluginfo service response · d6e38c2a
      David Mudrák authored
      The new client's method makes sure that the returned data structure has
      expected format so that the plugin manager can safely rely on it.
      d6e38c2a
    • David Mudrák's avatar
      MDL-49329 admin: Improve Plugins check page · 0ec7d101
      David Mudrák authored
      Better inform about the number of plugins requiring attention vs total
      plugins. Clean up the renderer.
      0ec7d101
    • David Mudrák's avatar
    • David Mudrák's avatar
      MDL-49329 admin: Add ability to cancel installation of a new plugin · 2f29cf6e
      David Mudrák authored
      The plugins check screen now provides buttons to cancel installation of
      a plugin. Available only for new installations (not upgrades) and for
      additional plugins (not standard), given that the web server process has
      write access to the plugin folder.
      
      This has also been reported as MDL-48535.
      
      As a part of the patch, there is improved processing of page URLs during
      the upgrade. All this dancing around $reload URL is not needed once the
      $PAGE->url is properly set to guide the admin on the correct page during
      the upgrade process.
      2f29cf6e
    • David Mudrák's avatar
      MDL-49329 admin: Introduce new \core\update\validator class · f2d8ed45
      David Mudrák authored
      This is not really new class. Originally, the validator was implemented
      in the scope of the tool_installaddon plugin. But we need its features
      in other parts at the core level (e.g. during the upgrade to validate
      available missing dependencies or available updates). Looking back, it
      was a mistake to have it implemented at the plugin level rather than the
      core level.
      
      So this patch moves the tool_installaddon_validator class to
      \core\update\validator class, together with associated unit tests,
      fixture files and strings. There were changes made in the
      tool_installaddon to make use of this new class instead of the old one.
      
      This is a great step towards the bright future, hopefully there won't be
      many regressions.
      
      AMOS BEGIN
       MOV [validationmsg_componentmatch,tool_installaddon],[validationmsg_componentmatch,core_plugin]
       MOV [validationmsg_componentmismatchname,tool_installaddon],[validationmsg_componentmismatchname,core_plugin]
       MOV [validationmsg_componentmismatchname_help,tool_installaddon],[validationmsg_componentmismatchname_help,core_plugin]
       MOV [validationmsg_componentmismatchname_info,tool_installaddon],[validationmsg_componentmismatchname_info,core_plugin]
       MOV [validationmsg_componentmismatchtype,tool_installaddon],[validationmsg_componentmismatchtype,core_plugin]
       MOV [validationmsg_componentmismatchtype_info,tool_installaddon],[validationmsg_componentmismatchtype_info,core_plugin]
       MOV [validationmsg_filenotexists,tool_installaddon],[validationmsg_filenotexists,core_plugin]
       MOV [validationmsg_filesnumber,tool_installaddon],[validationmsg_filesnumber,core_plugin]
       MOV [validationmsg_filestatus,tool_installaddon],[validationmsg_filestatus,core_plugin]
       MOV [validationmsg_filestatus_info,tool_installaddon],[validationmsg_filestatus_info,core_plugin]
       MOV [validationmsg_foundlangfile,tool_installaddon],[validationmsg_foundlangfile,core_plugin]
       MOV [validationmsg_maturity,tool_installaddon],[validationmsg_maturity,core_plugin]
       MOV [validationmsg_maturity_help,tool_installaddon],[validationmsg_maturity_help,core_plugin]
       MOV [validationmsg_missingcomponent,tool_installaddon],[validationmsg_missingcomponent,core_plugin]
       MOV [validationmsg_missingcomponent_help,tool_installaddon],[validationmsg_missingcomponent_help,core_plugin]
       MOV [validationmsg_missingcomponent_link,tool_installaddon],[validationmsg_missingcomponent_link,core_plugin]
       MOV [validationmsg_missingexpectedlangenfile,tool_installaddon],[validationmsg_missingexpectedlangenfile,core_plugin]
       MOV [validationmsg_missingexpectedlangenfile_info,tool_installaddon],[validationmsg_missingexpectedlangenfile_info,core_plugin]
       MOV [validationmsg_missinglangenfile,tool_installaddon],[validationmsg_missinglangenfile,core_plugin]
       MOV [validationmsg_missinglangenfolder,tool_installaddon],[validationmsg_missinglangenfolder,core_plugin]
       MOV [validationmsg_missingversion,tool_installaddon],[validationmsg_missingversion,core_plugin]
       MOV [validationmsg_missingversionphp,tool_installaddon],[validationmsg_missingversionphp,core_plugin]
       MOV [validationmsg_multiplelangenfiles,tool_installaddon],[validationmsg_multiplelangenfiles,core_plugin]
       MOV [validationmsg_onedir,tool_installaddon],[validationmsg_onedir,core_plugin]
       MOV [validationmsg_onedir_help,tool_installaddon],[validationmsg_onedir_help,core_plugin]
       MOV [validationmsg_pathwritable,tool_installaddon],[validationmsg_pathwritable,core_plugin]
       MOV [validationmsg_pluginversion,tool_installaddon],[validationmsg_pluginversion,core_plugin]
       MOV [validationmsg_release,tool_installaddon],[validationmsg_release,core_plugin]
       MOV [validationmsg_requiresmoodle,tool_installaddon],[validationmsg_requiresmoodle,core_plugin]
       MOV [validationmsg_rootdir,tool_installaddon],[validationmsg_rootdir,core_plugin]
       MOV [validationmsg_rootdir_help,tool_installaddon],[validationmsg_rootdir_help,core_plugin]
       MOV [validationmsg_rootdirinvalid,tool_installaddon],[validationmsg_rootdirinvalid,core_plugin]
       MOV [validationmsg_rootdirinvalid_help,tool_installaddon],[validationmsg_rootdirinvalid_help,core_plugin]
       MOV [validationmsg_targetexists,tool_installaddon],[validationmsg_targetexists,core_plugin]
       MOV [validationmsg_targetexists_help,tool_installaddon],[validationmsg_targetexists_help,core_plugin]
       MOV [validationmsg_unknowntype,tool_installaddon],[validationmsg_unknowntype,core_plugin]
       MOV [validationmsg_versionphpsyntax,tool_installaddon],[validationmsg_versionphpsyntax,core_plugin]
       MOV [validationmsglevel_debug,tool_installaddon],[validationmsglevel_debug,core_plugin]
       MOV [validationmsglevel_error,tool_installaddon],[validationmsglevel_error,core_plugin]
       MOV [validationmsglevel_info,tool_installaddon],[validationmsglevel_info,core_plugin]
       MOV [validationmsglevel_warning,tool_installaddon],[validationmsglevel_warning,core_plugin]
      AMOS END
      f2d8ed45
    • David Mudrák's avatar
      MDL-49329 admin: Introduce new \core\update\core_manager tool · 0e442ee7
      David Mudrák authored
      The plan is to have a single tool looking after all operations with
      plugin ZIP packages (downloading, unzipping, moving to the dirroot and
      back). For legacy reasons, we have that logic currently duplicated in
      mdeploy and tool_installaddon. I would like to unify and simplify the
      whole machinery to use the same code for available updates, manual
      installation and plugin dependencies.
      0e442ee7
    • David Mudrák's avatar
      MDL-49329 admin: Display missing dependencies on plugins check screen · 5a92cd0b
      David Mudrák authored
      The patch improves the dependencies resolution in the plugin manager so
      that the information about availability of the missing dependency is
      included and can be displayed at the Plugins check screen during the
      upgrade.
      5a92cd0b
    • David Mudrák's avatar
      MDL-49329 admin: Introduce new \core\update\api client class · 48900324
      David Mudrák authored
      The purpose of this class is to provide a general client for all APIs
      available at https://download.moodle.org/api/ (e.g. available updates,
      plugin info, plugins list etc). Currently, fetching data from this API
      is done separately at several places. This leads to code duplication and
      harder maintenance (I know it well).
      
      Additionally, the existing client was implemented as
      tool_installaddon_pluginfo_client in the admin/tool/installaddon/ scope.
      I will soon need to use the same functionality in the
      core_plugin_manager and it would hurt my karma if the core was depending
      on a class provided by a admin tool plugin (even if it is standard one).
      
      So, there is new \core\update\api client implementing the version 1.3 of
      the pluginfo API. There is a TODO note left for remaining services.
      48900324
    • David Mudrák's avatar
      MDL-49329 admin: Move requirements resolving to the plugin manager · 7eb87eff
      David Mudrák authored
      The patch moves the resolving logic from the renderer (where it should
      not really be) to the plugin manager (controller). This is needed
      because we will need the very same logic to be used at other places.
      7eb87eff
    • David Mudrák's avatar
      MDL-49329 admin: Improve loading of available updates info · c44bbe35
      David Mudrák authored
      The actual loading of available updates info objects is moved back to
      the plugin manager class. As we can now mockup the manager in unit
      tests, this allows us to bypass the real \core\update\checker and have
      unit tests for \core\plugininfo\base::available_updates().
      c44bbe35
    • David Mudrák's avatar
      MDL-49329 admin: Keep reference to plugin manager in plugininfo objects · 2d488c8f
      David Mudrák authored
      Plugin info objects are owned by the plugin manager (composition
      pattern). Even if the plugin manager is a singleton, we need to keep
      explicit reference to the plugin manager that owns the plugin info so
      that we can mock up things in unit tests.
      
      Therefore this patch introduces a new property of plugin info objects
      that holds the reference to the instance of the plugin manager that made
      (and hence owns) the given info instance.
      
      The only trouble here is with static methods of plugin info classes such
      as \core\plugininfo\base::get_enabled_plugins(). In these cases, the
      code keeps using the core_plugin_manager singleton. The solution would
      be to pass the plugin manager instance as a parameter but that is not
      worth of change for now, IMHO.
      2d488c8f
    • David Mudrák's avatar
      MDL-49329 admin: Make core_plugin_manager better suited for unit testing · 361feecd
      David Mudrák authored
      We can now override the plugin manager's methods in the testable
      subclass while still keeping the singleton behaviour of it. The change
      makes use of late static binding.
      361feecd
    • David Mudrák's avatar
      MDL-49329 admin: Do not always load info about available updates · 30d8bc5f
      David Mudrák authored
      Before this patch, whenever core_plugin_manager::get_plugins() was
      called, it always attached info about available updates. But this is
      needed only in quite rare cases, such as when the admin is looking at
      the Plugins overview and Plugins check screens. There is no need to load
      this on other places and for non-admin users.
      
      The patch removes the loading from the method
      core_plugin_manager::get_plugins_of_type() and implements lazy loading
      directly in the plugininfo classes so that it is loaded only when
      \core\plugininfo\base::available_updates() is actually called.
      30d8bc5f
    • David Mudrák's avatar
      MDL-49329 admin: Fix \core\update\checker::enabled() logic · e9d3c212
      David Mudrák authored
      The method should check against $CFG->disableupdatenotifications and not
      $CFG->disableupdateautodeploy. This had to be a copy&paste mistake from
      the \core\update\deployer::enabled().
      
      While looking at it, I also fixed couple of places where this method
      should and could be used.
      e9d3c212
    • David Mudrák's avatar
      MDL-49329 admin: Improve the styling of the Plugins check screen · fd17898c
      David Mudrák authored
      The intention here is to make the table a little bit more compact (using
      less columns) and to make use of the bootstrap based label elements if
      available.
      fd17898c
  2. 08 Oct, 2015 12 commits
  3. 07 Oct, 2015 4 commits