User talk:Trebla
From EQ KnowledgePit
Contents |
[edit] Editors
Any chance you're popular in any wiki communities? I'm trying to get a few more editors signed onto here, and after consulting with a couple people I know who run other wikis, the general consensus is that that's the best way to recruit editors...ask on wiki communities where you have popularity ;)
Floppie 19:40, 6 November 2007 (EST)
[edit] Nope...
Unfortunately, no... I've only ever barely contributed to a few wikis, the most prolific one being a Vanguard wiki, but that was only for about a week or two after launch and I don't even remember which site it was.
Trebla 15:56, 7 November 2007 (EST)
- I pretty much figured that, but at the same time figured it was worth a shot to ask ;) ~Floppie(talk • contribs) 16:08, 7 November 2007 (EST)
[edit] Re: il tag request
I'll make it happen. I'll do it the same way that the drop/vendor/reward/quest item editor accepts the item name...if it finds more than one exact match, it will fail; if it finds one exact match, it will use that; and if it finds zero exact matches, it will use the one with the highest (according to MySQL) relevance ;)
~Floppie(talk • contribs) 15:25, 28 November 2007 (EST)
- It's in a warped dialect of PHP. PHP is the underlying language, but MediaWiki has such an insanely huge codebase that when you work with it you aren't really coding in PHP anymore. You're using all the MediaWiki API-provided functions. The database is MySQL, though, and all my stuff works with raw queries rather than going through their abstraction code. I'm not ever going to have the site running on a non-MySQL database, so I don't need to worry about abstracting it. So that pseudocode pretty much hits the nail on the head ;) ~Floppie(talk • contribs) 15:44, 28 November 2007 (EST)
[edit] New il tag code
Here it is:
function eqkpItemLink($str, $argv, &$parser) {
global $wgOut;
if(is_numeric($str)) {
if(!$item = Item::newFromID($str)) return '<i>Item ID#' . $str . ' not found</i>';
} else {
$item = Item::newFromText($str);
if($item === 0) {
return '<i>No item matches found for "' . $str . '"</i>';
} elseif($item === 1) {
return '<i>More than one exact matches found for "' . $str . '"; please use the <a href="/wiki/Special:ItemSearch">item search</a> and identify the item by ID</i>';
}
}
$wgOut->addKeyword($item->name);
return $item->getLink();
}
And the Item::newFromText() function:
public static function newFromText($text) {
global $wgMemc;
$text = strtolower($text);
$key = wfMemcKey('ext', 'item', 'textmatch', str_replace(' ', '_', $text));
$id = $wgMemc->get($key);
if(is_integer($id)) {
return Item::newFromID($id);
} elseif($id === false) {
return 0;
}
$db = &wfGetDB(DB_SLAVE);
$q = $db->query('SELECT `r`.`id` FROM `eq_ext_items` `r`, `eq_ext_items_revision` `i` WHERE `i`.`id` = `r`.`rev_id` AND `i`.`name` = \'' . $text . '\'');
if($db->numRows($q) === 1) {
list($id) = $db->fetchRowN($q);
$wgMemc->set($key, $id, 1209600);
return Item::newFromID($id);
} elseif($db->numRows($q) > 1) {
return 1;
}
$q = $db->query('SELECT `r`.`id` FROM `eq_ext_items` `r`, `eq_ext_items_revision` `i` WHERE `i`.`id` = `r`.`rev_id` AND MATCH(`i`.`name`) AGAINST(\'' . $text . '\') ORDER BY MATCH(`i`.`name`) AGAINST(\'' . $text . '\') DESC LIMIT 0,1');
if($db->numRows($q) === 0) {
$wgMemc->set($key, false, 1209600);
return 0;
}
list($id) = $db->fetchRowN($q);
return Item::newFromID($id);
}
This should allow for maximum efficiency; after it makes the search by name once, it caches the ID result...or false if no matches could be found. Then it tries to pull from the cache rather than making the search every time.
[edit] Re: Error
That's because it's the closest match it finds. It uses the same matching code as the item search, and returns the ID of the closest match, if an exact match isn't found. I really can't think of any other way to handle that, other than maybe adding a parameter like match="exact" to the tag, to make it only return exact matches, and an error if no exact match is found, rather than returning the closest thing. I'll do that if you'd like to have it that way ;) ~Floppie(talk • contribs) 17:09, 28 November 2007 (EST)
- Done. It defaults to only returning an exact match, but if you add
partial="allow"to the tag (for example,<il partial="allow">transcendent</il>returns Drape of Transcendent Thought), it still returns partial matches. ~Floppie(talk • contribs)
- I thought about that for a little while when I first made the change, and I think I'd rather just let the link add itself ;) I agree, it's both easier and cleaner. Although, with all MediaWiki's implicit caching, I'm not sure if the link will "add itself" per se. The page may need a null edit (hit edit and hit save with on changes), or I might just have to shutdown and restart the memcache daemon on my memory whore box. Or maybe I'll have to restart HTTPd on the webserver. That all remains to be seen, but in any case, I think it's better than having to edit and remove all the (link needed) bits. ~Floppie(talk • contribs) 14:13, 29 November 2007 (EST)
- It is set to only cache the page for a certain amount of time - but if I remember correctly, that amount of time is one month...rofl. I found out, though, that if you touch the LocalSettings.php file, it overrides the cache - so I'll just do that when I update the item database. ~Floppie(talk • contribs) 16:42, 29 November 2007 (EST)
[edit] Re: Question
In duplicate subcategories is fine. If it's a Secrets of Faydwer raid mob, it should be in both Category:Secrets of Faydwer Raids and Category:Raid Mobs - and (as far as I can think of, there might be exceptions) no others. Placing it in Category:Secrets of Faydwer Raids will automatically put it in Category:Secrets of Faydwer by transitivity, so it should pretty much be set. I'm thinking I'll add <category>Secrets of Faydwer Raids</category> to Category:Secrets of Faydwer though, for ease of navigation without sticking everything into that one category ;)
~Floppie(talk • contribs) 14:20, 6 December 2007 (EST)
[edit] Tracker
Here's all the inf0z.
The URL template for an item search here is http://eq.knowledgepit.org/wiki/Special:ItemSearch?searchfor=urlencoded+item+name. For example, Transcended Fistwraps of Immortality would be http://eq.knowledgepit.org/wiki/Special:ItemSearch?searchfor=Transcended+Fistwraps+of+Immortality. If one and only one perfect match is found for the name, it'll automatically redirect to that item's page. Using spaces as normal, rather than +s, will also work; http://eq.knowledgepit.org/wiki/Special:ItemSearch?searchfor=Transcended%20Fistwraps%20of%20Immortality for example. Normal spaces will work as well, they'll just be redirected to URL-encoded %20s; I only used %20s on here because MediaWiki doesn't like spaces in external links, it gets confused ;)



