Jump to content

User talk:Chris G: Difference between revisions

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Content deleted Content added
ClueBot III (talk | contribs)
m Archiving 1 discussion to User talk:Chris G/Archives/2012/October. (BOT)
Line 70: Line 70:
</div>
</div>
<!-- EdwardsBot 0387 -->
<!-- EdwardsBot 0387 -->

== Shit fuck baby!!! ==

....---

Revision as of 11:07, 18 October 2012

User:Chris G User talk:Chris G Special:Emailuser/Chris G User:Chris G/Bots User:Chris G/Awards
User Talk Email Bots Awards

Template:Archive box collapsible

Wikibot

Hi Chris,

Because botclasses.php is getting large and ugerly, and it looks to have a fair bit of 'legacy' (i.e. no-longer-used) code in it, I've started rebuilding a set of PHP classes for bot usage on-wiki.

I expect this to take me quite a long time as I'm early-on in getting familiar with PHP. I'd like to think, if nothing else, you might want to snarf the curl class I've put together in here: https://github.com/Brian-McNeil/NewsieBot-WikiInterface

One thing I noticed knocking a few 'quick-and-dirty' bot processes together with botclasses.php was needing to send an excessive number of requests to get information that could have been pulled all in a single request. I'm of the opinion Perl is "transmission line noise" masquerading as code, and I want to make any bot code look as-simple as the test_one.php program in the above repository. If you, and the other folks who've worked on botclasses.php to-date, are interested in getting a more up-to-date framework together, I'm happy to grant commit access. I take it for granted that anyone with a few years PHP programming under their belt will find some of what I do awful, so no need to 'tiptoe' around saying I've done something badly. Point is to make a more-easily maintained class, and set of extending classes, to handle usual bot functions.

I do have one question, relating to edit-conflict avoidance, am I reading API documentation etc correctly that this works off a timestamp? That seems insane; I'd expect it to work off a revision ID. Do you know if the MW devs are working towards implementing that, or if they need nudged in that direction? --Brian McNeil /talk 17:50, 2 October 2012 (UTC)[reply]

Sorry about the delay in responding.
Thanks. Your classes looks good. Yeah, I will certainly agree that was one of the draw backs of botclasses (honestly, I've been meaning to rewrite the damn thing and "do it properly", but, yeah, time is a funny thing). I'm not sure when I'll get a change to contribute something, but my github username is (rather creatively) : chr1sg so it would be nice if you could add me. Also, you might want to list your framework here
Re edit-conflicts. Yeah, from my understanding it is timestamp based. You can try nudging them if you like, although I would suspect the response will either be along the lines of "if it ain't broke, don't fix it" or "yeah, we should fix it, but it'll be a breaking change to the api, break other bots/scripts". --Chris 09:07, 10 October 2012 (UTC)[reply]
  • I 'nipped' a bit about editconflict in #mediawiki, and got a sort-of "yeah, it should be better" response.
Have added you to the contributors and expanded stuff a little. I want to keep the page-related stuff in one class, get that right, then move on to adding things like a WikiAdmin.class.php WikiMedia.class.pgp (for images/sound etc).
I thought a "nice to have" (which I stuck in today) was that the bot be able to log whatever it does to a wiki page. You can see that over on this Wikinews page.
There's a heads-up that the API may be impacted by changes being rolled out on Monday, if you spot anything impacting botclasses.php, give me a shout over on Wikinews; I'll fixup the classes I'm developing (a bucketload of the internal code may-well be 'fugly, but the point is to make bot code doing real work easily-read).
I'm relatively pleased with how I'm doing, considering I'd not touched PHP six months ago and haven't had to learn a new programming language in well-over a decade.
Did find a 'bug' today: Added a get_toc($pagename) function, and it doesn't return an error if you request the toc off a nonexistent page (but, if you ask for an 'illegal' page, eg Special:Olympics, it does throw an error).
Happy to have anyone else prod this with a pointy stick, such as whoever wrote the LyricsWiki stuff. Not to roll it into the main classes, but that there's a LyricsWiki.class.php which requires, and extends, whatever they need to use. --Brian McNeil /talk 17:11, 13 October 2012 (UTC)[reply]
Logged my first API bug from developing this (41042). And, abstracted a load of the debug output. I don't want to throw it to the lions and add it to the framework list until it does everything an anon user could do with a page. At that point, someone could use it for a basic bot. I note that botclasses.php does a load of admin-type stuff and, you could say, more than a Swiss army knife in some regards. What are the vitally important operations you need botclasses.php for? --Brian McNeil /talk 20:15, 15 October 2012 (UTC)[reply]
this give a bit of an idea of the functions most frameworks have. As you can see there's actually quite a bit of difference between what each framework supports (e.g. I've always been pretty happy with just having one edit function, and letting the bot writer do the rest; however phpwikibot has about 3 different functions just for replacing text in a page, and a whole bunch for removing templates etc).

The most important functions would be (imo):

  • get page content
  • get the members of a category
  • subpages of a page
  • what links here for a page
  • template transclusions

Less important (but still useful), are ones like: get page id, page history, user edit count and user contribs.

Also, at some point you'll probably think "hey, you know what would be nice? parsing wikitext!" and have images of a lovely DOM model where you can just go "$template = $page->getTemplate('infobox'); $template->getParam('DoB');". My advice is to sit down and wait until the urge passes (my other advise is, unless your dealing with very simple wikitext, don't use regex).

--Chris 11:46, 16 October 2012 (UTC)[reply]

Greetings! You have been randomly selected to receive an invitation to participate in the request for comment on Wikipedia:Village pump (proposals). Should you wish to respond to the invitation, your contribution to this discussion will be very much appreciated! If in doubt, please see suggestions for responding. If you do not wish to receive these types of notices, please remove your name from Wikipedia:Feedback request service.RFC bot (talk) 16:15, 12 October 2012 (UTC)[reply]

Please comment on Template talk:Civility

Greetings! You have been randomly selected to receive an invitation to participate in the request for comment on Template talk:Civility. Should you wish to respond to the invitation, your contribution to this discussion will be very much appreciated! If in doubt, please see suggestions for responding. If you do not wish to receive these types of notices, please remove your name from Wikipedia:Feedback request service.RFC bot (talk) 17:16, 15 October 2012 (UTC)[reply]

The Signpost: 15 October 2012

Shit fuck baby!!!

....---