OSDN Git Service

RDBMS support was suspended.
authorpanda <panda>
Sun, 23 Mar 2003 12:03:09 +0000 (21:03 +0900)
committerpanda <panda>
Sun, 23 Mar 2003 12:03:09 +0000 (21:03 +0900)
link_db.php [deleted file]
mysql.php [deleted file]
pgsql.php [deleted file]
plugin/yetlist.inc.php
pukiwiki.ini.php
pukiwiki.php

diff --git a/link_db.php b/link_db.php
deleted file mode 100644 (file)
index ba27d9d..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-<?php
-/////////////////////////////////////////////////
-// PukiWiki - Yet another WikiWikiWeb clone.
-//
-// $Id: link_db.php,v 1.1 2003/03/13 14:08:28 panda Exp $
-//
-
-// ¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é´ØÏ¢¥Ú¡¼¥¸¤òÆÀ¤ë
-function links_get_related_db($page)
-{
-       $links = array();
-       
-       $a_page = addslashes($page);
-       
-       // $page¤¬»²¾È¤·¤Æ¤¤¤ë¥Ú¡¼¥¸
-       $sql = <<<EOD
-SELECT refpage.name,refpage.lastmod
- FROM page
-  LEFT JOIN link ON page.id = page_id
-   LEFT JOIN page AS refpage ON ref_id = refpage.id
-    WHERE page.name = '$a_page' and refpage.lastmod > 0;
-EOD;
-       $rows = db_query($sql);
-       // $page¤ò»²¾È¤·¤Æ¤¤¤ë¥Ú¡¼¥¸
-       $sql = <<<EOD
-SELECT DISTINCT refpage.name,refpage.lastmod
- FROM page
-  LEFT JOIN link ON page.id = ref_id
-   LEFT JOIN page AS refpage ON page_id = refpage.id
-    WHERE page.name = '$a_page';
-EOD;
-       $rows += db_query($sql);
-       
-       foreach ($rows as $row)
-       {
-               if (empty($row['name']) or substr($row['name'],0,1) == ':')
-               {
-                       continue;
-               }
-               $links[$row['name']] = $row['lastmod'];
-       }
-       return $links;
-}
-//¥Ú¡¼¥¸¤Î´ØÏ¢¤ò¹¹¿·¤¹¤ë
-function links_update($page)
-{
-       global $whatsnew;
-       
-       $is_page = is_page($page);
-       $time = ($is_page) ? get_filetime($page) : 0;
-       $a_page = addslashes($page);
-       
-       $rows = db_query("SELECT id FROM page WHERE name='$a_page';");
-       if (count($rows) == 0)
-       {
-               if (!$is_page)
-               {
-                       return;
-               }
-               db_exec("INSERT INTO page (name,lastmod) VALUES ('$a_page',$time);");
-               $rows = db_query("SELECT id FROM page WHERE name='$a_page';");
-               $id = $rows[0]['id'];
-       }
-       else // if (count($rows) > 0)
-       {
-               $id = $rows[0]['id'];
-               // $page¤¬»²¾È¤·¤Æ¤¤¤ë¥Ú¡¼¥¸¤ò½é´ü²½
-               db_exec("DELETE FROM link WHERE page_id=$id;");
-               if (!$is_page)
-               {
-                       $_rows = db_query("SELECT * FROM link WHERE ref_id=$id;");
-                       if (count($_rows) == 0)
-                       {
-                               // $page¤ò»²¾È¤·¤Æ¤¤¤ë¥Ú¡¼¥¸¤¬¤Ê¤¤¤Î¤Ç¡¢¤³¤Î¥ì¥³¡¼¥É¤òºï½ü
-                               db_exec("DELETE FROM page WHERE id=$id;");
-                               return;
-                       }
-               }
-               // ¥Ú¡¼¥¸¤Î¹¹¿·»þ¹ï¤ò¥»¥Ã¥È
-               db_exec("UPDATE page SET lastmod=$time WHERE id=$id;");
-       }
-       
-       // cache
-       $pages = array();
-       
-       $links = links_get_objects($page);
-       foreach ($links as $_obj)
-       {
-               if (!isset($_obj->type) or $_obj->type != 'pagename' or $_obj->name == $page)
-               {
-                       continue;
-               }                       
-               $_page = $_obj->name;
-               if (!array_key_exists($_page,$pages))
-               {
-                       $a_page = addslashes($_page);
-                       $rows = db_query("SELECT id,name FROM page WHERE name='$a_page';");
-                       if (count($rows) == 0)
-                       {
-                               db_exec("INSERT INTO page (name,lastmod) VALUES ('$a_page',0);");
-                               $rows = db_query("SELECT id,name FROM page WHERE name='$a_page';");
-                       }
-                       $pages[$rows[0]['name']] = TRUE;
-                       $ref_id =$rows[0]['id'];
-                       db_exec("INSERT INTO link (page_id,ref_id) VALUES ($id,$ref_id);");
-               }
-       }
-       // Ã¯¤«¤é¤â»²¾È¤µ¤ì¤Ê¤¯¤Ê¤Ã¤¿¡Ö¸ºß¤·¤Ê¤¤¥Ú¡¼¥¸¡×¤ò¾Ãµî
-       // MySQL3¤Ï¡ÖÉûÌ䤤¹ç¤ï¤»¡×¤Ë̤Âбþ¡Ä?
-//             db_exec("DELETE FROM page WHERE id in (SELECT id FROM page LEFT JOIN link ON id=ref_id WHERE lastmod=0 AND page_id IS NULL);");
-       $rows = db_query("SELECT id FROM page LEFT JOIN link ON id=ref_id WHERE lastmod=0 AND page_id IS NULL;");
-       $_arr = array();
-       foreach ($rows as $row)
-       {
-               $_arr[] = $row['id'];
-       }
-       if (count($_arr))
-       {
-               db_exec("DELETE FROM page WHERE id in (".join(',',$_arr).");");
-       }
-}
-//¥Ú¡¼¥¸¤Î´ØÏ¢¤ò½é´ü²½¤¹¤ë
-function links_init()
-{
-       global $whatsnew;
-       
-       set_time_limit(0);
-       
-       // ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î½é´ü²½
-       db_exec('DELETE FROM page;');
-       db_exec('DELETE FROM link;');
-       $pages = get_existpages();
-       foreach ($pages as $page)
-       {
-               if ($page == $whatsnew)
-               {
-                       continue;
-               }
-               $time = get_filetime($page);
-               $a_page = addslashes($page);
-               db_exec("INSERT INTO page (name,lastmod) VALUES ('$a_page',$time);");
-       }
-       $rows = db_query('SELECT id,name FROM page;');
-       $pages = array();
-       foreach ($rows as $row)
-       {
-               $pages[$row['name']] = $row['id'];
-       }
-       
-       foreach ($pages as $page=>$id)
-       {
-               $links = links_get_objects($page);
-               foreach ($links as $_obj)
-               {
-                       if ($_obj->type != 'pagename')
-                       {
-                               continue;
-                       }
-                       $_page = $_obj->name;
-                       if (!array_key_exists($_page,$pages))
-                       {
-                               $a_page = addslashes($_page);
-                               db_exec("INSERT INTO page (name) VALUES ('$a_page');");
-                               $rows = db_query("SELECT id,name FROM page WHERE name='$a_page';");
-                               $row = $rows[0];
-                               $pages[$row['name']] = $row['id'];
-                       }       
-                               
-                       $ref_id = $pages[$_page];
-                       if ($ref_id and $ref_id != $id)
-                       {
-                               db_exec("INSERT INTO link (page_id,ref_id) VALUES ($id,$ref_id);");
-                       }
-               }
-       }
-}
-function &links_get_objects($page,$refresh=FALSE)
-{
-       static $obj;
-       
-       if (!isset($obj) or $refresh)
-       {
-               $obj = &new InlineConverter(NULL,array('note'));
-       }
-       
-       return $obj->get_objects(join('',preg_grep('/^(?!\/\/|\s)./',get_source($page))),$page);
-}
-?>
diff --git a/mysql.php b/mysql.php
deleted file mode 100644 (file)
index d04e882..0000000
--- a/mysql.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/////////////////////////////////////////////////
-// PukiWiki - Yet another WikiWikiWeb clone.
-//
-// $Id: mysql.php,v 1.2 2003/03/10 11:30:50 panda Exp $
-//
-
-function db_exec($sql)
-{
-       $conn = mysql_pconnect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS)
-               or die_message('cannot connect db.');
-       mysql_select_db(MYSQL_DB,$conn)
-               or die_message('cannot select db.');
-       $result = mysql_query($sql,$conn)
-               or die_message("query '$sql' failure.\n".mysql_error($conn));
-       return $result;
-}
-
-
-function db_query($sql)
-{
-       $result = db_exec($sql);
-       
-       $rows = array();
-       while ($row = mysql_fetch_array($result)) {
-               $rows[] = $row;
-       }
-       mysql_free_result($result);
-
-       return $rows;
-}
-
-/*
-create table page (id integer auto_increment primary key, name text not null, lastmod integer not null);
-create table link (page_id integer not null, ref_id integer not null);
-*/
-?>
diff --git a/pgsql.php b/pgsql.php
deleted file mode 100644 (file)
index 42764bf..0000000
--- a/pgsql.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/////////////////////////////////////////////////
-// PukiWiki - Yet another WikiWikiWeb clone.
-//
-// $Id: pgsql.php,v 1.1 2003/01/27 05:44:11 panda Exp $
-//
-
-function db_exec($sql)
-{
-       $conn = pg_pconnect(PG_CONNECT_STRING)
-               or die_message('cannot connect db.');
-       $result = pg_query($conn,$sql)
-               or die_message("query '$sql' failure.");
-       return $result;
-}
-
-function db_query($sql)
-{
-       $result = db_exec($sql);
-       
-       $rows = array();
-       while ($row = pg_fetch_array($result)) {
-               $rows[] = $row;
-       }
-       pg_free_result($result);
-       
-       return $rows;
-}
-
-/*
-create table page (id serial primary key, name text not null, lastmod integer not null);
-create table link (page_id integer not null, ref_id integer not null);
-grant all on page,link,page_id_seq to apache;
-*/
-?>
index 9c04f6c..3ed762d 100644 (file)
@@ -2,7 +2,7 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: yetlist.inc.php,v 1.15 2003/03/15 11:39:04 panda Exp $
+// $Id: yetlist.inc.php,v 1.16 2003/03/23 12:03:09 panda Exp $
 //
 
 function plugin_yetlist_init()
@@ -31,31 +31,13 @@ function plugin_yetlist_action()
        
        $refer = array();
        $exists = get_existpages();
-       if (defined('LINK_DB'))
+       $pages = array_diff(get_existpages(CACHE_DIR,'.ref'),get_existpages());
+       foreach ($pages as $page)
        {
-               $sql = <<<EOD
-SELECT DISTINCT page.name,refpage.name AS refer
- FROM page
-  LEFT JOIN link ON page.id = ref_id
-   LEFT JOIN page AS refpage ON page_id = refpage.id
-    WHERE page.lastmod=0;
-EOD;
-               $rows = db_query($sql);
-               foreach ($rows as $row)
+               foreach (file(CACHE_DIR.encode($page).'.ref') as $line)
                {
-                       $refer[$row['name']][] = $row['refer'];
-               }
-       }
-       else
-       {
-               $pages = array_diff(get_existpages(CACHE_DIR,'.ref'),get_existpages());
-               foreach ($pages as $page)
-               {
-                       foreach (file(CACHE_DIR.encode($page).'.ref') as $line)
-                       {
-                               list($_page) = explode("\t",$line);
-                               $refer[$page][] = $_page;
-                       }
+                       list($_page) = explode("\t",$line);
+                       $refer[$page][] = $_page;
                }
        }
        
index ec5f8a4..a82eba9 100644 (file)
@@ -2,7 +2,7 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: pukiwiki.ini.php,v 1.32 2003/03/10 11:30:50 panda Exp $
+// $Id: pukiwiki.ini.php,v 1.33 2003/03/23 12:03:08 panda Exp $
 //
 // PukiWiki setting file
 
@@ -25,19 +25,6 @@ define('PLUGIN_DIR','./plugin/');
 define('CACHE_DIR','./cache/');
 
 /////////////////////////////////////////////////
-// ´ØÏ¢¤¹¤ë¥Ú¡¼¥¸¤Î¥­¥ã¥Ã¥·¥å
-// ¥Õ¥¡¥¤¥ë¥Ù¡¼¥¹¤Î¤È¤­¤Ïdefine('LINK_DB',...)¤ò¥³¥á¥ó¥È¥¢¥¦¥È
-// MySQL
-//define('LINK_DB','mysql');
-//define('MYSQL_HOST','localhost');
-//define('MYSQL_USER','apache');
-//define('MYSQL_PASS','');
-//define('MYSQL_DB','pukiwiki');
-// PostgreSQL
-//define('LINK_DB','pgsql');
-//define('PG_CONNECT_STRING','dbname=pukiwiki host=localhost user=apache');
-
-/////////////////////////////////////////////////
 // ¥í¡¼¥«¥ë»þ´Ö
 define('ZONE','JST');
 define('ZONETIME',9 * 3600); // JST = GMT+9
index 84f5583..1680ea5 100644 (file)
@@ -29,7 +29,7 @@
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
 //
-// $Id: pukiwiki.php,v 1.23 2003/03/13 14:13:17 panda Exp $
+// $Id: pukiwiki.php,v 1.24 2003/03/23 12:03:08 panda Exp $
 /////////////////////////////////////////////////
 
 
@@ -45,20 +45,12 @@ require('convert_html.php');
 require('make_link.php');
 require('diff.php');
 require('config.php');
+require('link.php');
 
 /////////////////////////////////////////////////
 // ¥×¥í¥°¥é¥à¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß
 require('init.php');
 
-if (defined('LINK_DB'))
-{
-       require(LINK_DB.'.php');
-       require('link_db.php');
-}
-else
-{
-       require('link.php');
-}
 /////////////////////////////////////////////////
 // ¥á¥¤¥ó½èÍý