Jump to content

Extension talk:Farmer

Add topic
From mediawiki.org
Latest comment: 5 years ago by Msnhinet8 in topic farmer

An example setting for URL Prefix Strategy

[edit]

Thanks for the extension. Here's my installation procedure using URL Prefix stragety. MediaWiki version = 1.16.4

  • Choose "mediawiki_" as the sql table prefix and "http://HOSTNAME//mediawiki" as the installation directory.
  • First extract and install the extension in the extensions/ directory as usual.
  • Add this in LocalSettings.php
require_once( "$IP/extensions/Farmer/Farmer.php" );
/* We use the internal _matchByURLHostname function to find the wiki name */
$wgFarmerSettings['wikiIdentifierFunction'] = array( 'MediaWikiFarmer', '_matchByURLRegExp' );
$wgFarmerSettings['matchRegExp'] = '/[^\/]+/';
$wgFarmerSettings['matchOffset'] = 0;

$wgFarmerSettings['dbAdminUser'] = $wgDBuser;
$wgFarmerSettings['dbAdminPassword'] = $wgDBpassword;
$wgFarmerSettings['dbTablePrefixSeparator'] = '_';
$wgFarmerSettings['newDbSourceFile'] = realpath( dirname( __FILE__ ) ) . '/maintenance/tables.sql';
$wgFarmerSettings['defaultWiki'] = "mediawiki";
  • Find the $wgScriptPath declaration in the LocalSettings.php, replace it with:
function wgGetDaughterWikiName()
{
	if ( preg_match( '/[^\/]+/', $_SERVER['REQUEST_URI'], $wgURLMatches ) ===1)
	{
		return $wgURLMatches[0];
	}
	else
	{
		return "mediawiki";
	}
}

$wgScriptPath = "/" . wgGetDaughterWikiName();
  • You can also replace the logo: create <daughterwikiname>_wiki.png
$wgLogo             = "$wgStylePath/common/images/". wgGetDaughterWikiName() . "_wiki.png";
  • Update URLs in the Special:Allmessages page.
  • Create wikis in Special:Farmer page.
  • Create soft links to mediawiki directory using the daughter wiki names.
  • It should work now.

By the way, there were no accounts in daughter wikis, so i created them manually. --Crlf0710 04:43, 7 May 2011 (UTC)Reply

Hello, I installed Farmer but now I cannot see anything when I go to my wiki. I installed farmer extension thru SVN.

There is something wrong with the $wgFarmerSettings. I used ais_ as the defaultwiki. the prefix separator is "_". Should I use ais or ais_.

I am at dead end. Please help.

RegExp examples

[edit]

Can anyone provide some regexp examples for using with matchRegExp and matchOffset?


Error with $wgFarmerSettings

[edit]
  • I prefer Localsettings.php with
$wgFarmerSettings['wikiIdentifierFunction'] = array('MediaWikiFarmer', '_matchByURLHostname');

This delivers on startup of default wiki

Warning: Missing argument 1 for MediaWikiFarmer::_matchByURLHostname() in \extensions\Farmer\MediaWikiFarmer.php on line 281


  • I tested Localsettings.php with
$wgFarmerSettings['wikiIdentifierFunction'] = array('MediaWikiFarmer', '_matchByServerName');

This delivers on creating new wiki

Warning: Invalid argument supplied for foreach() in \extensions\Farmer\MediaWikiFarmer.php on line 434


  • Can you help me to get one of both to work?

Environment and Setting

[edit]
  1. OS: Win 2000
  2. MediaWiki: 1.11alpha (r22753)
  3. PHP: 5.1.1 (apache2handler)
  4. MySQL: 5.0.18

--Wissenslogistiker 14:18, 7 June 2007 (UTC)Reply

Non-shared user and user_groups

[edit]

does Farmer support non-shared user and user_groups databases yet ?

Seems not for now.--FR6 20:20, 14 May 2007 (UTC)Reply

Updating wiki source

[edit]

What happens when you update the wiki source code? Will all necessary configurations of all the wiki installs be updated? Or will this still have to be done manually? --Denise 11:41, 3 April 2007 (UTC)Reply

I don't understand What they mean

[edit]

I am a Chinese. I don't understand what the followed mean:

  1. "MediaWiki trunk", which mentioned in the section "mysql_errno.28.29_fix" is what? Can I find the explain(s) of it in somewhere?
  2. The section tall me "You need to change this to read: if ( $this->lastErrno() ) {", I'v checked the Database.php but I still don't know how do I follow the instruction ?

Please tall me, Thanks!

Environment and Setting

[edit]
  1. OS: Win XP
  2. Mediawiki Version 1.9.2
  3. Apache Web Server Version 2.2.3
  4. PHP Script Language Version 5.1.6
  5. MySQL Database Version 5.0.24a

--Roc michael 04:32, 13 May 2007 (UTC)Reply


How to use the patch?

[edit]

What is the description "Farmer currently requires my patch to work correctly" mean in the section "Shared_Tables"? I've check the link my patch. In the other end of the link is a file which I don't know what the type of the file is. It isn't a ".php" file. Does it can be executive on Win XP or by firefox? How do I use it?

Please tall me, Thanks!

Environment and Setting

[edit]
  1. OS: Win XP
  2. Mediawiki Version 1.9.2
  3. Apache Web Server Version 2.2.3
  4. PHP Script Language Version 5.1.6
  5. MySQL Database Version 5.0.24a

--Roc michael 04:32, 13 May 2007 (UTC)Reply

See Subversion. I suggest that you use TortoiseSVN for aplying a patch from Windows. --FR6 20:26, 14 May 2007 (UTC)Reply

Error on creating new wiki

[edit]

I get the following error when I try to create a new wiki under farmer.

Database error A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

    (SQL query hidden)

from within function "Revision::insertOn". MySQL returned error "1054: Unknown column 'rev_len' in 'field list' (localhost)".

Anyone have any ideas on how to fix this problem?


Also once I try to create the wiki again it says that it already exists. Where is is getting that information. I tried looking in to the config directory but did not see it.

Update

[edit]

Looking at the sql code and error messages it looks like the error is in the daughterwiki.sql file. The column that is requested in here is not actually created by the sql file.

To fix this I added

  rev_len int(10) unsigned default NULL,

When I fixed this I tried to create another wiki it showed that two more table were not even created. The two tables that were not created where redirect and page_restrictions

Once I added these two tables to the sql code I was able to create a working wiki. Not sure if I am going to run in to other problems later. If I find anything else I will post it here

Additional Information:

[edit]

This note is from somebody who had similar problems updating his Wiki:


I found I had the exact same errors. Mine occurred when I upgraded to MySQL 5.0.45 AFTER I had already (successfully) upgraded from MediaWiki 1.9 to 1.11. However by re-executing the php update.php in the maintenance directory I found it added a whole bunch of stuff that it did not add the first time I ran it under MySQL4. When I re-executed it under MySQL5 it fixed all the problems that I was having.

Hope that helps anyone else who happened on this page by searching for the rev_len issue. ~ Mark

Doesn't work for me

[edit]

This didn't work for me, for some reason, even after I set the variables, when doing a test installation on localhost, and on my webhost - freeunlimitedweb.com

I tried configuring the settings, but nothing worked properly.

By the way, I'm running the latest version of MediaWiki (trunk) from SVN, and the trunk version of this extension, so why has this gone wrong?? --84.45.219.185 08:59, 30 July 2008 (UTC)Reply

Database error

[edit]

hi

i am working with mediwiki-1.11

i install the Farmer extension but showme this error when i create a new wiki

Database error A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was: (SQL query hidden) from within function "Revision::insertOn". MySQL returned error "1054: Unknown column 'rev_len' in 'field list' (localhost)".

what is the problem?

you can help me?

thanks

--200.77.227.68 18:40, 8 August 2008 (UTC)Reply

Error

[edit]

Fatal error: Call to undefined function wfMsgHtml() in extensions/Farmer/MediaWikiFarmer.php on line 112

What did i forget to do?

Its Debian 4.0 etch Apache 2.2.3 PHP 5.2.0-8 MySQL 5.0.32 Mediawiki 1.14alpha SVN rveision 43190

Any ideas? And I'm confused about what to do with the patch.

Gewt 14:37, 4 November 2008 (UTC)Reply

Using multiple Databases for one wiki

[edit]

I had the idea to use two databases or more for one wiki. The databases should be shared with other wikis. For example, each wiki has it's very own database for common articles but one database which is shard with other wikis for templates. So it would be possible to share and maintain templates with other wikis without using interwikis which are not very comfortable because of the prefix and some other reasons. --Danwe 21:28, 30 April 2009 (UTC)Reply

Something like that is possible now with the extension WikiSync. It allows to synchronize between several wikis --Danwe 22:57, 29 June 2011 (UTC)Reply

Renaming mw tables for use with Farmer

[edit]

You may want to mention a PHP script to help renaming the MySQL tables [1]. Not all phpmyadmin are set-up properly with PMA enabled and therefore it would become a manual action of individually renaming 35+ tables, with someone bound to go wrong.

daughterwiki.sql is missing in v1.15.x

[edit]

According to the documentation, this extension also provides a file called daugtherwiki.sql, however it's not present in release 1.15.x. I notice it is present if I download an earlier version. Can I use the file from an older version? I've checked the subversion source repository, it not present anymore in the trunk. Where can I find the latest version? --85.91.175.221 09:38, 30 June 2009 (UTC)Reply

daughterwiki.sql is missing in v1.15.x and Unknown column 'rev_len' in 'field list'- solved

[edit]

it seems if you use tables.sql in the maintenance folder (of MediaWiki) it will work.

Here's my experience installing this extension

[edit]

On a new mediawiki 1.15 installation, running on sub domain... I was writing instructions as I went for future times when I need to do this (I don't think there will be a second time).

  1. Install mediawiki (with PREFIX!)
  2. Decide on hosting strategy (I choose URL Prefix)
  3. Download your version of Farmer from here Special:ExtensionDistributor/Farmer
  4. Upload the .tar.gz to the /extensions/ directory and unzip it (a /Farmer/ folder will be created)
  5. Add this code snippet to the bottom of /LocalSettings.php

require_once( 'farmer/Farmer.php' );

$wgFarmer = new MediaWikiFarmer( $wgFarmerSettings ); $wgFarmer->run();

  1. Add some configuration (you may as well do this in the previous step)
require_once( 'extensions/Farmer/Farmer.php' ); 
$wgFarmerSettings['defaultWiki'] = 'wiki'; # without the prefix separator apparently
$wgFarmerSettings['wikiIdentifierFunction'] = array( 'MediaWikiFarmer', '_matchByServerName' );
$wgFarmerSettings['dbAdminUser'] = 'MYDBUSER';
$wgFarmerSettings['dbAdminPassword'] = 'MYPASSWORD';
$wgFarmerSettings['dbTablePrefixSeparator'] = '_';
$wgFarmerSettings['newDbSourceFile'] = realpath( dirname( __FILE__ ) ) . '/extensions/Farmer/daughterwiki.sql';
$wgFarmer = new MediaWikiFarmer( $wgFarmerSettings );
$wgFarmer->run();
  1. Add a /configs/ directory to the /extensions/Farmer/ directory and set it to 777
  2. Access the homepage to install Farmer (make sure /configs/ is writable)
    • You may need to wait a bit and do a full refresh
  3. Go to Special:Allmessages
  4. Login as WikiSysop and create the pages for "farmerwikiurl" and "farmerinterwikiurl", seting the values to

http://wiki.MYDOMAIN.com/$1 and http://wiki.MYDOMAIN.com/$1/$2

  1. Go to Special:Farmer to set some settings ("Bad things happen unless you do this")
  2. Try creating a new wiki via the admin tool
    • It might say daughterwiki.sql is missing (it was missed in the 1.15 distribution, download it from 1.14)
  3. Try fixing the errors it spits out...

THIS INSTALLATION IS A PIECE OF SHIT AND SO ARE THE INSTRUCTIONS (but thanks for some free software and sorry about my frustration)

3 hours later.... I give up, but the next step would be to go through and try all those config variables and see if you can find one that's necessary that was never listed in the example and hence has not been set properly.

I did everything by your instruction on MediaWiki 1.19. Worked perfectly for me, thanks! --91.237.24.2 19:42, 28 June 2013 (UTC)Reply

No success

[edit]

Did not manage to get Farmer running. I get the farmer page on the wiki and I can create wikis. This is done on Mediawiki 1.15.3. For this version I adapted daughterwiki.sql from an earlier version. The problem I have that the generated links lead to file not found error.I decided to use URL Prefix Hosting Strategy. Any ideas? --Dramtix 07:45, 28 May 2010 (UTC)Reply

Please fix

[edit]

This extension is majorly broken, could the dev look into it? PseudoOne 19:17, 17 October 2010 (UTC)Reply

How we can reach to new created wikis

[edit]

I have many trouble to run farmer on mediawiki. At the and I have successfully run but couldn't access to newly created wiki.

Thaks

Session problem

[edit]

2011-01-13 I managed to install Farmer, everything is working correctly except I got sessions and cookies error when i try to login. I cant understand where is the problem. Tried it with the nightly build mw and the 1.16mw, same problem. Did someone manage to install it without any bugs?

Infobox status

[edit]

The infobox for extensions could use a 'status' field that indicates level of polish and completeness. 24.61.47.46 08:50, 22 January 2011 (UTC)Reply

white page after creating new wiki

[edit]

All things works But after create a new wiki , and clik on http://wiki.mysite.com/newwiki/ I have :

Not Found

The requested URL /newwiki/ was not found on this server.

Someone help? Thx


Great Job

[edit]

Hi, we have chosen this extension for a project within our company to integrate
our product (a school management system) with mediawiki.
So far, though we are still in development stage, the Farmer looks pretty good and
it has delivered what it promised So first of all my congratulation for the nice job.
Everything seems to work pretty nice. As we need some automation ( on onunknownwiki we
actually want to create a wiki) and we have solved this by using the mediawiki hooks and
leaving the extension pure as it is.

I've also became curious about the upgrading when it involves database changes. As far as
I manage to understand, the Farmer will not be called to upgrade all the instances in a
database right? Is this a planned thing the might be out there or would it be good for the extension if we
could contribute this for the extension? We still haven't manage to level this up (tech team
and hosting team are discussing the need of upgrading) but it is my perspective this could actually
benefit farmer extension.

Thanks for the god work

Blank Page

[edit]

Whenever i try to use the extension i get a blank page. Bill9929 04:07, 10 December 2011 (UTC)Reply

Installation was ok, but extension doesn't work

[edit]

My configuration:

.htaccess settings:

RewriteEngine On

RewriteRule ^main/(.*)$ /w/index.php?title=$1 [PT,L,QSA]
RewriteRule ^main/*$ /w/index.php [L,QSA]
RewriteRule ^/*$ /w/index.php  [L,QSA]}

LocalSettings.php:

.........

# for RewriteEngine
$wgArticlePath = "/main/$1";
#Farmer
/* We use the internal _matchByURLHostname function to find the wiki name */
$wgFarmerSettings['wikiIdentifierFunction'] = array( 'MediaWikiFarmer', '_matchByServerName' );
#$wgFarmerSettings['dbAdminUser'] = 'xxxxx';
$wgFarmerSettings['dbAdminUser'] = $wgDBadminuser;
#$wgFarmerSettings['dbAdminPassword'] = 'xxxxxxx';
$wgFarmerSettings['dbAdminPassword'] = $wgDBadminpassword;
$wgFarmerSettings['dbTablePrefixSeparator'] = '';
# Use this file in early versions
# $wgFarmerSettings['newDbSourceFile'] = realpath( dirname( __FILE__ ) ) . '/extensions/farmer/daughterwiki.sql'; 
$wgFarmerSettings['newDbSourceFile'] = realpath( dirname( __FILE__ ) ) . '/maintenance/tables.sql'; 
$wgFarmerSettings['defaultWiki'] = "main"; 
$wgFarmer = new MediaWikiFarmer( $wgFarmerSettings );
 
$wgFarmer->run();
?>

I have facebook extension also.

I had to add the following variable in LocalSettings.php:

$wgFarmerSettings['defaultWiki'] = "main";

and had to change the following variable in the same file

$wgFarmerSettings['dbTablePrefixSeparator'] = '_-_';

to

$wgFarmerSettings['dbTablePrefixSeparator'] = '';

Also the config folder for this extension was not created and I had to create it as well: /home/sixthtas/public_html/wiki/extensions/Farmer/configs/ After the above, my site started loading.

But when I try add new wiki i see this errors: http://sixthtaste.com/step1.jpg http://sixthtaste.com/step2.jpg http://sixthtaste.com/step3.jpg

How can I decide this problem?

Database serialization may cause problems, since the connection is not restored on wakeup.

[edit]

That's the error message I get. Followed by this on account I turned on error logging:

Backtrace:
  1. [internal function]: DatabaseBase->__sleep()
  2. /home/nowakid/public_html/wiki/extensions/Farmer/MediaWikiFarmer_Wiki.php(196): serialize(Object(MediaWikiFarmer_Wiki))
  3. /home/nowakid/public_html/wiki/extensions/Farmer/MediaWikiFarmer_Wiki.php(141): MediaWikiFarmer_Wiki->save()
  4. /home/nowakid/public_html/wiki/extensions/Farmer/SpecialFarmer.php(127): MediaWikiFarmer_Wiki->create()
  5. /home/nowakid/public_html/wiki/extensions/Farmer/SpecialFarmer.php(38): SpecialFarmer->_executeCreate(Object(MediaWikiFarmer), NULL)
  6. /home/nowakid/public_html/wiki/includes/SpecialPageFactory.php(476): SpecialFarmer->execute('create')
  7. /home/nowakid/public_html/wiki/includes/Wiki.php(263): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
  8. /home/nowakid/public_html/wiki/includes/Wiki.php(593): MediaWiki->performRequest()
  9. /home/nowakid/public_html/wiki/includes/Wiki.php(503): MediaWiki->main()
  10. /home/nowakid/public_html/wiki/index.php(58): MediaWiki->run()
  11. {main}

my localhost looks like this :

<?php
# This file was automatically generated by the MediaWiki 1.19.0
# installer. If you make manual changes, please keep track in case you
# need to recreate them later.
#
# See includes/DefaultSettings.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.
#
# Further documentation for configuration settings may be found at:
# http://www.mediawiki.org/wiki/Manual:Configuration_settings

# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
	exit;
}

## Uncomment this to disable output compression
# $wgDisableOutputCompression = true;

$wgSitename      = "xxxxxxxxxxx";
$wgMetaNamespace = "xxxxxxxxxxx";

## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
function wgGetDaughterWikiName()
{
        if ( preg_match( '/[^\/]+/', $_SERVER['REQUEST_URI'], $wgURLMatches ) ===1)
        {
                return $wgURLMatches[0];
        }
        else
        {
                return "wiki";
        }
}

$wgScriptPath = "/" . wgGetDaughterWikiName();
// $wgScriptPath       = "/wiki";
$wgScriptExtension  = ".php";

## The protocol and server name to use in fully-qualified URLs
$wgServer           = "http://wiki.xxxxxx.org";

## The relative URL path to the skins directory
$wgStylePath        = "$wgScriptPath/skins";

## The relative URL path to the logo.  Make sure you change this from the default,
## or else you'll overwrite your logo when you upgrade!
$wgLogo             = "$wgStylePath/common/images/wiki.png";

## UPO means: this is also a user preference option

$wgEnableEmail      = true;
$wgEnableUserEmail  = true; # UPO

$wgEmergencyContact = "xxxxx";
$wgPasswordSender   = "xxxxx";

$wgEnotifUserTalk      = false; # UPO
$wgEnotifWatchlist     = false; # UPO
$wgEmailAuthentication = true;

## Database settings
$wgDBtype           = "mysql";
$wgDBserver         = "localhost";
$wgDBname           = "xxxxxxxxxxx";
$wgDBuser           = "xxxxxxxxxxx";
$wgDBpassword       = "xxxxxxxxxxx";

# MySQL specific settings

// CUT OUT A WHOLE LOT OF GENERATED SETTINGS YOU DON'T NEED

# Enabled Extensions. Most extensions are enabled by including the base extension file here
# but check specific extension documentation for more details
# The following extensions were automatically enabled:
require_once( "$IP/extensions/Gadgets/Gadgets.php" );
require_once( "$IP/extensions/ParserFunctions/ParserFunctions.php" );
require_once( "$IP/extensions/Vector/Vector.php" );
require_once( "$IP/extensions/WikiEditor/WikiEditor.php" );


# End of automatically generated settings.
# Add more configuration options below.

require_once("$IP/extensions/Cite/Cite.php");
require_once("$IP/extensions/InputBox/InputBox.php");



/* FARMER SETUP
---------------*/
require_once( "$IP/extensions/Farmer/Farmer.php" );
/* We use the internal _matchByURLHostname function to find the wiki name */
$wgFarmerSettings['useWgConf'] = true;
$wgFarmerSettings['wikiIdentifierFunction'] = array( 'MediaWikiFarmer', '_matchByURLRegExp' );
$wgFarmerSettings['matchRegExp'] = '/[^\/]+/';
$wgFarmerSettings['matchOffset'] = 0;
#$wgFarmerSettings['dbAdminUser'] = 'wiki';
$wgFarmerSettings['dbAdminUser'] = $wgDBuser;
#$wgFarmerSettings['dbAdminPassword'] = 'wiki';
$wgFarmerSettings['dbAdminPassword'] = $wgDBpassword;
$wgFarmerSettings['dbTablePrefixSeparator'] = '';
# Use this file in early versions
# $wgFarmerSettings['newDbSourceFile'] = realpath( dirname( __FILE__ ) ) . '/extensions/farmer/daughterwiki.sql'; 
$wgFarmerSettings['newDbSourceFile'] = realpath( dirname( __FILE__ ) ) . '/maintenance/tables.sql'; 
$wgFarmerSettings['defaultWiki'] = 'wiki';
$wgFarmerSettings['matchServerNameSuffix'] = 'wiki.xxxxxxxxxxx.org';
$wgFarmerSettings['perWikiStorageRoot'] = '/images/';
$wgFarmerSettings['perWikiStorageUrl'] = 'http://wiki.xxxxxxxxxxx/images/';
 
$wgFarmer = new MediaWikiFarmer( $wgFarmerSettings );
$wgShowExceptionDetails = true;
$wgFarmer->run();

I xxx out the private information but the rest of the wiki seams to be working so the information is correct. Any idea what's going on? 123.2.78.75 12:00, 18 May 2012 (UTC)Reply

Can't download extension

[edit]

I couldn't download this extension from https://www.mediawiki.org/wiki/Special:ExtensionDistributor/Farmer .

--TaRy0116 (talk) 11:35, 18 August 2014 (UTC)Reply

This will not work since this extension is no longer in the repo which the extension distributor uses. I have updated the respective section. Cheers --[[kgh]] (talk) 11:47, 18 August 2014 (UTC)Reply
Thank you! --TaRy0116 (talk) 11:57, 18 August 2014 (UTC)Reply
It is now avalible on git and is also now working at https://www.mediawiki.org/wiki/Special:ExtensionDistributor/Farmer 151.225.136.51 15:30, 25 October 2014 (UTC)Reply

Fix problem in this extension

[edit]

This extension needs to be fixed it doesent work properly in newer versions of MediaWiki please fix it. 151.229.250.233 22:55, 12 February 2015 (UTC)Reply

One Bug at Farmer-REL1_25-f4cbe03.tar.gz and MediaWiki 1.25.2

[edit]
-P1ayer (talk) 12:54, 31 August 2015 (UTC)Reply

farmer

[edit]