Difference between revisions of "lensowiki:Installation caveats"

From lensowiki
Jump to: navigation, search
m (References: +navbox)
m (Updating MySQL on Mac OS X: formatting and typo fixes)
 
(One intermediate revision by the same user not shown)
Line 58: Line 58:
 
===References===
 
===References===
 
*http://bugzilla.wikimedia.org/show_bug.cgi?id=11428
 
*http://bugzilla.wikimedia.org/show_bug.cgi?id=11428
 +
 +
==Updating MySQL on Mac OS X==
 +
I just went through a prolonged ordeal to upgrade MySQL from 5.1.30 to 5.1.47, so I'm going to write down some steps so that I don't hit so many dead-ends in the future. Note that this presumes that you have already done a DB dump of your wiki database (i.e. SequelPro's Export… command).
 +
 +
The installer does not detect the presence of an older installation, and as a result, leaves the old data directory untouched. In retrospect, you could probably just move it and all would be well. Alternatively, you can recreate your databases as well. Here's what I did.
 +
 +
* First, to run the <tt>mysql_upgrade</tt> script, enable the root user in Directory Utility (which is now in CoreServices, or accessible from the Accounts prefpane).
 +
* <tt>su -</tt>
 +
* <tt>su _mysql -c "/usr/local/mysql/mysql_upgrade"</tt>
 +
* <tt>logout</tt>
 +
* Restart MySQL
 +
Now, [http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html secure the root/guest accounts], [http://dev.mysql.com/doc/refman/5.1/en/create-user.html create the wiki user], and [http://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#MySQL create the wiki db and grant privileges]. Go into LocalSettings.php and change the connection settings so that it doesn't try to connect to the DB until you are done with the rest. Then
 +
* <tt>sudo mkdir /usr/local/mysql/etc</tt>
 +
* <tt>sudo chown -R mysql /usr/local/mysql/etc</tt>
 +
* <tt>su -</tt>
 +
* <tt>su -m _mysql -c "touch /usr/local/mysql/etc/my.cnf"</tt> (you can safely ignore the <tt>getcwd</tt> error)
 +
* <tt>logout</tt>
 +
* Turn off root user
 +
* Add this to the <tt>my.cnf</tt> file:
 +
:<code>[mysqld]<br/>max_allowed_packet=10737418</code>
 +
* Restart MySQL again
 +
* Fire up SequelPro and import the SQL dump made earlier. Errors related to disallowed <tt>DROP</tt> operations are fine.
 +
* Change back the connection parameters in LocalSettings.php and refresh the wiki!
  
 
{{cs projects}}
 
{{cs projects}}
  
 
[[Category:MediaWiki User's Guide]]
 
[[Category:MediaWiki User's Guide]]

Latest revision as of 21:58, 13 June 2010

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.11.0, 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

Updating MySQL on Mac OS X

I just went through a prolonged ordeal to upgrade MySQL from 5.1.30 to 5.1.47, so I'm going to write down some steps so that I don't hit so many dead-ends in the future. Note that this presumes that you have already done a DB dump of your wiki database (i.e. SequelPro's Export… command).

The installer does not detect the presence of an older installation, and as a result, leaves the old data directory untouched. In retrospect, you could probably just move it and all would be well. Alternatively, you can recreate your databases as well. Here's what I did.

  • First, to run the mysql_upgrade script, enable the root user in Directory Utility (which is now in CoreServices, or accessible from the Accounts prefpane).
  • su -
  • su _mysql -c "/usr/local/mysql/mysql_upgrade"
  • logout
  • Restart MySQL

Now, secure the root/guest accounts, create the wiki user, and create the wiki db and grant privileges. Go into LocalSettings.php and change the connection settings so that it doesn't try to connect to the DB until you are done with the rest. Then

  • sudo mkdir /usr/local/mysql/etc
  • sudo chown -R mysql /usr/local/mysql/etc
  • su -
  • su -m _mysql -c "touch /usr/local/mysql/etc/my.cnf" (you can safely ignore the getcwd error)
  • logout
  • Turn off root user
  • Add this to the my.cnf file:
[mysqld]
max_allowed_packet=10737418
  • Restart MySQL again
  • Fire up SequelPro and import the SQL dump made earlier. Errors related to disallowed DROP operations are fine.
  • Change back the connection parameters in LocalSettings.php and refresh the wiki!
CS projects
Production software FMenuWebGrabber
Class projects CS 61b
Misc MediaWiki Installation caveatsSony Clie on Mac OS XBlack screensaver