| Index: trunk/phase3/maintenance/archives/patch-math.sql |
| — | — | @@ -1,28 +0,0 @@ |
| 2 | | - |
| 3 | | - |
| 4 | | -DROP TABLE IF EXISTS /*$wgDBprefix*/math; |
| 5 | | -CREATE TABLE /*$wgDBprefix*/math ( |
| 6 | | - -- Binary MD5 hash of the latex fragment, used as an identifier key. |
| 7 | | - math_inputhash varbinary(16) NOT NULL, |
| 8 | | - |
| 9 | | - -- Not sure what this is, exactly... |
| 10 | | - math_outputhash varbinary(16) NOT NULL, |
| 11 | | - |
| 12 | | - -- texvc reports how well it thinks the HTML conversion worked; |
| 13 | | - -- if it's a low level the PNG rendering may be preferred. |
| 14 | | - math_html_conservativeness tinyint NOT NULL, |
| 15 | | - |
| 16 | | - -- HTML output from texvc, if any |
| 17 | | - math_html text, |
| 18 | | - |
| 19 | | - -- MathML output from texvc, if any |
| 20 | | - math_mathml text, |
| 21 | | - |
| 22 | | - UNIQUE KEY math_inputhash (math_inputhash) |
| 23 | | - |
| 24 | | -) /*$wgDBTableOptions*/; |
| Index: trunk/phase3/maintenance/postgres/tables.sql |
| — | — | @@ -399,15 +399,7 @@ |
| 400 | 400 | CREATE UNIQUE INDEX wl_user_namespace_title ON watchlist (wl_namespace, wl_title, wl_user); |
| 401 | 401 | CREATE INDEX wl_user ON watchlist (wl_user); |
| 402 | 402 | |
| 403 | | -CREATE TABLE math ( |
| 404 | | - math_inputhash BYTEA NOT NULL UNIQUE, |
| 405 | | - math_outputhash BYTEA NOT NULL, |
| 406 | | - math_html_conservativeness SMALLINT NOT NULL, |
| 407 | | - math_html TEXT, |
| 408 | | - math_mathml TEXT |
| 409 | | -); |
| 410 | 403 | |
| 411 | | - |
| 412 | 404 | CREATE TABLE interwiki ( |
| 413 | 405 | iw_prefix TEXT NOT NULL UNIQUE, |
| 414 | 406 | iw_url TEXT NOT NULL, |
| Index: trunk/phase3/maintenance/oracle/tables.sql |
| — | — | @@ -405,15 +405,6 @@ |
| 406 | 406 | CREATE INDEX &mw_prefix.watchlist_i01 ON &mw_prefix.watchlist (wl_namespace, wl_title); |
| 407 | 407 | |
| 408 | 408 | |
| 409 | | -CREATE TABLE &mw_prefix.math ( |
| 410 | | - math_inputhash VARCHAR2(32) NOT NULL, |
| 411 | | - math_outputhash VARCHAR2(32) NOT NULL, |
| 412 | | - math_html_conservativeness NUMBER NOT NULL, |
| 413 | | - math_html CLOB, |
| 414 | | - math_mathml CLOB |
| 415 | | -); |
| 416 | | -CREATE UNIQUE INDEX &mw_prefix.math_u01 ON &mw_prefix.math (math_inputhash); |
| 417 | | - |
| 418 | 409 | CREATE TABLE &mw_prefix.searchindex ( |
| 419 | 410 | si_page NUMBER NOT NULL, |
| 420 | 411 | si_title VARCHAR2(255) DEFAULT '' NOT NULL, |
| Index: trunk/phase3/maintenance/mssql/tables.sql |
| — | — | @@ -545,18 +545,6 @@ |
| 546 | 546 | ); |
| 547 | 547 | CREATE UNIQUE INDEX /*$wgDBprefix*/namespace_title ON /*$wgDBprefix*/watchlist(wl_namespace,wl_title); |
| 548 | 548 | |
| 549 | | -CREATE TABLE /*$wgDBprefix*/math ( |
| 550 | | - math_inputhash varbinary(16) NOT NULL PRIMARY KEY, |
| 551 | | - math_outputhash varbinary(16) NOT NULL, |
| 552 | | - math_html_conservativeness tinyint NOT NULL, |
| 553 | | - math_html NVARCHAR(MAX), |
| 554 | | - math_mathml NVARCHAR(MAX), |
| 555 | | -); |
| 556 | | - |
| 557 | 549 | -- Needs fulltext index. |
| 558 | 550 | CREATE TABLE /*$wgDBprefix*/searchindex ( |
| 559 | 551 | si_page INT NOT NULL unique REFERENCES /*$wgDBprefix*/page(page_id) ON DELETE CASCADE, |
| Index: trunk/phase3/maintenance/ibm_db2/tables.sql |
| — | — | @@ -445,15 +445,6 @@ |
| 446 | 446 | CREATE UNIQUE INDEX wl_user_namespace_title ON watchlist (wl_namespace, wl_title, wl_user); |
| 447 | 447 | |
| 448 | 448 | |
| 449 | | -CREATE TABLE math ( |
| 450 | | - math_inputhash VARCHAR(16) FOR BIT DATA NOT NULL UNIQUE, |
| 451 | | - math_outputhash VARCHAR(16) FOR BIT DATA NOT NULL, |
| 452 | | - math_html_conservativeness SMALLINT NOT NULL, |
| 453 | | - math_html CLOB(64K) INLINE LENGTH 4096, |
| 454 | | - math_mathml CLOB(64K) INLINE LENGTH 4096 |
| 455 | | -); |
| 456 | | - |
| 457 | | - |
| 458 | 449 | CREATE TABLE interwiki ( |
| 459 | 450 | iw_prefix VARCHAR(32) NOT NULL UNIQUE, |
| 460 | 451 | iw_url CLOB(64K) INLINE LENGTH 4096 NOT NULL, |
| Index: trunk/phase3/maintenance/tables.sql |
| — | — | @@ -1032,31 +1032,6 @@ |
| 1033 | 1033 | |
| 1034 | 1034 | |
| 1035 | 1035 | -- |
| 1036 | | -CREATE TABLE /*_*/math ( |
| 1037 | | - -- Binary MD5 hash of the latex fragment, used as an identifier key. |
| 1038 | | - math_inputhash varbinary(16) NOT NULL, |
| 1039 | | - |
| 1040 | | - -- Not sure what this is, exactly... |
| 1041 | | - math_outputhash varbinary(16) NOT NULL, |
| 1042 | | - |
| 1043 | | - -- texvc reports how well it thinks the HTML conversion worked; |
| 1044 | | - -- if it's a low level the PNG rendering may be preferred. |
| 1045 | | - math_html_conservativeness tinyint NOT NULL, |
| 1046 | | - |
| 1047 | | - -- HTML output from texvc, if any |
| 1048 | | - math_html text, |
| 1049 | | - |
| 1050 | | - -- MathML output from texvc, if any |
| 1051 | | - math_mathml text |
| 1052 | | -) /*$wgDBTableOptions*/; |
| 1053 | | - |
| 1054 | | -CREATE UNIQUE INDEX /*i*/math_inputhash ON /*_*/math (math_inputhash); |
| 1055 | | - |
| 1056 | | - |
| 1057 | 1036 | -- When using the default MySQL search backend, page titles |
| 1058 | 1037 | -- and text are munged to strip markup, do Unicode case folding, |
| 1059 | 1038 | -- and prepare the result for MySQL's fulltext index. |
| Index: trunk/phase3/tests/parser/parserTest.inc |
| — | — | @@ -707,7 +707,7 @@ |
| 708 | 708 | 'protected_titles', 'revision', 'text', 'pagelinks', 'imagelinks', |
| 709 | 709 | 'categorylinks', 'templatelinks', 'externallinks', 'langlinks', 'iwlinks', |
| 710 | 710 | 'site_stats', 'hitcounter', 'ipblocks', 'image', 'oldimage', |
| 711 | | - 'recentchanges', 'watchlist', 'math', 'interwiki', 'logging', |
| | 711 | + 'recentchanges', 'watchlist', 'interwiki', 'logging', |
| 712 | 712 | 'querycache', 'objectcache', 'job', 'l10n_cache', 'redirect', 'querycachetwo', |
| 713 | 713 | 'archive', 'user_groups', 'page_props', 'category', 'msg_resource', 'msg_resource_links' |
| 714 | 714 | ); |
| Index: trunk/extensions/Math/Math.php |
| — | — | @@ -87,6 +87,8 @@ |
| 88 | 88 | $wgExtensionFunctions[] = 'MathHooks::setup'; |
| 89 | 89 | $wgHooks['ParserFirstCallInit'][] = 'MathHooks::onParserFirstCallInit'; |
| 90 | 90 | $wgHooks['GetPreferences'][] = 'MathHooks::onGetPreferences'; |
| | 91 | +$wgHooks['LoadExtensionSchemaUpdates'][] = 'MathHooks::onLoadExtensionSchemaUpdates'; |
| | 92 | +$wgHooks['ParserTestTables'][] = 'MathHooks::onParserTestTables'; |
| 91 | 93 | |
| 92 | 94 | $dir = dirname( __FILE__ ) . '/'; |
| 93 | 95 | $wgAutoloadClasses['MathHooks'] = $dir . 'Math.hooks.php'; |
| Index: trunk/extensions/Math/Math.hooks.php |
| — | — | @@ -97,4 +97,44 @@ |
| 98 | 98 | |
| 99 | 99 | return true; |
| 100 | 100 | } |
| | 101 | + |
| | 102 | + /** |
| | 103 | + * LoadExtensionSchemaUpdates handler; set up math table on install/upgrade. |
| | 104 | + * |
| | 105 | + * @param $updater DatabaseUpdater |
| | 106 | + * @return bool |
| | 107 | + */ |
| | 108 | + static function onLoadExtensionSchemaUpdates( $updater ) { |
| | 109 | + $map = array( |
| | 110 | + 'mysql' => 'math.sql', |
| | 111 | + 'sqlite' => 'math.sql', |
| | 112 | + 'postgres' => 'math.pg.sql', |
| | 113 | + 'oracle' => 'math.oracle.sql', |
| | 114 | + 'mssql' => 'math.mssql.sql', |
| | 115 | + 'db2' => 'math.db2.sql', |
| | 116 | + ); |
| | 117 | + $base = dirname( __FILE__ ); |
| | 118 | + $type = $updater->getDB()->getType(); |
| | 119 | + if ( array_key_exists( $type, $map ) ) { |
| | 120 | + $file = $map[$type]; |
| | 121 | + $sql = "$base/db/$file"; |
| | 122 | + $updater->addNewExtension( 'CodeReview', $sql ); |
| | 123 | + $updater->addExtensionTable( 'math', $sql ); |
| | 124 | + } else { |
| | 125 | + throw new MWException( "Math extension does not currently support $type database." ); |
| | 126 | + } |
| | 127 | + return true; |
| | 128 | + } |
| | 129 | + |
| | 130 | + /** |
| | 131 | + * Add 'math' table to the list of tables that need to be copied to |
| | 132 | + * temporary tables for parser tests to run. |
| | 133 | + * |
| | 134 | + * @param array $tables |
| | 135 | + * @return bool |
| | 136 | + */ |
| | 137 | + function onParserTestTables( &$tables ) { |
| | 138 | + $tables[] = 'math'; |
| | 139 | + return true; |
| | 140 | + } |
| 101 | 141 | } |
| Index: trunk/extensions/Math/db/math.mssql.sql |
| — | — | @@ -0,0 +1,11 @@ |
| | 2 | +-- |
| | 3 | +-- Used by the math module to keep track |
| | 4 | +-- of previously-rendered items. |
| | 5 | +-- |
| | 6 | +CREATE TABLE /*$wgDBprefix*/math ( |
| | 7 | + math_inputhash varbinary(16) NOT NULL PRIMARY KEY, |
| | 8 | + math_outputhash varbinary(16) NOT NULL, |
| | 9 | + math_html_conservativeness tinyint NOT NULL, |
| | 10 | + math_html NVARCHAR(MAX), |
| | 11 | + math_mathml NVARCHAR(MAX), |
| | 12 | +); |
| Index: trunk/extensions/Math/db/math.sql |
| — | — | @@ -0,0 +1,23 @@ |
| | 2 | +-- |
| | 3 | +-- Used by the math module to keep track |
| | 4 | +-- of previously-rendered items. |
| | 5 | +-- |
| | 6 | +CREATE TABLE /*_*/math ( |
| | 7 | + -- Binary MD5 hash of the latex fragment, used as an identifier key. |
| | 8 | + math_inputhash varbinary(16) NOT NULL, |
| | 9 | + |
| | 10 | + -- Not sure what this is, exactly... |
| | 11 | + math_outputhash varbinary(16) NOT NULL, |
| | 12 | + |
| | 13 | + -- texvc reports how well it thinks the HTML conversion worked; |
| | 14 | + -- if it's a low level the PNG rendering may be preferred. |
| | 15 | + math_html_conservativeness tinyint NOT NULL, |
| | 16 | + |
| | 17 | + -- HTML output from texvc, if any |
| | 18 | + math_html text, |
| | 19 | + |
| | 20 | + -- MathML output from texvc, if any |
| | 21 | + math_mathml text |
| | 22 | +) /*$wgDBTableOptions*/; |
| | 23 | + |
| | 24 | +CREATE UNIQUE INDEX /*i*/math_inputhash ON /*_*/math (math_inputhash); |
| Index: trunk/extensions/Math/db/math.oracle.sql |
| — | — | @@ -0,0 +1,8 @@ |
| | 2 | +CREATE TABLE &mw_prefix.math ( |
| | 3 | + math_inputhash VARCHAR2(32) NOT NULL, |
| | 4 | + math_outputhash VARCHAR2(32) NOT NULL, |
| | 5 | + math_html_conservativeness NUMBER NOT NULL, |
| | 6 | + math_html CLOB, |
| | 7 | + math_mathml CLOB |
| | 8 | +); |
| | 9 | +CREATE UNIQUE INDEX &mw_prefix.math_u01 ON &mw_prefix.math (math_inputhash); |
| Index: trunk/extensions/Math/db/math.pg.sql |
| — | — | @@ -0,0 +1,7 @@ |
| | 2 | +CREATE TABLE math ( |
| | 3 | + math_inputhash BYTEA NOT NULL UNIQUE, |
| | 4 | + math_outputhash BYTEA NOT NULL, |
| | 5 | + math_html_conservativeness SMALLINT NOT NULL, |
| | 6 | + math_html TEXT, |
| | 7 | + math_mathml TEXT |
| | 8 | +); |
| Index: trunk/extensions/Math/db/math.db2.sql |
| — | — | @@ -0,0 +1,7 @@ |
| | 2 | +CREATE TABLE math ( |
| | 3 | + math_inputhash VARCHAR(16) FOR BIT DATA NOT NULL UNIQUE, |
| | 4 | + math_outputhash VARCHAR(16) FOR BIT DATA NOT NULL, |
| | 5 | + math_html_conservativeness SMALLINT NOT NULL, |
| | 6 | + math_html CLOB(64K) INLINE LENGTH 4096, |
| | 7 | + math_mathml CLOB(64K) INLINE LENGTH 4096 |
| | 8 | +); |