Improve mathtable
* Add primary key to mathtable * Unify naming of database files Bug: 65525 Change-Id: I4f4d31c281257014734e9e3a8d7f1506855ea6d9
This commit is contained in:
parent
86617af1db
commit
ed570661de
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* MediaWiki math extension
|
||||
*
|
||||
* (c) 2002-2012 various MediaWiki contributors
|
||||
* (c) 2002-2014 various MediaWiki contributors
|
||||
* GPLv2 license; info in main package.
|
||||
*/
|
||||
|
||||
|
@ -176,8 +176,7 @@ class MathHooks {
|
|||
MW_MATH_SOURCE => 'mw_math_source',
|
||||
MW_MATH_PNG => 'mw_math_png',
|
||||
MW_MATH_MATHML => 'mw_math_mathml',
|
||||
MW_MATH_LATEXML => 'mw_math_latexml',
|
||||
MW_MATH_MATHJAX => 'mw_math_mathjax'
|
||||
MW_MATH_LATEXML => 'mw_math_latexml'
|
||||
);
|
||||
$names = array();
|
||||
foreach ( $wgMathValidModes as $mode ) {
|
||||
|
@ -214,19 +213,13 @@ class MathHooks {
|
|||
throw new MWException( 'Math extension is only necessary in 1.18 or above' );
|
||||
}
|
||||
|
||||
$map = array(
|
||||
'mysql' => 'math.sql',
|
||||
'sqlite' => 'math.sql',
|
||||
'postgres' => 'math.pg.sql',
|
||||
'oracle' => 'math.oracle.sql',
|
||||
'mssql' => 'math.mssql.sql',
|
||||
);
|
||||
$map = array( 'mysql', 'sqlite', 'postgres', 'oracle', 'mssql' );
|
||||
|
||||
$type = $updater->getDB()->getType();
|
||||
|
||||
if ( isset( $map[$type] ) ) {
|
||||
$sql = dirname( __FILE__ ) . '/db/' . $map[$type];
|
||||
$updater->addExtensionTable( 'math', $sql );
|
||||
if ( in_array( $type, $map ) ) {
|
||||
$sql = dirname( __FILE__ ) . '/db/math.' . $type . '.sql';
|
||||
$updater->addExtensionTable( 'math', $sql );
|
||||
} else {
|
||||
throw new MWException( "Math extension does not currently support $type database." );
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
--
|
||||
CREATE TABLE /*_*/math (
|
||||
-- Binary MD5 hash of the latex fragment, used as an identifier key.
|
||||
math_inputhash varbinary(16) NOT NULL,
|
||||
math_inputhash varbinary(16) NOT NULL PRIMARY KEY,
|
||||
|
||||
-- Not sure what this is, exactly...
|
||||
math_outputhash varbinary(16) NOT NULL,
|
||||
|
@ -19,5 +19,3 @@ CREATE TABLE /*_*/math (
|
|||
-- MathML output from texvc, or from LaTeXML
|
||||
math_mathml text
|
||||
) /*$wgDBTableOptions*/;
|
||||
|
||||
CREATE UNIQUE INDEX /*i*/math_inputhash ON /*_*/math (math_inputhash);
|
|
@ -0,0 +1,21 @@
|
|||
--
|
||||
-- Used by the math module to keep track
|
||||
-- of previously-rendered items.
|
||||
--
|
||||
CREATE TABLE /*_*/math (
|
||||
-- Binary MD5 hash of the latex fragment, used as an identifier key.
|
||||
math_inputhash varbinary(16) NOT NULL PRIMARY KEY,
|
||||
|
||||
-- Not sure what this is, exactly...
|
||||
math_outputhash varbinary(16) NOT NULL,
|
||||
|
||||
-- texvc reports how well it thinks the HTML conversion worked;
|
||||
-- if it's a low level the PNG rendering may be preferred.
|
||||
math_html_conservativeness tinyint NOT NULL,
|
||||
|
||||
-- HTML output from texvc, if any
|
||||
math_html text,
|
||||
|
||||
-- MathML output from texvc, or from LaTeXML
|
||||
math_mathml text
|
||||
) /*$wgDBTableOptions*/;
|
Loading…
Reference in New Issue