From 3cbb5225e37925c5325384d0181809d545e358b0 Mon Sep 17 00:00:00 2001 From: physikerwelt Date: Tue, 27 May 2014 05:53:46 +0000 Subject: [PATCH] Add separate database tables for Mathoid Add the tables needed for Mathoid. Bug: 65793 Change-Id: Ia8dcb11234dffb7bce67f9ca0e7ebf1279fd7620 --- Math.hooks.php | 8 ++++++++ db/mathoid.mysql.sql | 20 ++++++++++++++++++++ db/mathoid.postgres.sql | 20 ++++++++++++++++++++ db/mathoid.sqlite.sql | 20 ++++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 db/mathoid.mysql.sql create mode 100644 db/mathoid.postgres.sql create mode 100644 db/mathoid.sqlite.sql diff --git a/Math.hooks.php b/Math.hooks.php index 2579a34..51ea2f7 100644 --- a/Math.hooks.php +++ b/Math.hooks.php @@ -229,6 +229,14 @@ class MathHooks { throw new MWException( "Math extension does not currently support $type database for LaTeXML." ); } } + if ( in_array( MW_MATH_MATHML, $wgMathValidModes ) ) { + if ( in_array( $type, array( 'mysql', 'sqlite', 'postgres' ) ) ) { + $sql = dirname( __FILE__ ) . '/db/mathoid.' . $type . '.sql'; + $updater->addExtensionTable( 'mathoid', $sql ); + } else { + throw new MWException( "Math extension does not currently support $type database for Mathoid." ); + } + } } else { throw new MWException( "Math extension does not currently support $type database." ); } diff --git a/db/mathoid.mysql.sql b/db/mathoid.mysql.sql new file mode 100644 index 0000000..61abc57 --- /dev/null +++ b/db/mathoid.mysql.sql @@ -0,0 +1,20 @@ +-- +-- Used by the math module to keep track +-- of previously-rendered items. +-- +CREATE TABLE /*_*/mathoid ( + -- Binary MD5 hash of math_inputtex, used as an identifier key. + math_inputhash varbinary(16) NOT NULL PRIMARY KEY, + -- the user input + math_input text NOT NULL, + -- the validated tex + math_tex text, + -- MathML output LaTeXML + math_mathml text, + -- SVG output mathoid + math_svg text, + -- MW_MATHSTYLE_(INLINE_DISPLAYSTYLE|DISPLAY|INLINE) + math_style tinyint, + -- type of the Math input (TeX, MathML, AsciiMath...) + math_input_type tinyint +) /*$wgDBTableOptions*/; diff --git a/db/mathoid.postgres.sql b/db/mathoid.postgres.sql new file mode 100644 index 0000000..be705b0 --- /dev/null +++ b/db/mathoid.postgres.sql @@ -0,0 +1,20 @@ +-- +-- Used by the math module to keep track +-- of previously-rendered items. +-- +CREATE TABLE /*_*/mathoid ( + -- Binary MD5 hash of math_inputtex, used as an identifier key. + math_inputhash BYTEA PRIMARY KEY, + -- the user input + math_input TEXT NOT NULL, + -- the validated tex + math_tex TEXT, + -- MathML output LaTeXML + math_mathml TEXT, + -- SVG output mathoid + math_svg TEXT, + -- MW_MATHSTYLE_(INLINE_DISPLAYSTYLE|DISPLAY|INLINE) + math_style SMALLINT, + -- type of the Math input (TeX, MathML, AsciiMath...) + math_input_type SMALLINT +) /*$wgDBTableOptions*/; diff --git a/db/mathoid.sqlite.sql b/db/mathoid.sqlite.sql new file mode 100644 index 0000000..61abc57 --- /dev/null +++ b/db/mathoid.sqlite.sql @@ -0,0 +1,20 @@ +-- +-- Used by the math module to keep track +-- of previously-rendered items. +-- +CREATE TABLE /*_*/mathoid ( + -- Binary MD5 hash of math_inputtex, used as an identifier key. + math_inputhash varbinary(16) NOT NULL PRIMARY KEY, + -- the user input + math_input text NOT NULL, + -- the validated tex + math_tex text, + -- MathML output LaTeXML + math_mathml text, + -- SVG output mathoid + math_svg text, + -- MW_MATHSTYLE_(INLINE_DISPLAYSTYLE|DISPLAY|INLINE) + math_style tinyint, + -- type of the Math input (TeX, MathML, AsciiMath...) + math_input_type tinyint +) /*$wgDBTableOptions*/;