[dokuwiki] Re: Hello, a couple questions. :)

  • From: Eddie Parker <eddie@xxxxxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Thu, 02 Jun 2005 09:16:45 -0600

Hello Andreas!

I've started a new thread regarding the auth_ changes I was thinking about, but I figured I'd answer back on a few of the points you raised here. :)

Anyhow, the root of my change is this: I want to allow users to edit their preferences, which at this time is just e-mail, username, and password. Pretty trivial to do, in terms of getting the data, displaying it, etc. No problem.


Not so trivial when using plain text files ;-) I'm currently just use the append mode which makes additions unproblematic even in multiuser environment (when to people register at exactly the same time). You need some locking mechanism if you need to change a file (not impossible but you should think on it)

Right, that's quite true. It's unfortunate, but things like this are going to impact performance on the server a bit - locking mechanisms aren't really all that efficient. That said, I imagine plaintext/XML solutions aren't really meant for a massive system. Hence my proposal for the auth refactor, so it should be easier to extend DokuWiki to using SQL, or some other type of directory server.... But I'll let that other thread talk more about it. :)

The format of the plaintext file isn't too bad, I believe it's colon separated or some such, but I was thinking this would be a great place to put XML in, especially since PHP has a very nifty xml_parse_into_struct, to get what we need, and writing it out is even simpler.


Using XML could indeed make it easier to add some optional additional fields like suggested by Bob. But it makes it harder to edit the file by hand. but remember Dokuwiki authenticates against external Databases as well - you need to stay compatible here so this was my intention when restricting it to the minimal needed fields.

Right. I figured that XML was a good choice, since it's not often read by the user, and it's very easy to manipulate programmatically. I was hoping that with the changes to allow users to edit their own passwords etc, however, there would be less of a need to go in and muck with these files anyhow, so XML might be more acceptable in those cases (I myself loathe having to go to the server to change my password. :)). Trust me, I have a longstanding rant against improper usage of XML <http://www.kickingdragon.com/?postid=11>, so I'm more than happy to not use it in cases where it doesn't belong. :)

On your note regarding Dokuwiki authenticates against external DB's: I'm hoping that my comment on the auth_ refactor thread will show the usefulness in maintainability and extension for things like that. :)

I noticed that there are no classes in use anywhere! (Near as I could see). Out of curiousity, is that policy, or preference?


Well I originally used no classes... however some things are now implemented in classes (parser/renderer/plugins). I don't mind a mixture between OO and procedural programming. When using OO be sure to stay compatible with PHP 4!

Fair enough. :) I'm a big fan of using OO, although I have to admit, the procedural code in there isn't too bad! That said, anything I do will be in PHP 4, so no worries on that front. :)

Also, on a similar note: what are thoughts on using PHPUnit? (http://pear.php.net/manual/en/packages.php.phpunit.intro.php) I haven't had much experience with PHPUnit, but I'm a huge advocate of PyUnit, Boost::Test, JsUnit, etc, and I wouldn't mind hooking my things up to proper unit testing.


I have no experience with this kind of stuff. Harry Fuecks introduced some Unit testing for the parser stuff using SimpleTest, but this is currently broken because some heavily modification in the parser and no update of the test classes. If anyone would have a look at it I'd be glad. I'm not used to these automatic testing stuff yet so I tend to ignore it as too much work (shame on me).

Hah, fair enough. :) Unit testing isn't for everyone, however, the huge benefit I see in open-source projects, is that you can actually get your users to do some work for you. Richard Jones, the owner of the RoundUp <http://roundup.sourceforge.net> project, introduced me to the concept, by asking for bug reports (that were really heavily technical) to be in the form of a unit test that fails. It made it much easier to fix things on his end, and when I adopted the practice, it made me understand what was going wrong much faster as well.

Anyhow, I'll look into doing it on anything I do, if anyone has any questions, let me know! (I've never used PHPUnit, but it should be interesting to try! :))

Thanks once again for answering my questions, and happy Wiki-ing. :D

-e-

Other related posts: