Showing posts with label Wikipedia. Show all posts
Showing posts with label Wikipedia. Show all posts

Tuesday, September 8, 2015

Trac wiki formatting

http://trac.edgewall.org/wiki/WikiFormatting
https://trac.tools.ietf.org/wg/enum/trac/wiki/WikiMacros

Tuesday, November 4, 2014

Wikipedia management

Wikipedia is a nice open source project. However it may incur a lot of hackers' interests if it is open for edit. Hackers may register large number of spam accounts, create new pages and modify existing pages. This is what's happening to a wikipedia I'm managing right now.

Although quite straightforward, I keep log of these management tips of wikipedia.

The default settings are in wiki/includes/DefaultSettings.php. But changes to settings can be made in wiki/LocalSettings.php, the changes here will override default settings.

1) To change logo, change this line:

$wgLogo = "$wgStylePath/common/images/wiki.png";


2) To disable anonymous user (not logged in) creating new page and editing, add this to the end of LocalSettings:

#
# See: http://www.mediawiki.org/wiki/Manual:User_rights
#

#
# not-logged-in user
#
$wgGroupPermissions['*']['createaccount'] = false; # no new user registration.
//$wgGroupPermissions['*']['read']          = true;      # default is true, so no need to add this statement.
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createpage'] = false;

#
# logged-in user. 
# Add this if you want to disable logged-in users from createpage/edit actions.
#
#$wgGroupPermissions['user']['edit'] = false;
#$wgGroupPermissions['user']['createpage'] = false; // true;

#
# sysop
# If you disabled logged-in users actions, you may want to enable sysop's permission here.
#
#$wgGroupPermissions['sysop']['edit'] = true;
#$wgGroupPermissions['sysop']['createpage'] = true;

After you disabled new user's createaccount ability, you will want to manually create new accounts. You can do this by logging in as sysop, and going to "Special pages -> Login / create account".

3) Email setting. Use $wgSMTP to change email setting: either use Pear Mail or PHP Mail.

Refer to the last post "Fix Bluehost wikipedia email problem".


Fix Bluehost wikipedia email problem

I'm managing a website hosted by Bluehost.com.

From CPanel I installed wikipedia. However the email function does not work. It says: "bluehost Mailer returned: Failed to add recipient: [email] … Mailer returned: Unknown error in PHP's mail() function."

I followed instruction at http://www.mediawiki.org/wiki/Manual:$wgSMTP to add email SMTP setting to wiki/LocalSettings.php:

$wgSMTP = array(
 'host'     => "mail.example.com", 
 'IDHost'   => "example.com",      
 'port'     => 26,                 
 'auth'     => true,               
 'username' => "my_user_name",     
 'password' => "my_password"       
);

Still it does not work. I followed Bluehost's email setting page, use either SSL/TLS setting or non-SSL setting. Still it fails.

Finally I tried to find out where $wgSMTP is used: grep -i wgSMTH */*, and found it being used in /wiki/includes/UserMailer.php. It comes down to the function send().  When $wgSMTP is used, it uses Pear Mail; otherwise, it uses PHP Mail. Since I'm using PHP Mail in a personal project on the same server, I tried to check what's different it uses PHP Mail from my use. On line 359 of UserMailer.php, it has this code:

foreach ( $to as $recip ) {
      if ( $safeMode ) {
          $sent = mail( $recip, self::quotedPrintable( $subject ), $body, $headers );
      } else {
          $sent = mail( $recip, self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
      }
}

I print out $headers, it is:

From: CareerAssist Wiki Return-Path: apache@www.careerassist.org Date: Tue, 04 Nov 2014 04:41:29 -0700 Message-ID: X-Mailer: MediaWiki mailer MIME-Version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8bit

Since I'm using the PHP's mail() function in a personal project on the same server and it works well, where I simply use: $headers = "From: [email]";

So I replace the $headers here with this simpler rendition:

foreach ( $to as $recip ) {
      if ( $safeMode ) {
          $sent = mail( $recip, self::quotedPrintable( $subject ), $body, $headers );
      } else {
          $headers = "From: [email]";
          $sent = mail( $recip, self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
      }
}

Then it works! This also shows it takes the 2nd path here ($safeMode is false).

Thus I got wikipedia email working on Bluehost, with this hack into wikipedia's source code.


Saturday, March 29, 2008

Wikipedia content copyrights and installation

When trying to copy some material about hyacc to wikipedia, and also put a link to the original source, I was warned by a copyright notice. The effort was aborted.

Later I found this information on copyrights problem when publishing on wikipedia: http://en.wikipedia.org/wiki/Wikipedia:Copyrights

Wikipedia is an open source project: http://sourceforge.net/projects/wikipedia/
From http://en.wikipedia.org/wiki/Mediawiki: "MediaWiki is a web-based wiki software application used by all projects of the Wikimedia Foundation".

The Wikipedia source download page is: http://www.mediawiki.org/wiki/Download
The current stable version is 1.11.1. It can be installed on platforms from FreeBSD, GNU/Linux, MacOS X, Netware, Solaris to Windows.

If install it on linux, I would want to install on Open Suse: http://en.opensuse.org and see http://en.opensuse.org/Download_Help

Blog Archive

Followers