[xoops-cvslog 1431] CVS update: xoops2jp/html/modules/base/admin/class

Back to archive index

Minahito minah****@users*****
2005年 12月 27日 (火) 14:31:15 JST


Index: xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php
diff -u xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php:1.1.2.3 xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php:1.1.2.4
--- xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php:1.1.2.3	Wed Dec 21 13:09:36 2005
+++ xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php	Tue Dec 27 14:31:15 2005
@@ -48,16 +48,16 @@
 	function installTable(&$module, &$log)
 	{
 		$sqlfileInfo =& $module->getInfo('sqlfile');
-		$sqlfile = XOOPS_MODULE_PATH . "/" . $module->getVar('dirname') . "/" . $sqlfileInfo[XOOPS_DB_TYPE];
-		if (!file_exists($sqlfile)) {
+		$dirname = $module->getVar('dirname');
+
+		$sqlfile = $sqlfileInfo[XOOPS_DB_TYPE];
+		if (!file_exists(XOOPS_MODULE_PATH . "/" . $dirname . "/" . $sqlfile)) {
 			$log->addError("SQL file not found at $sqlfile");
 			return false;
 		}
 
-		$sqlQuery = trim(implode("", file($sqlfile)));
-		
 		require_once XOOPS_ROOT_PATH . "/class/database/sqlutility.php";
-		SqlUtility::splitMySqlFile($pieces, $sqlQuery);
+		$util =& new sqlutility($module->getVar('dirname'),$sqlfile);
 
 		$root =& XCube_Root::getSingleton();
 		$db =& $root->mController->getDB();
@@ -65,27 +65,13 @@
 		//
 		// TODO The following variable exists for rollback, but it is not implemented.
 		//
-		$createdTables = array();
+		$createdTables = $util->get_create();;
 
-		foreach ($pieces as $piece) {
-			$prefixedQuery =SqlUtility::prefixQuery($piece, $db->prefix());
-			if ($prefixedQuery == false) {
-				$log->addError("${piece} is not a valid SQL");
-				return;
-			}
-			
-			if (!$db->query($prefixedQuery[0])) {
+		foreach ($util->get_sql() as $sql) {
+			if (!$db->query($sql)) {
 				$log->addError($db->error());
 				return;
 			}
-			
-			// TODO I don't use reserve table in this time.
-			if (!in_array($prefixedQuery[4], $createdTables)) {
-				$createdTables[] = $prefixedQuery[4];
-			}
-			else {
-				$log->addReport("Data inserted to table " . $db->prefix($prefixedQuery[4]));
-			}
 		}
 		
 		$log->addReport("*Database table setup finished.*");


xoops-cvslog メーリングリストの案内
Back to archive index