探究OpenWiki

OpenWiki是用ASP编写的WIKI引擎中比较优秀的,而且还是开源的项目。它的架构设计的非常精巧,是学设程序设计不可多得的范例。

OpenWiki的工作流程
ow.asp是OpenWiki的入口程序,负责 解析指令,调用相关的action 通过(owactions.asp),找出相关页的数据从数据库中通过(owdb.asp),然后生成xml stream(ToXml() method),并根据 xsl 将xml stream转换成 html stream送出通过(owtransformer.asp)。

OpenWiki的程序模块
owconfig_default.asp: 参数设置文件。
owall.asp: 将各个模块包含进来的总控文件。
owpreamble.asp: 全局各个常量定义文件。
owprocessor.asp: 处理核心
owpatterns.asp: init the RegExpr pattern contants.
owwikify.asp: 格式转换.
owvector.asp:  实现可变数组类: Vector.
owregexp.asp: 函数 s,m在这里定义: These functions simulate the m and s operations as available in the programming language perl. You can usually literally copy perl regular expressions and expect them to work with these functions.
owtoc.asp: 定义 TableOfContents 类。
owactions.asp: 规定动作
owdb.asp: 定义Namespace 类
owpage.asp: 与 WikiPage 相关的类
owdiff.asp: 比较两个文件的异同,我稍微扩充就完全可以作为版本控制的核心。
my/myactions.asp: 自定义动作

OpenWiki的数据库表结构
下面以ms sql的表为例来注解。
 CREATE TABLE [openwiki_attachments] (
    [att_wrv_name] [nvarchar] (128) NOT NULL ,
    [att_wrv_revision] [int] NOT NULL ,
    [att_name] [nvarchar] (255) NOT NULL ,
    [att_revision] [int] NOT NULL ,
    [att_hidden] [int] NOT NULL ,
    [att_deprecated] [int] NOT NULL ,
    [att_filename] [nvarchar] (255) NOT NULL ,
    [att_timestamp] [datetime] NOT NULL ,
    [att_filesize] [int] NOT NULL ,
    [att_host] [nvarchar] (128) NULL ,
    [att_agent] [nvarchar] (255) NULL ,
    [att_by] [nvarchar] (128) NULL ,
    [att_byalias] [nvarchar] (128) NULL ,
    [att_comment] [text] NULL
)

CREATE TABLE [openwiki_attachments_log] ( 
    [ath_wrv_name] [nvarchar] (128) NOT NULL ,
    [ath_wrv_revision] [int] NOT NULL ,
    [ath_name] [nvarchar] (255) NOT NULL ,
    [ath_revision] [int] NOT NULL ,
    [ath_timestamp] [datetime] NOT NULL ,
    [ath_agent] [nvarchar] (255) NULL ,
    [ath_by] [nvarchar] (128) NULL ,
    [ath_byalias] [nvarchar] (128) NULL ,
    [ath_action] [nvarchar] (20) NOT NULL
)

CREATE TABLE [openwiki_cache] ( 
    [chc_name] [nvarchar] (128) NOT NULL ,
    [chc_hash] [int] NOT NULL ,
    [chc_xmlisland] [text] NOT NULL
)

CREATE TABLE [openwiki_interwikis] ( 
    [wik_name] [nvarchar] (128) NOT NULL ,
    [wik_url] [nvarchar] (255) NOT NULL
)

//页面内容, //主键 [wpg_name] (页面名)
CREATE TABLE [openwiki_pages] ( 
    [wpg_name] [nvarchar] (128) NOT NULL ,
    [wpg_lastmajor] [int] NOT NULL ,
    [wpg_lastminor] [int] NOT NULL ,
    [wpg_changes] [int] NOT NULL
)

// 页面不同版本的內容 //主键 [wrv_name] + [wrv_revision]
CREATE TABLE [openwiki_revisions] ( 
    [wrv_name] [nvarchar] (128) NOT NULL ,
    [wrv_revision] [int] NOT NULL ,
    [wrv_current] [int] NOT NULL ,
    [wrv_status] [int] NOT NULL ,
    [wrv_timestamp] [datetime] NOT NULL ,
    [wrv_minoredit] [int] NOT NULL ,
    [wrv_host] [nvarchar] (128) NULL ,
    [wrv_agent] [nvarchar] (255) NULL ,
    [wrv_by] [nvarchar] (128) NULL ,
    [wrv_byalias] [nvarchar] (128) NULL ,
    [wrv_comment] [nvarchar] (1024) NULL ,
    [wrv_text] [ntext] NULL
)

CREATE TABLE [openwiki_rss] ( 
    [rss_url] [nvarchar] (256) NOT NULL ,
    [rss_last] [datetime] NOT NULL ,
    [rss_next] [datetime] NOT NULL ,
    [rss_refreshrate] [int] NOT NULL ,
    [rss_cache] [ntext] NOT NULL
)

CREATE TABLE [openwiki_rss_aggregations] ( 
    [agr_feed] [nvarchar] (200) NOT NULL ,
    [agr_resource] [nvarchar] (200) NOT NULL ,
    [agr_rsslink] [nvarchar] (200) NULL ,
    [agr_timestamp] [datetime] NOT NULL ,
    [agr_dcdate] [nvarchar] (25) NULL ,
    [agr_xmlisland] [ntext] NOT NULL
)

ALTER TABLE [openwiki_attachments] WITH NOCHECK ADD 
    CONSTRAINT [PK_openwiki_attachments] PRIMARY KEY  NONCLUSTERED
    (
        [att_wrv_name],
        [att_name],
        [att_revision]
    ) WITH  FILLFACTOR = 90  ON [PRIMARY]

ALTER TABLE [openwiki_cache] WITH NOCHECK ADD 
    CONSTRAINT [PK_openwiki_cache] PRIMARY KEY  NONCLUSTERED
    (
        [chc_name],
        [chc_hash]
    ) WITH  FILLFACTOR = 90  ON [PRIMARY]

ALTER TABLE [openwiki_interwikis] WITH NOCHECK ADD 
    CONSTRAINT [PK_openwiki_interwikis] PRIMARY KEY  NONCLUSTERED
    (
        [wik_name]
    ) WITH  FILLFACTOR = 90  ON [PRIMARY]

ALTER TABLE [openwiki_rss] WITH NOCHECK ADD 
    CONSTRAINT [PK_openwiki_rss] PRIMARY KEY  NONCLUSTERED
    (
        [rss_url]
    ) WITH  FILLFACTOR = 90  ON [PRIMARY]

ALTER TABLE [openwiki_rss_aggregations] WITH NOCHECK ADD 
    CONSTRAINT [PK_openwiki_rss_aggregations] PRIMARY KEY  NONCLUSTERED
    (
        [agr_feed],
        [agr_resource]
    ) WITH  FILLFACTOR = 90  ON [PRIMARY]

ALTER TABLE [openwiki_attachments] ADD 
    CONSTRAINT [FK_openwiki_attachments_openwiki_revisions] FOREIGN KEY
    (
        [att_wrv_name],
        [att_wrv_revision]
    ) REFERENCES [openwiki_revisions] (
        [wrv_name],
        [wrv_revision]
    )

OpenWiki是非常好的ASP的WIKI,只是对中文支持不好,所以很少有人用。现在中文问题终于被解决了。最新的中文修正版是由威狼维护的并提供源码下载,这是在英文openwiki 0.78sp1基础上的修改版。修改了中文链接的问题。并做了部分汉化。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值