MDL-28250 license: upgrade old versions of cc-nc
authorDan Poltawski <dan@moodle.com>
Wed, 15 May 2013 09:44:37 +0000 (10:44 +0100)
committerDan Poltawski <dan@moodle.com>
Wed, 15 May 2013 10:22:13 +0000 (11:22 +0100)
The url was incorectly defined in previous versions

lib/db/upgrade.php
version.php

index 1e464e4..a8d71bd 100644 (file)
@@ -2139,5 +2139,26 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2013042300.00);
     }
 
+    if ($oldversion < 2013051400.01) {
+        // Fix incorrect cc-nc url. Unfortunately the license 'plugins' do
+        // not give a mechanism to do this.
+
+        $sql = "UPDATE {license}
+                   SET source = :url, version = :newversion
+                 WHERE shortname = :shortname AND version = :oldversion";
+
+        $params = array(
+            'url' => 'http://creativecommons.org/licenses/by-nc/3.0/',
+            'shortname' => 'cc-nc',
+            'newversion' => '2013051500',
+            'oldversion' => '2010033100'
+        );
+
+        $DB->execute($sql, $params);
+
+        // Main savepoint reached.
+        upgrade_main_savepoint(true, 2013051400.01);
+    }
+
     return true;
 }
index 6776f7d..4ce8ab1 100644 (file)
@@ -29,7 +29,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$version  = 2013051400.00;              // 20130514      = branching date YYYYMMDD - do not modify!
+$version  = 2013051400.01;              // 20130514      = branching date YYYYMMDD - do not modify!
                                         //         RR    = release increments - 00 in DEV branches
                                         //           .XX = incremental changes