So, I just pushed some changes to the 0.7.x dev branch that I'd like to
explain.

Laconica supports "fancy URLs" -- encoding important information about a
request into the URL itself. So if you fetch /group/ubuntu/members, the
software knows that you're trying to run the groupmembers action with
the group nicknamed 'ubuntu'. And we could turn the showstream action
for the user nicknamed '8ball' with page = 2 into an URL like /8ball?page=2.

Up till now, we've done the URL-to-args mapping using a long and
complicated htaccess.sample file, and the args-to-URL mapping using a
long and complicated function common_fancy_url(). This has had lots of
problems:

* It's hard to keep this data up-to-date in two places.
* Web servers that didn't support htaccess files couldn't use fancy
  URLs.
* We couldn't use PATH_INFO hacks to make kinda-fancy URLs like
  index.php/evan/repies . PATH_INFO often works on hosted sites where
  mod_rewrite is unavailable.

So, I started looking into some other options. I looked at how Drupal,
MediaWiki, and Wordpress all did URL routing, and they all seem to use a
lot of custom code that only works in one direction.

But Robin found a great package on PEAR, Net_URL_Mapper. It works very
nicely for what we do, and it's bi-directional. I was worried about its
performance at first (some people in IRC might have seen me complain),
but I was using it wrong.

So I've translated all our URL-mapping code to use Net_URL_Mapper. On
dev/0.7.x, the rules are all in the lib/route.php file. I've obliterated
the greater part of the htaccess.sample file, and common_local_url() is
now just a wrapper for the Route code.

I seem to have gotten most of the URL rules correct, but there are a
couple that I've noticed that are wrong. The query-string arguments,
like 'page' and 'q', aren't coming through, and I think some of the
Twitter-like API rules are off.

But it's working well enough that I've pushed it to dev, and I'd
appreciate feedback on how it's working. This will probably go live on
Identi.ca later next week (along with the Exceptions, Events, Plugins code).

And, yes: three or four radical changes for the codebase in what are
supposed to be "stable" releases, but... yeah. No excuse, really. Just
scratching an itch.

-Evan
_______________________________________________
Laconica-dev mailing list
[email protected]
http://mail.laconi.ca/mailman/listinfo/laconica-dev

Reply via email to