User talk:Zayoo/Extension:Advanced Meta
Contents |
This is a suggested version of Extension:Advanced Meta.
[edit] Installation
To install this plugin:
- Create a folder called MWAdvancedMeta in /extensions/ in your MediaWiki main folder.
- Then upload the source code below in two files called MWAdvancedMeta.php and MWAdvancedMeta.i18n.php in the new folder you just created.
In LocalSettings.php add this line:
require_once( "$IP/extensions/MWAdvancedMeta/MWAdvancedMeta.php" );
Create the page Mediawiki:Globalkeywords in your own wiki and write your global keywords there, separated by commas (,).
- Example: movie stars,saints,legends,bots
[edit] More LocalSettings Options
Other LocalSettings.php settings you can change are:
- Namespaces (NS_MAIN and NS_PROJECT are the default settings for this extension.)
- Users (No default settings.)
- Usergroups (The default settings are sysop and bureaucrat.)
To set these settings, add this line first:
$mwaMeta = MWAdvancedMeta::setup();
Then add one or more of the lines shown below (change to the actual Users and/or Usergroups you want to grant access):
$mwaMeta->setAllowedUsers(array('BrigitteBardot','Sophia Loren','JoanOfArc','Medusa')); $mwaMeta->setAllowedUsergroups(array('bot','user','ScriptKiddie')); $mwaMeta->setIndexedPages(array(NS_MAIN, NS_PROJECT, NS_IMAGE, NS_TALK));
Namespaces that are not in the 'indexedpages' variable will be set to "noindex,follow" by default. There is currently no setting to also prevent them from being followed, but I might add that sooner or later depending on if it's being requested (feel free to contact me).
[edit] Database Changes
Last, add a table to your mediawiki database. The following SQL should take care of that (note: change 'mw' to your wiki prefix as needed for the AL code and modify the table name referenced in the "write" function as well....):
- (Zayoo, what does "AL code" mean in the above line "change 'mw' to your wiki prefix as needed for the AL code..."?)-Davydog 02:53, 22 November 2010 (UTC)
CREATE TABLE IF NOT EXISTS `mw_ext_meta` ( `pageid` INT(8) NOT NULL, `rindex` tinyint(1) NOT NULL, `rfollow` tinyint(1) NOT NULL, `titlealias` VARCHAR(255), `keywords` text, `description` text, PRIMARY KEY (`pageid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[edit] MWAdvancedMeta.php MySQL Table Insert Script
An alternative way to add the required table to your database is to use a simple php script.
- Edit the script shown below with your database login credentials.
- Save it as MWAdvancedMeta.php and upload it to your wiki's root folder.
- Point your browser to the script (example:
http://www.yourdomain.org/wiki/MWAdvancedMeta.php). - If your browser window responds with a "Table Created!" message, congratulate yourself on a job well done!
<?php // Make a MySQL Connection mysql_connect("mysql.yourdomain.org", "yourusername", "yourpassword") or die(mysql_error()); mysql_select_db("localhost") or die(mysql_error()); // Create a MySQL table in the selected database mysql_query("CREATE TABLE IF NOT EXISTS `mw_ext_meta` ( `pageid` int(8) NOT NULL, `rindex` tinyint(1) NOT NULL, `rfollow` tinyint(1) NOT NULL, `titlealias` varchar(255), `keywords` varchar(500), `description` varchar(2000), PRIMARY KEY (`pageid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;") or die(mysql_error()); echo "Table Created!"; ?>
-Davydog 03:57, 21 November 2010 (UTC)