From: Ivan H. <iv...@us...> - 2004-05-24 23:02:22
|
Update of /cvsroot/phpwebsite-comm/modules/ras/boost In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12212 Added Files: install.php install.sql uninstall.php uninstall.sql Log Message: Initial create --- NEW FILE: install.sql --- #drop table mod_ras_settings; #drop table mod_ras_apps; #drop table mod_ras_resources; #drop table mod_ras_items; create table mod_ras_settings ( is_master BOOL, accept_anonymous BOOL, channels TEXT ); insert into mod_ras_settings(is_master, accept_anonymous, channels) values(0, 0, ''); create table mod_ras_apps ( app_id INT UNSIGNED PRIMARY KEY NOT NULL, app_name varchar(50) NOT NULL, app_version varchar(20) NOT NULL, UNIQUE INDEX ras_app_idx(app_name, app_version) ); create table mod_ras_resources ( res_id INT UNSIGNED PRIMARY KEY NOT NULL , app_id INT UNSIGNED NOT NULL REFERENCES mod_ras_app, res_name varchar(50) NOT NULL, res_type varchar(10) NOT NULL, res_description TEXT, UNIQUE INDEX ras_res_idx(res_name, res_type) ); create table mod_ras_items ( itm_id INT UNSIGNED PRIMARY KEY NOT NULL, res_id INT UNSIGNED NOT NULL REFERENCES mod_ras_resources, itm_type varchar(4) NOT NULL, itm_version varchar(20) NOT NULL default '', itm_date DATETIME NOT NULL, itm_lang varchar(2) default '', itm_url TEXT NOT NULL, itm_changes TEXT, itm_md5 char(32), UNIQUE INDEX ras_itm_idx (itm_version, itm_date, itm_lang) ); --- NEW FILE: uninstall.php --- <?php /** * Uninstall file for ras v0.0.4 */ /* return to home page if the user is not the Deity */ if (!$_SESSION["OBJ_user"]->isDeity()) { header("location:index.php"); exit(); } $status = 1; /* read sql install script, execute it, suppress errors */ if ($GLOBALS['core']->sqlImport(PHPWS_SOURCE_DIR."mod/ras/boost/uninstall.sql", TRUE, TRUE) ) { /* report success */ $content = $_SESSION['translate']->it("All Remote Application Syndication tables successfully removed.") . "<br />"; $status = 1; /* TODO */ /* uninstall Language */ if(PHPWS_Language::uninstallLanguages('ras')) { $content .= $_SESSION['translate']->it("RAS successfully updated the Language system") . "<br />"; } /* remove file directories */ $path = $GLOBALS['core']->home_dir . "/files/ras/imports"; if (file_exists($path)) { if(PHPWS_File::rmdir($path)) { $content .= $_SESSION['translate']->it("RAS imports directory was fully removed.") . "<br />"; } else { $content .= $_SESSION['translate']->it("RAS import directory could not be removed.") . "<br />"; } } $path = $GLOBALS['core']->home_dir . "/files/ras/resources"; if (file_exists($path)) { if(PHPWS_File::rmdir($path)) { $content .= $_SESSION['translate']->it("RAS resources directory was fully removed.") . "<br />"; } else { $content .= $_SESSION['translate']->it("RAS resources directory could not be removed.") . "<br />"; } } $path = $GLOBALS['core']->home_dir . "/files/ras"; if (file_exists($path)) { if(PHPWS_File::rmdir($path)) { $content .= $_SESSION['translate']->it("RAS files directory was fully removed.") . "<br />"; } else { $content .= $_SESSION['translate']->it("RAS files directory could not be removed.") . "<br />"; } } } else { $content .= $_SESSION['translate']->it("Unable to access the database.") . "<br />"; } ?> --- NEW FILE: install.php --- <?php /* instal for RAS 0.0.4 */ if (!$_SESSION["OBJ_user"]->isDeity()){ header("location:index.php"); exit(); } if ( ! $GLOBALS['core']->sqlImport(PHPWS_SOURCE_DIR."mod/ras/boost/install.sql", 1, 1)) { $content .= $_SESSION['translate']->it("Unable to write to the database.") . "<br />"; $status = 0; } else { $content = $_SESSION['translate']->it("All Ras tables successfully written.") . "<br />"; $status = 1; /* Create files directory */ if (mkdir($GLOBALS['core']->home_dir . "files/ras")) { $content .= $_SESSION['translate']->it("Ras files directory ") . $GLOBALS['core']->home_dir . "files/ras" . $_SESSION['translate']->it(" successfully created!") . "<br />"; if (mkdir($GLOBALS['core']->home_dir . "files/ras/resources")) { $content .= $_SESSION['translate']->it("Ras resources files directory ") . $GLOBALS['core']->home_dir . "files/ras/resources " . $_SESSION['translate']->it("successfully created!") . "<br />"; } else { $content .= $_SESSION['translate']->it("Ras could not create the files directory: ") . $GLOBALS['core']->home_dir . "files/ras/resources<br />" . $_SESSION['translate']->it("You will have to do this manually!") . "<br />"; } if (mkdir($GLOBALS['core']->home_dir . "files/ras/imports")) { $content .= $_SESSION['translate']->it("Ras import files directory ") . $GLOBALS['core']->home_dir . "files/ras/import " . $_SESSION['translate']->it("successfully created!") . "<br />"; } else { $content .= $_SESSION['translate']->it("Ras could not create the files directory: ") . $GLOBALS['core']->home_dir . "files/ras/import<br />" . $_SESSION['translate']->it("You will have to do this manually!") . "<br />"; } } else { $content .= $_SESSION['translate']->it("Ras could not create the files directory: ") . $GLOBALS['core']->home_dir . "files/ras<br />" . $GLOBALS['core']->home_dir . "files/ras/resources<br />" . $GLOBALS['core']->home_dir . "files/ras/imports<br />" . $_SESSION['translate']->it("You will have to do this manually!") . "<br />"; } } ?> --- NEW FILE: uninstall.sql --- drop table mod_ras_settings; drop table mod_ras_apps; drop table mod_ras_resources; drop table mod_ras_items; |