Difference between revisions of "Mediawiki installation"

From Biowikifarm Metawiki
Jump to: navigation, search
(MediaWiki upgrading)
m (+highlighting)
Line 7: Line 7:
  
 
The first installation was made under mediawiki 1.14. We decided to directly follow the Wikipedia versions by checking out the Trunk revisions. Following [http://www.mediawiki.org/wiki/Download_from_SVN]:
 
The first installation was made under mediawiki 1.14. We decided to directly follow the Wikipedia versions by checking out the Trunk revisions. Following [http://www.mediawiki.org/wiki/Download_from_SVN]:
 +
<source lang="bash">
 
  sudo mkdir /usr/share/mediawiki; cd /usr/share/mediawiki
 
  sudo mkdir /usr/share/mediawiki; cd /usr/share/mediawiki
 
  # Checking out head revision for main and extensions
 
  # Checking out head revision for main and extensions
Line 12: Line 13:
 
  sudo svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions
 
  sudo svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions
 
  sudo apt-get install imagemagick librsvg2-2 librsvg2-bin
 
  sudo apt-get install imagemagick librsvg2-2 librsvg2-bin
 +
</source>
  
 
<small>Notes: "phase3" contains the main application, "extensions" the extension code. (Alternative for a more fixed version would be: svn checkout http://svn.wikimedia.org/svnroot/mediawiki/branches/REL1_13/phase3).</small>
 
<small>Notes: "phase3" contains the main application, "extensions" the extension code. (Alternative for a more fixed version would be: svn checkout http://svn.wikimedia.org/svnroot/mediawiki/branches/REL1_13/phase3).</small>
  
 
Also, for testing subversion updates, we checkout the wiki a second time into a staging folder:
 
Also, for testing subversion updates, we checkout the wiki a second time into a staging folder:
 +
<source lang="bash">
 
  sudo mkdir /usr/share/mediawikistaging; cd /usr/share/mediawikistaging
 
  sudo mkdir /usr/share/mediawikistaging; cd /usr/share/mediawikistaging
 
  sudo svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3
 
  sudo svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3
 
  sudo svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions
 
  sudo svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions
 
+
</source>
 
We want to run multiple mediawiki instances on one server. We created a special, "mixed" form of linking, where the LocalSettings.php, the config and image folder are local, and the rest is linked, following instructions [http://dfwlpiki.dfwlp.org/index.php/Advanced_Guide_to_Installing_Multiple_MediaWiki_Sites here] (an [http://booleandreams.wordpress.com/2007/06/12/running-multiple-instance-of-mediawiki-on-the-same-server-using-the-same-source-code/ alternative method] would probably create problems with the maintenance scripts). Later we detected a [http://www.steverumberg.com/wiki/index.php?title=WikiHelp_-_Method_Two page probably equivalent to our method] (its source?) which may be helpful if problems should arise (but we did not use it yet). We created this mixed linked/local for a "/var/www/wiki-template" folder:
 
We want to run multiple mediawiki instances on one server. We created a special, "mixed" form of linking, where the LocalSettings.php, the config and image folder are local, and the rest is linked, following instructions [http://dfwlpiki.dfwlp.org/index.php/Advanced_Guide_to_Installing_Multiple_MediaWiki_Sites here] (an [http://booleandreams.wordpress.com/2007/06/12/running-multiple-instance-of-mediawiki-on-the-same-server-using-the-same-source-code/ alternative method] would probably create problems with the maintenance scripts). Later we detected a [http://www.steverumberg.com/wiki/index.php?title=WikiHelp_-_Method_Two page probably equivalent to our method] (its source?) which may be helpful if problems should arise (but we did not use it yet). We created this mixed linked/local for a "/var/www/wiki-template" folder:
 
+
<source lang="bash">
 
  md /var/www/wiki-template; cd /var/www/wiki-template/
 
  md /var/www/wiki-template; cd /var/www/wiki-template/
 
  # it is important not to add any further "/" anywhere:
 
  # it is important not to add any further "/" anywhere:
Line 29: Line 32:
 
  sudo rm -rf images ## may have changed since, check
 
  sudo rm -rf images ## may have changed since, check
 
  sudo cp -vpRP /usr/share/mediawiki/phase3/images .
 
  sudo cp -vpRP /usr/share/mediawiki/phase3/images .
 
+
</source>
 
For installation, we need to make the config folder writable by the webserver, for media files some folders within images need to be writable. Also we renamed "images" to "media"
 
For installation, we need to make the config folder writable by the webserver, for media files some folders within images need to be writable. Also we renamed "images" to "media"
  
 +
<source lang="bash">
 
  cd /var/www/wiki-template/; sudo chmod 755 config
 
  cd /var/www/wiki-template/; sudo chmod 755 config
 
  sudo mv images media; sudo chmod 777 media
 
  sudo mv images media; sudo chmod 777 media
 
  cd /var/www/wiki-template/media/; sudo mkdir archive; mkdir thumb; sudo mkdir temp
 
  cd /var/www/wiki-template/media/; sudo mkdir archive; mkdir thumb; sudo mkdir temp
 
  sudo chmod 755 archive; sudo chmod 755 thumb; sudo chmod 755 temp
 
  sudo chmod 755 archive; sudo chmod 755 thumb; sudo chmod 755 temp
 +
</source>
  
 
To enable the display of svn revision numbers on Special:Version pages (as can be seen on the Wikimedia foundation wikis), one also must create a .svn link in each wiki folder from pointing to .svn in phase3.
 
To enable the display of svn revision numbers on Special:Version pages (as can be seen on the Wikimedia foundation wikis), one also must create a .svn link in each wiki folder from pointing to .svn in phase3.
Line 46: Line 51:
 
  sudo apt-get install php-mail php-net-smtp
 
  sudo apt-get install php-mail php-net-smtp
 
then add to LocalSettings.php:
 
then add to LocalSettings.php:
 +
 +
<source lang="php">
 
  ini_set("include_path", ".:$IP:$IP/includes:$IP/languages:/usr/share/php/:/usr/share/php/PEAR/");
 
  ini_set("include_path", ".:$IP:$IP/includes:$IP/languages:/usr/share/php/:/usr/share/php/PEAR/");
 
  $wgSMTP = array(
 
  $wgSMTP = array(
Line 55: Line 62:
 
  'password' => "xxx123xxx123xxx123"
 
  'password' => "xxx123xxx123xxx123"
 
  );
 
  );
 
+
</source>
 
==Cloning a new wiki==
 
==Cloning a new wiki==
  
 
Any code above needs to be run only the first time. From then on, the template can be reused to clone instances (where "NEW-WIKI" is replaced with the name for your wiki):
 
Any code above needs to be run only the first time. From then on, the template can be reused to clone instances (where "NEW-WIKI" is replaced with the name for your wiki):
 
+
<source lang="bash">
 
  cd /var/www/; sudo cp -r wiki-template NEW-Wiki
 
  cd /var/www/; sudo cp -r wiki-template NEW-Wiki
 
  cd /var/www/NEW-Wiki; sudo chmod a+w config; sudo chmod a+w cache; sudo chmod a+w media
 
  cd /var/www/NEW-Wiki; sudo chmod a+w config; sudo chmod a+w cache; sudo chmod a+w media
 
+
</source>
 
followed by the install process in a web browser (<nowiki>http://..../NEW-Wiki/config/index.php</nowiki>)
 
followed by the install process in a web browser (<nowiki>http://..../NEW-Wiki/config/index.php</nowiki>)
  
Line 68: Line 75:
  
 
Full notes for settings made on the web forms of the MediaWiki installation: For the DPG (society of phytopathologists in Germany): Name=DPG, contact email gh, language de, License: Creative Commons, choose non-commercial, share-alike, Admin name: WikiSysop, (password noted separate), caching memcached 127.0.0.1:11211, email options left default (or user-to-user disabled), DB config: MySQL, localhost:8088 (the port on which we operate mysql), databasename: pmedwiki, user name wikiuser, (password noted separate). adding root credentials so that wikiuser and tables can be created (wikiuser has insufficient rights). No database table prefix (originally we DID use prefixes and a single db, however, that prevents to ever use the single-sign-on mechanism...), engine=InnoDB, character set ''changed to UTF-8''. Click Install, move LocalSettings.php to the parent directory, remove the config folder:
 
Full notes for settings made on the web forms of the MediaWiki installation: For the DPG (society of phytopathologists in Germany): Name=DPG, contact email gh, language de, License: Creative Commons, choose non-commercial, share-alike, Admin name: WikiSysop, (password noted separate), caching memcached 127.0.0.1:11211, email options left default (or user-to-user disabled), DB config: MySQL, localhost:8088 (the port on which we operate mysql), databasename: pmedwiki, user name wikiuser, (password noted separate). adding root credentials so that wikiuser and tables can be created (wikiuser has insufficient rights). No database table prefix (originally we DID use prefixes and a single db, however, that prevents to ever use the single-sign-on mechanism...), engine=InnoDB, character set ''changed to UTF-8''. Click Install, move LocalSettings.php to the parent directory, remove the config folder:
 
+
<source lang="bash">
 
  cd /var/www/NEW-Wiki/; sudo mv config/LocalSettings.php .; sudo rm -rf config
 
  cd /var/www/NEW-Wiki/; sudo mv config/LocalSettings.php .; sudo rm -rf config
 
+
</source>
 
For each wiki add to the virtual host configuration (e.g. to <code>/etc/apache2/sites-available/default</code>):
 
For each wiki add to the virtual host configuration (e.g. to <code>/etc/apache2/sites-available/default</code>):
 
+
<source lang="apache">
 
  Alias /NEW-Wiki-VIRTUAL /var/www/NEW-WIKI/index.php
 
  Alias /NEW-Wiki-VIRTUAL /var/www/NEW-WIKI/index.php
+
</source>
 
and restart Apache2 gracefully:
 
and restart Apache2 gracefully:
 
+
<source lang="bash">
 
  sudo /usr/sbin/apache2ctl -k graceful
 
  sudo /usr/sbin/apache2ctl -k graceful
 
  # or not graceful: sudo /usr/sbin/apache2ctl -k restart
 
  # or not graceful: sudo /usr/sbin/apache2ctl -k restart
+
</source>
 
For each wiki using ShortURLs, the robot.txt must be updated.
 
For each wiki using ShortURLs, the robot.txt must be updated.
  
 
Some extensions need execution of a sql command for each db (where "DBNAME" and "DBUSER" are replaced with actual db name and user) (<code>ls /var/www/NEW-Wiki/extensions/*.sql</code>):
 
Some extensions need execution of a sql command for each db (where "DBNAME" and "DBUSER" are replaced with actual db name and user) (<code>ls /var/www/NEW-Wiki/extensions/*.sql</code>):
 
+
<source lang="bash">
 
   mysql -u USER -p --database=studienstiftungswiki < /usr/share/mediawiki/extensions/ConfirmAccount/ConfirmAccount.sql
 
   mysql -u USER -p --database=studienstiftungswiki < /usr/share/mediawiki/extensions/ConfirmAccount/ConfirmAccount.sql
 
   mysql -u USER -p --database=studienstiftungswiki < /usr/share/mediawiki/extensions/OpenID/openid_table.sql
 
   mysql -u USER -p --database=studienstiftungswiki < /usr/share/mediawiki/extensions/OpenID/openid_table.sql
 
   mysql -u USER -p --database=studienstiftungswiki < /usr/share/mediawiki/extensions/TitleKey/titlekey.sql
 
   mysql -u USER -p --database=studienstiftungswiki < /usr/share/mediawiki/extensions/TitleKey/titlekey.sql
 
   echo "CREATE VIEW dpl_clview AS SELECT IFNULL(cl_from, page_id) AS cl_from, IFNULL(cl_to, '') AS cl_to, cl_sortkey FROM page LEFT OUTER JOIN categorylinks ON page_id=cl_from;" | mysql -u USER -p DBNAME
 
   echo "CREATE VIEW dpl_clview AS SELECT IFNULL(cl_from, page_id) AS cl_from, IFNULL(cl_to, '') AS cl_to, cl_sortkey FROM page LEFT OUTER JOIN categorylinks ON page_id=cl_from;" | mysql -u USER -p DBNAME
 +
echo "CREATE VIEW dpl_clview AS SELECT IFNULL(cl_from, page_id) AS cl_from, IFNULL(cl_to, '') AS cl_to, cl_sortkey FROM page LEFT OUTER JOIN categorylinks ON page_id=cl_from;" | mysql -u mb-gh -p --database=studienstiftungswiki
 +
</source>
  
echo "CREATE VIEW dpl_clview AS SELECT IFNULL(cl_from, page_id) AS cl_from, IFNULL(cl_to, '') AS cl_to, cl_sortkey FROM page LEFT OUTER JOIN categorylinks ON page_id=cl_from;" | mysql -u mb-gh -p --database=studienstiftungswiki
 
  
 
Similar tables would be needed for the '''OAI (OpenArchiveInitiative) extension'''. The documentation is very poor so that '''THIS IS NOT YET APPLIED AND THE EXTENSION DISABLED FOR THE TIME BEING!''' ARE ALL TABLES COVERED BELOW?
 
Similar tables would be needed for the '''OAI (OpenArchiveInitiative) extension'''. The documentation is very poor so that '''THIS IS NOT YET APPLIED AND THE EXTENSION DISABLED FOR THE TIME BEING!''' ARE ALL TABLES COVERED BELOW?
  # mysql -u USER -p DBNAME < /usr/share/mediawiki/extensions/OAI/oaiaudit_table.sql
+
<source lang="bash">
  # mysql -u USER -p DBNAME < /usr/share/mediawiki/extensions/OAI/oaiharvest_table.sql
+
  # mysql -u USER -p DBNAME < /usr/share/mediawiki/extensions/OAI/oaiaudit_table.sql
  # mysql -u USER -p DBNAME < /usr/share/mediawiki/extensions/OAI/oaiuser_table.sql
+
  # mysql -u USER -p DBNAME < /usr/share/mediawiki/extensions/OAI/oaiharvest_table.sql
 +
  # mysql -u USER -p DBNAME < /usr/share/mediawiki/extensions/OAI/oaiuser_table.sql
 
  # mysql -u USER -p DBNAME < /usr/share/mediawiki/extensions/OAI/update_table.sql
 
  # mysql -u USER -p DBNAME < /usr/share/mediawiki/extensions/OAI/update_table.sql
 
+
</source>
 
To simplify the setup, we have extracted the common settings from LocalSettings.php into a file called MediaWikiCommonSettings.php directly in the www-root. Usually, because of the manual change to MediaWikiCommonSettings.php, we manually modify a template LocalSettings.php from any wiki and use it instead of the one created by the install process.
 
To simplify the setup, we have extracted the common settings from LocalSettings.php into a file called MediaWikiCommonSettings.php directly in the www-root. Usually, because of the manual change to MediaWikiCommonSettings.php, we manually modify a template LocalSettings.php from any wiki and use it instead of the one created by the install process.
  
Line 109: Line 118:
 
* Timezone settings added: ( #Set Default Timezone: // $wgLocaltimezone="Europe/Berlin"; // $wgLocalTZoffset = +120; // putenv("TZ=$wgLocaltimezone");)
 
* Timezone settings added: ( #Set Default Timezone: // $wgLocaltimezone="Europe/Berlin"; // $wgLocalTZoffset = +120; // putenv("TZ=$wgLocaltimezone");)
 
* Security information on preventing editing by anonymous users and user-creation options under [http://www.mediawiki.org/wiki/Preventing_Access Preventing_Access]; we added following to MediaWikiCommonSettings.php:
 
* Security information on preventing editing by anonymous users and user-creation options under [http://www.mediawiki.org/wiki/Preventing_Access Preventing_Access]; we added following to MediaWikiCommonSettings.php:
 
+
<source lang="php">
 
  $wgEnableUploads  = true; # (Make sure the php.ini settings are correct, see above)
 
  $wgEnableUploads  = true; # (Make sure the php.ini settings are correct, see above)
 
  $wgMaxImageArea = 5e7; # Default is 1.25e7.
 
  $wgMaxImageArea = 5e7; # Default is 1.25e7.
Line 117: Line 126:
 
  # Prevent new user registrations except by sysops
 
  # Prevent new user registrations except by sysops
 
  $wgGroupPermissions['*']['createaccount'] = false;
 
  $wgGroupPermissions['*']['createaccount'] = false;
 
+
</source>
 
(Perhaps see also [http://23rdworld.com/2007/03/30/how-to-make-your-mediawiki-private/ a blog describing this method]). A better method than limiting creation to sysops it the [http://www.mediawiki.org/wiki/Extension:ConfirmAccount ConfirmAccount] extension, which we installed (see extensions below).
 
(Perhaps see also [http://23rdworld.com/2007/03/30/how-to-make-your-mediawiki-private/ a blog describing this method]). A better method than limiting creation to sysops it the [http://www.mediawiki.org/wiki/Extension:ConfirmAccount ConfirmAccount] extension, which we installed (see extensions below).
  
Line 125: Line 134:
  
 
The first part, establishing the symbolic links, must be done once for the subversion-managed mediawiki installation. Normally further actions are necessary (LocalSettings.php) for each wiki, but we perform them centrally in MediaWikiCommonSettings.php. Yet some db-specific actions are necessary for some extensions, see at the end. Most extensions are already available through the subversion download. Symbolic links are created to enable selected extensions, initially for:
 
The first part, establishing the symbolic links, must be done once for the subversion-managed mediawiki installation. Normally further actions are necessary (LocalSettings.php) for each wiki, but we perform them centrally in MediaWikiCommonSettings.php. Yet some db-specific actions are necessary for some extensions, see at the end. Most extensions are already available through the subversion download. Symbolic links are created to enable selected extensions, initially for:
 
+
<source lang="bash">
 
  cd /usr/share/mediawiki/phase3/extensions
 
  cd /usr/share/mediawiki/phase3/extensions
 +
# make symbolic links
 
  ln -s ../../extensions/CategoryTree
 
  ln -s ../../extensions/CategoryTree
 
  ln -s ../../extensions/CentralAuth
 
  ln -s ../../extensions/CentralAuth
Line 171: Line 181:
 
  ln -s ../../extensions/TitleKey
 
  ln -s ../../extensions/TitleKey
 
  ln -s ../../extensions/TreeAndMenu
 
  ln -s ../../extensions/TreeAndMenu
 
+
</source>
  
 
This is further necessary to self-written extensions such as:
 
This is further necessary to self-written extensions such as:
 +
<source lang="bash">
 
  ln -s /usr/share/mediawiki/NonSvnExtensions/IdentificationTool
 
  ln -s /usr/share/mediawiki/NonSvnExtensions/IdentificationTool
 
  ln -s /usr/share/mediawiki/NonSvnExtensions/MetadataHarvester
 
  ln -s /usr/share/mediawiki/NonSvnExtensions/MetadataHarvester
 
+
</source>
 
Only for Key to Nature the following special extensions are linked in:
 
Only for Key to Nature the following special extensions are linked in:
 +
<source lang="bash">
 
  cd /usr/share/mediawiki/phase3/extensions
 
  cd /usr/share/mediawiki/phase3/extensions
 
  ln -s /usr/share/mediawiki/NonSvnExtensions/AddScriptCss
 
  ln -s /usr/share/mediawiki/NonSvnExtensions/AddScriptCss
 
  ln -s /usr/share/mediawiki/NonSvnExtensions/StubManager
 
  ln -s /usr/share/mediawiki/NonSvnExtensions/StubManager
 
  ln -s /usr/share/mediawiki/NonSvnExtensions/VideoFlash
 
  ln -s /usr/share/mediawiki/NonSvnExtensions/VideoFlash
 
+
</source>
  
 
[http://www.mediawiki.org/wiki/Extension:SyntaxHighlight SyntaxHighlight] needs an additional checkout from a different source:
 
[http://www.mediawiki.org/wiki/Extension:SyntaxHighlight SyntaxHighlight] needs an additional checkout from a different source:
  
 +
<source lang="bash">
 
  cd /usr/share/mediawiki/extensions/SyntaxHighlight_GeSHi
 
  cd /usr/share/mediawiki/extensions/SyntaxHighlight_GeSHi
 
  svn checkout http://geshi.svn.sourceforge.net/svnroot/geshi/trunk/geshi-1.0.X/src/ geshi
 
  svn checkout http://geshi.svn.sourceforge.net/svnroot/geshi/trunk/geshi-1.0.X/src/ geshi
 
+
</source>
 
The CentralAuth extension needs to create the following tables a single time (file CentralAuth/central-auth.sql, stored here for immediate repetition, but may be obsolete with software updates):
 
The CentralAuth extension needs to create the following tables a single time (file CentralAuth/central-auth.sql, stored here for immediate repetition, but may be obsolete with software updates):
<div style="font-size:0.75em">
+
<source lang="mysql">
 
CREATE TABLE globalnames (gn_name varchar(255) binary not null, primary key (gn_name)) TYPE=InnoDB;
 
CREATE TABLE globalnames (gn_name varchar(255) binary not null, primary key (gn_name)) TYPE=InnoDB;
CREATE TABLE localnames (ln_wiki varchar(255) binary not null, ln_name varchar(255) binary not null, primary key (ln_wiki, ln_name), key (ln_name, ln_wiki)) TYPE=InnoDB;
+
CREATE TABLE localnames (
CREATE TABLE globaluser (gu_id int auto_increment, gu_name varchar(255) binary, gu_enabled varchar(14) not null, gu_enabled_method enum('opt-in', 'batch', 'auto', 'admin'), gu_home_db varchar(255) binary, gu_email varchar(255) binary, gu_email_authenticated char(14) binary, gu_salt varchar(16) binary, gu_password tinyblob, gu_locked bool not null default 0, gu_hidden bool not null default 0, gu_registration varchar(14) binary, gu_password_reset_key tinyblob, gu_password_reset_expiration varchar(14) binary, gu_auth_token varbinary(32) NULL, primary key (gu_id), unique key (gu_name), key (gu_email)) TYPE=InnoDB;
+
  ln_wiki varchar(255) binary not null,
CREATE TABLE localuser (lu_wiki varchar(255) binary not null, lu_name varchar(255) binary not null, lu_attached_timestamp varchar(14) binary, lu_attached_method enum ('primary', 'empty', 'mail', 'password', 'admin', 'new', 'login'), primary key (lu_wiki, lu_name), key (lu_name, lu_wiki)) TYPE=InnoDB;
+
  ln_name varchar(255) binary not null,
CREATE TABLE global_user_groups (gug_user int(11) not null, gug_group varchar(255) not null, PRIMARY KEY (gug_user,gug_group), KEY (gug_user), key (gug_group)) TYPE=InnoDB;
+
  primary key (ln_wiki, ln_name),
CREATE TABLE global_group_permissions (ggp_group varchar(255) not null, ggp_permission varchar(255) not null, PRIMARY KEY (ggp_group, ggp_permission), KEY (ggp_group), KEY (ggp_permission)) TYPE=InnoDB;
+
  key (ln_name, ln_wiki)) TYPE=InnoDB;
</div>
+
CREATE TABLE globaluser (
 +
  gu_id int auto_increment, gu_name varchar(255) binary,
 +
  gu_enabled varchar(14) not null,
 +
  gu_enabled_method enum('opt-in', 'batch', 'auto', 'admin'),
 +
  gu_home_db varchar(255) binary,
 +
  gu_email varchar(255) binary,
 +
  gu_email_authenticated char(14) binary,
 +
  gu_salt varchar(16) binary,
 +
  gu_password tinyblob,
 +
  gu_locked bool not null default 0,
 +
  gu_hidden bool not null default 0,
 +
  gu_registration varchar(14) binary,
 +
  gu_password_reset_key tinyblob,
 +
  gu_password_reset_expiration varchar(14) binary,
 +
  gu_auth_token varbinary(32) NULL,
 +
  primary key (gu_id),
 +
  unique key (gu_name), key (gu_email)) TYPE=InnoDB;
 +
CREATE TABLE localuser (
 +
  lu_wiki varchar(255) binary not null,
 +
  lu_name varchar(255) binary not null,
 +
  lu_attached_timestamp varchar(14) binary,
 +
  lu_attached_method enum ('primary', 'empty', 'mail', 'password', 'admin', 'new', 'login'),
 +
  primary key (lu_wiki, lu_name),
 +
  key (lu_name, lu_wiki)) TYPE=InnoDB;
 +
CREATE TABLE global_user_groups (
 +
  gug_user int(11) not null,
 +
  gug_group varchar(255) not null,
 +
  PRIMARY KEY (gug_user,gug_group),
 +
  KEY (gug_user), key (gug_group)) TYPE=InnoDB;
 +
CREATE TABLE global_group_permissions (
 +
  ggp_group varchar(255) not null,
 +
  ggp_permission varchar(255) not null,
 +
  PRIMARY KEY (ggp_group, ggp_permission),
 +
  KEY (ggp_group), KEY (ggp_permission)) TYPE=InnoDB;
 +
</source>
  
  
 
In LocalSettings/CommonSettings, add the following corresponding code at the end '''(requires updating!)''':
 
In LocalSettings/CommonSettings, add the following corresponding code at the end '''(requires updating!)''':
  
 +
<source lang="php">
 
  # EXTENSIONS:
 
  # EXTENSIONS:
 
  # MakeBot, MakeSysop are still listed in en/de wikipedia, but obsolete, now in core!
 
  # MakeBot, MakeSysop are still listed in en/de wikipedia, but obsolete, now in core!
Line 209: Line 257:
 
   ##this needs configuration of http://www.mediawiki.org/wiki/Manual:%24wgConf, which must occurs after the specific settings, see
 
   ##this needs configuration of http://www.mediawiki.org/wiki/Manual:%24wgConf, which must occurs after the specific settings, see
 
  require_once("$IP/extensions/CharInsert/CharInsert.php");
 
  require_once("$IP/extensions/CharInsert/CharInsert.php");
  require_once("$IP/extensions/Cite/SpecialCite.php");  
+
  require_once("$IP/extensions/Cite/SpecialCite.php");
 
   
 
   
 
  # ConfirmAccount needs email enabled! Otherwise users can't get their passwords...
 
  # ConfirmAccount needs email enabled! Otherwise users can't get their passwords...
Line 231: Line 279:
 
   $wgAllowAccountRequestFiles = false; // Default was false
 
   $wgAllowAccountRequestFiles = false; // Default was false
 
   # $wgGroupPermissions['*']['createaccount'] = false;
 
   # $wgGroupPermissions['*']['createaccount'] = false;
   # $wgGroupPermissions['bureaucrat']['confirmaccount'] = true;  
+
   # $wgGroupPermissions['bureaucrat']['confirmaccount'] = true;
 
   # $wgGroupPermissions['bureaucrat']['requestips'] = true; // This right has the request IP show when confirming accounts
 
   # $wgGroupPermissions['bureaucrat']['requestips'] = true; // This right has the request IP show when confirming accounts
 
   $wgConfirmAccountNotice = true; // Show notice for open requests to admins? Cached, but may still be expensive for thousands of requests.
 
   $wgConfirmAccountNotice = true; // Show notice for open requests to admins? Cached, but may still be expensive for thousands of requests.
Line 239: Line 287:
 
   $wgGroupPermissions['user'        ]['skipcaptcha'] = false;
 
   $wgGroupPermissions['user'        ]['skipcaptcha'] = false;
 
   $wgGroupPermissions['autoconfirmed']['skipcaptcha'] = true;
 
   $wgGroupPermissions['autoconfirmed']['skipcaptcha'] = true;
   $wgGroupPermissions['bot'          ]['skipcaptcha'] = true;  
+
   $wgGroupPermissions['bot'          ]['skipcaptcha'] = true;
 
   $wgGroupPermissions['sysop'        ]['skipcaptcha'] = true;
 
   $wgGroupPermissions['sysop'        ]['skipcaptcha'] = true;
   $wgCaptchaTriggers['edit']          = false;  
+
   $wgCaptchaTriggers['edit']          = false;
   $wgCaptchaTriggers['create']        = false;  
+
   $wgCaptchaTriggers['create']        = false;
   $wgCaptchaTriggers['addurl']        = false;  
+
   $wgCaptchaTriggers['addurl']        = false;
 
   $wgCaptchaTriggers['createaccount'] = true;
 
   $wgCaptchaTriggers['createaccount'] = true;
 
   $wgCaptchaTriggers['badlogin']      = true;
 
   $wgCaptchaTriggers['badlogin']      = true;
Line 250: Line 298:
 
  require_once("$IP/extensions/DismissableSiteNotice/DismissableSiteNotice.php");
 
  require_once("$IP/extensions/DismissableSiteNotice/DismissableSiteNotice.php");
 
  #add DynamicPageList Extension, used e.g. for automatic event listing on key2nature. See also: http://semeb.com/dpldemo/
 
  #add DynamicPageList Extension, used e.g. for automatic event listing on key2nature. See also: http://semeb.com/dpldemo/
  require_once("$IP/extensions/DynamicPageList/DynamicPageList2.php");  
+
  require_once("$IP/extensions/DynamicPageList/DynamicPageList2.php");
 
  ### enabling FlaggedRevs requires many further actions (sql)!
 
  ### enabling FlaggedRevs requires many further actions (sql)!
 
   ### include_once("$IP/extensions/FlaggedRevs/FlaggedRevs.php");
 
   ### include_once("$IP/extensions/FlaggedRevs/FlaggedRevs.php");
 
  require_once("$IP/extensions/ExpandTemplates/ExpandTemplates.php");
 
  require_once("$IP/extensions/ExpandTemplates/ExpandTemplates.php");
  require_once("$IP/extensions/Gadgets/Gadgets.php");  
+
  require_once("$IP/extensions/Gadgets/Gadgets.php");
+
 
 
  ## GoogleMapsExtension: This may have to be moved to individual wikis or secondary commons files, since it is URL dependend
 
  ## GoogleMapsExtension: This may have to be moved to individual wikis or secondary commons files, since it is URL dependend
   ## Key for http://www.phytopathology.net/:  
+
   ## Key for http://www.phytopathology.net/:
 
   $wgGoogleMapsKey = "ABQIAAAAtIv2htpKQclAQPE21vjSBBSL1aXnaBCy0UI5nOCX2jho6QpXrBTEjwGjkp6B0qEgN34MXgC9JE17Ag";
 
   $wgGoogleMapsKey = "ABQIAAAAtIv2htpKQclAQPE21vjSBBSL1aXnaBCy0UI5nOCX2jho6QpXrBTEjwGjkp6B0qEgN34MXgC9JE17Ag";
 
  ## GoogleMaps temporarily disabled again, it adds huge amounts of JavaScript to each page!
 
  ## GoogleMaps temporarily disabled again, it adds huge amounts of JavaScript to each page!
  ## xyyfafxy<xykeopkfdrequire_once("$IP/extensions/GoogleMaps/GoogleMaps.php");  
+
  ## xyyfafxy<xykeopkfdrequire_once("$IP/extensions/GoogleMaps/GoogleMaps.php");
+
 
 
  include_once("$IP/extensions/IdentificationTool/IdentificationTool.php"); /* OUR OWN EXTENSION */
 
  include_once("$IP/extensions/IdentificationTool/IdentificationTool.php"); /* OUR OWN EXTENSION */
 
  require_once("$IP/extensions/ImageMap/ImageMap.php");
 
  require_once("$IP/extensions/ImageMap/ImageMap.php");
Line 275: Line 323:
 
  require_once("$IP/extensions/MathStatFunctions/MathStatFunctions.php");
 
  require_once("$IP/extensions/MathStatFunctions/MathStatFunctions.php");
 
  require_once("$IP/extensions/MultiUpload/SpecialMultipleUpload.php");
 
  require_once("$IP/extensions/MultiUpload/SpecialMultipleUpload.php");
  ### DISABLED, SQL ADDITIONS NEEDED, NO DOCUMENTATION ON USE:  
+
  ### DISABLED, SQL ADDITIONS NEEDED, NO DOCUMENTATION ON USE:
 
   ### require_once("$IP/extensions/OAI/OAIRepo.php");
 
   ### require_once("$IP/extensions/OAI/OAIRepo.php");
 
  ### OpenID: DISABLED! The libraries are installed, the sql executed, but when enabling and navigating to special pages an error occurs
 
  ### OpenID: DISABLED! The libraries are installed, the sql executed, but when enabling and navigating to special pages an error occurs
   ### require_once("$IP/extensions/OpenID/OpenID.setup.php");  
+
   ### require_once("$IP/extensions/OpenID/OpenID.setup.php");
+
 
 
  require_once("$IP/extensions/ParserFunctions/ParserFunctions.php");
 
  require_once("$IP/extensions/ParserFunctions/ParserFunctions.php");
 
  ## Allow Sysops to reset passwords:
 
  ## Allow Sysops to reset passwords:
Line 287: Line 335:
 
  require_once("$IP/extensions/Renameuser/SpecialRenameuser.php" );
 
  require_once("$IP/extensions/Renameuser/SpecialRenameuser.php" );
 
  include_once("$IP/extensions/ReplaceText/ReplaceText.php");
 
  include_once("$IP/extensions/ReplaceText/ReplaceText.php");
+
 
 
  ##SEMANTIC MEDIAWIKI:
 
  ##SEMANTIC MEDIAWIKI:
 
  include_once("$IP/extensions/SemanticMediaWiki/includes/SMW_Settings.php");
 
  include_once("$IP/extensions/SemanticMediaWiki/includes/SMW_Settings.php");
 
  include_once("$IP/extensions/SemanticForms/includes/SF_Settings.php");
 
  include_once("$IP/extensions/SemanticForms/includes/SF_Settings.php");
 
  enableSemantics('example.org'); # replace example.org by the name of the wiki.
 
  enableSemantics('example.org'); # replace example.org by the name of the wiki.
 
+
 
 
  include_once("$IP/extensions/SQL2Wiki/SQL2Wiki.php");
 
  include_once("$IP/extensions/SQL2Wiki/SQL2Wiki.php");
 
  ### NOT YET ENABLED: ShibbolethAuthentication, folder linked, not yet tested or activated
 
  ### NOT YET ENABLED: ShibbolethAuthentication, folder linked, not yet tested or activated
Line 298: Line 346:
 
  require_once("$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php");
 
  require_once("$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php");
 
  ### DO NOT ENABLE TitleKey without a good reason. Without it being installed, searching for articles DOES work case-insensitive already. No further explanations could be found.
 
  ### DO NOT ENABLE TitleKey without a good reason. Without it being installed, searching for articles DOES work case-insensitive already. No further explanations could be found.
 +
</source>
  
 
Additional actions for some extensions:
 
Additional actions for some extensions:
Line 308: Line 357:
 
* (Cite may also need additional action, although the mentioned cite layout file is already present. Nothing done so far, needs testing)
 
* (Cite may also need additional action, although the mentioned cite layout file is already present. Nothing done so far, needs testing)
 
* (Sitenotice: It is possible to set one in LocalSettings.php, but better method is MediaWiki:Sitenotice)
 
* (Sitenotice: It is possible to set one in LocalSettings.php, but better method is MediaWiki:Sitenotice)
* Todo:  
+
* Todo:
 
** FlaggedRevs has a number of things to do, '''not yet done'''
 
** FlaggedRevs has a number of things to do, '''not yet done'''
 
** install lucene (links on MWSearch page), add and install MWSearch extension
 
** install lucene (links on MWSearch page), add and install MWSearch extension
Line 317: Line 366:
  
 
* '''TODO:''' '''Quiz''': the building tool adopted by Wikiversity! This one comes close to '''identification tools!'''
 
* '''TODO:''' '''Quiz''': the building tool adopted by Wikiversity! This one comes close to '''identification tools!'''
* '''TODO:''' Install and test Extension:CentralAuth. The special tables are created in wikidb, and a variant for CommonSettings2.php exists in the root. However, configuring the wgConfig variable remained unclear for a config with with prefixed tables for multiple wikis in a single database. Could not get it to work...  
+
* '''TODO:''' Install and test Extension:CentralAuth. The special tables are created in wikidb, and a variant for CommonSettings2.php exists in the root. However, configuring the wgConfig variable remained unclear for a config with with prefixed tables for multiple wikis in a single database. Could not get it to work...
 
** CentralAuth is confirmed not to work at present when multiple wikis are kept in a single DB, separated by table prefixes.
 
** CentralAuth is confirmed not to work at present when multiple wikis are kept in a single DB, separated by table prefixes.
 
** Instead we configured one Wiki-database to manage the users from all Wikis (using the localsettings variable [http://www.mediawiki.org/wiki/Manual:$wgSharedDB $wgSharedDB]). This provides single identity, although not single sign-on.
 
** Instead we configured one Wiki-database to manage the users from all Wikis (using the localsettings variable [http://www.mediawiki.org/wiki/Manual:$wgSharedDB $wgSharedDB]). This provides single identity, although not single sign-on.
 
** If we fail to get this running, drop the tables again: ''DROP TABLE globalnames; DROP TABLE localnames; DROP TABLE globaluser; DROP TABLE localuser; DROP TABLE global_user_groups; DROP TABLE global_group_permissions;''
 
** If we fail to get this running, drop the tables again: ''DROP TABLE globalnames; DROP TABLE localnames; DROP TABLE globaluser; DROP TABLE localuser; DROP TABLE global_user_groups; DROP TABLE global_group_permissions;''
* GoogleMapsExtension  
+
* GoogleMapsExtension
 
* Configure [http://www.mediawiki.org/wiki/Extension:Gadgets Gadgets Extension], extension is running but no gadgets are active yet (wikED would be nice).
 
* Configure [http://www.mediawiki.org/wiki/Extension:Gadgets Gadgets Extension], extension is running but no gadgets are active yet (wikED would be nice).
 
* MWSearch (NEEDS LUCENE FIRST)
 
* MWSearch (NEEDS LUCENE FIRST)
Line 330: Line 379:
 
* '''Under Review, potential security thread: '''SQL2Wiki'''
 
* '''Under Review, potential security thread: '''SQL2Wiki'''
 
* '''Not activated:'' '''LdapAuthentication''' (http://www.mediawiki.org/wiki/Extension:LDAP_Authentication)
 
* '''Not activated:'' '''LdapAuthentication''' (http://www.mediawiki.org/wiki/Extension:LDAP_Authentication)
* '''Considered:'' '''DataTable''', '''Glossary''' (both currently not in subversion-extensions), '''PDF Export''',  
+
* '''Considered:'' '''DataTable''', '''Glossary''' (both currently not in subversion-extensions), '''PDF Export''',
 
* '''Intersection''' has been disabled again, lack of usage documentation, may conflict with DynamicPageList (Same php file name, same tag??). They have similar purposes, but Intersection is used on WikiNews, DynamicPageList not.
 
* '''Intersection''' has been disabled again, lack of usage documentation, may conflict with DynamicPageList (Same php file name, same tag??). They have similar purposes, but Intersection is used on WikiNews, DynamicPageList not.
 
** Update: Intersection/DynamicPageList is documented [http://meta.wikimedia.org/wiki/DynamicPageList here], the names are just confusing!
 
** Update: Intersection/DynamicPageList is documented [http://meta.wikimedia.org/wiki/DynamicPageList here], the names are just confusing!
Line 338: Line 387:
 
For just the database see: http://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki. A more complete script can be found here: http://www.mediawiki.org/wiki/User:Flominator/Backup_MW - this also backups the folder with uploads (media). Based on that source, adapted scripts were created, execute as:
 
For just the database see: http://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki. A more complete script can be found here: http://www.mediawiki.org/wiki/User:Flominator/Backup_MW - this also backups the folder with uploads (media). Based on that source, adapted scripts were created, execute as:
  
 +
<source lang="bash">
 
  cd /var/backups/scripts/; ./backup-mw.sh
 
  cd /var/backups/scripts/; ./backup-mw.sh
 
+
</source>
 
The additional backup-mw.php script can potentially be used within www to directly create and download a copy of the mediawiki. We are testing this as a measure to build trust.
 
The additional backup-mw.php script can potentially be used within www to directly create and download a copy of the mediawiki. We are testing this as a measure to build trust.
  
 
In addition, to create an xml dump, make sure a link to AdminSettings.php exists in the current wiki folder and the maintenance folder is temporarily copied, then run, e.g.:
 
In addition, to create an xml dump, make sure a link to AdminSettings.php exists in the current wiki folder and the maintenance folder is temporarily copied, then run, e.g.:
 +
<source lang="bash">
 
  cd /var/www/v-k2n/w/maintenance # replace path with actual wiki path
 
  cd /var/www/v-k2n/w/maintenance # replace path with actual wiki path
 
  php dumpBackup.php --full > /var/backups/wikis/k2n-full.xml
 
  php dumpBackup.php --full > /var/backups/wikis/k2n-full.xml
 
  php dumpBackup.php --logs > /var/backups/wikis/k2n-logs.xml
 
  php dumpBackup.php --logs > /var/backups/wikis/k2n-logs.xml
 +
</source>
  
 
(Note: --logs may not yet be working under version 1.12, it works in 1.14)
 
(Note: --logs may not yet be working under version 1.12, it works in 1.14)
  
 
To restore such a xml-dump, remove tables and create new tables with default values in mysql, then:
 
To restore such a xml-dump, remove tables and create new tables with default values in mysql, then:
 +
<source lang="bash">
 
  cd /var/www/WIKINAME;  # (replace path with actual wiki path!)
 
  cd /var/www/WIKINAME;  # (replace path with actual wiki path!)
 
  php ./maintenance/importDump.php /var/backups/wikis/k2n-full.xml --conf ./LocalSettings.php
 
  php ./maintenance/importDump.php /var/backups/wikis/k2n-full.xml --conf ./LocalSettings.php
Line 355: Line 408:
 
  ## If backlinks etc. do not work, or extensions had to be disabled, use (Very slow!!!!):
 
  ## If backlinks etc. do not work, or extensions had to be disabled, use (Very slow!!!!):
 
  php ./maintenance/rebuildall.php  --quick --conf ./LocalSettings.php
 
  php ./maintenance/rebuildall.php  --quick --conf ./LocalSettings.php
 
+
</source>
 
Notes: In our experience, some extensions may create problems during reimport. We found GoogleMaps and DynamicPageList to cause importDump to abort. After disabling these two extensions, the import worked correctly. However, all DPL pages are then still cached without proper DPL rendering even after re-enabling both extensions. Running rebuildall.php fixed this.
 
Notes: In our experience, some extensions may create problems during reimport. We found GoogleMaps and DynamicPageList to cause importDump to abort. After disabling these two extensions, the import worked correctly. However, all DPL pages are then still cached without proper DPL rendering even after re-enabling both extensions. Running rebuildall.php fixed this.
  
 
Example restore for testing of the wikimediafoundation commons xml-dump:
 
Example restore for testing of the wikimediafoundation commons xml-dump:
 +
<source lang="bash">
 
  cd /var/www/wmf-commons; php ./maintenance/importDump.php  /mnt/wpTest/commonswiki-pages-articles.xml  --conf ./LocalSettings.php
 
  cd /var/www/wmf-commons; php ./maintenance/importDump.php  /mnt/wpTest/commonswiki-pages-articles.xml  --conf ./LocalSettings.php
 +
</source>
  
 
==Maintenance scripts==
 
==Maintenance scripts==
Line 366: Line 421:
  
 
In /usr/share/mediawiki/phase3/ copy AdminSettings.sample to AdminSettings.php, create a new user wikiadmin for mysql with localhost only, and edit AdminSettings.php accordingly. Then, for each wiki, in /var/www/wikifolder/, a symlink must be created linking to /usr/share/mediawiki/phase3/AdminSettings.php. Since we have a symlinked installation, installations scripts must run like:
 
In /usr/share/mediawiki/phase3/ copy AdminSettings.sample to AdminSettings.php, create a new user wikiadmin for mysql with localhost only, and edit AdminSettings.php accordingly. Then, for each wiki, in /var/www/wikifolder/, a symlink must be created linking to /usr/share/mediawiki/phase3/AdminSettings.php. Since we have a symlinked installation, installations scripts must run like:
+
 
 +
<source lang="bash">
 
  php /var/www/wikifolder/maintenance/rebuildall.php  --conf /var/www/wikifolder/LocalSettings.php
 
  php /var/www/wikifolder/maintenance/rebuildall.php  --conf /var/www/wikifolder/LocalSettings.php
 
  php /var/www/wikifolder/maintenance/importImages.php --conf /var/www/wikifolder/LocalSettings.php /var/www/wikifolder/media/newimages .jpg .png .svg
 
  php /var/www/wikifolder/maintenance/importImages.php --conf /var/www/wikifolder/LocalSettings.php /var/www/wikifolder/media/newimages .jpg .png .svg
 +
</source>
  
 
Rebuild all is necessary after external text, sql, or xml imports.
 
Rebuild all is necessary after external text, sql, or xml imports.
Line 375: Line 432:
  
 
Rebuilding the file cache (note: permission may be a problem; this will be the commandline user, whereas normally cache is written by apache):
 
Rebuilding the file cache (note: permission may be a problem; this will be the commandline user, whereas normally cache is written by apache):
 +
<source lang="bash">
 
  cd /var/www/metawiki;      php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 
  cd /var/www/metawiki;      php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 
  cd /var/www/testwiki;      php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 
  cd /var/www/testwiki;      php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
Line 387: Line 445:
 
  cd /var/www/v-species/w;    php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 
  cd /var/www/v-species/w;    php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 
  cd /var/www/v-workbench/w;  php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 
  cd /var/www/v-workbench/w;  php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 +
</source>
  
 
After erroneously localizing commons images not to openmedia but to local wikis, extension Nuke was used to deleted the caching-bot imports, and deleteArchivedFiles to actually delete all archived files:
 
After erroneously localizing commons images not to openmedia but to local wikis, extension Nuke was used to deleted the caching-bot imports, and deleteArchivedFiles to actually delete all archived files:
 +
<source lang="bash">
 
  cd /var/www/v-onf/w; php ./maintenance/deleteArchivedFiles.php  --conf ./LocalSettings.php --delete
 
  cd /var/www/v-onf/w; php ./maintenance/deleteArchivedFiles.php  --conf ./LocalSettings.php --delete
 +
</source>
  
 
Fix problems with unparsable image names (see [http://www.mediawiki.org/wiki/Manual:CleanupImages.php]):
 
Fix problems with unparsable image names (see [http://www.mediawiki.org/wiki/Manual:CleanupImages.php]):
 +
<source lang="bash">
 
  cd /var/www/v-k2n/w; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 
  cd /var/www/v-k2n/w; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 
  cd /var/www/v-onf/w; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 
  cd /var/www/v-onf/w; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 
  cd /var/www/v-species/o; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 
  cd /var/www/v-species/o; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 
  cd /var/www/v-species/s; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 
  cd /var/www/v-species/s; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 +
</source>
  
  
Line 402: Line 465:
 
Some extensions provide their own maintenance scripts in their own extension folder. On a wiki farm, the execution of these scripts may fail due to the linked directory structure. They need an additional link (needs to be created only once):
 
Some extensions provide their own maintenance scripts in their own extension folder. On a wiki farm, the execution of these scripts may fail due to the linked directory structure. They need an additional link (needs to be created only once):
  
 +
<source lang="bash">
 
  cd /usr/share/mediawiki/; ln -s /usr/share/mediawikistaging/phase3/maintenance
 
  cd /usr/share/mediawiki/; ln -s /usr/share/mediawikistaging/phase3/maintenance
 
  cd /usr/share/mediawikistaging/; ln -s /usr/share/mediawikistaging/phase3/maintenance
 
  cd /usr/share/mediawikistaging/; ln -s /usr/share/mediawikistaging/phase3/maintenance
 +
</source>
  
 
Now '''TitleKey''' works:
 
Now '''TitleKey''' works:
  
 +
<source lang="bash">
 
  cd /var/www/testwiki; php ./extensions/TitleKey/rebuildTitleKeys.php --conf ./LocalSettings.php
 
  cd /var/www/testwiki; php ./extensions/TitleKey/rebuildTitleKeys.php --conf ./LocalSettings.php
 +
</source>
  
 
==MediaWiki configuration tips==
 
==MediaWiki configuration tips==
Line 419: Line 486:
  
 
To upgrade Mediawiki first run the update on the staging version (= testwiki, http://biowikifarm.net/test):
 
To upgrade Mediawiki first run the update on the staging version (= testwiki, http://biowikifarm.net/test):
 +
<source lang="bash">
 
  cd /usr/share/mediawikistaging/; sudo svn update phase3 extensions  -r59858
 
  cd /usr/share/mediawikistaging/; sudo svn update phase3 extensions  -r59858
 
  sudo /usr/sbin/apache2ctl -k graceful
 
  sudo /usr/sbin/apache2ctl -k graceful
Line 425: Line 493:
 
  sudo apt-get upgrade
 
  sudo apt-get upgrade
 
  cd /usr/share/; sudo svn update phpmyadmin-dev
 
  cd /usr/share/; sudo svn update phpmyadmin-dev
 +
</source>
  
 
After testing and verifying functionality, also update the production version (where "-r52502" indicates to update precisely to revision 52502; this should always be the value of the tested revision from staging / test wiki!):
 
After testing and verifying functionality, also update the production version (where "-r52502" indicates to update precisely to revision 52502; this should always be the value of the tested revision from staging / test wiki!):
 +
<source lang="bash">
 
  cd /usr/share/mediawiki; sudo svn update phase3 extensions  -r66620
 
  cd /usr/share/mediawiki; sudo svn update phase3 extensions  -r66620
 
  sudo /usr/sbin/apache2ctl -k graceful
 
  sudo /usr/sbin/apache2ctl -k graceful
 +
</source>
  
 
Occasionally the SVN upgrading of Mediawiki may require an upgrade of the database structures. Again, the update.php must be called with symlink-compatible syntax. Examples '''for mediawiki core''':
 
Occasionally the SVN upgrading of Mediawiki may require an upgrade of the database structures. Again, the update.php must be called with symlink-compatible syntax. Examples '''for mediawiki core''':
 +
<source lang="bash">
 
  cd /var/www/metawiki; php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 
  cd /var/www/metawiki; php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 
  cd /var/www/testwiki; php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 
  cd /var/www/testwiki; php ./maintenance/update.php  --quick --conf ./LocalSettings.php
Line 447: Line 519:
 
  cd /var/www/v-species/w;  php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 
  cd /var/www/v-species/w;  php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 
  cd /var/www/v-workbench/w; php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 
  cd /var/www/v-workbench/w; php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 +
</source>
  
  
 
'''For semantic mediawiki extension (SMW)''' click on "Initialise or upgrade tables" on SpecialPage Semantic Admin:
 
'''For semantic mediawiki extension (SMW)''' click on "Initialise or upgrade tables" on SpecialPage Semantic Admin:
* http://biowikifarm.net/meta/Special:SMWAdmin  
+
* http://biowikifarm.net/meta/Special:SMWAdmin
* http://biowikifarm.net/test/Special:SMWAdmin  
+
* http://biowikifarm.net/test/Special:SMWAdmin
 
* http://www.offene-naturfuehrer.de/wiki/Spezial:SMW-Einrichtung
 
* http://www.offene-naturfuehrer.de/wiki/Spezial:SMW-Einrichtung
 
* http://www.species-id.net/openmedia/Special:SMWAdmin
 
* http://www.species-id.net/openmedia/Special:SMWAdmin
Line 461: Line 534:
  
 
Uploading files with extensions and Content types (MIME types) usually not allowed on wikis:
 
Uploading files with extensions and Content types (MIME types) usually not allowed on wikis:
The default of normally allowed extensions is listed <code>$wgFileExtensions</code> in  /includes/DefaultSettings.php (which should never be edited). To allow  
+
The default of normally allowed extensions is listed <code>$wgFileExtensions</code> in  /includes/DefaultSettings.php (which should never be edited). To allow
 
additional extensions override <code>$wgFileExtensions</code> in LocalSettings.php.
 
additional extensions override <code>$wgFileExtensions</code> in LocalSettings.php.
  
Line 476: Line 549:
 
For debugging, you may enable logging of debug and error messages:
 
For debugging, you may enable logging of debug and error messages:
  
# create a log-file somewhere  
+
<source lang="bash">
 +
# create a log-file somewhere
 
   sudo touch /var/www/v-k2n/w/log.txt
 
   sudo touch /var/www/v-k2n/w/log.txt
 
   sudo chmod 777 /var/www/v-k2n/w/log.txt
 
   sudo chmod 777 /var/www/v-k2n/w/log.txt
 +
</source>
 +
<source lang="php">
 
# edit LocalSettings.php and add the following line after the line including the DefaultSettings.php:
 
# edit LocalSettings.php and add the following line after the line including the DefaultSettings.php:
 
   $wgDebugLogFile = "/var/www/v-k2n/w/log.txt";
 
   $wgDebugLogFile = "/var/www/v-k2n/w/log.txt";
 +
</source>
  
 
Note, that the logfile will get quite big pretty fast, so you should switch on the logging only for short periods of time, and delete the logfile after you're done.
 
Note, that the logfile will get quite big pretty fast, so you should switch on the logging only for short periods of time, and delete the logfile after you're done.

Revision as of 12:21, 28 August 2010

An overview and record of strategies to install mediawiki the first time, and maintain and upgrade it.

See also Debian installation for the underlying server, Mediawiki Development for links to software documentation etc.


First time MediaWiki installation

The first installation was made under mediawiki 1.14. We decided to directly follow the Wikipedia versions by checking out the Trunk revisions. Following [1]:

 sudo mkdir /usr/share/mediawiki; cd /usr/share/mediawiki
 # Checking out head revision for main and extensions
 sudo svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3
 sudo svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions
 sudo apt-get install imagemagick librsvg2-2 librsvg2-bin

Notes: "phase3" contains the main application, "extensions" the extension code. (Alternative for a more fixed version would be: svn checkout http://svn.wikimedia.org/svnroot/mediawiki/branches/REL1_13/phase3).

Also, for testing subversion updates, we checkout the wiki a second time into a staging folder:

 sudo mkdir /usr/share/mediawikistaging; cd /usr/share/mediawikistaging
 sudo svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3
 sudo svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions

We want to run multiple mediawiki instances on one server. We created a special, "mixed" form of linking, where the LocalSettings.php, the config and image folder are local, and the rest is linked, following instructions here (an alternative method would probably create problems with the maintenance scripts). Later we detected a page probably equivalent to our method (its source?) which may be helpful if problems should arise (but we did not use it yet). We created this mixed linked/local for a "/var/www/wiki-template" folder:

 md /var/www/wiki-template; cd /var/www/wiki-template/
 # it is important not to add any further "/" anywhere:
 sudo ln -s /usr/share/mediawiki/phase3/* .
 sudo rm -rf config
 sudo cp -vpRP /usr/share/mediawiki/phase3/config .
 sudo rm -rf images ## may have changed since, check
 sudo cp -vpRP /usr/share/mediawiki/phase3/images .

For installation, we need to make the config folder writable by the webserver, for media files some folders within images need to be writable. Also we renamed "images" to "media"

 cd /var/www/wiki-template/; sudo chmod 755 config
 sudo mv images media; sudo chmod 777 media
 cd /var/www/wiki-template/media/; sudo mkdir archive; mkdir thumb; sudo mkdir temp
 sudo chmod 755 archive; sudo chmod 755 thumb; sudo chmod 755 temp

To enable the display of svn revision numbers on Special:Version pages (as can be seen on the Wikimedia foundation wikis), one also must create a .svn link in each wiki folder from pointing to .svn in phase3.

Change Owner of media folder; NOT DONE, seems to be not necessary: (user "www-data" = apache user, confirmed to be present on Debian and most parts of apache run under this, ps -ef): chown www-data: media/


Email: Setting up the email functions requires either a local server, or for external server setting $wgSMTP. It also first requires to install the Mail.php functionality:

sudo apt-get install php-mail php-net-smtp

then add to LocalSettings.php:

 ini_set("include_path", ".:$IP:$IP/includes:$IP/languages:/usr/share/php/:/usr/share/php/PEAR/");
 $wgSMTP = array(
 'host'     => "160.45.63.40",
 'IDHost'   => "bgbm.org",
 'port'     => 25,
 'auth'     => true,
 'username' => "xxx123",
 'password' => "xxx123xxx123xxx123"
 );

Cloning a new wiki

Any code above needs to be run only the first time. From then on, the template can be reused to clone instances (where "NEW-WIKI" is replaced with the name for your wiki):

 cd /var/www/; sudo cp -r wiki-template NEW-Wiki
 cd /var/www/NEW-Wiki; sudo chmod a+w config; sudo chmod a+w cache; sudo chmod a+w media

followed by the install process in a web browser (http://..../NEW-Wiki/config/index.php)

Short note for later installs: do not forget to set localhost:8088 with port and UTF-8 character set. Add root superuser, the wikiuser has very limited rights (table insert to delete, create temp tables only, not including create table privileges).

Full notes for settings made on the web forms of the MediaWiki installation: For the DPG (society of phytopathologists in Germany): Name=DPG, contact email gh, language de, License: Creative Commons, choose non-commercial, share-alike, Admin name: WikiSysop, (password noted separate), caching memcached 127.0.0.1:11211, email options left default (or user-to-user disabled), DB config: MySQL, localhost:8088 (the port on which we operate mysql), databasename: pmedwiki, user name wikiuser, (password noted separate). adding root credentials so that wikiuser and tables can be created (wikiuser has insufficient rights). No database table prefix (originally we DID use prefixes and a single db, however, that prevents to ever use the single-sign-on mechanism...), engine=InnoDB, character set changed to UTF-8. Click Install, move LocalSettings.php to the parent directory, remove the config folder:

 cd /var/www/NEW-Wiki/; sudo mv config/LocalSettings.php .; sudo rm -rf config

For each wiki add to the virtual host configuration (e.g. to /etc/apache2/sites-available/default):

 Alias /NEW-Wiki-VIRTUAL /var/www/NEW-WIKI/index.php

and restart Apache2 gracefully:

 sudo /usr/sbin/apache2ctl -k graceful
 # or not graceful: sudo /usr/sbin/apache2ctl -k restart

For each wiki using ShortURLs, the robot.txt must be updated.

Some extensions need execution of a sql command for each db (where "DBNAME" and "DBUSER" are replaced with actual db name and user) (ls /var/www/NEW-Wiki/extensions/*.sql):

  mysql -u USER -p --database=studienstiftungswiki < /usr/share/mediawiki/extensions/ConfirmAccount/ConfirmAccount.sql
  mysql -u USER -p --database=studienstiftungswiki < /usr/share/mediawiki/extensions/OpenID/openid_table.sql
  mysql -u USER -p --database=studienstiftungswiki < /usr/share/mediawiki/extensions/TitleKey/titlekey.sql
  echo "CREATE VIEW dpl_clview AS SELECT IFNULL(cl_from, page_id) AS cl_from, IFNULL(cl_to, '') AS cl_to, cl_sortkey FROM page LEFT OUTER JOIN categorylinks ON page_id=cl_from;" | mysql -u USER -p DBNAME
 echo "CREATE VIEW dpl_clview AS SELECT IFNULL(cl_from, page_id) AS cl_from, IFNULL(cl_to, '') AS cl_to, cl_sortkey FROM page LEFT OUTER JOIN categorylinks ON page_id=cl_from;" | mysql -u mb-gh -p --database=studienstiftungswiki


Similar tables would be needed for the OAI (OpenArchiveInitiative) extension. The documentation is very poor so that THIS IS NOT YET APPLIED AND THE EXTENSION DISABLED FOR THE TIME BEING! ARE ALL TABLES COVERED BELOW?

 # mysql -u USER -p DBNAME < /usr/share/mediawiki/extensions/OAI/oaiaudit_table.sql
 # mysql -u USER -p DBNAME < /usr/share/mediawiki/extensions/OAI/oaiharvest_table.sql
 # mysql -u USER -p DBNAME < /usr/share/mediawiki/extensions/OAI/oaiuser_table.sql
 # mysql -u USER -p DBNAME < /usr/share/mediawiki/extensions/OAI/update_table.sql

To simplify the setup, we have extracted the common settings from LocalSettings.php into a file called MediaWikiCommonSettings.php directly in the www-root. Usually, because of the manual change to MediaWikiCommonSettings.php, we manually modify a template LocalSettings.php from any wiki and use it instead of the one created by the install process.

Note: virtual wiki path in lower case is preferable, because it helps to highlight the page title (having Title-Case)!

Notes: Using "commons" for image is problematic because easily confused with wikipedia (and the desirable WP interwiki link). "Media" is bad because existing "media:" prefix. Currently, we use m script and openmedia rewrite path inside species-id as a media repository.

Configuration after setup

  • Logo changed in each LocalSettings
  • Short_URL see: http://www.mediawiki.org/wiki/Manual:Short_URL
  • Timezone settings added: ( #Set Default Timezone: // $wgLocaltimezone="Europe/Berlin"; // $wgLocalTZoffset = +120; // putenv("TZ=$wgLocaltimezone");)
  • Security information on preventing editing by anonymous users and user-creation options under Preventing_Access; we added following to MediaWikiCommonSettings.php:
 $wgEnableUploads  = true; # (Make sure the php.ini settings are correct, see above)
 $wgMaxImageArea = 5e7; # Default is 1.25e7.
   # (support thumb generation for large line drawings which may only be 1.4 MB but larger 5000 px)
 # Disable anonymous editing
 $wgGroupPermissions['*']['edit'] = false;
 # Prevent new user registrations except by sysops
 $wgGroupPermissions['*']['createaccount'] = false;

(Perhaps see also a blog describing this method). A better method than limiting creation to sysops it the ConfirmAccount extension, which we installed (see extensions below).


Enabling extensions

The first part, establishing the symbolic links, must be done once for the subversion-managed mediawiki installation. Normally further actions are necessary (LocalSettings.php) for each wiki, but we perform them centrally in MediaWikiCommonSettings.php. Yet some db-specific actions are necessary for some extensions, see at the end. Most extensions are already available through the subversion download. Symbolic links are created to enable selected extensions, initially for:

 cd /usr/share/mediawiki/phase3/extensions
 # make symbolic links
 ln -s ../../extensions/CategoryTree
 ln -s ../../extensions/CentralAuth
 ln -s ../../extensions/CentralNotice
 ln -s ../../extensions/CharInsert
 ln -s ../../extensions/Cite
 ln -s ../../extensions/ConfirmAccount
 ln -s ../../extensions/ConfirmEdit
 ln -s ../../extensions/CrossNamespaceLinks
 ln -s ../../extensions/DismissableSiteNotice
 ln -s ../../extensions/DynamicPageList
 ln -s ../../extensions/ExpandTemplates
 ln -s ../../extensions/FlaggedRevs
 ln -s ../../extensions/Gadgets
 ln -s ../../extensions/GoogleMaps
 ln -s ../../extensions/intersection
 ln -s ../../extensions/Interwiki
 ln -s ../../extensions/ImageMap
 ln -s ../../extensions/inputbox
 # No longer used (now using MediaFunctions): ln -s /usr/share/mediawiki/NonSvnExtensions/ImageSizeInfoFunctions
 ln -s /usr/share/mediawiki/NonSvnExtensions/LinkedImage
 # NOT: MakeBot, Makesysop, both now core functionality (although still listed as extension in en/de wikipedia)
 ln -s ../../extensions/MathStatFunctions
 ln -s ../../extensions/MediaFunctions
 ln -s ../../extensions/MultiUpload
 ln -s ../../extensions/MWSearch
 ln -s /usr/share/mediawiki/NonSvnExtensions/IdentificationTool
 ln -s ../../extensions/OAI
 ln -s ../../extensions/OpenID
 ln -s ../../extensions/Oversight
 ln -s ../../extensions/PasswordReset
 ln -s ../../extensions/ParserFunctions
 ln -s /usr/share/mediawiki/NonSvnExtensions/RawFile
 ln -s ../../extensions/Renameuser
 ln -s ../../extensions/ReplaceText
 ln -s ../../extensions/SemanticMediaWiki
 ln -s ../../extensions/SemanticForms
 ln -s ../../extensions/SharedUserRights
 # Following two not in subversion:
 ln -s /usr/share/mediawiki/NonSvnExtensions/ShibbolethAuthentication
 ln -s /usr/share/mediawiki/NonSvnExtensions/SQL2Wiki
 ln -s ../../extensions/StringFunctions
 ln -s ../../extensions/SyntaxHighlight_GeSHi
 ln -s ../../extensions/TitleKey
 ln -s ../../extensions/TreeAndMenu

This is further necessary to self-written extensions such as:

 ln -s /usr/share/mediawiki/NonSvnExtensions/IdentificationTool
 ln -s /usr/share/mediawiki/NonSvnExtensions/MetadataHarvester

Only for Key to Nature the following special extensions are linked in:

 cd /usr/share/mediawiki/phase3/extensions
 ln -s /usr/share/mediawiki/NonSvnExtensions/AddScriptCss
 ln -s /usr/share/mediawiki/NonSvnExtensions/StubManager
 ln -s /usr/share/mediawiki/NonSvnExtensions/VideoFlash

SyntaxHighlight needs an additional checkout from a different source:

 cd /usr/share/mediawiki/extensions/SyntaxHighlight_GeSHi
 svn checkout http://geshi.svn.sourceforge.net/svnroot/geshi/trunk/geshi-1.0.X/src/ geshi

The CentralAuth extension needs to create the following tables a single time (file CentralAuth/central-auth.sql, stored here for immediate repetition, but may be obsolete with software updates):

CREATE TABLE globalnames (gn_name varchar(255) binary not null, primary key (gn_name)) TYPE=InnoDB;
CREATE TABLE localnames (
  ln_wiki varchar(255) binary not null,
  ln_name varchar(255) binary not null,
  primary key (ln_wiki, ln_name),
  key (ln_name, ln_wiki)) TYPE=InnoDB;
CREATE TABLE globaluser (
  gu_id int auto_increment, gu_name varchar(255) binary,
  gu_enabled varchar(14) not null,
  gu_enabled_method enum('opt-in', 'batch', 'auto', 'admin'),
  gu_home_db varchar(255) binary,
  gu_email varchar(255) binary,
  gu_email_authenticated char(14) binary,
  gu_salt varchar(16) binary,
  gu_password tinyblob,
  gu_locked bool not null default 0,
  gu_hidden bool not null default 0,
  gu_registration varchar(14) binary,
  gu_password_reset_key tinyblob,
  gu_password_reset_expiration varchar(14) binary,
  gu_auth_token varbinary(32) NULL,
  primary key (gu_id),
  unique key (gu_name), key (gu_email)) TYPE=InnoDB;
CREATE TABLE localuser (
  lu_wiki varchar(255) binary not null,
  lu_name varchar(255) binary not null,
  lu_attached_timestamp varchar(14) binary,
  lu_attached_method enum ('primary', 'empty', 'mail', 'password', 'admin', 'new', 'login'),
  primary key (lu_wiki, lu_name),
  key (lu_name, lu_wiki)) TYPE=InnoDB;
CREATE TABLE global_user_groups (
  gug_user int(11) not null,
  gug_group varchar(255) not null,
  PRIMARY KEY (gug_user,gug_group),
  KEY (gug_user), key (gug_group)) TYPE=InnoDB;
CREATE TABLE global_group_permissions (
  ggp_group varchar(255) not null,
  ggp_permission varchar(255) not null,
  PRIMARY KEY (ggp_group, ggp_permission),
  KEY (ggp_group), KEY (ggp_permission)) TYPE=InnoDB;


In LocalSettings/CommonSettings, add the following corresponding code at the end (requires updating!):

 # EXTENSIONS:
 # MakeBot, MakeSysop are still listed in en/de wikipedia, but obsolete, now in core!
 $wgUseAjax = true; // needed for CategoryTree
 require_once("$IP/extensions/CategoryTree/CategoryTree.php");
 #### DISABLED: (configuration problems) #####require_once("$IP/extensions/CentralAuth/CentralAuth.php");
  ##this needs configuration of http://www.mediawiki.org/wiki/Manual:%24wgConf, which must occurs after the specific settings, see
 require_once("$IP/extensions/CharInsert/CharInsert.php");
 require_once("$IP/extensions/Cite/SpecialCite.php");
 
 # ConfirmAccount needs email enabled! Otherwise users can't get their passwords...
 #### DISABLED #####require_once("$IP/extensions/ConfirmAccount/SpecialConfirmAccount.php");
  $wgMakeUserPageFromBio = true; // Set the person's bio as their userpage?
  $wgAutoUserBioText = ''; // Text to add to bio pages if the above option is on
  $wgAutoWelcomeNewUsers = true;
  $wgUseRealNamesOnly = false; // Make the username of the real name? DEFAULT was true
  $wgConfirmAccountRejectAge = 30 * 24 * 3600; // 1 month = How long after accounts have been requested/held before they count as 'rejected'
  $wgAccountRequestThrottle = 5; // How many requests can an IP make at once; DEFAULT was 1, but this is for firewalled users
  $wgAccountRequestMinWords = 3; // Minimum biography specs (original was 50)
  $wgAccountRequestToS = false; // Show ToS checkbox
  $wgAccountRequestExtraInfo = true; // Show confirmation info fields
  # If set, will add {{DEFAULTSORT:sortkey}} to userpages for auto-categories.
  # The sortkey will be made be replacing the first element of this array
  # (regexp) with the second. Set this variable to false to avoid sortkey use.
  $wgConfirmAccountSortkey = true;
  $wgConfirmAccountSortkey = array( '/^(.+) ([^ ]+)$/', '$2, $1' );  // this will do {{DEFAULTSORT:firstname, lastname}}
  # If ConfirmEdit is installed and set to trigger for createaccount, inject catpchas for requests too?
  $wgConfirmAccountCaptchas = false; // DEFAULT was true, but this seems redundant
  $wgAllowAccountRequestFiles = false; // Default was false
  # $wgGroupPermissions['*']['createaccount'] = false;
  # $wgGroupPermissions['bureaucrat']['confirmaccount'] = true;
  # $wgGroupPermissions['bureaucrat']['requestips'] = true; // This right has the request IP show when confirming accounts
  $wgConfirmAccountNotice = true; // Show notice for open requests to admins? Cached, but may still be expensive for thousands of requests.
 require_once("$IP/extensions/ConfirmEdit/ConfirmEdit.php" );
  # ConfirmEdit configuration:
  $wgGroupPermissions['*'            ]['skipcaptcha'] = false;
  $wgGroupPermissions['user'         ]['skipcaptcha'] = false;
  $wgGroupPermissions['autoconfirmed']['skipcaptcha'] = true;
  $wgGroupPermissions['bot'          ]['skipcaptcha'] = true;
  $wgGroupPermissions['sysop'        ]['skipcaptcha'] = true;
  $wgCaptchaTriggers['edit']          = false;
  $wgCaptchaTriggers['create']        = false;
  $wgCaptchaTriggers['addurl']        = false;
  $wgCaptchaTriggers['createaccount'] = true;
  $wgCaptchaTriggers['badlogin']      = true;
 require_once("$IP/extensions/CentralNotice/CentralNotice.php");
 require_once("$IP/extensions/CrossNamespaceLinks/SpecialCrossNamespaceLinks.php");
 require_once("$IP/extensions/DismissableSiteNotice/DismissableSiteNotice.php");
 #add DynamicPageList Extension, used e.g. for automatic event listing on key2nature. See also: http://semeb.com/dpldemo/
 require_once("$IP/extensions/DynamicPageList/DynamicPageList2.php");
 ### enabling FlaggedRevs requires many further actions (sql)!
  ### include_once("$IP/extensions/FlaggedRevs/FlaggedRevs.php");
 require_once("$IP/extensions/ExpandTemplates/ExpandTemplates.php");
 require_once("$IP/extensions/Gadgets/Gadgets.php");

 ## GoogleMapsExtension: This may have to be moved to individual wikis or secondary commons files, since it is URL dependend
  ## Key for http://www.phytopathology.net/:
  $wgGoogleMapsKey = "ABQIAAAAtIv2htpKQclAQPE21vjSBBSL1aXnaBCy0UI5nOCX2jho6QpXrBTEjwGjkp6B0qEgN34MXgC9JE17Ag";
 ## GoogleMaps temporarily disabled again, it adds huge amounts of JavaScript to each page!
 ## xyyfafxy<xykeopkfdrequire_once("$IP/extensions/GoogleMaps/GoogleMaps.php");

 include_once("$IP/extensions/IdentificationTool/IdentificationTool.php"); /* OUR OWN EXTENSION */
 require_once("$IP/extensions/ImageMap/ImageMap.php");
 require_once("$IP/extensions/inputbox/inputbox.php");
 ### DISABLED, undocumented usage, unclear whether conflicting with full DynamicPageList:
   ### require_once("$IP/extensions/intersection/DynamicPageList.php");
 require_once("$IP/extensions/Interwiki/SpecialInterwiki.php");
  $wgGroupPermissions['*']['interwiki'] = false;
  $wgGroupPermissions['sysop']['interwiki'] = true;
  # an additional user group is possible, bureaucrats can assign this:
  # $wgGroupPermissions['interwiki']['interwiki'] = true;
 include_once("$IP/extensions/LinkedImage/LinkedImage.php");
 require_once("$IP/extensions/MathStatFunctions/MathStatFunctions.php");
 require_once("$IP/extensions/MultiUpload/SpecialMultipleUpload.php");
 ### DISABLED, SQL ADDITIONS NEEDED, NO DOCUMENTATION ON USE:
   ### require_once("$IP/extensions/OAI/OAIRepo.php");
 ### OpenID: DISABLED! The libraries are installed, the sql executed, but when enabling and navigating to special pages an error occurs
   ### require_once("$IP/extensions/OpenID/OpenID.setup.php");

 require_once("$IP/extensions/ParserFunctions/ParserFunctions.php");
 ## Allow Sysops to reset passwords:
 require_once("$IP/extensions/PasswordReset/PasswordReset.php");
  $wgGroupPermissions['sysop']['passwordreset']   = true;
 require_once("$IP/extensions/RawFile/RawFile.php");
 require_once("$IP/extensions/Renameuser/SpecialRenameuser.php" );
 include_once("$IP/extensions/ReplaceText/ReplaceText.php");

 ##SEMANTIC MEDIAWIKI:
 include_once("$IP/extensions/SemanticMediaWiki/includes/SMW_Settings.php");
 include_once("$IP/extensions/SemanticForms/includes/SF_Settings.php");
 enableSemantics('example.org'); # replace example.org by the name of the wiki.

 include_once("$IP/extensions/SQL2Wiki/SQL2Wiki.php");
 ### NOT YET ENABLED: ShibbolethAuthentication, folder linked, not yet tested or activated
 require_once("$IP/extensions/StringFunctions/StringFunctions.php");
 require_once("$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php");
 ### DO NOT ENABLE TitleKey without a good reason. Without it being installed, searching for articles DOES work case-insensitive already. No further explanations could be found.

Additional actions for some extensions:

  • CharInsert requires after standard installation to create/edit MediaWiki:Edittools
    • Good templates are found (but respect the license!) at en.wikipedia or de.wikipedia.
    • The english WP uses a mixture of direct use and Javascript; it requires also MediaWiki:Edittools.js
    • The place where MediaWiki:Edittools.js is being activated needs still to be found! TODO!
  • ConfirmAccount needs sql commands for each db; details under cloning wikis above.
  • OpenID requires the openidenabled.com 2.x libraries. Debian 4 support those only as backports, so make sure the repository has been added (see above). Then issue apt-get install python-openid. Additional sql code is needed; details under cloning wikis above.
  • (Cite may also need additional action, although the mentioned cite layout file is already present. Nothing done so far, needs testing)
  • (Sitenotice: It is possible to set one in LocalSettings.php, but better method is MediaWiki:Sitenotice)
  • Todo:
    • FlaggedRevs has a number of things to do, not yet done
    • install lucene (links on MWSearch page), add and install MWSearch extension

Note: according to testing by Evolaris, the CentralNotice extension is slowing down the Wiki functionality significantly, by loading <script type="text/javascript" src="http://smorgasbord.local/trunk/index.php/Special:NoticeLoader"></script> from external sites. We may want to disable this function again. the function occurs on both KeyToNature and the JKI installations. Note that, although the en and de Wikipedias themselves use the extension, the script does not appear there!!!

Open Questions

  • TODO: Quiz: the building tool adopted by Wikiversity! This one comes close to identification tools!
  • TODO: Install and test Extension:CentralAuth. The special tables are created in wikidb, and a variant for CommonSettings2.php exists in the root. However, configuring the wgConfig variable remained unclear for a config with with prefixed tables for multiple wikis in a single database. Could not get it to work...
    • CentralAuth is confirmed not to work at present when multiple wikis are kept in a single DB, separated by table prefixes.
    • Instead we configured one Wiki-database to manage the users from all Wikis (using the localsettings variable $wgSharedDB). This provides single identity, although not single sign-on.
    • If we fail to get this running, drop the tables again: DROP TABLE globalnames; DROP TABLE localnames; DROP TABLE globaluser; DROP TABLE localuser; DROP TABLE global_user_groups; DROP TABLE global_group_permissions;
  • GoogleMapsExtension
  • Configure Gadgets Extension, extension is running but no gadgets are active yet (wikED would be nice).
  • MWSearch (NEEDS LUCENE FIRST)
  • TitleKey (probably not necessary when MWSearch is active, Article name search is case-insensitive)
  • OAI (installation problems, sql queries remained unclear)
  • SemanticMediaWiki (no sql queries needed)
  • Under Review, potential security thread: SQL2Wiki
  • Not activated: LdapAuthentication' (http://www.mediawiki.org/wiki/Extension:LDAP_Authentication)
  • Considered: DataTable', Glossary (both currently not in subversion-extensions), PDF Export,
  • Intersection has been disabled again, lack of usage documentation, may conflict with DynamicPageList (Same php file name, same tag??). They have similar purposes, but Intersection is used on WikiNews, DynamicPageList not.
    • Update: Intersection/DynamicPageList is documented here, the names are just confusing!

Backup/Restore

For just the database see: http://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki. A more complete script can be found here: http://www.mediawiki.org/wiki/User:Flominator/Backup_MW - this also backups the folder with uploads (media). Based on that source, adapted scripts were created, execute as:

 cd /var/backups/scripts/; ./backup-mw.sh

The additional backup-mw.php script can potentially be used within www to directly create and download a copy of the mediawiki. We are testing this as a measure to build trust.

In addition, to create an xml dump, make sure a link to AdminSettings.php exists in the current wiki folder and the maintenance folder is temporarily copied, then run, e.g.:

 cd /var/www/v-k2n/w/maintenance # replace path with actual wiki path
 php dumpBackup.php --full > /var/backups/wikis/k2n-full.xml
 php dumpBackup.php --logs > /var/backups/wikis/k2n-logs.xml

(Note: --logs may not yet be working under version 1.12, it works in 1.14)

To restore such a xml-dump, remove tables and create new tables with default values in mysql, then:

 cd /var/www/WIKINAME;  # (replace path with actual wiki path!)
 php ./maintenance/importDump.php /var/backups/wikis/k2n-full.xml --conf ./LocalSettings.php
 php ./maintenance/rebuildrecentchanges.php --conf ./LocalSettings.php    # absolutely necessary
 ## If backlinks etc. do not work, or extensions had to be disabled, use (Very slow!!!!):
 php ./maintenance/rebuildall.php  --quick --conf ./LocalSettings.php

Notes: In our experience, some extensions may create problems during reimport. We found GoogleMaps and DynamicPageList to cause importDump to abort. After disabling these two extensions, the import worked correctly. However, all DPL pages are then still cached without proper DPL rendering even after re-enabling both extensions. Running rebuildall.php fixed this.

Example restore for testing of the wikimediafoundation commons xml-dump:

 cd /var/www/wmf-commons; php ./maintenance/importDump.php  /mnt/wpTest/commonswiki-pages-articles.xml  --conf ./LocalSettings.php

Maintenance scripts

(see http://www.mediawiki.org/wiki/Manual:Maintenance_scripts)

In /usr/share/mediawiki/phase3/ copy AdminSettings.sample to AdminSettings.php, create a new user wikiadmin for mysql with localhost only, and edit AdminSettings.php accordingly. Then, for each wiki, in /var/www/wikifolder/, a symlink must be created linking to /usr/share/mediawiki/phase3/AdminSettings.php. Since we have a symlinked installation, installations scripts must run like:

 php /var/www/wikifolder/maintenance/rebuildall.php   --conf /var/www/wikifolder/LocalSettings.php
 php /var/www/wikifolder/maintenance/importImages.php --conf /var/www/wikifolder/LocalSettings.php /var/www/wikifolder/media/newimages .jpg .png .svg

Rebuild all is necessary after external text, sql, or xml imports.

Table corruption: rebuildall.php may report that a table, especially searchindex (which is MyISAM even if other tables are InnoDB) is corrupt and needs to be repaired. In phpmyadmin, open a sql window for the affected database, and issue: truncate table searchindex;. Running rebuildall.php afterwards concluded the repair in a case we had.

Rebuilding the file cache (note: permission may be a problem; this will be the commandline user, whereas normally cache is written by apache):

 cd /var/www/metawiki;       php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/testwiki;       php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-k2n/w;        php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-k2n/it;       php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-lias/w;       php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-phytomed/w;   php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-phytopathology/w; php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-rosaceae/w;   php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-species/n;    php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-species/o;    php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-species/w;    php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-workbench/w;  php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php

After erroneously localizing commons images not to openmedia but to local wikis, extension Nuke was used to deleted the caching-bot imports, and deleteArchivedFiles to actually delete all archived files:

 cd /var/www/v-onf/w; php ./maintenance/deleteArchivedFiles.php  --conf ./LocalSettings.php --delete

Fix problems with unparsable image names (see [2]):

 cd /var/www/v-k2n/w; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 cd /var/www/v-onf/w; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 cd /var/www/v-species/o; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 cd /var/www/v-species/s; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php


Extension maintenance scripts

Some extensions provide their own maintenance scripts in their own extension folder. On a wiki farm, the execution of these scripts may fail due to the linked directory structure. They need an additional link (needs to be created only once):

 cd /usr/share/mediawiki/; ln -s /usr/share/mediawikistaging/phase3/maintenance
 cd /usr/share/mediawikistaging/; ln -s /usr/share/mediawikistaging/phase3/maintenance

Now TitleKey works:

 cd /var/www/testwiki; php ./extensions/TitleKey/rebuildTitleKeys.php --conf ./LocalSettings.php

MediaWiki configuration tips

Configuring MediaWiki:Sidebar: New options July 2008, see [3]

It may be useful to copy the contents of http://en.wikipedia.org/wiki/MediaWiki:Common.css and http://en.wikipedia.org/wiki/MediaWiki:Monobook.css into the Mediawiki:Common.css and MediaWiki:Monobook.css pages of each Wiki where you may want to use copied things e.g. templates from wikipedia.


MediaWiki upgrading

To upgrade Mediawiki first run the update on the staging version (= testwiki, http://biowikifarm.net/test):

 cd /usr/share/mediawikistaging/; sudo svn update phase3 extensions  -r59858
 sudo /usr/sbin/apache2ctl -k graceful
 # Optionally add other updates:
 sudo apt-get update
 sudo apt-get upgrade
 cd /usr/share/; sudo svn update phpmyadmin-dev

After testing and verifying functionality, also update the production version (where "-r52502" indicates to update precisely to revision 52502; this should always be the value of the tested revision from staging / test wiki!):

 cd /usr/share/mediawiki; sudo svn update phase3 extensions  -r66620
 sudo /usr/sbin/apache2ctl -k graceful

Occasionally the SVN upgrading of Mediawiki may require an upgrade of the database structures. Again, the update.php must be called with symlink-compatible syntax. Examples for mediawiki core:

 cd /var/www/metawiki; php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/testwiki; php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-on/w;  php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-ispi/w;  php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-k2n/w;  php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-k2n/h;  php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-k2n/it;  php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-lias/w;  php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-phytomed/w; php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-phytopathology/w; php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-rosaceae/w;  php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-species/n;   php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-species/o;   php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-species/s;   php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-species/w;   php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-workbench/w; php ./maintenance/update.php  --quick --conf ./LocalSettings.php


For semantic mediawiki extension (SMW) click on "Initialise or upgrade tables" on SpecialPage Semantic Admin:

See also Maintenance scripts above for further scripts.

File uploading and Mime types

Uploading files with extensions and Content types (MIME types) usually not allowed on wikis: The default of normally allowed extensions is listed $wgFileExtensions in /includes/DefaultSettings.php (which should never be edited). To allow additional extensions override $wgFileExtensions in LocalSettings.php.

There are also $wgMimeTypeBlacklist and $wgFileBlacklist for file extensions and MIME types that are never allowed for security reasons, even if added to $wgFileExtensions. If needed for special purposes and considered safe, they can be commented out in these blacklists in LocalSettings.php.

If there is still the error message "The file is corrupt or has an incorrect extension. Please check the file and upload again", the reason can be that the file you want to upload has a MIME type for which only certain file extensions are allowed in /includes/mime.types and has an extension not listed there. If considered safe, the extension can be added in that file. The mime type can be determined with the command file -i filename. Note: Files that are changed manually are then excluded from svn update. To drop own changes and get back to the svn version delete the file and then run svn update (see above).

Securing MediaWiki

See http://www.mediawiki.org/w/index.php?title=Manual:Security

Logging/Debugging

For debugging, you may enable logging of debug and error messages:

# create a log-file somewhere
  sudo touch /var/www/v-k2n/w/log.txt
  sudo chmod 777 /var/www/v-k2n/w/log.txt
# edit LocalSettings.php and add the following line after the line including the DefaultSettings.php:
  $wgDebugLogFile = "/var/www/v-k2n/w/log.txt";

Note, that the logfile will get quite big pretty fast, so you should switch on the logging only for short periods of time, and delete the logfile after you're done.