mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
MDL-40112 badges: Drop unused image field from badge table
This commit is contained in:
parent
f8e6e5bc30
commit
e50220f840
7 changed files with 15 additions and 12 deletions
|
@ -2029,7 +2029,6 @@ class restore_badges_structure_step extends restore_structure_step {
|
|||
$params = array(
|
||||
'name' => $data->name,
|
||||
'description' => $data->description,
|
||||
'image' => 0,
|
||||
'timecreated' => $this->apply_date_offset($data->timecreated),
|
||||
'timemodified' => $this->apply_date_offset($data->timemodified),
|
||||
'usercreated' => $data->usercreated,
|
||||
|
|
|
@ -80,7 +80,6 @@ if ($form->is_cancelled()) {
|
|||
$fordb->timemodified = $now;
|
||||
$fordb->usercreated = $USER->id;
|
||||
$fordb->usermodified = $USER->id;
|
||||
$fordb->image = 0;
|
||||
$fordb->issuername = $data->issuername;
|
||||
$fordb->issuerurl = $data->issuerurl;
|
||||
$fordb->issuercontact = $data->issuercontact;
|
||||
|
|
|
@ -46,7 +46,6 @@ class badges_testcase extends advanced_testcase {
|
|||
$fordb->timemodified = time();
|
||||
$fordb->usercreated = $user->id;
|
||||
$fordb->usermodified = $user->id;
|
||||
$fordb->image = 0;
|
||||
$fordb->issuername = "Test issuer";
|
||||
$fordb->issuerurl = "http://issuer-url.domain.co.nz";
|
||||
$fordb->expiredate = null;
|
||||
|
@ -74,7 +73,6 @@ class badges_testcase extends advanced_testcase {
|
|||
$newid = $badge->make_clone();
|
||||
$cloned_badge = new badge($newid);
|
||||
|
||||
$this->assertEquals($badge->image, $cloned_badge->image);
|
||||
$this->assertEquals($badge->description, $cloned_badge->description);
|
||||
$this->assertEquals($badge->issuercontact, $cloned_badge->issuercontact);
|
||||
$this->assertEquals($badge->issuername, $cloned_badge->issuername);
|
||||
|
|
|
@ -108,7 +108,6 @@ class badge {
|
|||
public $timemodified;
|
||||
public $usercreated;
|
||||
public $usermodified;
|
||||
public $image;
|
||||
public $issuername;
|
||||
public $issuerurl;
|
||||
public $issuercontact;
|
||||
|
@ -241,7 +240,6 @@ class badge {
|
|||
|
||||
$fordb->name = get_string('copyof', 'badges', $this->name);
|
||||
$fordb->status = BADGE_STATUS_INACTIVE;
|
||||
$fordb->image = 0;
|
||||
$fordb->usercreated = $USER->id;
|
||||
$fordb->usermodified = $USER->id;
|
||||
$fordb->timecreated = time();
|
||||
|
@ -1081,10 +1079,7 @@ function badges_process_badge_image(badge $badge, $iconfile) {
|
|||
require_once($CFG->libdir. '/gdlib.php');
|
||||
|
||||
if (!empty($CFG->gdversion)) {
|
||||
if ($fileid = (int)process_new_icon($badge->get_context(), 'badges', 'badgeimage', $badge->id, $iconfile)) {
|
||||
$badge->image = $fileid;
|
||||
$badge->save();
|
||||
}
|
||||
process_new_icon($badge->get_context(), 'badges', 'badgeimage', $badge->id, $iconfile);
|
||||
@unlink($iconfile);
|
||||
|
||||
// Clean up file draft area after badge image has been saved.
|
||||
|
|
|
@ -2868,7 +2868,6 @@
|
|||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
||||
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||
<FIELD NAME="image" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="usercreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||
|
|
|
@ -2190,5 +2190,18 @@ function xmldb_main_upgrade($oldversion) {
|
|||
upgrade_main_savepoint(true, 2013061700.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2013070400.01) {
|
||||
// Define field attachment to be dropped from badge.
|
||||
$table = new xmldb_table('badge');
|
||||
$field = new xmldb_field('image');
|
||||
|
||||
// Conditionally launch drop field eventtype.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2013070400.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2013070400.00; // YYYYMMDD = weekly release date of this DEV branch
|
||||
$version = 2013070400.01; // YYYYMMDD = weekly release date of this DEV branch
|
||||
// RR = release increments - 00 in DEV branches
|
||||
// .XX = incremental changes
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue