Project

General

Profile

Bug #4716

Delete get_scorm_database() functions and other "scorm database calls"

Added by Julio Montoya over 7 years ago. Updated over 7 years ago.

Status:
Bug resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
08/05/2012
Due date:
% Done:

100%

Estimated time:
8.00 h
Complexity:
Normal
SCRUM pts - complexity:
?

Description

we have a database called scorm_main, i think this is not used because it's not even create

define('TABLE_SCORM_MAIN', 'scorm_main');

Associated revisions

Revision 905de2cf (diff)
Added by Julio Montoya over 7 years ago

Removing scorm calls. Leaving just the table definition (needed when migrating from 1.6 to 1.8). Removing removescormDir() unused function see #4716

Revision f088d75e (diff)
Added by Julio Montoya over 7 years ago

Commenting adding @deprecated in some scorm unused functions see #4716

Revision f55d0cb5 (diff)
Added by Julio Montoya over 7 years ago

Removing old code scorm.lib.php, scorm_admin.php see #4716

History

#1

Updated by Yannick Warnier over 7 years ago

  • Estimated time set to 8.00 h
Again, this is for retroactive compatibility.
In earlier versions of D0keos, there were 4 main databases:
  • the "main" database (courses lists, users lists, sessions lists etc)
  • the "stats" database (for all stats)
  • the "scorm" database (for all things related to SCORM)
  • the "user" database (for a few tables about users)

As we progressed in time, these databases were slowly merged into the main one (by me, for scorm and user databases), but now that we are getting everything into one database, it is important to make sure that previous installations (with these 4 different databases) are really migrated into one single database.

However, the migration process did not previously merge them, so if those databases were separated in the past, they would still be separated in 1.8.8.4.

Testing it is very easy: install a D0keos 1.6.5 from here: http://www.dokeos.com/download/dokeos-1.6.5.tar.gz, install it, check it has the 4 different databases, and try to upgrade it and see if the database tables were really migrated into one.
If you can do that, then you can remove the TABLE_SCORM_MAIN and everything related to all those deprecated databases.

My guess is this isn't managed well so far, but it should (definitely).

#2

Updated by Julio Montoya over 7 years ago

the only calls that I found of TABLE_SCORM_MAIN and get_scorm_table() are in this file:

main/newscorm/scorm.lib.php

and it just delete things, and the function removescormDir, is never used in Chamilo 1.9 ...

function removescormDir($dir) {
    global $_course;
    if(!@$opendir = opendir($dir)) {
        return false;
    }
    while($readdir = readdir($opendir)) {
        if($readdir != '..' && $readdir != '.') {
            if(is_file($dir.'/'.$readdir)) {
                $pos = strpos('/'.$readdir, 'imsmanifest.xml');
                if ($pos) {    // So we have the imsmanifest in this dir
                            // from d:/myworks/dokeos/dokeos_cvs/dokeos/dokeos/courses/CVSCODE4/scorm/LP2/LP2
                            // We have to get /LP2/LP2
                    $path = api_get_path(SYS_COURSE_PATH).$_course['official_code'].'/scorm';
                    $pos = strpos($dir, $path);
                    if ($pos == 0) {
                        $scormdir = substr($dir, strlen($path), strlen($dir) - strlen($path));
                        $courseid = $_course['official_code'];
                        $sql = "SELECT * FROM ".Database::get_scorm_table(TABLE_SCORM_MAIN)." where (contentTitle='$scormdir' and dokeosCourse='$courseid')";
                        $result = Database::query($sql);
                        while ($row = Database::fetch_array($result)) {
                            $c = $row['contentId'];
                            $sql2 = "DELETE FROM ".Database::get_scorm_table(TABLE_SCORM_SCO_DATA)." where contentId=$c";
                            $result2 = Database::query($sql2);
                        }
                        $sql = "DELETE FROM ".Database::get_scorm_table(TABLE_SCORM_MAIN)." where (contentTitle='$scormdir' and dokeosCourse='$courseid')";
                        $result = Database::query($sql);
                    }
                }
                if (!@unlink($dir.'/'.$readdir)) {
                    return false;
                }
            } elseif (is_dir($dir.'/'.$readdir)) {
                if(!removescormDir($dir.'/'.$readdir)) {
                    return false;
                }
            }
        }
    }
    closedir($opendir);
    if (!@rmdir($dir)) {
        return false;
    }
    return true;
}
#3

Updated by Yannick Warnier over 7 years ago

  • Target version set to 1.9 Beta

The scorm database itself is in fact a bit special in this case because it was the first removed and because all scorm content (since the creation of the main/newscorm/ directory) has been managed inside the lp* tables, so it can be dropped straight away, without the need for database upgrade review. However, the user and stats databases have to be reviewed.

Yes, about the get_scorm_table() and the constant, you can remove them. The check of databases merging should be done before 1.9 though (it is too important to miss).

#4

Updated by Julio Montoya over 7 years ago

I'm conserving the database constants needed for the migration from 1.6 to 1.8

#5

Updated by Julio Montoya over 7 years ago

  • Status changed from New to Needs more info
#6

Updated by Yannick Warnier over 7 years ago

  • Status changed from Needs more info to Bug resolved
  • Assignee set to Julio Montoya
  • % Done changed from 0 to 100

Good enough for me. Will re-open if we catch something

Also available in: Atom PDF