Первый фоллен на хелле (wildkin) wrote in changelog,
Первый фоллен на хелле
wildkin
changelog

[ljcom] r8121: 1) use LJ::Request instead of Apache(->r...

Committer: dnikolaev
1) use LJ::Request instead of Apache(->request).
2) BML code blocks do not receive now request object in first parameter. Apache::BML::bml_block changed.
3) All LJ methods and subroutines in BMLs, which was calling with parameter $r or hashref like { r => ... }, now calls with 'UNUSED' string.
4) LJ::Request::meets_conditions created.
5) TODO: LJ::Request::err_header_out must be created.

U   branches/modernize2/cgi-bin/bml/scheme/dystopia.look
U   branches/modernize2/cgi-bin/bml/scheme/lanzelot.look
U   branches/modernize2/htdocs/admin/accounts/paidsummary.bml
U   branches/modernize2/htdocs/admin/accounts/vgiftsummary.bml
U   branches/modernize2/htdocs/admin/feedback/deletion.bml
U   branches/modernize2/htdocs/misc/elsewhere_info.bml
U   branches/modernize2/htdocs/misc/m365_ack.bml
U   branches/modernize2/htdocs/news/2004-01-qa.bml
U   branches/modernize2/htdocs/pay/modify.bml
U   branches/modernize2/htdocs/pay/paymeth/webmoney.bml
U   branches/modernize2/htdocs/sup/rpc_interface.bml
U   branches/modernize2/ssldocs/manage/account/cc.bml
U   branches/modernize2/ssldocs/misc/m365_mo.bml
U   branches/modernize2/ssldocs/pay/cc.bml
U   branches/modernize2/ssldocs/pay/ccpay.bml
Modified: branches/modernize2/cgi-bin/bml/scheme/dystopia.look
===================================================================
--- branches/modernize2/cgi-bin/bml/scheme/dystopia.look	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/cgi-bin/bml/scheme/dystopia.look	2010-01-20 08:27:03 UTC (rev 8121)
@@ -140,7 +140,7 @@
 <link rel="contents" title="Site Map" href="<?siteroot?>/site/" />
 <link rel="help" title="Technical Support" href="<?siteroot?>/support/" />
 <title><?_code {
-    my $elhash = $_[2];
+    my $elhash = $_[1];
     return $elhash->{'WINDOWTITLE'} || $elhash->{'TITLE'};
 } _code?></title>
 <?_code LJ::res_includes() _code?>

Modified: branches/modernize2/cgi-bin/bml/scheme/lanzelot.look
===================================================================
--- branches/modernize2/cgi-bin/bml/scheme/lanzelot.look	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/cgi-bin/bml/scheme/lanzelot.look	2010-01-20 08:27:03 UTC (rev 8121)
@@ -43,7 +43,7 @@
 <head>
     <meta http-equiv="X-UA-Compatible" content="IE=7"/>
     <meta http-equiv="content-type" content="text/html; charset=utf-8">
-    <title><?_code { my $elhash = $_[2]; return $elhash->{'WINDOWTITLE'} || $elhash->{'TITLE'}; } _code?></title>
+    <title><?_code { my $elhash = $_[1]; return $elhash->{'WINDOWTITLE'} || $elhash->{'TITLE'}; } _code?></title>
 
 <?_code
         LJ::need_res('js/core.js');

Modified: branches/modernize2/htdocs/admin/accounts/paidsummary.bml
===================================================================
--- branches/modernize2/htdocs/admin/accounts/paidsummary.bml	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/htdocs/admin/accounts/paidsummary.bml	2010-01-20 08:27:03 UTC (rev 8121)
@@ -5,10 +5,6 @@
 
     my $PAGE_SIZE = 50;
 
-    # sometimes need an Apache::Request object
-    my $req = shift;
-    my $r = $req->{'r'};
-
     my $remote = LJ::get_remote();
     return "You must first <a href=\"/login.bml?ret=1\">log in</a>."
         unless $remote;
@@ -60,7 +56,7 @@
 
     # Handle CSV output (which outputs different content than HTMl output)
     if ($view_mode eq 'csv') {
-        handle_csv($r, \%stats, $year, $month, $day);
+        handle_csv(\%stats, $year, $month, $day);
         return;
     }
 
@@ -513,7 +509,7 @@
     }   # subroutine
 
     sub handle_csv {
-        my ($r, $stats_ref, $year, $month, $day) = @_;
+        my ($stats_ref, $year, $month, $day) = @_;
 
         # CSV columns.  FIXME: add more
         my $ret .= join
@@ -597,10 +593,10 @@
             sprintf("paidsummary-%4d-%02d.csv", $year, $month) :
             sprintf("paidsummary-%4d-%02d-%02d.csv", $year, $month, $day);
 
-        $r->content_type("application/x-csv");
-        $r->header_out("Content-disposition" => "attachment; filename=\"$filename\"");
-        $r->send_http_header;
-        $r->print($ret);
+        LJ::Request->content_type("application/x-csv");
+        LJ::Request->header_out("Content-disposition" => "attachment; filename=\"$filename\"");
+        LJ::Request->send_http_header();
+        LJ::Request->print($ret);
 
         return;
     }

Modified: branches/modernize2/htdocs/admin/accounts/vgiftsummary.bml
===================================================================
--- branches/modernize2/htdocs/admin/accounts/vgiftsummary.bml	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/htdocs/admin/accounts/vgiftsummary.bml	2010-01-20 08:27:03 UTC (rev 8121)
@@ -5,10 +5,6 @@
 
     my $PAGE_SIZE = 50;
 
-    # sometimes need an Apache::Request object
-    my $req = shift;
-    my $r = $req->{'r'};
-
     my $remote = LJ::get_remote();
     return "You must first <a href=\"/login.bml?ret=1\">log in</a>."
         unless $remote;
@@ -235,10 +231,10 @@
                 sprintf("paidsummary-%4d-%02d.csv", $year, $month) :
                 sprintf("paidsummary-%4d-%02d-%02d.csv", $year, $month, $day);
 
-            $r->content_type("application/x-csv");
-            $r->header_out("Content-disposition" => "attachment; filename=\"$filename\"");
-            $r->send_http_header;
-            $r->print($output);
+            LJ::Request->content_type("application/x-csv");
+            LJ::Request->header_out("Content-disposition" => "attachment; filename=\"$filename\"");
+            LJ::Request->send_http_header();
+            LJ::Request->print($output);
 
             return;
         }

Modified: branches/modernize2/htdocs/admin/feedback/deletion.bml
===================================================================
--- branches/modernize2/htdocs/admin/feedback/deletion.bml	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/htdocs/admin/feedback/deletion.bml	2010-01-20 08:27:03 UTC (rev 8121)
@@ -89,11 +89,10 @@
 
             my $filename = sprintf("deletion_feedback_%4d-%02d-%02d_through_%4d-%02d-%02d.csv", $year_start, $month_start, $day_start, $year_end, $month_end, $day_end);
 
-            my $r = Apache->request;
-            $r->content_type("application/x-csv");
-            $r->header_out("Content-disposition" => "attachment; filename=\"$filename\"");
-            $r->send_http_header;
-            $r->print($csv_text);
+            LJ::Request->content_type("application/x-csv");
+            LJ::Request->header_out("Content-disposition" => "attachment; filename=\"$filename\"");
+            LJ::Request->send_http_header();
+            LJ::Request->print($csv_text);
 
             return;
         }

Modified: branches/modernize2/htdocs/misc/elsewhere_info.bml
===================================================================
--- branches/modernize2/htdocs/misc/elsewhere_info.bml	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/htdocs/misc/elsewhere_info.bml	2010-01-20 08:27:03 UTC (rev 8121)
@@ -6,11 +6,8 @@
     # We'll handle it from here
     BML::finish_suppress_all();
 
-    my $req = shift;
-    my $r = $req->{r};
+    Apache::LiveJournal::Interface::ElsewhereInfo->handle('UNUSED');
 
-    Apache::LiveJournal::Interface::ElsewhereInfo->handle($r);
-
     return;
 }
 _code?>

Modified: branches/modernize2/htdocs/misc/m365_ack.bml
===================================================================
--- branches/modernize2/htdocs/misc/m365_ack.bml	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/htdocs/misc/m365_ack.bml	2010-01-20 08:27:03 UTC (rev 8121)
@@ -3,17 +3,14 @@
     use strict;
     use vars qw(%GET %POST);
 
-    my $req = shift;
-    my $r = $req->{r};
-
     # BML calls $r->content which can only be called once
     # so we'll add a 'content' pnotes field for \%POST
-    $r->pnotes('content' => \%GET);
+    LJ::Request->pnotes('content' => \%GET);
 
     my $gw = LJ::sms_gateway()
         or die "unable to retrieve gateway object";
 
-    my $dsms_ack = $gw->recv_ack_http($r);
+    my $dsms_ack = $gw->recv_ack_http('UNUSED');
 
     # create an LJ::SMS::MessageAck from this DSMS::MessageAck
     my $lj_ack = LJ::SMS::MessageAck->new_from_dsms($dsms_ack);

Modified: branches/modernize2/htdocs/news/2004-01-qa.bml
===================================================================
--- branches/modernize2/htdocs/news/2004-01-qa.bml	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/htdocs/news/2004-01-qa.bml	2010-01-20 08:27:03 UTC (rev 8121)
@@ -4,7 +4,7 @@
 {Fp}
 <?_code
 {
-    my ($scratch, $args) = ($_[1], $_[2]);
+    my ($scratch, $args) = ($_[0], $_[1]);
     my $ljuser = $args->{LJUSER};
     my $count = ++$scratch->{"count"};
     my $lastnum = $scratch->{"perma_$ljuser"};

Modified: branches/modernize2/htdocs/pay/modify.bml
===================================================================
--- branches/modernize2/htdocs/pay/modify.bml	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/htdocs/pay/modify.bml	2010-01-20 08:27:03 UTC (rev 8121)
@@ -10,9 +10,6 @@
     return BML::redirect("./")
         unless LJ::did_post();
 
-    my $req = shift;
-    my $r = $req->{'r'};
-
     my $now = time();
 
     ($title, $body) = ("", "");
@@ -214,7 +211,7 @@
         $cartobj->payvar_add("browser", $ua) if $ua;
 
         # log uniq
-        my $uniq = $r->notes('uniq');
+        my $uniq = LJ::Request->notes('uniq');
         $cartobj->payvar_add("uniq",  LJ::mysql_time() . " - $uniq") if $uniq;
 
         if ($paymeth eq "sup_sms" && LJ::Pay::can_use_sup_sms($remote)) {

Modified: branches/modernize2/htdocs/pay/paymeth/webmoney.bml
===================================================================
--- branches/modernize2/htdocs/pay/paymeth/webmoney.bml	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/htdocs/pay/paymeth/webmoney.bml	2010-01-20 08:27:03 UTC (rev 8121)
@@ -9,9 +9,6 @@
     # Continue shopping if they hit that button
     return BML::redirect("/shop/") if $POST{'action:continue'};
 
-    my $req = shift;
-    my $r = $req->{'r'};
-
     my $now = time();
 
     ($title, $body) = ("", "");

Modified: branches/modernize2/htdocs/sup/rpc_interface.bml
===================================================================
--- branches/modernize2/htdocs/sup/rpc_interface.bml	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/htdocs/sup/rpc_interface.bml	2010-01-20 08:27:03 UTC (rev 8121)
@@ -10,8 +10,10 @@
     use XML::Simple;
     use JSON qw//;
 
-    my $r = eval { Apache->request };
-    my $response_format = $r ? $r->headers_in->get("X-Response-Format") : 'xml';
+    # Old code:
+    # my $r = eval { Apache->request };
+    # my $response_format = $r ? $r->headers_in->get("X-Response-Format") : 'xml';
+    my $response_format = LJ::Request->headers_in->get("X-Response-Format");
 
     #
     # PARAMS:
@@ -27,8 +29,7 @@
     my $ip_class  = LJ::LJcom::ip_class();
     my $remote_ip = LJ::get_remote_ip();
 
-    $r->notes('codepath' => "interface.sup_rpc.index:" . $params->{action})
-        if $r;
+    LJ::Request->notes('codepath' => "interface.sup_rpc.index:" . $params->{action});
     
     my $trusted_commands = 
         $LJ::IS_DEV_SERVER 

Modified: branches/modernize2/ssldocs/manage/account/cc.bml
===================================================================
--- branches/modernize2/ssldocs/manage/account/cc.bml	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/ssldocs/manage/account/cc.bml	2010-01-20 08:27:03 UTC (rev 8121)
@@ -80,9 +80,7 @@
     my ($ret, $err);
 
     # Sysban checks
-    my $req = shift;
-    my $r = $req->{r};
-    my $uniq = $r->notes('uniq');
+    my $uniq = LJ::Request->notes('uniq');
 
     if (LJ::sysban_check('pay_email', $u->email_raw)) {
         LJ::sysban_note($u->{'userid'},

Modified: branches/modernize2/ssldocs/misc/m365_mo.bml
===================================================================
--- branches/modernize2/ssldocs/misc/m365_mo.bml	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/ssldocs/misc/m365_mo.bml	2010-01-20 08:27:03 UTC (rev 8121)
@@ -3,17 +3,14 @@
     use strict;
     use vars qw(%POST);
 
-    my $req = shift;
-    my $r = $req->{r};
-
     # BML calls $r->content which can only be called once
     # so we'll add a 'content' pnotes field for \%POST
-    $r->pnotes('content' => \%POST);
+    LJ::Request->pnotes('content' => \%POST);
 
     my $gw = LJ::sms_gateway()
         or die "unable to retrieve gateway object";
 
-    my $resp = $gw->recv_msg_http($r);
+    my $resp = $gw->recv_msg_http('UNUSED');
 
     # was it a properly formed and read request?
     if ($resp->is_success) {

Modified: branches/modernize2/ssldocs/pay/cc.bml
===================================================================
--- branches/modernize2/ssldocs/pay/cc.bml	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/ssldocs/pay/cc.bml	2010-01-20 08:27:03 UTC (rev 8121)
@@ -8,9 +8,7 @@
     # Auto redirect to status if disabled
     return BML::redirect("http://status.livejournal.org/") if $LJ::DISABLED{'recbill_shop'};
 
-    my $req = shift;
-    my $r = $req->{r};
-    my $uniq = $r->notes('uniq');
+    my $uniq = LJ::Request->notes('uniq');
     my $remote = LJ::get_remote();
     my $remote_ip = LJ::get_remote_ip();
 

Modified: branches/modernize2/ssldocs/pay/ccpay.bml
===================================================================
--- branches/modernize2/ssldocs/pay/ccpay.bml	2010-01-20 08:18:36 UTC (rev 8120)
+++ branches/modernize2/ssldocs/pay/ccpay.bml	2010-01-20 08:27:03 UTC (rev 8121)
@@ -8,9 +8,7 @@
     use LWP;
     use LWP::UserAgent;
 
-    my $req = shift;
-    my $r = $req->{r};
-    my $uniq = $r->notes('uniq');
+    my $uniq = LJ::Request->notes('uniq');
 
     my $dbh = LJ::get_db_writer();
     my $cart = $POST{'cart'};

Tags: bml, ljcom, look, wildkin
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments