From: Geoffrey T. D. <da...@us...> - 2001-09-18 19:16:27
|
Update of /cvsroot/phpwiki/phpwiki/schemas In directory usw-pr-cvs1:/tmp/cvs-serv2684/schemas Modified Files: schema.mysql schema.psql Log Message: Jeff's hacks II. This is a major change, to say the least. Some highlights: o Completely new database API. WARNING: all database schemas (currently MySQL, Postgres and DBA support is working) use completely revised schema, so you must start this new code with a new blank database... o WikiPlugins o New template engine. In addition, some more incremental changes: o Cascading Style Sheets reworked. o Expanded syntax for text search: e.g. "wiki OR wacky AND NOT page". o PhpWiki should now work with register_globals off. (Security issue.) o Edit preview button. (and probably more, which I'm forgetting about now.) Much of this code is still in a state of flux (particularly the new template engine code, and to a lesser extent the API for the plugins.) Feel free to play and hack on this, just be warned that some of it may still change quite a bit... See pgsrc/ReleaseNotes for a few more notes. And feel free to post questions or comments either publicly on <php...@li...>, or privately, to <da...@da...>. Index: schema.mysql =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/schemas/schema.mysql,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** schema.mysql 2001/07/17 15:58:28 1.6 --- schema.mysql 2001/09/18 19:16:23 1.7 *************** *** 1,60 **** -- $Id$ ! drop table if exists phpwiki_pages; ! drop table if exists phpwiki_archive; ! drop table if exists phpwiki_links; ! drop table if exists phpwiki_hitcount; ! drop table if exists phpwiki_score; ! drop table if exists phpwiki_hottopics; - - CREATE TABLE phpwiki_pages ( - pagename VARCHAR(100) NOT NULL, - version INT NOT NULL DEFAULT 1, - flags INT NOT NULL DEFAULT 0, - author VARCHAR(100), - lastmodified INT NOT NULL, - created INT NOT NULL, - content MEDIUMTEXT NOT NULL, - refs TEXT, - PRIMARY KEY (pagename) - ); - - CREATE TABLE phpwiki_archive ( - pagename VARCHAR(100) NOT NULL, - version INT NOT NULL DEFAULT 1, - flags INT NOT NULL DEFAULT 0, - author VARCHAR(100), - lastmodified INT NOT NULL, - created INT NOT NULL, - content MEDIUMTEXT NOT NULL, - refs TEXT, - PRIMARY KEY (pagename, version) - ); - - CREATE TABLE phpwiki_links ( - frompage VARCHAR(100) NOT NULL, - topage VARCHAR(100) NOT NULL, - PRIMARY KEY (frompage, topage) - ); - - CREATE TABLE phpwiki_hitcount ( - pagename VARCHAR(100) NOT NULL, - hits INT NOT NULL DEFAULT 0, - PRIMARY KEY (pagename) - ); - - CREATE TABLE phpwiki_score ( - pagename VARCHAR(100) NOT NULL, - score INT NOT NULL DEFAULT 0, - PRIMARY KEY (pagename) - ); - - - -- tables below are not yet used - - CREATE TABLE phpwiki_hottopics ( - pagename VARCHAR(100) NOT NULL, - lastmodified INT NOT NULL, - PRIMARY KEY (pagename, lastmodified) - ); --- 1,47 ---- -- $Id$ ! drop table if exists page; ! CREATE TABLE page ( ! id INT NOT NULL, ! pagename VARCHAR(100) BINARY NOT NULL, ! hits INT NOT NULL DEFAULT 0, ! pagedata MEDIUMTEXT NOT NULL DEFAULT '', ! PRIMARY KEY (id), ! UNIQUE KEY (pagename) ! ); ! ! drop table if exists version; ! CREATE TABLE version ( ! id INT NOT NULL, ! version INT NOT NULL, ! mtime INT NOT NULL, ! minor_edit TINYINT DEFAULT 0, ! content MEDIUMTEXT NOT NULL DEFAULT '', ! versiondata MEDIUMTEXT NOT NULL DEFAULT '', ! PRIMARY KEY (id,version), ! INDEX (mtime) ! ); ! ! drop table if exists recent; ! CREATE TABLE recent ( ! id INT NOT NULL, ! latestversion INT, ! latestmajor INT, ! latestminor INT, ! PRIMARY KEY (id) ! ); ! ! drop table if exists nonempty; ! CREATE TABLE nonempty ( ! id INT NOT NULL, ! PRIMARY KEY (id) ! ); ! ! drop table if exists link; ! CREATE TABLE link ( ! linkfrom INT NOT NULL, ! linkto INT NOT NULL, ! INDEX (linkfrom), ! INDEX (linkto) ! ); Index: schema.psql =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/schemas/schema.psql,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** schema.psql 2001/07/18 04:59:47 1.8 --- schema.psql 2001/09/18 19:16:23 1.9 *************** *** 1,65 **** -- $Id$ ! drop table phpwiki_pages; ! drop table phpwiki_archive; ! drop table phpwiki_links; ! drop table phpwiki_hottopics; ! drop table phpwiki_hitcount; ! drop table phpwiki_score; ! ! CREATE TABLE phpwiki_pages ( ! pagename VARCHAR(100) NOT NULL, ! version INT NOT NULL DEFAULT 1, ! flags INT NOT NULL DEFAULT 0, ! author VARCHAR(100), ! lastmodified INT NOT NULL, ! created INT NOT NULL, ! content TEXT NOT NULL, ! refs TEXT, ! PRIMARY KEY (pagename) ! ); ! ! CREATE TABLE phpwiki_archive ( ! pagename VARCHAR(100) NOT NULL, ! version INT NOT NULL DEFAULT 1, ! flags INT NOT NULL DEFAULT 0, ! author VARCHAR(100), ! lastmodified INT NOT NULL, ! created INT NOT NULL, ! content TEXT NOT NULL, ! refs TEXT, ! PRIMARY KEY (pagename, version) ! ); ! ! CREATE TABLE phpwiki_links ( ! frompage VARCHAR(100) NOT NULL, ! topage VARCHAR(100) NOT NULL, ! PRIMARY KEY (frompage, topage) ! ); ! ! CREATE TABLE phpwiki_hottopics ( ! pagename VARCHAR(100) NOT NULL, ! lastmodified INT NOT NULL, ! PRIMARY KEY (pagename, lastmodified) ! ); ! ! CREATE TABLE phpwiki_hitcount ( ! pagename VARCHAR(100) NOT NULL, ! hits INT NOT NULL DEFAULT 0, ! PRIMARY KEY (pagename) ! ); ! ! CREATE TABLE phpwiki_score ( ! pagename VARCHAR(100) NOT NULL, ! score INT NOT NULL DEFAULT 0, ! PRIMARY KEY (pagename) ! ); ! ! ! GRANT ALL ON phpwiki_pages TO nobody; ! GRANT ALL ON phpwiki_archive TO nobody; ! GRANT ALL ON phpwiki_links TO nobody; ! GRANT ALL ON phpwiki_hottopics TO nobody; ! GRANT ALL ON phpwiki_hitcount TO nobody; ! GRANT ALL ON phpwiki_score TO nobody; --- 1,126 ---- -- $Id$ ! \set QUIET + + --================================================================ + -- Prefix for table names. + -- + -- You should set this to the same value you specify for + -- $DBParams['prefix'] in index.php. + + \set prefix '' + + --================================================================ + -- Which postgres user gets access to the tables? + -- + -- You should set this to the name of the postgres + -- user who will be accessing the tables. + -- + -- Commonly, connections from php are made under + -- the user name of 'nobody' or 'apache'. + + \set httpd_user 'apache' + + --================================================================ + -- + -- Don't modify below this point unless you know what you are doing. + -- + --================================================================ + + \set qprefix '\'' :prefix '\'' + \set qhttp_user '\'' :httpd_user '\'' + \echo Initializing PhpWiki tables with: + \echo ' prefix = ' :qprefix + \echo ' httpd_user = ' :qhttp_user + \echo + \echo 'Expect some \'Relation \'*\' does not exists\' errors unless you are' + \echo 'overwriting existing tables.' + + \set page_tbl :prefix 'page' + \set page_id :prefix 'page_id' + \set page_nm :prefix 'page_nm' + + \set version_tbl :prefix 'version' + \set vers_id :prefix 'vers_id' + \set vers_mtime :prefix 'vers_mtime' + + \set recent_tbl :prefix 'recent' + \set recent_id :prefix 'recent_id' + + \set nonempty_tbl :prefix 'nonempty' + \set nonmt_id :prefix 'nonmt_id' + + \set link_tbl :prefix 'link' + \set link_from :prefix 'link_from' + \set link_to :prefix 'link_to' + + \echo Dropping :page_tbl + DROP TABLE :page_tbl; + \echo Creating :page_tbl + CREATE TABLE :page_tbl ( + id INT NOT NULL, + pagename VARCHAR(100) NOT NULL, + hits INT NOT NULL DEFAULT 0, + pagedata TEXT NOT NULL DEFAULT '' + ); + CREATE UNIQUE INDEX :page_id + ON :page_tbl (id); + CREATE UNIQUE INDEX :page_nm + ON :page_tbl (pagename); + + \echo Dropping :version_tbl + DROP TABLE :version_tbl; + \echo Creating :version_tbl + CREATE TABLE :version_tbl ( + id INT NOT NULL, + version INT NOT NULL, + mtime INT NOT NULL, + --FIXME: should use boolean, but that returns 't' or 'f'. not 0 or 1. + minor_edit INT2 DEFAULT 0, + content TEXT NOT NULL DEFAULT '', + versiondata TEXT NOT NULL DEFAULT '' + ); + CREATE UNIQUE INDEX :vers_id + ON :version_tbl (id,version); + CREATE INDEX :vers_mtime + ON :version_tbl (mtime); + + \echo Dropping :recent_tbl + DROP TABLE :recent_tbl; + \echo Creating :recent_tbl + CREATE TABLE :recent_tbl ( + id INT NOT NULL, + latestversion INT, + latestmajor INT, + latestminor INT + ); + CREATE UNIQUE INDEX :recent_id + ON :recent_tbl (id); + + + \echo Dropping :nonempty_tbl + DROP TABLE :nonempty_tbl; + \echo Creating :nonempty_tbl + CREATE TABLE :nonempty_tbl ( + id INT NOT NULL + ); + CREATE UNIQUE INDEX :nonmt_id + ON :nonempty_tbl (id); + + \echo Dropping :link_tbl + DROP TABLE :link_tbl; + \echo Creating :link_tbl + CREATE TABLE :link_tbl ( + linkfrom INT NOT NULL, + linkto INT NOT NULL + ); + CREATE INDEX :link_from ON :link_tbl (linkfrom); + CREATE INDEX :link_to ON :link_tbl (linkto); + + + GRANT ALL ON :page_tbl TO :httpd_user; + GRANT ALL ON :version_tbl TO :httpd_user; + GRANT ALL ON :recent_tbl TO :httpd_user; + GRANT ALL ON :nonempty_tbl TO :httpd_user; + GRANT ALL ON :link_tbl TO :httpd_user; |