mod_rewrite

bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sun, 2005-03-13 23:53

This looks fantastic. Big improvement and excellent movement in the
right direction. I think that this change clearly demonstrates the
power that we'll be able to provide with the rewrite code. It's a
work in progress so I won't do the nitty-gritty review here, but I did
notice some stuff. Great work as always.

Minor stuff:

You don't need to add a new callback in the module list. We'll only
be using this callback infrequently (in AdminRewrite) so it's easier
to just check all the modules instead of trying to isolate the ones
that implement the callback. We only register the callbacks currently
to avoid having to load every module on every page view. I think it
does make sense to push the core rules into the core module, but we
can do that later on when we do the next core update. You'll also
want to update GalleryModule.class to include the getRewriteRules()
method in the base class with appropriate phpdoc.

RewriteHelper bombs on line 78 because you're calling
parent::getCurrentUrl() in a static context. It looks like this code
got moved over from RewriteUrlGenerator; it should probably just be
returning an error code there.

SetupRewrite.inc calls RewriteHelper::getTemplate() with no
$rewriteRules argument so it throws a warning

Storage.. it's probably fine to store your data as a serialized object
in the plugin parameter map for now. The issue with that map is more
the number of rows than the size of the data in any one row. If it
becomes a performance issue we can always set up your own table easily
enough later on.

 
joris.struijk

Joined: 2003-06-24
Posts: 17
Posted: Tue, 2005-03-15 08:51

Hi there.
A am trying to install the 2 files provided by Pelle but have no clue where to begin and how to handle.
Maby someone can assist me.

I think i yust have to overwrite the files in the rewrite module with the files in the rewrite-0.9.1.tar.gz file.
But what's with the other file?

Grx,
Joris

 
joris.struijk

Joined: 2003-06-24
Posts: 17
Posted: Tue, 2005-03-15 10:06

I yust overwritten the files in the Rewrite dir under the Modules dir with the files i got from Pelle. Now there's another problem.
The Gallery Modules page now is telling me i should Upgrade the URL Rewrite module. When i click upgrade, it link's to a page where nothing showes up and nothing happens.

Anyone?

Ps. it tell's me Version: 0.8.0 Installed: 0.9.1 Action: Upgrade

 
Einstein
Einstein's picture

Joined: 2003-10-13
Posts: 105
Posted: Thu, 2005-03-17 17:08

FYI, A CVS version one hour old give me the following error:
RewriteRule: cannot compile regular expression '^d/([0-9]+).*?'\n

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Fri, 2005-03-18 08:07

Try editing that expression and deleting the ? .. does that fix it?

 
kaare
kaare's picture

Joined: 2005-03-18
Posts: 9
Posted: Fri, 2005-03-18 22:10

Hi there. Since this is my first post I'd like to thank you all for this great application. G2 is awesome =)

It was the support for multiple virtual hosts in G2 that made me try this application since I wanted to keep my friends albums separated. I haven't tried rewrite-0.9.X, only the one supplied with G2b1 (0.8.0).

My site's spec:

AMD Sempron 2200+
Debian GNU/Linux sid (unstable)
apache-mpm-prefork 2.0.53-5
libapache-mod-php4 4.3.10-9

Ok, so let me explain the problem/symptoms when using the rewrite module with multiple virtual hosts:

I have three hosts using this application: gallery.wert.no, silje.wert.no and f0nix.wert.no. gallery.wert.no has the default section in config.php. The problem was that I could only make gallery.wert.no work properly with the rewrite module enabled, and when this was enabled, only this host worked properly, unless I commented out the line

RewriteRule ^$ /main.php [L]

in .htaccess. With thise line commented out I could only use the rewrite module on gallery.wert.no, not the others, as this would send me back to the default gallery (gallery.wert.no). I.e. f0nix.wert.no and silje.wert.no would both load the default configuration part in config.php.

The problem is not in in the rewrite module, but this module triggers it. With the RewriteRule above enabled $_SERVER[REQUEST_URI] will return "/", not "/main.php", so the method getGalleryId() in gallery2/modules/core/classes/GalleryUrlGenerator.class will not return a valid $galleryId for config.php.

The regular expression in the preg_replace() function in getGalleryId() has no match for "http://silje.wert.no/" so the function will return "http://silje.wert.no/", not "silje.wert.no", as expected. This expression made my day:
return preg_replace('{^.*?://(.*?)/.*$}', '$1', $url);

Using this expression everything works like a charm.

I can see why the original expression is made to return a correct galleryId when you request only certain files or paths, but I don't understand why.

Anyway, this lengthy post for such a small problem should probably be sent as a bug report, but reading this thread made it kind of "easy" to just post it here. Shoot me :-)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-05-07 14:16

[b]pelle, if you haven't noticed yet. we're working on a new multisite + rewrite solution in http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=29915 .
in the new solution, galleryId isn't needed anymore (:)!). the rewrite rules and config.php would be distributed, not all in one file.

 
pelle
pelle's picture

Joined: 2004-12-10
Posts: 389
Posted: Sat, 2005-05-07 16:40

+1 for no galleryId ;)

 
hawkmaster

Joined: 2005-06-22
Posts: 1
Posted: Wed, 2005-06-22 17:52

I am thinking about buying some SPAM from MORESPAM. Has anybody had any experience SPAM from them.

SPAM SPAM

(Edit: converted all spam related content into the word SPAM. [bharat])

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-06-22 18:03

hawkmaster, this has absolutely nothing to do with Gallery or development.

 
ArthurWetselaar

Joined: 2002-06-11
Posts: 38
Posted: Wed, 2005-06-22 20:05

That is called spamming valiant. It is on purpose cause these pages of the forum have a high pagerank in Google and a high Alexarank too. And he can put his link here. Links to his site will benefit his position in searchengines so pls delete that post. And if possible ban his IP.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-06-22 20:12

I'm aware that this is most probably spam. But a link deep in the G2 forums isn't worth much, plus I believe in the good ;)