Difference between revisions of "Patent Data Project Wiki"

From edegan.com
Jump to navigation Jump to search
imported>Ed
imported>Ed
m (Protected "Patent Data Project Wiki" [edit=nber:move=nber:read=nber])
 
(7 intermediate revisions by the same user not shown)
Line 103: Line 103:
  
 
When we browsed to http://www.nber.org/~edegan/w/index.php we got a 500 internal server error.
 
When we browsed to http://www.nber.org/~edegan/w/index.php we got a 500 internal server error.
Adding the following code to the top of the page (below <?php) showed a problem with the ctype function. This was resolved by Mohan, who installed php5-ctype.
+
Adding the following debug code to the top of the page showed a problem with the ctype function. This was resolved by Mohan, who installed php5-ctype.
 +
 
 +
'''Debug code''' can be added to the top of LocalSettings.php (below <?php though). It should be taken out again at the end of the build:
  
 
  error_reporting( E_ALL | E_STRICT );
 
  error_reporting( E_ALL | E_STRICT );
 
  ini_set( 'display_errors', 1 );
 
  ini_set( 'display_errors', 1 );
 
  $wgShowExceptionDetails = true;
 
  $wgShowExceptionDetails = true;
 +
  
 
==Configuration and Extensions==
 
==Configuration and Extensions==
Line 117: Line 120:
 
  $wgGroupPermissions['*']['edit'] = false; #Stops editing without an account, globally
 
  $wgGroupPermissions['*']['edit'] = false; #Stops editing without an account, globally
 
  $wgEnableUploads = true; #Note that the max upload size is likely dictated by max_upload_filesize in php.ini
 
  $wgEnableUploads = true; #Note that the max upload size is likely dictated by max_upload_filesize in php.ini
 +
$wgFileExtensions=array('png','gif','jpg','jpeg','doc','xls','pdf','ppt','tiff','bmp','docx','xlsx','pptx','ps','odt','ods','odg','div','docx','xlsx','asci','csv','txt','wiki','sql');
 +
$wgVerifyMimeType=false;
 +
$wgStrictFileExtensions=false;
 +
$wgCheckFileExtensions=false;
  
 
Edit (or create by going to):   
 
Edit (or create by going to):   
Line 123: Line 130:
 
  * navigation
 
  * navigation
 
  ** mainpage|mainpage-description
 
  ** mainpage|mainpage-description
  ** portal-url|portal
+
  ** data|Data
  ** currentevents-url|currentevents
+
  ** documentation|Documentation
 +
** development|Development
 +
** reference|Reference
 +
** about|About PDPWiki
 
  ** recentchanges-url|recentchanges
 
  ** recentchanges-url|recentchanges
 
  ** randompage-url|randompage
 
  ** randompage-url|randompage
 
  ** helppage|help
 
  ** helppage|help
** Special:MultipleUpload|Upload Multiple Files
 
 
  * SEARCH
 
  * SEARCH
 
  * TOOLBOX
 
  * TOOLBOX
 
  * LANGUAGES
 
  * LANGUAGES
 +
 +
Edit the main page description: http://www.nber.org/~edegan/w/index.php?title=MediaWiki:Mainpage-description&action=edit
 +
 +
Patent Data Project
  
 
===Extensions===
 
===Extensions===
Line 182: Line 195:
 
  $wgMaxUploadFiles=10;
 
  $wgMaxUploadFiles=10;
  
===Additional Extensions===
+
===Additional Configuration/Extensions===
  
 
At some point we might want to install the math extension (required in v1.18 to get LaTeX to render).
 
At some point we might want to install the math extension (required in v1.18 to get LaTeX to render).
Line 203: Line 216:
  
 
We might also want UserRightsList, but it does not appear to work for v1.18 (this has been reported to the author)
 
We might also want UserRightsList, but it does not appear to work for v1.18 (this has been reported to the author)
 +
 +
And we WILL want to use short URLs. This will mean that we need to add to LocalSettings.php
 +
 +
$wgArticlePath = "/~edegan/wiki/$1";    # Redirect for short URLs
 +
  and possibly:
 +
$wgUsePathInfo = true;
 +
 +
As well as a .htaccess file or other means of doing the redirect. An example .htaccess file that doesn't work, most likely because the webserver doesn't allow Rewrites is:
 +
 +
RewriteEngine On
 +
RewriteRule ^/~edegan/wiki/(.*)$ /~edegan/w/index.php?title=$1 [PT,L,QSA]
 +
RewriteRule ^/~edegan/wiki/*$ /~edegan/w/index.php [L,QSA]
 +
 +
Documentation on configuring Short URLs is here: http://www.mediawiki.org/wiki/Manual:Short_URL
 +
 +
 +
==Security==
 +
 +
Until we can move the wiki and change its owner to apache (or similar), which requires root, the best we can do appears to be (from public_html):
 +
 +
chmod -R og-wx+X w/
 +
chmod -R og+w w/images/
 +
 +
Note that the images directory needs write to allow file uploads.

Latest revision as of 19:05, 9 February 2012

The patent data project wiki is intended to be a central location for cooperative development, data dissemination, and information provision for the Patent Data Project at the NBER.

This page details the installation and configuration of the wiki.

Getting the files

See the download page for mediawiki

Do the following:

nber7%> wget http://download.wikimedia.org/mediawiki/1.18/mediawiki-1.18.1.tar.gz

Note that we use mediawiki version 1.18.1.

Installation

The official mediawiki Installation guide

Check that PHP is higher than version 5.2.3 (and not 5.3.1):

nber7%> php -v
PHP 5.3.3 (cli) (built: Jul 22 2010 15:57:00)

Check that MySQL is version 4.0 or higher:

nber7%> mysql -h mysql.nber.org -u wikipatent -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7991397
Server version: 5.1.48-log FreeBSD port: mysql-server-5.1.48

We will also need:

  • ImageMagick or GD is required for image thumbnailing.
  • TeX is required for the in-line display of mathematical formulae.
  • Sendmail is required in order for the system to be able to send e-mails.

Extract the tar.gz and put the files in a directory called 'w' under public_html:

tar xvzf mediawiki-*.tar.gz
mv mediawiki-1.18.1 ../public_html/
cd ../public_html/
mv mediawiki-1.18.1/ w/

Mohan at the NBER created a database for the wiki. Check it's configuration now.

nber7%> mysql -h mysql.nber.org -u wikipatent -p
mysql> show GRANTS;
+----------------------------------------------------------------------------------+
| Grants for wikipatent@%                                                          |
+----------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'wikipatent'@'%' IDENTIFIED BY PASSWORD '610973195c4dda6b' |
| GRANT ALL PRIVILEGES ON `patentwiki`.* TO 'wikipatent'@'%'                       |
+----------------------------------------------------------------------------------+
2 rows in set (0.02 sec)

Fix the permissions so we can set up the wiki in directory 'w' (tighten them afterwards):

chmod 777 -R w

Browse to http://www.nber.org/~edegan/w/index.php and click the 'set-up the wiki' link.


Basic Configuration

Make the following choices in the web-based interface (otherwise use the defaults):

Database host: mysql.nber.org
Database name: patentwiki
Database username: wikipatent
Database password: ******** (available from Mohan)
Name of wiki: PDPWiki
Your name: wikiadmin
Password: ******** (same as above)
Password again: ******** (same as above)
Enable user talk page notification: yes
Enable watchlist notification: yes
WikiEditor: yes
Renameuser: yes
Enable file uploads: yes (directory for deleted files: /disk/homes2b/nber/edegan/public_html/w/images/deleted)
Logo Url: /disk/homes2b/nber/edegan/public_html/wiki.png

Then click the final continues...

Save the offered LocalSettings.php file. Then upload it into the w directory, and chmod 777 LocalSettings.php (tighten the security again later).

There where also the following notices:

  • ImageMagick was found
  • intl PECL extension was not available (this is not crucial unless the traffic is high) [1]
  • The uploads directory has a security vulnerability that needs closing [2]

There was also the following database warning:

Warning: You have selected MyISAM as storage engine for MySQL, 
which is not recommended for use with MediaWiki, because:
*it barely supports concurrency due to table locking 
*it is more prone to corruption than other engines 
*the MediaWiki codebase does not always handle MyISAM as it should 

If your MySQL installation supports InnoDB, it is highly recommended 
that you choose that instead. If your MySQL installation does not 
support InnoDB, maybe it's time for an upgrade.

Note that the configuration page is here: http://www.nber.org/~edegan/w/mw-config/index.php

When we browsed to http://www.nber.org/~edegan/w/index.php we got a 500 internal server error. Adding the following debug code to the top of the page showed a problem with the ctype function. This was resolved by Mohan, who installed php5-ctype.

Debug code can be added to the top of LocalSettings.php (below <?php though). It should be taken out again at the end of the build:

error_reporting( E_ALL | E_STRICT );
ini_set( 'display_errors', 1 );
$wgShowExceptionDetails = true;


Configuration and Extensions

Configuration

Add the following to the bottom of LocalSettings.php

$wgGroupPermissions['*']['edit'] = false; #Stops editing without an account, globally
$wgEnableUploads = true; #Note that the max upload size is likely dictated by max_upload_filesize in php.ini
$wgFileExtensions=array('png','gif','jpg','jpeg','doc','xls','pdf','ppt','tiff','bmp','docx','xlsx','pptx','ps','odt','ods','odg','div','docx','xlsx','asci','csv','txt','wiki','sql');
$wgVerifyMimeType=false;
$wgStrictFileExtensions=false;
$wgCheckFileExtensions=false;

Edit (or create by going to): http://www.nber.org/~edegan/w/index.php/MediaWiki:Sidebar

* navigation
** mainpage|mainpage-description
** data|Data
** documentation|Documentation
** development|Development
** reference|Reference
** about|About PDPWiki
** recentchanges-url|recentchanges
** randompage-url|randompage
** helppage|help
* SEARCH
* TOOLBOX
* LANGUAGES

Edit the main page description: http://www.nber.org/~edegan/w/index.php?title=MediaWiki:Mainpage-description&action=edit

Patent Data Project

Extensions

From the extensions directory, do the following:

wget http://upload.wikimedia.org/ext-dist/SimpleSecurity-MW1.18-r92088.tar.gz
tar -xzf SimpleSecurity-MW1.18-r92088.tar.gz
chmod 777 -R SimpleSecurity/
wget http://upload.wikimedia.org/ext-dist/UserMerge-MW1.18-r91995.tar.gz
tar -xzf UserMerge-MW1.18-r91995.tar.gz
chmod 777 -R UserMerge/
wget http://upload.wikimedia.org/ext-dist/ImportUsers-MW1.18-r91995.tar.gz
tar -xzf ImportUsers-MW1.18-r91995.tar.gz
chmod 777 -R ImportUsers/
wget http://upload.wikimedia.org/ext-dist/MultiUpload-MW1.18-r91995.tar.gz
tar -xzf MultiUpload-MW1.18-r91995.tar.gz
chmod 777 -R MultiUpload/

Add the following to the bottom of LocalSettings.php

#SimpleSecurity
$wgSecurityUseDBHook = true; # Add this to enable the experimental DB hook for stronger security
include_once("{$IP}/extensions/SimpleSecurity/SimpleSecurity.php");
# All other SimpleSecurity directives MUST be specified after the include or the defaults will override them.
$wgSecurityRenderInfo = true;
$wgSecurityAllowUnreadableLinks = false;
$wgPageRestrictions['Category:Servers']['read'] = 'sysop';
$wgSecurityExtraGroups = array(
   'students' => 'Students',
   'faculty' => 'Faculty,
   'staff' => 'Staff',
);
#Renameuser (this is installed by default in the extensions folder)
require_once("$IP/extensions/Renameuser/Renameuser.php");
#UserMergeAndDelete
require_once( "$IP/extensions/UserMerge/UserMerge.php" );
$wgGroupPermissions['bureaucrat']['usermerge'] = true;
#ImportUsers
require_once("$IP/extensions/ImportUsers/SpecialImportUsers.php");
#MultipleUpload
require_once("$IP/extensions/MultiUpload/SpecialMultipleUpload.php");
$wgMaxUploadFiles=10;

Additional Configuration/Extensions

At some point we might want to install the math extension (required in v1.18 to get LaTeX to render).

The documentation is here: http://www.mediawiki.org/wiki/Extension:Math

Downloading instructions:

wget http://upload.wikimedia.org/ext-dist/Math-MW1.18-r103240.tar.gz
tar -xzf Math-MW1.18-r103240.tar.gz
chmod 777 -R Math/
cd Math/math
wget http://caml.inria.fr/pub/distrib/ocaml-3.12/ocaml-3.12.1.tar.gz
tar -xzf ocaml-3.12.1.tar.gz
...and make ocaml and texvc

Additions to LocalSettings.php

#Math
require_once("$IP/extensions/Math/Math.php");
$wgUseTeX = true;

We might also want UserRightsList, but it does not appear to work for v1.18 (this has been reported to the author)

And we WILL want to use short URLs. This will mean that we need to add to LocalSettings.php

$wgArticlePath = "/~edegan/wiki/$1";     # Redirect for short URLs
 and possibly:
$wgUsePathInfo = true;

As well as a .htaccess file or other means of doing the redirect. An example .htaccess file that doesn't work, most likely because the webserver doesn't allow Rewrites is:

RewriteEngine On
RewriteRule ^/~edegan/wiki/(.*)$ /~edegan/w/index.php?title=$1 [PT,L,QSA]
RewriteRule ^/~edegan/wiki/*$ /~edegan/w/index.php [L,QSA]

Documentation on configuring Short URLs is here: http://www.mediawiki.org/wiki/Manual:Short_URL


Security

Until we can move the wiki and change its owner to apache (or similar), which requires root, the best we can do appears to be (from public_html):

chmod -R og-wx+X w/
chmod -R og+w w/images/

Note that the images directory needs write to allow file uploads.