Skip to content

Commit

Permalink
Fix Moodle 31 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
bdaloukas committed Jun 14, 2016
1 parent 0fc4259 commit 6036c8c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion db/install.xml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/game/db" VERSION="20151229" COMMENT="XMLDB file for Moodle mod/game"
<XMLDB PATH="mod/game/db" VERSION="20160614" COMMENT="XMLDB file for Moodle mod/game"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
Expand Down Expand Up @@ -46,6 +46,7 @@
<FIELD NAME="maxattempts" TYPE="int" LENGTH="3" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="userlanguage" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="disablesummarize" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="glossaryonlyapproved" TYPE="int" LENGTH="1" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
Expand Down
2 changes: 1 addition & 1 deletion db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,7 @@ function xmldb_game_upgrade($oldversion) {
upgrade_mod_savepoint(true, $ver, 'game');
}

if ($oldversion < ($ver = 2016031202)) {
if ($oldversion < ($ver = 2016061402)) {
$table = new xmldb_table('game');
$field = new xmldb_field('glossaryonlyapproved', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, '0');
if (!$dbman->field_exists($table, $field)) {
Expand Down
7 changes: 5 additions & 2 deletions exportjavame.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ function game_exportjavame_exportdata( $src, $destmobiledir, $destdir, $game, $m
if ($lang == '') {
$lang = current_language();
}
copy( $src. '/lang/'.$lang.'/language.txt', $destdir."/$destmobiledir/language.txt");
$sourcefile = $src. '/lang/'.$lang.'/language.txt';
if( !file_exists( $sourcefile))
$sourcefile = $src. '/lang/'.$lang.'_utf8/language.txt';
copy( $sourcefile, $destdir."/$destmobiledir/language.txt");

$exportattachment = ( $destmobiledir == 'hangmanp');

Expand Down Expand Up @@ -342,7 +345,7 @@ function game_create_jar( $srcdir, $course, $javame) {
$cmd = "cd $srcdir;jar cvfm $filejar META-INF/MANIFEST.MF *";
exec( $cmd);

return (file_exists( $filejar) ? "{$javame->filename}.jar" : '');
return (file_exists( $filejar) ? $filejar : '');
}

function game_showanswers_appendselect( $form) {
Expand Down
2 changes: 1 addition & 1 deletion locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,7 @@ function game_export_createtempdir() {

srand( (double)microtime() * 1000000);
while (true) {
$rbasedir = "game/".date("Y-m-d H.i.s-").rand(0, 10000);
$rbasedir = "game/".date("Y-m-d-H.i.s-").rand(0, 10000);
$newdir = $CFG->dataroot.'/temp/'.$rbasedir;
if (!file_exists( $newdir)) {
mkdir( $newdir);
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
}

$plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics).
$plugin->version = 2016043101; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2016061402; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2010112400; // Requires Moodle 2.0.
$plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->release = '2016-04-31';
$plugin->release = '2016-06-14';

if ($useplugin != 2) {
$module = $plugin;
Expand Down

0 comments on commit 6036c8c

Please sign in to comment.