[dw-free] 32bit support
[commit: http://hg.dwscoalition.org/dw-free/rev/c22b4bb13976]
http://bugs.dwscoalition.org/show_bug.cgi?id=1632
My changes to make this more robust only worked in web context. Moved the
code to ljlib to ensure that it works for workers, console tools, etc as
well.
Patch by
mark.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1632
My changes to make this more robust only worked in web context. Moved the
code to ljlib to ensure that it works for workers, console tools, etc as
well.
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- cgi-bin/ljlib.pl
- cgi-bin/modperl_subs.pl
-------------------------------------------------------------------------------- diff -r a93b8ece20db -r c22b4bb13976 cgi-bin/ljlib.pl --- a/cgi-bin/ljlib.pl Mon Jan 11 04:00:21 2010 +0000 +++ b/cgi-bin/ljlib.pl Mon Jan 11 04:46:12 2010 +0000 @@ -16,6 +16,8 @@ use strict; use strict; no warnings 'uninitialized'; +use LJ::Config; + BEGIN { # ugly hack to shutup dependent libraries which sometimes want to bring in # ljlib.pl (via require, ick!). so this lets them know if it's recursive. @@ -26,6 +28,21 @@ BEGIN { $LJ::HOME ||= $ENV{LJHOME}; die "No \$LJ::HOME set, or not a directory!\n" unless $LJ::HOME && -d $LJ::HOME; + + # mod_perl does this early too, make sure we do as well + LJ::Config->load; + + # arch support has to be done pretty early + if ( $LJ::ARCH32 ) { + $LJ::ARCH = 32; + $LJ::LOGMEMCFMT = 'NNNLN'; + $LJ::PUBLICBIT = 2 ** 31; + } else { + $LJ::ARCH32 = 0; + $LJ::ARCH = 64; + $LJ::LOGMEMCFMT = 'NNNQN'; + $LJ::PUBLICBIT = 2 ** 63; + } } use lib "$LJ::HOME/cgi-bin"; @@ -50,7 +67,6 @@ use TheSchwartz; use TheSchwartz; use TheSchwartz::Job; use LJ::Comment; -use LJ::Config; use LJ::ExternalSite; use LJ::Message; use LJ::PageStats; @@ -77,8 +93,6 @@ sub Unicode::MapUTF8::AUTOLOAD { no strict 'refs'; goto *{$Unicode::MapUTF8::AUTOLOAD}{CODE}; } - -LJ::Config->load; sub END { LJ::end_request(); } diff -r a93b8ece20db -r c22b4bb13976 cgi-bin/modperl_subs.pl --- a/cgi-bin/modperl_subs.pl Mon Jan 11 04:00:21 2010 +0000 +++ b/cgi-bin/modperl_subs.pl Mon Jan 11 04:46:12 2010 +0000 @@ -26,18 +26,6 @@ use LJ::Config; BEGIN { LJ::Config->load; - - # now that configuration is loaded, setup arch specific stuff - if ( $LJ::ARCH32 ) { - $LJ::ARCH = 32; - $LJ::LOGMEMCFMT = 'NNNLN'; - $LJ::PUBLICBIT = 2 ** 31; - } else { - $LJ::ARCH32 = 0; - $LJ::ARCH = 64; - $LJ::LOGMEMCFMT = 'NNNQN'; - $LJ::PUBLICBIT = 2 ** 63; - } } use Apache::LiveJournal; --------------------------------------------------------------------------------