Project 1999

Project 1999 (/forums/index.php)
-   Blue Server Chat (/forums/forumdisplay.php?f=17)
-   -   P99 wiki bug (/forums/showthread.php?t=280158)

steme08 08-25-2017 12:21 AM

P99 wiki bug
 
Has anyone tried using the p99 wiki for butcherblock mountains recently? It is all messed up. https://wiki.project1999.com/Butcherblock_Mountains

loramin 08-25-2017 01:00 AM

Yeah that happens from time to time. You might try messaging Rhavin; I'm not sure but I think he might be able to fix it.

OR someone could give me wiki admin access and then I could fix it ... just saying ...

Rygar 08-25-2017 07:36 AM

Quote:

Originally Posted by loramin (Post 2574017)
Yeah that happens from time to time. You might try messaging Rhavin; I'm not sure but I think he might be able to fix it.

OR someone could give me wiki admin access and then I could fix it ... just saying ...

I had messaged Ravihn about this recently, he told me to check out the custom extensions here for the PHP which includes the Dynamic Zone List and he can incorporate any changes. I need to brush up on my PHP before I dive into this, but you seem pretty knowledgeable.

Here's the link (its just the page add utility, never noticed the 'Custom Extensions Source' link before on it):

http://wiki.project1999.com/utils/wikiUtils.php

Lotxi 08-25-2017 11:05 AM

Grobb page has a similar issue

Gumbo 08-25-2017 01:43 PM

A few of the zone pages are bugged out like the BB zone page...

loramin 08-25-2017 02:08 PM

Quote:

Originally Posted by Rygar (Post 2574079)
I had messaged Ravihn about this recently, he told me to check out the custom extensions here for the PHP which includes the Dynamic Zone List and he can incorporate any changes. I need to brush up on my PHP before I dive into this, but you seem pretty knowledgeable.

Here's the link (its just the page add utility, never noticed the 'Custom Extensions Source' link before on it):

http://wiki.project1999.com/utils/wikiUtils.php

Sweet! Yeah, I'd seen that page before too, but also never noticed that link.

PHP is like my least favorite language (would have taken Node.js, Python, Java or even Ruby over it), but I have used it in the past, so I'll take a look at the code and see if I can find anything. No promises though since it's a lot harder to debug something when you can't actually test the possible fixes.

loramin 08-25-2017 03:43 PM

Ok, here's what I have so far.

Let's start with the NPC list part, as I'm pretty sure I understand what's happening in it now (just not why). The way the "dynamic zone list" code works is it asks the database for all NPC "articles" related to the zone:

Code:

$catNames = array($zoneName,"NPCs");
$NPCs = DynamicZoneList::getCatIntersection($db,$parser,$catNames);

Then, it parses them:

Code:

$rowVals = DynamicZoneList::parseNPCPage($templateText);
But before it does, it grabs the article's title, and uses that to set the title in the table (ie. it doesn't look in the article's contents to find the title). This explains why all of the NPC names are still working in the list when the rest is broken: the problem is with the article's content but it's DB title still works fine.

Now "parseNPCPage" in turn uses another function, which is used to parse both items and NPCs:

Code:

$parms = DynamicZoneList::parseTemplateParameters($templateText);
When I look at that function ... well it's a bit low-level but I'm pretty sure it's trying to split all the lines in the NPC article that look like:

Code:

| name              = a decaying dwarf skeleton
| race              = Skeleton New
| class            = [[Warrior]]

into separate array items ("parameters"). Then "parseNPCPage" iterates through those parameters, and here's where things get interesting. Inside that loop it tries to extract the parameters that get used in the dynamic list (name, race, class, etc.). Here's the part where it extracts the class:

Code:

if ( strpos($parm,"class") === 0) {
  $ePos = strpos($parm,"=");
  $class = trim(substr($parm,$ePos+1));
}

So in other words, when it finds a line like:
Code:

| class            = [[Warrior]]
it's supposed to use the part after the "=" (ie. "[[Warrior]]").

But it's not doing that. If you look at the Butcherblock page it has:

Code:

NPC Name        Race        Class        ...
A Decaying Dwarf Skeleton                "zoneTopTable" ! Level of Monsters:

As I said before the name is coming from the DB, so that makes sense, but it couldn't find a Race, and when it tried to find the class it found ""zoneTopTable" ! Level of Monsters:". Now "zoneTopTable" doesn't even exist in the code, so where is that coming from?

Let's look at the top of a zone (not NPC) page:

Code:

{|
|rowspan="6" valign="top" width="160"| <div style='float:left;'>__TOC__</div>
|valign="top"|
{| class="zoneTopTable"
! ''' Level of Monsters: '''

Doesn't that last part look familiar?

So here's my theory on what's going wrong: the code is trying to grab the NPC pages and parse their content so it can use them in the zone page's dynamic zone list ... but something is going wrong and it's grabbing the zone page (can't tell which zone page it's grabbing, but I'd guess it's the same page the dynamic list is on). When it goes to parse that zone page it doesn't find the (NPC) bits its looking for, but it does find one bit that looks the same as NPC bit ... only it's not the NPC's class, it's the class of the table of the zone page.

I need a break for now (all this PHP is draining ;)). But, if anyone can figure out why the extension is grabbing the wrong pages (I would guess the issue is somewhere in "getCatIntersection"?) I think we can come up with a fix ... and if no one else does I'll try and figure it out later.

Baler 08-25-2017 03:55 PM

You rock Loramin! Glad to finally see something proactive being done about that problem that has blighted the wiki for too long.

http://i.imgur.com/aHkiEUo.gif

loramin 08-26-2017 03:26 PM

TLDR
I need help to fix this. Just give me one of the following:

1) have someone with access log the variables I mention below, then visit the BB page, then send me the log output
2) give me admin access so I can add those lines and see the output myself
3) give me a DB dump of the wiki (it doesn't have to be a recent one, as long as it has this issue) and I can debug locally

Wall of Text
Good news/bad news time. The good news is that my theory seems to be correct. If you look at Grobb (also broken) you will see that it has a slightly different text for its NPCs' class:

Code:

"zoneTopTable" ! width="150"
and if you look at Grobb's code (at the top of the page) you'll see ...

Code:

{| class="zoneTopTable"
! width="150"

So it seems pretty clear that the NPCs at least (and probably the quests/items) are being pulled from the zone page, instead of from their actual pages.

The bad news is, I can't figure out why it's happening. The problem is definitely with the related pages (the quest/zones/items), because if you change a broken page to use the dynamic list of a working page (ie. change BB's page to use Erudin's list) it works just fine, but if you rename the page and don't change the list it remains broken. The list of broken pages I've found so far is:

Ak'Anon, Burning Wood, Butcherblock Mountains, Crushbone, Eastern Plains of Karana, Frontier Mountains, Grobb

but I don't see any connection between them. There are other (working) zones with apostrophes and spaces in their name, so it's not the zone name. There could be a single quest/item/npc with some bad wiki code that is causing the problem, but I don't see any mobs that share all (or even most) of those zones.

What would REALLY help is if I could get some debugging info. If I could get access, or if someone with access could add some code for me, what I'd really like to see is all of the values (both the query and the response) from this line in "getCatIntersection" when someone hits the Butcherblock page:

Code:

$res = $db->select( $aTables, $aFields, $aWhere, __METHOD__, $aOptions, $aJoin );
In particular I'd like to see "$aJoin", which should be the JOIN clauses of the SELECT, and should be something like:

Code:

INNER JOIN page_id = c{0}.cl_from AND c{0}.cl_to='Butcherblock_Mountains'
INNER JOIN page_id = c{1}.cl_from AND c{1}.cl_to='NPCs'

and then the results ("$res") of that SELECT, which should be:

Code:

page_namespace, page_title
'', 'A Decaying Dwarf Skeleton'
...

but I'm guessing it might actually be '', 'Butcherblock Mountains', and if that's the case the query variables should explain how we got it.

Now the actual fetching of the related pages happens elsewhere, in the assorted parse* methods, but they just fetch whatever title is given to them, and since that title comes from the above SELECT I strongly suspect the issue is happening in that SELECT, not when the code tries to lookup "a decaying skeleton" (or whatnot).

Why Trust a Random Forum Poster With Admin Access?

A) I <3 the wiki and have created several important pages on it: the (GM-requested) installation guide, the various hunting guides, etc. I would never do anything to break or harm it

B) I'm a web developer with 10+ years of experience. I've written a book on it (well, on a Javascript library, same diff), led multiple teams, chaired an industry technology group, etc. I may not be a PHP expert, but this won't be my first rodeo and I won't do anything stupid.

Alternatively if I could just get a DB dump, instead of getting access, I could setup a local media wiki installation (with the dynamic table stuff) and debug without touching the live wiki at all. The only reason I haven't done that yet is that I think that the problem is in the data, and it's not realistic for me to manually copy (page by page) all of the pages in the Butcherblock category.

Rygar 08-26-2017 04:43 PM

You definitely would have my vote for an admin, you have proven yourself very worthy. I recommend sending Ravihn a PM here do he gets an email notification, he got back to me quick last time. Mention you think you have a fix for the dynamic zone list or something, and link this thread.

I haven't had any time to investigate your fixes, but I'm curious to see if there is a difference between the syntax of the zone pages, such as someone maybe adding a new line or something, same with first mob on each of those dynamic list pages. My plan was to try and see if I can break a list to figure out the problem, but I believe the list only refreshes weekly. Sometimes I have noticed people list the 'zone' field as {{:Kaladim}} which pulls the entire zone page into the npc page, so I fix to [[Kaladim]].

Recently Ravihn fixed the runnyeye dynamic list for me, he could offer you some technical insight as to what was causing the problem.


All times are GMT -4. The time now is 04:58 PM.

Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.