[wp-testers] Can we delete this code from classes.php?

Kirk Steffensen blogger at steffensenfamily.com
Thu Feb 2 01:17:21 GMT 2006


Ryan, Andy, and Aylwin,

Replacing line 31 in wp-gallery2.php from

require('./wp-blog-header.php');

to

require('./wp-config.php');
$wp->init();
$wp->parse_request();
$wp->send_headers();
$wp->query_posts();
$wp->register_globals();

does the trick.  It omits handle_404() while initializing everything else.
Now 

http://www.steffensenfamily.com/wordpress/wp-gallery2.php?g2_controller=exif
.SwitchDetailMode&g2_mode=detailed&g2_return=http%3A%2F%2Fwww.steffensenfami
ly.com%2Fwordpress%2Fv%2F2004_12_Christmas%2F2004_Steffensen_Christmas_Web_V
ersion.jpg.html&g2_returnName=photo

does the right thing even with the original WP classes.php file in place.

I still think it's a kludge and that forcing the 200 in classes.php is
incorrect.  If you don't fix it now, I'm betting that it will keep rearing
its ugly head as others come up with mod rewrite rules for other packages.

I'll leave it up to you whether to close the ticket.  I'd prefer to leave it
open as a reminder to continue to look at this, but I won't reopen it if it
is closed.

Thanks for working with us on finding a solution.  It definitely helped to
have the guys who know the code to point us in the right direction.

Cheers,
Kirk
 

-----Original Message-----
From: wp-testers-bounces at lists.automattic.com
[mailto:wp-testers-bounces at lists.automattic.com] On Behalf Of Ryan Boren
Sent: Wednesday, February 01, 2006 5:59 PM
To: wp-testers at lists.automattic.com
Subject: Re: [wp-testers] Can we delete this code from classes.php?

Aylwin Cal wrote:
> Hi,
> 
> I've tried changing line 31 from:
> require('./wp-blog-header.php');
> to:
> include('./wp-config.php');
> 
> I no longer get stuck with the 200 but I get the following error on 
> every single Gallery page:
> 
> Warning: extract(): First argument should be an array in 
> /var/hometemp/aylwin/public_html/wp2/wp-includes/functions.php on line 
> 2109

That's in load_template(), which should never be called when only loading
wp-config.php.  Curious.

If you look at the wp() call in functions.php, you'll see that it calls
WP::main() in classes.php.  main() does the basic init for a WP session. 
  You can call any of those functions individually, leaving out ones such as
handle_404() that you don't want to run.  You can try this:

require('./wp-config.php');

$wp->init();
$wp-parse_request();
$wp->send_headers();
$wp->query_posts();
//Skip built-in 404 and do your own thing.
// $wp->handle_404();
custom_404_handler();
$wp->register_globals();


Of course, fixin WP in a way that accomodates everyone would be preferable.
I didn't do the suggested change for 2.0.1 simply because I was afraid it
would break other setups.  We can nail this down for the next release.

Ryan


_______________________________________________
wp-testers mailing list
wp-testers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-testers






More information about the wp-testers mailing list