From 6036c8c372c30464929a0513bb3a22dea0f524f8 Mon Sep 17 00:00:00 2001 From: Vasilis Daloukas Date: Tue, 14 Jun 2016 08:05:48 +0300 Subject: [PATCH] Fix Moodle 31 compatibility --- db/install.xml | 3 ++- db/upgrade.php | 2 +- exportjavame.php | 7 +++++-- locallib.php | 2 +- version.php | 4 ++-- 5 files changed, 11 insertions(+), 7 deletions(-) mode change 100644 => 100755 db/install.xml diff --git a/db/install.xml b/db/install.xml old mode 100644 new mode 100755 index 74fe050..f20a0cd --- a/db/install.xml +++ b/db/install.xml @@ -1,5 +1,5 @@ - @@ -46,6 +46,7 @@ + diff --git a/db/upgrade.php b/db/upgrade.php index e32b0c5..34d5d6b 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -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)) { diff --git a/exportjavame.php b/exportjavame.php index 8f095a7..a66c3ed 100644 --- a/exportjavame.php +++ b/exportjavame.php @@ -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'); @@ -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) { diff --git a/locallib.php b/locallib.php index 89d4344..1eef5aa 100644 --- a/locallib.php +++ b/locallib.php @@ -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); diff --git a/version.php b/version.php index c6e2f89..cd8e0b5 100644 --- a/version.php +++ b/version.php @@ -36,10 +36,10 @@ if (!isset( $plugin)) { } $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;