Permalink
Browse files

Removing some upgrade stuff ... not sure what I was trying to do there

I'm checking this in so I can do some testing on other sites
  • Loading branch information...
moodler
moodler committed Aug 5, 2004
1 parent d02ad0f commit c35889f9f183eb69a3ea7a3e5652030df05c3777
Showing with 7 additions and 61 deletions.
  1. +3 −30 mod/resource/db/mysql.php
  2. +4 −31 mod/resource/db/postgres7.php
View
@@ -38,42 +38,15 @@ function resource_upgrade($oldversion) {
table_column("resource", "type", "type", "varchar", "30", "", "", "", "");
modify_database("", "UPDATE prefix_resource SET type='reference' WHERE type='1';");
- modify_database("", "UPDATE prefix_resource SET type='url', options='frame' WHERE type='2';");
+ modify_database("", "UPDATE prefix_resource SET type='file', options='frame' WHERE type='2';");
modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='3';");
modify_database("", "UPDATE prefix_resource SET type='text', options='0' WHERE type='4';");
- modify_database("", "UPDATE prefix_resource SET type='url' WHERE type='5';");
+ modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='5';");
modify_database("", "UPDATE prefix_resource SET type='html' WHERE type='6';");
- modify_database("", "UPDATE prefix_resource SET type='program' WHERE type='7';");
+ modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='7';");
modify_database("", "UPDATE prefix_resource SET type='text', options='3' WHERE type='8';");
modify_database("", "UPDATE prefix_resource SET type='directory' WHERE type='9';");
- }
-
- if ($oldversion < 2004072600) {
- modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='url';");
- modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='program';");
-
- }
- if ($oldversion < 2004073000) {
- /// Make sure the "frame" flag is turned on for things that can support it (for a smooth upgrade)
- require_once("$CFG->dirroot/files/mimetypes.php");
- if ($resources = get_records_select('resource', "type = 'file' AND options = '' AND popup = ''")) {
- foreach ($resources as $resource) {
- $mimetype = mimeinfo("type", $resource->reference);
- $embedded = false;
- if (in_array($mimetype, array('image/gif','image/jpeg','image/png'))
- or (substr($mimetype, 0, 10) == "video/x-ms")
- or ($mimetype == "audio/mp3")
- or ($mimetype == "video/quicktime")) {
- $embedded = true;
- }
- if (!$embedded) { /// Make sure it's in a frame
- $newresource->id = $resource->id;
- $newresource->options = 'frame';
- update_record('resource', $newresource);
- }
- }
- }
rebuild_course_cache();
}
@@ -29,46 +29,20 @@ function resource_upgrade($oldversion) {
if ($oldversion < 2004071300) {
table_column("resource", "", "options", "varchar", "255", "", "", "", "popup");
}
-
+
if ($oldversion < 2004071303) {
table_column("resource", "type", "type", "varchar", "30", "", "", "", "");
modify_database("", "UPDATE prefix_resource SET type='reference' WHERE type='1';");
- modify_database("", "UPDATE prefix_resource SET type='url', options='frame' WHERE type='2';");
+ modify_database("", "UPDATE prefix_resource SET type='file', options='frame' WHERE type='2';");
modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='3';");
modify_database("", "UPDATE prefix_resource SET type='text', options='0' WHERE type='4';");
- modify_database("", "UPDATE prefix_resource SET type='url' WHERE type='5';");
+ modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='5';");
modify_database("", "UPDATE prefix_resource SET type='html' WHERE type='6';");
- modify_database("", "UPDATE prefix_resource SET type='program' WHERE type='7';");
+ modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='7';");
modify_database("", "UPDATE prefix_resource SET type='text', options='3' WHERE type='8';");
modify_database("", "UPDATE prefix_resource SET type='directory' WHERE type='9';");
- }
- if ($oldversion < 2004072600) {
- modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='url';");
- modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='program';");
- }
-
- if ($oldversion < 2004073000) {
- /// Make sure the "frame" flag is turned on for things that can support it (for a smooth upgrade)
- require_once("$CFG->dirroot/files/mimetypes.php");
- if ($resources = get_records_select('resource', "type = 'file' AND options = '' AND popup = ''")) {
- foreach ($resources as $resource) {
- $mimetype = mimeinfo("type", $resource->reference);
- $embedded = false;
- if (in_array($mimetype, array('image/gif','image/jpeg','image/png'))
- or (substr($mimetype, 0, 10) == "video/x-ms")
- or ($mimetype == "audio/mp3")
- or ($mimetype == "video/quicktime")) {
- $embedded = true;
- }
- if (!$embedded) { /// Make sure it's in a frame
- $newresource->id = $resource->id;
- $newresource->options = 'frame';
- update_record('resource', $newresource);
- }
- }
- }
rebuild_course_cache();
}
@@ -77,4 +51,3 @@ function resource_upgrade($oldversion) {
?>
-

0 comments on commit c35889f

Please sign in to comment.