To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit daaaec24 authored by vermeul's avatar vermeul
Browse files

bugfixes in hook function definitions

parent 2f7c5ab2
...@@ -235,7 +235,7 @@ EOT; ...@@ -235,7 +235,7 @@ EOT;
// //
// Render the output of {{#annotcat: list}}. // Render the output of {{#annotcat: list}}.
// //
public static function annotation_categories( $parser, $method, $start_with ) { public static function annotation_categories( $parser, $method, $start_with=null ) {
if (! $method == "list") { if (! $method == "list") {
return ""; return "";
} }
...@@ -618,7 +618,7 @@ EOT; ...@@ -618,7 +618,7 @@ EOT;
} }
// manage any categories added // manage any categories added
public static function manage_categories( $dbw, $data, $status) { public static function manage_categories( $dbw, $data) {
# look for all tags {{#annotcat:(.*)}} # look for all tags {{#annotcat:(.*)}}
# and pass the matches to the callback function category_add_del_callback # and pass the matches to the callback function category_add_del_callback
# which will return an empty string in order to remove this tag before saving the page. # which will return an empty string in order to remove this tag before saving the page.
...@@ -672,7 +672,7 @@ EOT; ...@@ -672,7 +672,7 @@ EOT;
id => 'c.id', id => 'c.id',
name => 'c.name', name => 'c.name',
description => 'c.description', description => 'c.description',
parent_name => '""', parent_name => "''",
parent_id => 'c.parent_id' parent_id => 'c.parent_id'
), ),
array( array(
...@@ -1000,13 +1000,13 @@ EOT; ...@@ -1000,13 +1000,13 @@ EOT;
// first hook called when editing a page // first hook called when editing a page
// even before any checks whether a user is allowed to // even before any checks whether a user is allowed to
public static function onAlternateEdit(&$editPage) { public static function onAlternateEdit($editPage) {
} }
// transforms all categories from their internal ID to a text. // transforms all categories from their internal ID to a text.
// This allows us to change the category names later without having // This allows us to change the category names later without having
// to change all source code where this category occurs. // to change all source code where this category occurs.
public static function onEditFormInitialText(&$editPage) { public static function onEditFormInitialText($editPage) {
$data = $editPage->textbox1; $data = $editPage->textbox1;
$data = preg_replace_callback( $data = preg_replace_callback(
'/(?:{{#annot:(?P<params>.*?)}})/s', '/(?:{{#annot:(?P<params>.*?)}})/s',
......
--
-- Tables for the YATA extension
--
-- Annotations table
CREATE TABLE /*_*/yata_annotation (
-- unique identifier for every annotation
id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-- the comment itself.
comment blob,
-- the wiki text which is annotated
wiki_text blob,
-- foreign key to page.page_id
page_id int unsigned NOT NULL,
-- foreign key to user.user_id
user_id int unsigned NOT NULL,
-- start position of the annotation according to the wiki sourcecode
start_char int unsigned,
-- a unique bookmark for every annotation
-- so we later can link directly to the part
-- of the page an annotation was found.
bookmark varchar(6),
insert_date varbinary(14),
modified_date varbinary(14)
)/*$wgDBTableOptions*/;
CREATE INDEX /*i*/yata_annot_page ON /*_*/yata_annotation (page_id);
CREATE INDEX /*i*/yata_annot_user ON /*_*/yata_annotation (user_id);
--
-- Tables for the YATA extension
--
-- Many to many table for annotation and category.
-- Any given annotation can be assigned to more than one category.
CREATE TABLE /*_*/yata_annotation_category (
-- foreign key to a page (for faster lookups)
page_id int unsigned NOT NULL,
-- foreign key to an annotation
annotation_id int unsigned NOT NULL,
-- foreign key to a category
category_id int unsigned NOT NULL
)/*$wgDBTableOptions*/;
CREATE INDEX /*i*/yata_ann_cat_page_idx ON /*_*/yata_annotation_category (page_id);
CREATE INDEX /*i*/yata_ann_cat_annotation_idx ON /*_*/yata_annotation_category (annotation_id);
CREATE INDEX /*i*/yata_ann_cat_category_idx ON /*_*/yata_annotation_category (category_id);
--
-- Tables for the YATA extension
--
-- Annotation Category table
-- Annotation category table
CREATE TABLE /*_*/yata_category (
-- unique identifier for every annotation category
id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
name varchar(255),
description blob,
-- categories are organized as a tree
parent_id int unsigned
);
CREATE INDEX /*i*/yata_category_name ON /*_*/yata_category (name);
CREATE INDEX /*i*/yata_category_parent ON /*_*/yata_category (parent_id);
--
-- Tables for the YATA extension
--
-- Annotations table
CREATE TABLE mediawiki.yata_annotation
(
id SERIAL NOT NULL,
comment TEXT,
wiki_text TEXT,
page_id INT NOT NULL,
user_id INT NOT NULL,
start_char INT,
bookmark VARCHAR (10),
insert_date timestamp (6) WITH TIME ZONE,
modified_date timestamp (6) WITH TIME ZONE,
PRIMARY KEY (id)
);
--CREATE TABLE /*_*/yata_annotation (
-- -- unique identifier for every annotation
-- id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
--
-- -- the comment itself.
-- comment blob,
--
-- -- the wiki text which is annotated
-- wiki_text blob,
--
-- -- foreign key to page.page_id
-- page_id int unsigned NOT NULL,
--
-- -- foreign key to user.user_id
-- user_id int unsigned NOT NULL,
--
-- -- start position of the annotation according to the wiki sourcecode
-- start_char int unsigned,
--
-- -- a unique bookmark for every annotation
-- -- so we later can link directly to the part
-- -- of the page an annotation was found.
-- bookmark varchar(6),
--
-- insert_date varbinary(14),
-- modified_date varbinary(14)
--
--)/*$wgDBTableOptions*/;
CREATE INDEX yata_annot_page_idx ON mediawiki.yata_annotation (page_id);
CREATE INDEX yata_annot_user_idx ON mediawiki.yata_annotation (user_id);
--
-- Tables for the YATA extension
--
-- Many to many table for annotation and category.
-- Any given annotation can be assigned to more than one category.
CREATE TABLE mediawiki.yata_annotation_category
(
page_id INT NOT NULL,
annotation_id INT NOT NULL,
category_id INT NOT NULL
);
--CREATE TABLE /*_*/yata_annotation_category (
--
-- -- foreign key to a page (for faster lookups)
-- page_id int unsigned NOT NULL,
--
-- -- foreign key to an annotation
-- annotation_id int unsigned NOT NULL,
--
-- -- foreign key to a category
-- category_id int unsigned NOT NULL
--)/*$wgDBTableOptions*/;
CREATE INDEX yata_ann_cat_page_idx ON mediawiki.yata_annotation_category (page_id)
CREATE INDEX yata_ann_cat_annotation_idx ON mediawiki.yata_annotation_category (annotation_id)
CREATE INDEX yata_ann_cat_category_idx ON mediawiki.yata_annotation_category (category_id)
--
-- Tables for the YATA extension
--
-- Annotation Category table
-- Annotation category table
CREATE TABLE mediawiki.yata_category
(
id SERIAL NOT NULL,
"name" VARCHAR (255),
description TEXT,
parent_id INT,
PRIMARY KEY (id)
);
--CREATE TABLE /*_*/yata_category (
-- -- unique identifier for every annotation category
-- id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-- name varchar(255),
-- description blob,
-- -- categories are organized as a tree
-- parent_id int unsigned
--);
CREATE INDEX yata_category_name_idx ON mediawiki.yata_category (name);
CREATE INDEX yata_category_parent_idx ON mediawiki.yata_category (parent_id);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment