Media Wiki


Delete a Page

Give yourself sysop privilege

If you are using 1.5: The user rights are in a new table called user_groups with two fields called ug_user and ug_group. There must be one row inserted for each user right. You must know the user id number of the user from the "user" table. This sql query should do the trick. In the example below substitute 1 with the user ID number from the user table.

INSERT INTO user_groups (ug_user, ug_group) VALUES ('1', 'bureaucrat'); 
INSERT INTO user_groups (ug_user, ug_group) VALUES ('1', 'sysop');

Delete the page

Even after you give yourself sysop privileges by executing the above on your database, you still don't get any "delete link" on the page you want to delete.

I finally just tried manipulating the URL itself, adding "&action=delete" to the end of the URL, and that worked.

http://wiki/index.php?title=PCB_/_PCBA_Fabrication&action=delete

Short URL Setup

To set up a wiki that is directly off of the main domain, such as http://mycoolname.com/article_title, just add the .htaccess file below, and put the following three lines into LocalSettings.php.

LocalSettings.php

$wgScriptPath = '';         # Path to the actual files.
$wgArticlePath = '/$1';     # Virtual path. This directory MUST be different from the one used in $wgScriptPath
$wgUsePathInfo = true;      # Enable use of pretty URLs
//$wgScriptExtension  = ".php"; 

.htaccess

Options +FollowSymlinks
RewriteEngine on
# http://www.mediawiki.org/wiki/Manual:Short_URL/Apache_Rewrite_rules
RewriteEngine on
RewriteRule ^(images|skins)/ - [L]
RewriteRule ^(images|skins|fckeditor)/ - [L]
RewriteRule \.(php|html|gif|jpg|png|css|js)$ - [L]
RewriteRule \. - [L]
RewriteRule ^[^:]*[./] - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?title=$1 [PT,L,QSA] 

Copy Wikipedia Articles into your own internal wiki

Sometimes, you may wish to duplicate content from wikipedia on your own internal wiki, so users find that content when they're doing a search on your system.

To take an article from wikipedia and put it on your own wiki

  • Edit the wikipedia articla on wikipedia, so you can get the markup.
  • Copy the wikipedia markup to your clipboard
  • Paste the markup into UltraEdit.
  • Bring up the Replace menu, and select 'Perl' for the Regular Expression Engine
  • First, remove all <ref> <\ref> tags, even if they span multiple lines
    • Regexp: <ref(>| )((\n|\r|.)*?)<\/ref>
    • Replacement Text: nothing
  • Now, let's remove all templates, since they won't match your templates
    • We want all templates, even if they span multiple lines
      • Regexp: \{\{((\n|\r|.)*?)\}\}
      • Replacement Text: nothing
  • Then, 'replace all' internal links that don't have different text specified, with a different text attribute that matches, so [[Article Name]] becomes [[Article Name|Article Name]]
    • We want links [[ ]] that don't have a pipe or a colon in them
      • Regexp: \[\[(((?![:|]).)*?)\]\]
      • Replacement Text: [[$1|$1]]
  • Finally, add the wikipedia: interwiki designator, so formerly internal link now point to wikipedia
    • This markup probably has a lot of links to internal wikipedia pages, which will not be internal links to you. You want them to point back to wikipedia.
    • We want all internal links that don't have a colon in them
      • Regexp: \[\[(((?![:]).)*?)\]\]
      • Replacement Text: [[wikipedia:$1]]
  • You are now ready to paste the revised markup into your own internal wikipedia

In the above regexp, we are doing a (.*), but we add a ? after the * to make it lazy instead of greedy, so multiple links don't get combined.
So we have (.*?)
We're looking for [[ ]], but those are special chars, so we need to look for \[\[ \]\]
So we have \[\[(.*?)\]\]
In the first regexp, we also want to exclude the | char, so we don't add different text to links that already have different text
So our (.*?) becomes (((?![|]).)?)
So our final first regexp becomes \[\[(((?![|]).)
?)\]\]


Convert Microsoft Word Files to Wiki Articles

Add a wiki to the interwiki table

If I wanted to add the freeswitch wiki, so that whenever I wanted to link to a freeswitch page, I would just say [[freeswitch:Sofia|Sofia]].

In Heidi, do this...

INSERT INTO interwiki (iw_prefix, iw_url, iw_local, iw_trans) VALUES ('freeswitch', 'http://wiki.freeswitch.org/wiki/$1', 1, 0);