From af7b1a309f167219a2650dfa0168b46bb3b82194 Mon Sep 17 00:00:00 2001 From: Noy Cohen Date: Tue, 16 Nov 2021 16:00:04 +0200 Subject: [PATCH 1/7] KMS-24186 update version to 4.3.1 --- blocks/kalturamediagallery/version.php | 8 ++++---- filter/kaltura/version.php | 6 +++--- lib/editor/atto/plugins/kalturamedia/version.php | 6 +++--- lib/editor/tinymce/plugins/kalturamedia/version.php | 6 +++--- local/kaltura/version.php | 4 ++-- local/kalturamediagallery/version.php | 6 +++--- local/mymedia/version.php | 6 +++--- mod/kalvidassign/version.php | 6 +++--- mod/kalvidres/version.php | 6 +++--- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/blocks/kalturamediagallery/version.php b/blocks/kalturamediagallery/version.php index d9c03918..a2b2d33d 100644 --- a/blocks/kalturamediagallery/version.php +++ b/blocks/kalturamediagallery/version.php @@ -14,11 +14,11 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2021062039; -$plugin->release = 'Kaltura release 4.3.0'; +$plugin->version = 2020061501; +$plugin->release = 'Kaltura release 4.3.1'; $plugin->requires = 2018120300; $plugin->component = 'block_kalturamediagallery'; $plugin->dependencies = array( - 'local_kaltura' => 2021062039, - 'local_kalturamediagallery' => 2021062039 + 'local_kaltura' => 2020061501, + 'local_kalturamediagallery' => 2020061501 ); diff --git a/filter/kaltura/version.php b/filter/kaltura/version.php index d3cda427..9183a607 100644 --- a/filter/kaltura/version.php +++ b/filter/kaltura/version.php @@ -24,11 +24,11 @@ */ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2021062039; //version date YYYYMMDDXX 10 represent 3.0 for future option to moodle use 2 digit version +$plugin->version = 2020061501; //version date YYYYMMDDXX 10 represent 3.0 for future option to moodle use 2 digit version $plugin->component = 'filter_kaltura'; -$plugin->release = 'Kaltura release 4.3.0'; +$plugin->release = 'Kaltura release 4.3.1'; $plugin->requires = 2018120300; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = array( - 'local_kaltura' => 2021062039 + 'local_kaltura' => 2020061501 ); diff --git a/lib/editor/atto/plugins/kalturamedia/version.php b/lib/editor/atto/plugins/kalturamedia/version.php index b9891288..9cf058ea 100644 --- a/lib/editor/atto/plugins/kalturamedia/version.php +++ b/lib/editor/atto/plugins/kalturamedia/version.php @@ -24,10 +24,10 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2021062039; // The current plugin version (Date: YYYYMMDDXX). -$plugin->release = 'Kaltura release 4.3.0'; +$plugin->version = 2020061501; // The current plugin version (Date: YYYYMMDDXX). +$plugin->release = 'Kaltura release 4.3.1'; $plugin->requires = 2018120300; // Requires this Moodle version. $plugin->component = 'atto_kalturamedia'; // Full name of the plugin (used for diagnostics). $plugin->dependencies = array( - 'local_kaltura' => 2021062039 + 'local_kaltura' => 2020061501 ); diff --git a/lib/editor/tinymce/plugins/kalturamedia/version.php b/lib/editor/tinymce/plugins/kalturamedia/version.php index 2b84550e..c1a12332 100644 --- a/lib/editor/tinymce/plugins/kalturamedia/version.php +++ b/lib/editor/tinymce/plugins/kalturamedia/version.php @@ -23,12 +23,12 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2021062039; -$plugin->release = 'Kaltura release 4.3.0'; +$plugin->version = 2020061501; +$plugin->release = 'Kaltura release 4.3.1'; // Required Moodle version. $plugin->requires = 2018120300; // Full name of the plugin (used for diagnostics). $plugin->component = 'tinymce_kalturamedia'; $plugin->dependencies = array( - 'local_kaltura' => 2021062039 + 'local_kaltura' => 2020061501 ); diff --git a/local/kaltura/version.php b/local/kaltura/version.php index a77dc91e..2c07e282 100644 --- a/local/kaltura/version.php +++ b/local/kaltura/version.php @@ -25,8 +25,8 @@ die('Direct access to this script is forbidden.'); } -$plugin->version = 2021062039; +$plugin->version = 2020061501; $plugin->component = 'local_kaltura'; -$plugin->release = 'Kaltura release 4.3.0'; +$plugin->release = 'Kaltura release 4.3.1'; $plugin->requires = 2018120300; $plugin->maturity = MATURITY_STABLE; diff --git a/local/kalturamediagallery/version.php b/local/kalturamediagallery/version.php index a01030c1..624ea889 100644 --- a/local/kalturamediagallery/version.php +++ b/local/kalturamediagallery/version.php @@ -26,11 +26,11 @@ die('Direct access to this script is forbidden.'); } -$plugin->version = 2021062039; +$plugin->version = 2020061501; $plugin->component = 'local_kalturamediagallery'; -$plugin->release = 'Kaltura release 4.3.0'; +$plugin->release = 'Kaltura release 4.3.1'; $plugin->requires = 2018120300; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = array( - 'local_kaltura' => 2021062039 + 'local_kaltura' => 2020061501 ); diff --git a/local/mymedia/version.php b/local/mymedia/version.php index f1d7389e..770b6282 100644 --- a/local/mymedia/version.php +++ b/local/mymedia/version.php @@ -25,11 +25,11 @@ die('Direct access to this script is forbidden.'); } -$plugin->version = 2021062039; +$plugin->version = 2020061501; $plugin->component = 'local_mymedia'; -$plugin->release = 'Kaltura release 4.3.0'; +$plugin->release = 'Kaltura release 4.3.1'; $plugin->requires = 2018120300; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = array( - 'local_kaltura' => 2021062039 + 'local_kaltura' => 2020061501 ); diff --git a/mod/kalvidassign/version.php b/mod/kalvidassign/version.php index 6b9ec47c..7c13f194 100644 --- a/mod/kalvidassign/version.php +++ b/mod/kalvidassign/version.php @@ -25,12 +25,12 @@ die('Direct access to this script is forbidden.'); } -$plugin->version = 2021062039; +$plugin->version = 2020061501; $plugin->component = 'mod_kalvidassign'; -$plugin->release = 'Kaltura release 4.3.0'; +$plugin->release = 'Kaltura release 4.3.1'; $plugin->requires = 2018120300; $plugin->cron = 0; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = array( - 'local_kaltura' => 2021062039, + 'local_kaltura' => 2020061501, ); diff --git a/mod/kalvidres/version.php b/mod/kalvidres/version.php index 7bac28b0..706dd9ce 100644 --- a/mod/kalvidres/version.php +++ b/mod/kalvidres/version.php @@ -25,12 +25,12 @@ die('Direct access to this script is forbidden.'); } -$plugin->version = 2021062039; +$plugin->version = 2020061501; $plugin->component = 'mod_kalvidres'; -$plugin->release = 'Kaltura release 4.3.0'; +$plugin->release = 'Kaltura release 4.3.1'; $plugin->requires = 2018120300; $plugin->cron = 0; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = array( - 'local_kaltura' => 2021062039 + 'local_kaltura' => 2020061501 ); From 1f46b9aeeef61c4670230c606916ca341112d410 Mon Sep 17 00:00:00 2001 From: Noy Cohen Date: Wed, 10 Nov 2021 15:05:23 +0200 Subject: [PATCH 2/7] KMS-24816 update upgrade function to support the right moodle plugin version --- local/kaltura/db/upgrade.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/local/kaltura/db/upgrade.php b/local/kaltura/db/upgrade.php index 23d9a558..43d7a394 100644 --- a/local/kaltura/db/upgrade.php +++ b/local/kaltura/db/upgrade.php @@ -73,5 +73,34 @@ function xmldb_local_kaltura_upgrade($oldversion) { // Kaltura savepoint reached. upgrade_plugin_savepoint(true, 2016120130, 'local', 'kaltura'); } + + // fix wrong versions + if ($oldversion == 20210620311) { + update_wrong_plugin_version_value($oldversion, '2021051700'); + } + else if ($oldversion == 20201215310 || $oldversion == 20210620310) { + update_wrong_plugin_version_value($oldversion, '2020110900'); + } + else if ($oldversion == 2020070539 || $oldversion == 2020121539 || $oldversion == 2021062039) { + update_wrong_plugin_version_value($oldversion, '2020061500'); + } + return true; } + +/** + * @param $oldversion + * @param $newversion + */ +function update_wrong_plugin_version_value($oldversion, $newversion) { + global $DB; + $pluginsRecords = $DB->get_records_select('config_plugins', "name = 'version' AND value = '$oldversion'"); + + foreach ($pluginsRecords as $record) { + $record->value = $newversion; + $DB->update_record('config_plugins', $record); + } + +// // TODO: UNDERSTAND IF I NEED THIS +// upgrade_plugin_savepoint(true, 2020090700, 'tool', 'moodlenet'); +} From cc2cdd21bffc2062147776c40f59abbecb492d22 Mon Sep 17 00:00:00 2001 From: Noy Cohen Date: Sun, 14 Nov 2021 13:57:59 +0200 Subject: [PATCH 3/7] KMS-24186 move the code from upgrade.php to version.php so it'll work --- local/kaltura/db/upgrade.php | 32 +------------------------------ local/kaltura/version.php | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/local/kaltura/db/upgrade.php b/local/kaltura/db/upgrade.php index 43d7a394..0be31b0f 100644 --- a/local/kaltura/db/upgrade.php +++ b/local/kaltura/db/upgrade.php @@ -73,34 +73,4 @@ function xmldb_local_kaltura_upgrade($oldversion) { // Kaltura savepoint reached. upgrade_plugin_savepoint(true, 2016120130, 'local', 'kaltura'); } - - // fix wrong versions - if ($oldversion == 20210620311) { - update_wrong_plugin_version_value($oldversion, '2021051700'); - } - else if ($oldversion == 20201215310 || $oldversion == 20210620310) { - update_wrong_plugin_version_value($oldversion, '2020110900'); - } - else if ($oldversion == 2020070539 || $oldversion == 2020121539 || $oldversion == 2021062039) { - update_wrong_plugin_version_value($oldversion, '2020061500'); - } - - return true; -} - -/** - * @param $oldversion - * @param $newversion - */ -function update_wrong_plugin_version_value($oldversion, $newversion) { - global $DB; - $pluginsRecords = $DB->get_records_select('config_plugins', "name = 'version' AND value = '$oldversion'"); - - foreach ($pluginsRecords as $record) { - $record->value = $newversion; - $DB->update_record('config_plugins', $record); - } - -// // TODO: UNDERSTAND IF I NEED THIS -// upgrade_plugin_savepoint(true, 2020090700, 'tool', 'moodlenet'); -} +} \ No newline at end of file diff --git a/local/kaltura/version.php b/local/kaltura/version.php index 2c07e282..bf1c20b6 100644 --- a/local/kaltura/version.php +++ b/local/kaltura/version.php @@ -30,3 +30,40 @@ $plugin->release = 'Kaltura release 4.3.1'; $plugin->requires = 2018120300; $plugin->maturity = MATURITY_STABLE; + +global $DB; + +$localKalturaPluginVersionRecords = $DB->get_records_select('config_plugins', "plugin = 'local_kaltura' AND name = 'version'"); + +$kalturaPluginVersion = ""; +if ($localKalturaPluginVersionRecords) { + foreach ($localKalturaPluginVersionRecords as $key => $localKalturaPluginVersionRecord) { + $kalturaPluginVersion = $localKalturaPluginVersionRecord->value; + break; + } +} + +if ($kalturaPluginVersion == 20210620311) { + $pluginsRecords = $DB->get_records_select('config_plugins', "name = 'version' AND value = '$kalturaPluginVersion'"); + + foreach ($pluginsRecords as $record) { + $record->value = 2021051700; + $DB->update_record('config_plugins', $record); + } +} +else if ($kalturaPluginVersion == 20201215310 || $kalturaPluginVersion == 20210620310) { + $pluginsRecords = $DB->get_records_select('config_plugins', "name = 'version' AND value = '$kalturaPluginVersion'"); + + foreach ($pluginsRecords as $record) { + $record->value = 2020110900; + $DB->update_record('config_plugins', $record); + } +} +else if ($kalturaPluginVersion == 2020070539 || $kalturaPluginVersion == 2020121539 || $kalturaPluginVersion == 2021062039) { + $pluginsRecords = $DB->get_records_select('config_plugins', "name = 'version' AND value = '$kalturaPluginVersion'"); + + foreach ($pluginsRecords as $record) { + $record->value = 2020061500; + $DB->update_record('config_plugins', $record); + } +} \ No newline at end of file From f99c0c535d91b7670403851782ebf377e34b398c Mon Sep 17 00:00:00 2001 From: Noy Cohen Date: Sun, 14 Nov 2021 14:00:21 +0200 Subject: [PATCH 4/7] KMS-24186 return the "return true" statement --- local/kaltura/db/upgrade.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/local/kaltura/db/upgrade.php b/local/kaltura/db/upgrade.php index 0be31b0f..45c16d63 100644 --- a/local/kaltura/db/upgrade.php +++ b/local/kaltura/db/upgrade.php @@ -73,4 +73,6 @@ function xmldb_local_kaltura_upgrade($oldversion) { // Kaltura savepoint reached. upgrade_plugin_savepoint(true, 2016120130, 'local', 'kaltura'); } + + return true; } \ No newline at end of file From e4e2f3570c0118c629c8b1d4f3d1ccbaaf9aee44 Mon Sep 17 00:00:00 2001 From: Noy Cohen Date: Sun, 14 Nov 2021 15:25:41 +0200 Subject: [PATCH 5/7] KMS-24186 avoid repeating the same code --- local/kaltura/version.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/local/kaltura/version.php b/local/kaltura/version.php index bf1c20b6..a79abc23 100644 --- a/local/kaltura/version.php +++ b/local/kaltura/version.php @@ -43,27 +43,22 @@ } } +$updatedVersion = null; if ($kalturaPluginVersion == 20210620311) { - $pluginsRecords = $DB->get_records_select('config_plugins', "name = 'version' AND value = '$kalturaPluginVersion'"); - - foreach ($pluginsRecords as $record) { - $record->value = 2021051700; - $DB->update_record('config_plugins', $record); - } + $updatedVersion = 2021051700; } else if ($kalturaPluginVersion == 20201215310 || $kalturaPluginVersion == 20210620310) { - $pluginsRecords = $DB->get_records_select('config_plugins', "name = 'version' AND value = '$kalturaPluginVersion'"); - - foreach ($pluginsRecords as $record) { - $record->value = 2020110900; - $DB->update_record('config_plugins', $record); - } + $updatedVersion = 2020110900; } else if ($kalturaPluginVersion == 2020070539 || $kalturaPluginVersion == 2020121539 || $kalturaPluginVersion == 2021062039) { + $updatedVersion = 2020061500; +} + +if (!empty($updatedVersion)) { $pluginsRecords = $DB->get_records_select('config_plugins', "name = 'version' AND value = '$kalturaPluginVersion'"); foreach ($pluginsRecords as $record) { - $record->value = 2020061500; + $record->value = $updatedVersion; $DB->update_record('config_plugins', $record); } } \ No newline at end of file From 8a178a602d5949a12d1240b43ff12c2a2b2c9733 Mon Sep 17 00:00:00 2001 From: Noy Cohen Date: Sun, 14 Nov 2021 15:25:41 +0200 Subject: [PATCH 6/7] KMS-24186 avoid repeating the same code From 05bd166a4385d1574be247622c08088a1043a9b8 Mon Sep 17 00:00:00 2001 From: Noy Cohen Date: Sun, 14 Nov 2021 22:22:11 +0200 Subject: [PATCH 7/7] KMS-24186 replace foreach with array_pop --- local/kaltura/version.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/local/kaltura/version.php b/local/kaltura/version.php index a79abc23..cae99dba 100644 --- a/local/kaltura/version.php +++ b/local/kaltura/version.php @@ -33,14 +33,12 @@ global $DB; -$localKalturaPluginVersionRecords = $DB->get_records_select('config_plugins', "plugin = 'local_kaltura' AND name = 'version'"); +$localKalturaPluginVersionRecord = $DB->get_records_select('config_plugins', "plugin = 'local_kaltura' AND name = 'version'"); $kalturaPluginVersion = ""; -if ($localKalturaPluginVersionRecords) { - foreach ($localKalturaPluginVersionRecords as $key => $localKalturaPluginVersionRecord) { - $kalturaPluginVersion = $localKalturaPluginVersionRecord->value; - break; - } +if ($localKalturaPluginVersionRecord) { + $localKalturaPluginVersionRecordValue = array_pop($localKalturaPluginVersionRecord); + $kalturaPluginVersion = $localKalturaPluginVersionRecordValue->value; } $updatedVersion = null;