Skip to content

Commit

Permalink
MDL-30610 remove outdated workshop upgrade code
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Dec 23, 2011
1 parent 7c58c19 commit 17510ff
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 1,086 deletions.
59 changes: 57 additions & 2 deletions mod/workshop/backup/moodle1/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

defined('MOODLE_INTERNAL') || die();

require_once($CFG->dirroot.'/mod/workshop/db/upgradelib.php');

/**
* Workshop conversion handler
*/
Expand Down Expand Up @@ -354,3 +352,60 @@ public function on_elements_end() {
// do nothing by default
}
}

/**
* Given a record containing data from 1.9 workshop table, returns object containing data as should be saved in 2.0 workshop table
*
* @param stdClass $old record from 1.9 workshop table
* @return stdClass
*/
function workshop_upgrade_transform_instance(stdClass $old) {
global $CFG;
require_once(dirname(dirname(dirname(__FILE__))) . '/locallib.php');

$new = new stdClass();
$new->course = $old->course;
$new->name = $old->name;
$new->intro = $old->description;
$new->introformat = $old->format;
$new->nattachments = $old->nattachments;
$new->maxbytes = $old->maxbytes;
$new->grade = $old->grade;
$new->gradinggrade = $old->gradinggrade;
$new->phase = workshop::PHASE_CLOSED;
$new->timemodified = time();
if ($old->ntassessments > 0) {
$new->useexamples = 1;
} else {
$new->useexamples = 0;
}
$new->usepeerassessment = 1;
$new->useselfassessment = $old->includeself;
switch ($old->gradingstrategy) {
case 0: // 'notgraded' - renamed
$new->strategy = 'comments';
break;
case 1: // 'accumulative'
$new->strategy = 'accumulative';
break;
case 2: // 'errorbanded' - renamed
$new->strategy = 'numerrors';
break;
case 3: // 'criterion' - will be migrated into 'rubric'
$new->strategy = 'rubric';
break;
case 4: // 'rubric'
$new->strategy = 'rubric';
break;
}
if ($old->submissionstart < $old->submissionend) {
$new->submissionstart = $old->submissionstart;
$new->submissionend = $old->submissionend;
}
if ($old->assessmentstart < $old->assessmentend) {
$new->assessmentstart = $old->assessmentstart;
$new->assessmentend = $old->assessmentend;
}

return $new;
}
14 changes: 0 additions & 14 deletions mod/workshop/form/accumulative/db/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,5 @@
*/
function xmldb_workshopform_accumulative_install() {
global $CFG, $DB;
require_once(dirname(__FILE__) . '/upgradelib.php');

// upgrade from old workshop 1.x if needed
workshopform_accumulative_upgrade_legacy();
}

/**
* Post installation procedure recovery
*/
function xmldb_workshopform_accumulative_install_recovery() {
global $CFG, $DB;
require_once(dirname(__FILE__) . '/upgradelib.php');

// continue upgrading from old workshop 1.x if needed
workshopform_accumulative_upgrade_legacy();
}
16 changes: 0 additions & 16 deletions mod/workshop/form/accumulative/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,6 @@ function xmldb_workshopform_accumulative_upgrade($oldversion) {

$dbman = $DB->get_manager();

if ($oldversion < 2010091700) {
// clean up orphaned dimensions
$orphans = $DB->get_records_sql("SELECT d.id
FROM {workshopform_accumulative} d
LEFT JOIN {workshop} w ON d.workshopid = w.id
WHERE w.id IS NULL");
if (!empty($orphans)) {
echo $OUTPUT->notification('Orphaned assessment form elements found - cleaning...');
$DB->delete_records_list('workshopform_accumulative', 'id', array_keys($orphans));
}

upgrade_plugin_savepoint(true, 2010091700, 'workshopform', 'accumulative');
}

// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this

// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
Expand Down
Loading

0 comments on commit 17510ff

Please sign in to comment.