Типа я (zilogic) wrote in changelog,
Типа я
zilogic
changelog

[livejournal] r19474: LJSUP-9292: Create console command set f...

Committer: amyshkin
LJSUP-9292: Create console command set for $username s2privs $arg
U   trunk/cgi-bin/ljhooks.pl
Modified: trunk/cgi-bin/ljhooks.pl
===================================================================
--- trunk/cgi-bin/ljhooks.pl	2011-07-14 07:58:13 UTC (rev 19473)
+++ trunk/cgi-bin/ljhooks.pl	2011-07-14 08:15:59 UTC (rev 19474)
@@ -369,7 +369,6 @@
     return 1;
 });
 
-#TODO: enable 'enabled_s2_js' when it will be implemented
 register_setter("s2privs", sub {
     my ($u, $key, $value, $err) = @_;
 
@@ -380,20 +379,15 @@
         return 1;
     }
 
-    my %args = map { $_ => 1 } split( /\+/, $value );
-    my @to_set;
+    my %args = map { $_ => $_ } split( /\+/, $value );
+    my @to_set = delete @args{ keys %good_params };
+    @to_set = grep { $_ } @to_set;
 
-    delete $args{$_}
-        ? do {
-            push( @to_set, $_ );
-            delete $good_params{$_};
-          }
-        : undef
-            for keys %good_params;
-
     return 0 if int(keys %args);
     return 0 unless @to_set;
 
+    delete @good_params{ @to_set };
+
     # First of all clear unused s2privs props
     $u->set_prop( $_, 0 ) for keys %good_params;
 

Tags: livejournal, pl, zilogic
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