Skip to content

Commit

Permalink
Merge branch 'MDL-40112_master' of https://github.com/totara/openbadges
Browse files Browse the repository at this point in the history
Conflicts:
	lib/db/upgrade.php
	version.php
  • Loading branch information
stronk7 committed Jul 15, 2013
2 parents adbdb9b + e50220f commit e780e5c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
1 change: 0 additions & 1 deletion backup/moodle2/restore_stepslib.php
Expand Up @@ -2029,7 +2029,6 @@ public function process_badge($data) {
$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,
Expand Down
1 change: 0 additions & 1 deletion badges/newbadge.php
Expand Up @@ -80,7 +80,6 @@
$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;
Expand Down
2 changes: 0 additions & 2 deletions badges/tests/badgeslib_test.php
Expand Up @@ -46,7 +46,6 @@ protected function setUp() {
$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;
Expand Down Expand Up @@ -74,7 +73,6 @@ public function test_clone_badge() {
$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);
Expand Down
7 changes: 1 addition & 6 deletions lib/badgeslib.php
Expand Up @@ -108,7 +108,6 @@ class badge {
public $timemodified;
public $usercreated;
public $usermodified;
public $image;
public $issuername;
public $issuerurl;
public $issuercontact;
Expand Down Expand Up @@ -241,7 +240,6 @@ public function make_clone() {

$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();
Expand Down Expand Up @@ -1083,10 +1081,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.
Expand Down
1 change: 0 additions & 1 deletion lib/db/install.xml
Expand Up @@ -2876,7 +2876,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"/>
Expand Down
13 changes: 13 additions & 0 deletions lib/db/upgrade.php
Expand Up @@ -2293,5 +2293,18 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2013071500.01);
}

if ($oldversion < 2013071500.02) {
// 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, 2013071500.02);
}

return true;
}
2 changes: 1 addition & 1 deletion version.php
Expand Up @@ -29,7 +29,7 @@

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

$version = 2013071500.01; // YYYYMMDD = weekly release date of this DEV branch
$version = 2013071500.02; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes

Expand Down

0 comments on commit e780e5c

Please sign in to comment.