Difference between revisions of "lensowiki:Installation caveats"

From lensowiki
Jump to: navigation, search
(updates)
Line 2: Line 2:
 
==MySQL table field lengths==
 
==MySQL table field lengths==
 
===New installations===
 
===New installations===
The current MediaWiki install, 1.7.1 · 2006-07-08, will run into two problems upon trying to initialize all the initial MySQL tables if those tables are encoded in UTF8. The reason this happens is that KEY fields are limited to 1000 bytes, and each character takes up 3 bytes in UTF. When the key fields contain a combination of columns whose combined number of bytes exceeds 1000, the installation will bail.
+
The current MediaWiki install, 1.11.0, will run into two problems upon trying to initialize all the initial MySQL tables if those tables are encoded in UTF8. The reason this happens is that KEY fields are limited to 1000 bytes, and each character takes up 3 bytes in UTF. When the key fields contain a combination of columns whose combined number of bytes exceeds 1000, the installation will bail.
  
 
The obvious solution to this is to encode your tables in a different encoding. But what if you want to still use UTF8? There is a solution.
 
The obvious solution to this is to encode your tables in a different encoding. But what if you want to still use UTF8? There is a solution.
Line 9: Line 9:
  
 
In categorylinks, you need to change the following line:
 
In categorylinks, you need to change the following line:
   KEY cl_sortkey(cl_to,cl_sortkey),
+
   KEY cl_sortkey(cl_to,cl_sortkey,cl_from),
 
to
 
to
   KEY cl_sortkey(cl_to(253),cl_sortkey),
+
   KEY cl_sortkey(cl_to(160),cl_sortkey,cl_from),
 
To find the line, open the file in your favorite text editor, and search for '''/cat'''. Scroll down until you see the original line as shown above.
 
To find the line, open the file in your favorite text editor, and search for '''/cat'''. Scroll down until you see the original line as shown above.
  
Line 19: Line 19:
 
   KEY (job_cmd(166), job_namespace, job_title(166))
 
   KEY (job_cmd(166), job_namespace, job_title(166))
 
To find the line, search for '''/jobs'''. Scroll down until you see the original line as shown above.
 
To find the line, search for '''/jobs'''. Scroll down until you see the original line as shown above.
 
  
 
This guarantees that they keys are short enough so that the install won't bail.
 
This guarantees that they keys are short enough so that the install won't bail.
 
===MySQL 5===
 
If you turn on experimental MySQL 5 UTF-8 handling, the file you need to patch is  '''/maintenance/mysql5/tables.sql'''. In addition, the <code>cl_sortkey</code> key in <code>categorylinks</code> is apparently too big. Therefore, instead of the change posted above, use
 
  KEY cl_sortkey(cl_to(247),cl_sortkey),
 
  
 
===Upgrades===
 
===Upgrades===
Upgrades are plagued by the same problem and require a similar workaround. However, the files to patch are '''/maintenance/archives/patch-categorylinks.sql''' and '''/maintenance/archives/patch-job.sql''', respectively.
+
Upgrades are plagued by the same problem and require a similar workaround. However, the files to patch are '''/maintenance/archives/patch-categorylinksindex.sql''' and '''/maintenance/archives/patch-job.sql''', respectively. You might also need to change <code>KEY cl_sortkey(cl_to,cl_sortkey)</code> to <code>KEY cl_sortkey(cl_to(253),cl_sortkey)</code> in '''/maintenance/archives/patch-categorylinks.sql'''.
  
 
===References===
 
===References===
Line 37: Line 32:
 
==Interwiki links==
 
==Interwiki links==
 
The initial interwiki table does not include the shorthand keys <code>w</code>, <code>m</code>, and <code>mw</code>; you have to add them manually. However, even after you add them, you have to create at least one new interwiki link for the MediaWiki software to "re-read" the interwiki prefix table and actually make the links functional. You only need to do this once as an administrator, and the newly-created link can then be immediately deleted.
 
The initial interwiki table does not include the shorthand keys <code>w</code>, <code>m</code>, and <code>mw</code>; you have to add them manually. However, even after you add them, you have to create at least one new interwiki link for the MediaWiki software to "re-read" the interwiki prefix table and actually make the links functional. You only need to do this once as an administrator, and the newly-created link can then be immediately deleted.
 +
 
===References===
 
===References===
 
*http://meta.wikimedia.org/wiki/Help:Guide_for_system_administrators_for_setting_up_interwiki_linking#Admin_tips
 
*http://meta.wikimedia.org/wiki/Help:Guide_for_system_administrators_for_setting_up_interwiki_linking#Admin_tips
 +
 +
==Short article URLs==
 +
When <tt>$wgArticlePath = "$wgScriptPath/$1"</tt> and Apache rewrite rules look something like the following:
 +
Options FollowSymLinks
 +
RewriteEngine On
 +
RewriteCond %{REQUEST_FILENAME} !-f
 +
RewriteCond %{REQUEST_FILENAME} !-d
 +
RewriteRule ^(.+)$ index.php?title=$1 [L,QSA]
 +
any URLs containing index.php as part of a fully-qualified URL (such as http://wiki.lensovet.byethost12.com/index.php?title=lensowiki:Installation_caveats&action=edit) will be parsed incorrectly by the MediaWiki software. A patch provided by Zach Dennison works perfectly to remedy this situation. In essence, add the following lines at line 121 in '''includes/WebRequest.php''':
 +
/**
 +
* If $raw starts with the script path, followed by the script,
 +
* then we need to remove it so that things like stylesheets
 +
* load properly when using rewrite rules.
 +
*/
 +
global $wgScriptPath, $wgScriptExtension;
 +
$scriptLen = strlen( "$wgScriptPath/index$wgScriptExtension" );
 +
if( substr( $path, 0, $scriptLen ) == "$wgScriptPath/index$wgScriptExtension" ) {
 +
  $path = substr( $path, $scriptLen );
 +
}
 +
(these should go between <tt>$base = str_replace( <nowiki>'$1', '', $base</nowiki> );</tt> and <tt>$baseLen = strlen( $base );</tt>).
 +
 +
===References===
 +
http://bugzilla.wikimedia.org/show_bug.cgi?id=11428
  
 
[[Category:MediaWiki User's Guide]]
 
[[Category:MediaWiki User's Guide]]

Revision as of 08:27, 15 November 2007

Upon installing the Mediawiki software, I ran into a few problems. Here, I document fully functional workarounds and solutions to the problems I encountered.

MySQL table field lengths

New installations

The current MediaWiki install, 1.11.0, will run into two problems upon trying to initialize all the initial MySQL tables if those tables are encoded in UTF8. The reason this happens is that KEY fields are limited to 1000 bytes, and each character takes up 3 bytes in UTF. When the key fields contain a combination of columns whose combined number of bytes exceeds 1000, the installation will bail.

The obvious solution to this is to encode your tables in a different encoding. But what if you want to still use UTF8? There is a solution.

As of 1.7.1, there are two tables affected by this problem: categorylinks and jobs (The key is 2 * (255 255 8) = 1032). Both of these changes need to be made in /maintenance/tables.sql before running the initial configuration.

In categorylinks, you need to change the following line:

 KEY cl_sortkey(cl_to,cl_sortkey,cl_from),

to

 KEY cl_sortkey(cl_to(160),cl_sortkey,cl_from),

To find the line, open the file in your favorite text editor, and search for /cat. Scroll down until you see the original line as shown above.

In jobs, you need to change

 KEY (job_cmd, job_namespace, job_title)

to

 KEY (job_cmd(166), job_namespace, job_title(166))

To find the line, search for /jobs. Scroll down until you see the original line as shown above.

This guarantees that they keys are short enough so that the install won't bail.

Upgrades

Upgrades are plagued by the same problem and require a similar workaround. However, the files to patch are /maintenance/archives/patch-categorylinksindex.sql and /maintenance/archives/patch-job.sql, respectively. You might also need to change KEY cl_sortkey(cl_to,cl_sortkey) to KEY cl_sortkey(cl_to(253),cl_sortkey) in /maintenance/archives/patch-categorylinks.sql.

References

These bugs are actually filed on the MediaWiki bugzilla. See

Interwiki links

The initial interwiki table does not include the shorthand keys w, m, and mw; you have to add them manually. However, even after you add them, you have to create at least one new interwiki link for the MediaWiki software to "re-read" the interwiki prefix table and actually make the links functional. You only need to do this once as an administrator, and the newly-created link can then be immediately deleted.

References

Short article URLs

When $wgArticlePath = "$wgScriptPath/$1" and Apache rewrite rules look something like the following:

Options FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?title=$1 [L,QSA]

any URLs containing index.php as part of a fully-qualified URL (such as http://wiki.lensovet.byethost12.com/index.php?title=lensowiki:Installation_caveats&action=edit) will be parsed incorrectly by the MediaWiki software. A patch provided by Zach Dennison works perfectly to remedy this situation. In essence, add the following lines at line 121 in includes/WebRequest.php:

/**
* If $raw starts with the script path, followed by the script,
* then we need to remove it so that things like stylesheets
* load properly when using rewrite rules.
*/
global $wgScriptPath, $wgScriptExtension;
$scriptLen = strlen( "$wgScriptPath/index$wgScriptExtension" );
if( substr( $path, 0, $scriptLen ) == "$wgScriptPath/index$wgScriptExtension" ) {
  $path = substr( $path, $scriptLen );
}

(these should go between $base = str_replace( '$1', '', $base ); and $baseLen = strlen( $base );).

References

http://bugzilla.wikimedia.org/show_bug.cgi?id=11428