Browse Source

see #5118 Seems that the table xxx.metadata doesn't exists

Laurent Opprecht 12 years ago
parent
commit
a01210e240

+ 17 - 0
main/install/i_database.class.php

@@ -40,4 +40,21 @@ class iDatabase extends Database
         return parent::query($query, $connection, $file, $line);
     }
 
+    /**
+     * Returns true if the table exists in the database, false otherwise.
+     * @param string $database
+     * @param string table
+     * @return boolean 
+     */
+    static function table_exists($database, $table)
+    {
+        $tables = mysql_list_tables($db);
+        while (list ($temp) = mysql_fetch_array($tables)) {
+            if (strtolower($temp) == strtolower($table)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
 }

+ 2 - 0
main/install/migrate-db-1.8.8-1.9.0-pre.sql

@@ -327,6 +327,8 @@ CREATE TABLE track_e_attempt_coeff ( id int unsigned not null auto_increment pri
 -- xxUSERxx
 
 -- xxCOURSExx
+CREATE TABLE IF NOT EXISTS metadata (c_id INT NOT NULL, eid VARCHAR(250) NOT NULL, mdxmltext TEXT default '', md5 CHAR(32) default '', htmlcache1 TEXT default '', htmlcache2 TEXT default '', indexabletext TEXT default '', PRIMARY KEY (c_id, eid))
+
 ALTER TABLE lp ADD COLUMN hide_toc_frame INT NOT NULL DEFAULT 0;
 ALTER TABLE lp ADD COLUMN seriousgame_mode INT NOT NULL DEFAULT 0;
 ALTER TABLE lp_item_view modify column suspend_data longtext;

+ 1 - 1
main/install/update-db-1.8.8-1.9.0.inc.php

@@ -335,7 +335,7 @@ if (defined('SYSTEM_INSTALLATION')) {
                         iDatabase::select_db($row_course['db_name']);
                     }
                     Log::notice('Course db ' . $row_course['db_name']);
-
+                    
                     // Now use the $c_q_list
                     foreach ($c_q_list as $query) {
                         if ($singleDbForm) {