/** * Runs the update */ function run() { // modify the story_display_type option $query = "\n\t\tDESCRIBE\n\t\t\tstory story_display_type\n\t\t"; $r = db_query($query); $a = db_fetch_assoc($r); if (!eregi("(enum\\()(.*'rss'.*)(\\))", $a['Type']) && eregi("(enum\\()(.*)(\\))", $a['Type'], $parts)) { $query = "\n\t\t\tALTER TABLE \n\t\t\t\tstory\n\t\t\tCHANGE \n\t\t\t\tstory_display_type story_display_type \n\t\t\t\t\tENUM(" . $parts[2] . ",'rss') \n\t\t\t\t\tDEFAULT '" . $a['Default'] . "' \n\t\t\t\t\t" . ($a['Null'] ? "" : "NOT") . " NULL\n\t\t\t"; $r = db_query($query); } // create the cache directory if it doesn't exist // check for rss cache dir global $cfg; $path = realpath($cfg[uploaddir]); if (!file_exists($path . "/RSScache/")) { mkdir($path . "/RSScache/", 0770); } if (!file_exists($path . "/RSScache/autocache/")) { mkdir($path . "/RSScache/autocache/", 0770); } //modify the usertype in user table $query = "\n\t\tDESCRIBE\n\t\t\tuser user_type\n\t\t"; $r = db_query($query); $a = db_fetch_assoc($r); if (!eregi("(enum\\()(.*'visitor'.*)(\\))", $a['Type']) && eregi("(enum\\()(.*)(\\))", $a['Type'], $parts)) { $query = "\n\t\t\tALTER TABLE \n\t\t\t\tuser\n\t\t\tCHANGE \n\t\t\t\tuser_type user_type \n\t\t\t\t\tENUM(" . $parts[2] . ",'visitor','guest') \n\t\t\t\t\tDEFAULT '" . $a['Default'] . "' \n\t\t\t\t\t" . ($a['Null'] ? "" : "NOT") . " NULL\n\t\t\t"; $r = db_query($query); } //add the story_discusslabel field to the story table $query = "\n\t\tDESCRIBE\n\t\t\tstory story_discusslabel\n\t\t"; $r = db_query($query); if (db_num_rows($r) < 1) { $query = "\n\t\t\tALTER TABLE \n\t\t\t\tstory\n\t\t\tADD \n\t\t\t\tstory_discusslabel VARCHAR( 128 ) NULL AFTER story_discussauthor\n\t\t\t"; $r = db_query($query); } // check that the class_semester field in the class table is of type varchar $query = "\n\t\tDESCRIBE\n\t\t\tclass class_semester\n\t\t"; $r = db_query($query); $a = db_fetch_assoc($r); if ($a['Type'] != "varchar(50)") { $query = "ALTER TABLE \n\t\t\t\t\t\t\tclass\n\t\t\t\t\t\tCHANGE \n\t\t\t\t\t\t\tclass_semester\n\t\t\t\t\t\t\tclass_semester \n\t\t\t\t\t\t\tVARCHAR(50) \n\t\t\t\t\t\t\tDEFAULT 'w' \n\t\t\t\t\t\t\tNOT NULL"; $r = db_query($query); } // Go through all the sites and make sure that all of their parts have // the media links updated if (ini_get('max_execution_time') < 300) { ini_set('max_execution_time', 300); } $allSlots = slot::getAllSlots(); print "\n<br />Starting Link->Tag conversion."; foreach ($allSlots as $id => $sitename) { print "\n<br />Converting links to tags in site '" . $sitename . "'..."; convertAllInteralLinksToTags($sitename); } print "\n<br />Link->Tag conversion done."; }