mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-41437 rework plugin_manager caching and version info in blocks and modules
This patch includes: * version column removed from modules table, now using standard config, this allows decimal version for modules * version column removed from block table, now using standard config, this allows decimal version for blocks * module version.php can safely use $plugins instead of module * new plugin_manager bulk caching, this should help with MUC performance when logged in as admin * all missing plugins are now in plugin overview (previously only blocks and modules) * simplified code and improved coding style * reworked plugin_manager unit tests - now using real plugins instead of mocks * unit tests now fail if any plugin does not contain proper version.php file * allow uninstall of deleted filters
This commit is contained in:
parent
81881cb9d6
commit
bde002b81a
50 changed files with 1601 additions and 1940 deletions
|
@ -141,58 +141,13 @@ $definitions = array(
|
|||
'persistentmaxsize' => 2,
|
||||
),
|
||||
|
||||
// Cache used by the {@link plugininfo_base} class.
|
||||
'plugininfo_base' => array(
|
||||
// Cache used by the {@link plugin_manager} class.
|
||||
// NOTE: this must be a shared cache.
|
||||
'plugin_manager' => array(
|
||||
'mode' => cache_store::MODE_APPLICATION,
|
||||
'simplekeys' => true,
|
||||
'simpledata' => true,
|
||||
'persistent' => true,
|
||||
'persistentmaxsize' => 2,
|
||||
),
|
||||
|
||||
// Cache used by the {@link plugininfo_mod} class.
|
||||
'plugininfo_mod' => array(
|
||||
'mode' => cache_store::MODE_APPLICATION,
|
||||
'simplekeys' => true,
|
||||
'simpledata' => true,
|
||||
'persistent' => true,
|
||||
'persistentmaxsize' => 1,
|
||||
),
|
||||
|
||||
// Cache used by the {@link plugininfo_block} class.
|
||||
'plugininfo_block' => array(
|
||||
'mode' => cache_store::MODE_APPLICATION,
|
||||
'simplekeys' => true,
|
||||
'simpledata' => true,
|
||||
'persistent' => true,
|
||||
'persistentmaxsize' => 1,
|
||||
),
|
||||
|
||||
// Cache used by the {@link plugininfo_filter} class.
|
||||
'plugininfo_filter' => array(
|
||||
'mode' => cache_store::MODE_APPLICATION,
|
||||
'simplekeys' => true,
|
||||
'simpledata' => true,
|
||||
'persistent' => true,
|
||||
'persistentmaxsize' => 1,
|
||||
),
|
||||
|
||||
// Cache used by the {@link plugininfo_repository} class.
|
||||
'plugininfo_repository' => array(
|
||||
'mode' => cache_store::MODE_APPLICATION,
|
||||
'simplekeys' => true,
|
||||
'simpledata' => true,
|
||||
'persistent' => true,
|
||||
'persistentmaxsize' => 1,
|
||||
),
|
||||
|
||||
// Cache used by the {@link plugininfo_portfolio} class.
|
||||
'plugininfo_portfolio' => array(
|
||||
'mode' => cache_store::MODE_APPLICATION,
|
||||
'simplekeys' => true,
|
||||
'simpledata' => true,
|
||||
'persistent' => true,
|
||||
'persistentmaxsize' => 1,
|
||||
'persistent' => false,
|
||||
),
|
||||
|
||||
// Used to store the full tree of course categories
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="lib/db" VERSION="20130913" COMMENT="XMLDB file for core Moodle tables"
|
||||
<XMLDB PATH="lib/db" VERSION="20130921" COMMENT="XMLDB file for core Moodle tables"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
|
@ -668,7 +668,6 @@
|
|||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
||||
<FIELD NAME="name" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="version" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="cron" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="lastcron" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="search" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
|
||||
|
@ -2487,7 +2486,6 @@
|
|||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
||||
<FIELD NAME="name" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="version" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="cron" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="lastcron" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
|
||||
|
|
|
@ -2450,5 +2450,52 @@ function xmldb_main_upgrade($oldversion) {
|
|||
upgrade_main_savepoint(true, 2013091300.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2013092001.01) {
|
||||
// Force uninstall of deleted tool.
|
||||
if (!file_exists("$CFG->dirroot/$CFG->admin/tool/bloglevelupgrade")) {
|
||||
// Remove capabilities.
|
||||
capabilities_cleanup('tool_bloglevelupgrade');
|
||||
// Remove all other associated config.
|
||||
unset_all_config_for_plugin('tool_bloglevelupgrade');
|
||||
}
|
||||
upgrade_main_savepoint(true, 2013092001.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2013092001.02) {
|
||||
// Define field version to be dropped from modules.
|
||||
$table = new xmldb_table('modules');
|
||||
$field = new xmldb_field('version');
|
||||
|
||||
// Conditionally launch drop field version.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
// Migrate all plugin version info to config_plugins table.
|
||||
$modules = $DB->get_records('modules');
|
||||
foreach ($modules as $module) {
|
||||
set_config('version', $module->version, 'mod_'.$module->name);
|
||||
}
|
||||
unset($modules);
|
||||
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field version to be dropped from block.
|
||||
$table = new xmldb_table('block');
|
||||
$field = new xmldb_field('version');
|
||||
|
||||
// Conditionally launch drop field version.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$blocks = $DB->get_records('block');
|
||||
foreach ($blocks as $block) {
|
||||
set_config('version', $block->version, 'block_'.$block->name);
|
||||
}
|
||||
unset($blocks);
|
||||
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2013092001.02);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue