Commit 8571833f authored by Petr Skoda's avatar Petr Skoda
Browse files

MDL-23069 moving version and cron info into standard version.php - finally, yay!

parent 411b8c23
......@@ -16,6 +16,7 @@ required changes in code:
old global $THEME is fully replaced by $OUTPUT
* remove '_utf8' from language pack names, use new {$a} syntax in language packs
* use 'pluginname' lang pack identifier instead of 'blockname'
* move cron and version number into standard version.php
optional - no changes needed in older code:
*
......
......@@ -185,7 +185,7 @@ $string['dbsessionbroken'] = 'Serious database session problem detected.<br /><b
$string['dbsessionhandlerproblem'] = 'Setting up of database session failed.<br /><br />Please notify server administrator.';
$string['dbsessionmysqlpacketsize'] = 'Serious session error detected.<br /><br />Please notify administrator, this problem is most probably caused by small value in max_allowed_packet MySQL setting.';
$string['dbupdatefailed'] = 'Database update failed';
$string['ddldependencyerror'] = '{$a->targettype} "{$a->targetname}" cannot be modifed. Dependency found with {$a->offendingtype} "{$a->offendingname}"';
$string['ddldependencyerror'] = '{$a->targettype} "{$a->targetname}" cannot be modified. Dependency found with {$a->offendingtype} "{$a->offendingname}"';
$string['ddlexecuteerror'] = 'DDL sql execution error';
$string['ddlfieldalreadyexists'] = 'Field "{$a}" already exists';
$string['ddlfieldnotexist'] = 'Field "{$a->fieldname}" does not exist in table "{$a->tablename}"';
......@@ -194,7 +194,7 @@ $string['ddltablenotexist'] = 'Table "{$a}" does not exist';
$string['ddlunknownerror'] = 'Unknown DDL library error';
$string['ddlxmlfileerror'] = 'XML database file errors found';
$string['destinationcmnotexit'] = 'The destination course module does not exist';
$string['detectedbrokenplugin'] = 'Plugin "{$a}" is defective, can not continue, sorry.';
$string['detectedbrokenplugin'] = 'Plugin "{$a}" is defective or outdated, can not continue, sorry.';
$string['dmlreadexception'] = 'Error reading from database';
$string['dmltransactionexception'] = 'Database transaction error';
$string['dmlwriteexception'] = 'Error writing to database';
......
......@@ -7553,18 +7553,15 @@ function moodle_needs_upgrading() {
if ($blockname === 'NEWBLOCK') { // Someone has unzipped the template, ignore it
continue;
}
if (!is_readable($fullblock.'/block_'.$blockname.'.php')) {
if (!is_readable($fullblock.'/version.php')) {
continue;
}
include_once($fullblock.'/block_'.$blockname.'.php');
$classname = 'block_'.$blockname;
if (!class_exists($classname)) {
continue;
}
$blockobj = new $classname;
$plugin = new object();
$plugin->version = NULL;
include($fullblock.'/version.php');
if (empty($installed[$blockname])) {
return true;
} else if ($blockobj->get_version() > $installed[$blockname]->version) {
} else if ($plugin->version > $installed[$blockname]->version) {
return true;
}
}
......
......@@ -568,10 +568,19 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
$component = 'block_'.$blockname;
if (!is_readable($fullblock.'/version.php')) {
throw new plugin_defective_exception('block/'.$blockname, 'Missing version.php file.');
}
$plugin = new object();
$plugin->version = NULL;
$plugin->cron = 0;
include($fullblock.'/version.php');
$block = $plugin;
if (!is_readable($fullblock.'/block_'.$blockname.'.php')) {
throw new plugin_defective_exception('block/'.$blockname, 'Missing main block class file.');
}
require_once($fullblock.'/block_'.$blockname.'.php');
include_once($fullblock.'/block_'.$blockname.'.php');
$classname = 'block_'.$blockname;
......@@ -587,10 +596,7 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
throw new plugin_defective_exception($component, 'Self test failed.');
}
$block = new object(); // This may be used to update the db below
$block->name = $blockname; // The name MUST match the directory
$block->version = $blockobj->get_version();
$block->cron = !empty($blockobj->cron) ? $blockobj->cron : 0;
$block->multiple = $blockobj->instance_allow_multiple() ? 1 : 0;
if (empty($block->version)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment