fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-08-22 09:34 am

[dw-free] move cgi-bin/lj*.pl files into proper modules (in cgi-bin/LJ)

[commit: http://hg.dwscoalition.org/dw-free/rev/3d2583b4dc77]

http://bugs.dwscoalition.org/show_bug.cgi?id=1726

Move ljcapabilities.pl to LJ/Capabilities.pm. All functions inside, except
for get_cap must now use: LJ::Capabilities::function_name instead of
LJ::function_name; LJ::get_cap and LJ::Capabilities::get_cap both work.

Patch by [personal profile] kareila.

Files modified:
  • bin/checkconfig.pl
  • bin/maint/stats.pl
  • cgi-bin/LJ/Capabilities.pm
  • cgi-bin/LJ/S2/FriendsPage.pm
  • cgi-bin/LJ/User.pm
  • cgi-bin/ljcapabilities.pl
  • cgi-bin/ljlib.pl
  • cgi-bin/ljprotocol.pl
  • doc/raw/build/hooks/hooks2db.pl
  • doc/raw/ljp.book/int/cap_classes.xml
  • htdocs/support/see_request.bml
  • t/betafeatures.t
--------------------------------------------------------------------------------
diff -r fc856c03f49d -r 3d2583b4dc77 bin/checkconfig.pl
--- a/bin/checkconfig.pl	Mon Aug 22 16:26:01 2011 +0800
+++ b/bin/checkconfig.pl	Mon Aug 22 17:34:35 2011 +0800
@@ -316,7 +316,7 @@
     $ENV{READ_LJ_SOURCE} = 1 if $LJ::IS_DEV_SERVER;
 
     # check for beta features cap
-    unless (LJ::class_bit(LJ::BetaFeatures->cap_name)) {
+    unless ( LJ::Capabilities::class_bit( LJ::BetaFeatures->cap_name ) ) {
         print STDERR "Warning: BetaFeatures module cannot be used unless '" . LJ::BetaFeatures->cap_name . "' cap is configured.";
     }
 
diff -r fc856c03f49d -r 3d2583b4dc77 bin/maint/stats.pl
--- a/bin/maint/stats.pl	Mon Aug 22 16:26:01 2011 +0800
+++ b/bin/maint/stats.pl	Mon Aug 22 17:34:35 2011 +0800
@@ -165,7 +165,7 @@
                        while (my $rec = $sth->fetchrow_hashref) {
 
                            # account types
-                           my $capnameshort = LJ::name_caps_short($rec->{'caps'});
+                           my $capnameshort = LJ::Capabilities::name_caps_short( $rec->{caps} );
                            $ret{'account'}->{$capnameshort}++;
 
                            # ages
diff -r fc856c03f49d -r 3d2583b4dc77 cgi-bin/LJ/Capabilities.pm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi-bin/LJ/Capabilities.pm	Mon Aug 22 17:34:35 2011 +0800
@@ -0,0 +1,262 @@
+# This code was forked from the LiveJournal project owned and operated
+# by Live Journal, Inc. The code has been modified and expanded by
+# Dreamwidth Studios, LLC. These files were originally licensed under
+# the terms of the license supplied by Live Journal, Inc, which can
+# currently be found at:
+#
+# http://code.livejournal.org/trac/livejournal/browser/trunk/LICENSE-LiveJournal.txt
+#
+# In accordance with the original license, this code and all its
+# modifications are provided under the GNU General Public License.
+# A copy of that license can be found in the LICENSE file included as
+# part of this distribution.
+
+package LJ::Capabilities;
+use strict;
+
+sub class_bit {
+    my ($class) = @_;
+    foreach my $bit (0..15) {
+        my $def = $LJ::CAP{$bit};
+        next unless $def->{_key} && $def->{_key} eq $class;
+        return $bit;
+    }
+    return undef;
+}
+
+# what class name does a given bit number represent?
+sub class_of_bit {
+    my $bit = shift;
+    return $LJ::CAP{$bit}->{_key};
+}
+
+sub classes_from_mask {
+    my $caps = shift;
+
+    my @classes = ();
+    foreach my $bit (0..15) {
+        my $class = class_of_bit( $bit );
+        next unless $class && caps_in_group( $caps, $class );
+        push @classes, $class;
+    }
+
+    return @classes;
+}
+
+sub mask_from_classes {
+    my @classes = @_;
+
+    my $mask = 0;
+    foreach my $class (@classes) {
+        my $bit = class_bit( $class );
+        $mask |= (1 << $bit);
+    }
+
+    return $mask;
+}
+
+sub mask_from_bits {
+    my @bits = @_;
+
+    my $mask = 0;
+    foreach my $bit (@bits) {
+        $mask |= (1 << $bit);
+    }
+
+    return $mask;
+}
+
+sub caps_in_group {
+    my ($caps, $class) = @_;
+    $caps = $caps ? $caps + 0 : 0;
+    my $bit = class_bit( $class );
+    die "unknown class '$class'" unless defined $bit;
+    return ( $caps & ( 1 << $bit ) ) ? 1 : 0;
+}
+
+# <LJFUNC>
+# name: LJ::Capabilities::name_caps
+# des: Given a user's capability class bit mask, returns a
+#      site-specific string representing the capability class(es) name.
+# args: caps
+# des-caps: 16 bit capability bitmask
+# </LJFUNC>
+sub name_caps
+{
+    my $bit = shift;
+    my @caps = caps_string( $bit, '_visible_name' );
+    if ( @caps ) {
+        return join( ', ', @caps );
+    } else {
+        return name_caps_short( $bit );
+    }
+}
+
+# <LJFUNC>
+# name: LJ::Capabilities::name_caps_short
+# des: Given a user's capability class bit mask, returns a
+#      site-specific string representing the capability class(es) short name.
+# args: caps
+# des-caps: 16 bit capability bitmask
+# </LJFUNC>
+sub name_caps_short
+{
+    my $bit = shift;
+    return join( ', ', caps_string( $bit, '_name' ) );
+}
+
+# <LJFUNC>
+# name: LJ::Capabilities::caps_string
+# des: Given a user's capability class bitfield and a name field key,
+#      returns an array of all the account class names.
+# args: caps, name_value
+# des-caps: bitfield
+# des-name_value: string (_name for short name, _visible_name for long)
+sub caps_string {
+    my ($caps, $name_value) = @_;
+
+    my @classes = ();
+    foreach my $bit (0..15) {
+        my $class = class_of_bit( $bit );
+        next unless $class && caps_in_group( $caps, $class );
+        my $name = $LJ::CAP{$bit}->{$name_value};
+        push @classes, $name if $name ne "";
+    }
+
+    return @classes;
+}
+
+# <LJFUNC>
+# name: LJ::Capabilities::user_caps_icon
+# des: Given a user's capability class bit mask, returns
+#      site-specific HTML with the capability class icon.
+# args: caps
+# des-caps: 16 bit capability bitmask
+# </LJFUNC>
+sub user_caps_icon
+{
+    return undef unless LJ::Hooks::are_hooks("user_caps_icon");
+    my $caps = shift;
+    return LJ::Hooks::run_hook("user_caps_icon", $caps);
+}
+
+# <LJFUNC>
+# name: LJ::get_cap
+# des: Given a user object, capability class key or capability class bit mask
+#      and a capability/limit name,
+#      returns the maximum value allowed for given user or class, considering
+#      all the limits in each class the user is a part of.
+# args: u_cap, capname
+# des-u_cap: 16 bit capability bitmask or a user object from which the
+#            bitmask could be obtained
+# des-capname: the name of a limit, defined in [special[caps]].
+# </LJFUNC>
+sub get_cap
+{
+    my $caps = shift;   # capability bitmask (16 bits), cap key or user object
+    my $cname = shift;  # capability limit name
+    my $opts  = shift;  # { no_hook => 1/0 }
+    $opts ||= {};
+
+    # If caps is a reference
+    my $u = ref $caps ? $caps : undef;
+
+    # If caps is a reference get caps from User object
+    if ($u) {
+        $caps = $u->{'caps'};
+    # If it is not all digits assume it is a key
+    } elsif ($caps && $caps !~ /^\d+$/) {
+        my $bit = class_bit( $caps ) || 0;
+        $caps = 1 << $bit;
+    }
+    # The caps is the cap mask already or undef, force it to be a number
+    $caps += 0;
+
+    my $max = undef;
+
+    # allow a way for admins to force-set the read-only cap
+    # to lower writes on a cluster.
+    if ($cname eq "readonly" && $u &&
+        ($LJ::READONLY_CLUSTER{$u->{clusterid}} ||
+         $LJ::READONLY_CLUSTER_ADVISORY{$u->{clusterid}} &&
+         ! LJ::get_cap($u, "avoid_readonly"))) {
+
+        # HACK for desperate moments.  in when_needed mode, see if
+        # database is locky first
+        my $cid = $u->{clusterid};
+        if ($LJ::READONLY_CLUSTER_ADVISORY{$cid} eq "when_needed") {
+            my $now = time();
+            return 1 if $LJ::LOCKY_CACHE{$cid} > $now - 15;
+
+            my $dbcm = LJ::get_cluster_master($u->{clusterid});
+            return 1 unless $dbcm;
+            my $sth = $dbcm->prepare("SHOW PROCESSLIST");
+            $sth->execute;
+            return 1 if $dbcm->err;
+            my $busy = 0;
+            my $too_busy = $LJ::WHEN_NEEDED_THRES || 300;
+            while (my $r = $sth->fetchrow_hashref) {
+                $busy++ if $r->{Command} ne "Sleep";
+            }
+            if ($busy > $too_busy) {
+                $LJ::LOCKY_CACHE{$cid} = $now;
+                return 1;
+            }
+        } else {
+            return 1;
+        }
+    }
+
+    # is there a hook for this cap name?
+    if (! $opts->{no_hook} && LJ::Hooks::are_hooks("check_cap_$cname")) {
+        die "Hook 'check_cap_$cname' requires full user object"
+            unless LJ::isu($u);
+
+        my $val = LJ::Hooks::run_hook("check_cap_$cname", $u);
+        return $val if defined $val;
+
+        # otherwise fall back to standard means
+    }
+
+    # otherwise check via other means
+    foreach my $bit (keys %LJ::CAP) {
+        next unless ($caps & (1 << $bit));
+        my $v = $LJ::CAP{$bit}->{$cname};
+        next unless (defined $v);
+        next if (defined $max && $max > $v);
+        $max = $v;
+    }
+    return defined $max ? $max : $LJ::CAP_DEF{$cname};
+}
+*LJ::get_cap = \&get_cap;
+
+# <LJFUNC>
+# name: LJ::Capabilities::get_cap_min
+# des: Just like [func[LJ::get_cap]], but returns the minimum value.
+#      Although it might not make sense at first, some things are
+#      better when they're low, like the minimum amount of time
+#      a user might have to wait between getting updates or being
+#      allowed to refresh a page.
+# args: u_cap, capname
+# des-u_cap: 16 bit capability bitmask or a user object from which the
+#            bitmask could be obtained
+# des-capname: the name of a limit, defined in [special[caps]].
+# </LJFUNC>
+sub get_cap_min
+{
+    my $caps = shift;   # capability bitmask (16 bits), or user object
+    my $cname = shift;  # capability name
+    if (! defined $caps) { $caps = 0; }
+    elsif ( LJ::isu( $caps ) ) { $caps = $caps->{'caps'}; }
+    my $min = undef;
+    foreach my $bit (keys %LJ::CAP) {
+        next unless ($caps & (1 << $bit));
+        my $v = $LJ::CAP{$bit}->{$cname};
+        next unless (defined $v);
+        next if (defined $min && $min < $v);
+        $min = $v;
+    }
+    return defined $min ? $min : $LJ::CAP_DEF{$cname};
+}
+
+1;
diff -r fc856c03f49d -r 3d2583b4dc77 cgi-bin/LJ/S2/FriendsPage.pm
--- a/cgi-bin/LJ/S2/FriendsPage.pm	Mon Aug 22 16:26:01 2011 +0800
+++ b/cgi-bin/LJ/S2/FriendsPage.pm	Mon Aug 22 17:34:35 2011 +0800
@@ -65,7 +65,7 @@
     my $nowtime = time();
 
     # update delay specified by "friendsviewupdate"
-    my $newinterval = LJ::get_cap_min($remote, "friendsviewupdate") || 1;
+    my $newinterval = LJ::Capabilities::get_cap_min( $remote, "friendsviewupdate" ) || 1;
 
     # when are we going to say page was last modified?  back up to the
     # most recent time in the past where $time % $interval == 0
diff -r fc856c03f49d -r 3d2583b4dc77 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Mon Aug 22 16:26:01 2011 +0800
+++ b/cgi-bin/LJ/User.pm	Mon Aug 22 17:34:35 2011 +0800
@@ -1855,7 +1855,7 @@
 
 sub add_to_class {
     my ($u, $class) = @_;
-    my $bit = LJ::class_bit($class);
+    my $bit = LJ::Capabilities::class_bit( $class );
     die "unknown class '$class'" unless defined $bit;
 
     # call add_to_class hook before we modify the
@@ -2496,7 +2496,7 @@
 # names are site-specific.
 sub in_class {
     my ($u, $class) = @_;
-    return LJ::caps_in_group($u->{caps}, $class);
+    return LJ::Capabilities::caps_in_group( $u->{caps}, $class );
 }
 
 
@@ -2846,7 +2846,7 @@
 
 sub remove_from_class {
     my ($u, $class) = @_;
-    my $bit = LJ::class_bit($class);
+    my $bit = LJ::Capabilities::class_bit( $class );
     die "unknown class '$class'" unless defined $bit;
 
     # call remove_from_class hook before we modify the
diff -r fc856c03f49d -r 3d2583b4dc77 cgi-bin/ljcapabilities.pl
--- a/cgi-bin/ljcapabilities.pl	Mon Aug 22 16:26:01 2011 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,261 +0,0 @@
-# This code was forked from the LiveJournal project owned and operated
-# by Live Journal, Inc. The code has been modified and expanded by
-# Dreamwidth Studios, LLC. These files were originally licensed under
-# the terms of the license supplied by Live Journal, Inc, which can
-# currently be found at:
-#
-# http://code.livejournal.org/trac/livejournal/browser/trunk/LICENSE-LiveJournal.txt
-#
-# In accordance with the original license, this code and all its
-# modifications are provided under the GNU General Public License.
-# A copy of that license can be found in the LICENSE file included as
-# part of this distribution.
-
-package LJ;
-use strict;
-
-sub class_bit {
-    my ($class) = @_;
-    foreach my $bit (0..15) {
-        my $def = $LJ::CAP{$bit};
-        next unless $def->{_key} && $def->{_key} eq $class;
-        return $bit;
-    }
-    return undef;
-}
-
-# what class name does a given bit number represent?
-sub class_of_bit {
-    my $bit = shift;
-    return $LJ::CAP{$bit}->{_key};
-}
-
-sub classes_from_mask {
-    my $caps = shift;
-
-    my @classes = ();
-    foreach my $bit (0..15) {
-        my $class = LJ::class_of_bit($bit);
-        next unless $class && LJ::caps_in_group($caps, $class);
-        push @classes, $class;
-    }
-
-    return @classes;
-}
-
-sub mask_from_classes {
-    my @classes = @_;
-
-    my $mask = 0;
-    foreach my $class (@classes) {
-        my $bit = LJ::class_bit($class);
-        $mask |= (1 << $bit);
-    }
-
-    return $mask;
-}
-
-sub mask_from_bits {
-    my @bits = @_;
-
-    my $mask = 0;
-    foreach my $bit (@bits) {
-        $mask |= (1 << $bit);
-    }
-
-    return $mask;
-}
-
-sub caps_in_group {
-    my ($caps, $class) = @_;
-    $caps = $caps ? $caps + 0 : 0;
-    my $bit = LJ::class_bit($class);
-    die "unknown class '$class'" unless defined $bit;
-    return ( $caps & ( 1 << $bit ) ) ? 1 : 0;
-}
-
-# <LJFUNC>
-# name: LJ::name_caps
-# des: Given a user's capability class bit mask, returns a
-#      site-specific string representing the capability class(es) name.
-# args: caps
-# des-caps: 16 bit capability bitmask
-# </LJFUNC>
-sub name_caps
-{
-    my $bit = shift;
-    my @caps = LJ::caps_string( $bit, '_visible_name' );
-    if ( @caps ) {
-        return join( ', ', @caps );
-    } else {
-        return LJ::name_caps_short( $bit );
-    }
-}
-
-# <LJFUNC>
-# name: LJ::name_caps_short
-# des: Given a user's capability class bit mask, returns a
-#      site-specific string representing the capability class(es) short name.
-# args: caps
-# des-caps: 16 bit capability bitmask
-# </LJFUNC>
-sub name_caps_short
-{
-    my $bit = shift;
-    return join( ', ', LJ::caps_string( $bit, '_name' ) );
-}
-
-# <LJFUNC>
-# name: LJ::caps_string
-# des: Given a user's capability class bitfield and a name field key,
-#      returns an array of all the account class names.
-# args: caps, name_value
-# des-caps: bitfield
-# des-name_value: string (_name for short name, _visible_name for long)
-sub caps_string {
-    my ($caps, $name_value) = @_;
-
-    my @classes = ();
-    foreach my $bit (0..15) {
-        my $class = LJ::class_of_bit($bit);
-        next unless $class && LJ::caps_in_group($caps, $class);
-        my $name = $LJ::CAP{$bit}->{$name_value};
-        push @classes, $name if $name ne "";
-    }
-
-    return @classes;
-}
-
-# <LJFUNC>
-# name: LJ::user_caps_icon
-# des: Given a user's capability class bit mask, returns
-#      site-specific HTML with the capability class icon.
-# args: caps
-# des-caps: 16 bit capability bitmask
-# </LJFUNC>
-sub user_caps_icon
-{
-    return undef unless LJ::Hooks::are_hooks("user_caps_icon");
-    my $caps = shift;
-    return LJ::Hooks::run_hook("user_caps_icon", $caps);
-}
-
-# <LJFUNC>
-# name: LJ::get_cap
-# des: Given a user object, capability class key or capability class bit mask
-#      and a capability/limit name,
-#      returns the maximum value allowed for given user or class, considering
-#      all the limits in each class the user is a part of.
-# args: u_cap, capname
-# des-u_cap: 16 bit capability bitmask or a user object from which the
-#            bitmask could be obtained
-# des-capname: the name of a limit, defined in [special[caps]].
-# </LJFUNC>
-sub get_cap
-{
-    my $caps = shift;   # capability bitmask (16 bits), cap key or user object
-    my $cname = shift;  # capability limit name
-    my $opts  = shift;  # { no_hook => 1/0 }
-    $opts ||= {};
-
-    # If caps is a reference
-    my $u = ref $caps ? $caps : undef;
-
-    # If caps is a reference get caps from User object
-    if ($u) {
-        $caps = $u->{'caps'};
-    # If it is not all digits assume it is a key
-    } elsif ($caps && $caps !~ /^\d+$/) {
-        my $bit = LJ::class_bit( $caps ) || 0;
-        $caps = 1 << $bit;
-    }
-    # The caps is the cap mask already or undef, force it to be a number
-    $caps += 0;
-
-    my $max = undef;
-
-    # allow a way for admins to force-set the read-only cap
-    # to lower writes on a cluster.
-    if ($cname eq "readonly" && $u &&
-        ($LJ::READONLY_CLUSTER{$u->{clusterid}} ||
-         $LJ::READONLY_CLUSTER_ADVISORY{$u->{clusterid}} &&
-         ! LJ::get_cap($u, "avoid_readonly"))) {
-
-        # HACK for desperate moments.  in when_needed mode, see if
-        # database is locky first
-        my $cid = $u->{clusterid};
-        if ($LJ::READONLY_CLUSTER_ADVISORY{$cid} eq "when_needed") {
-            my $now = time();
-            return 1 if $LJ::LOCKY_CACHE{$cid} > $now - 15;
-
-            my $dbcm = LJ::get_cluster_master($u->{clusterid});
-            return 1 unless $dbcm;
-            my $sth = $dbcm->prepare("SHOW PROCESSLIST");
-            $sth->execute;
-            return 1 if $dbcm->err;
-            my $busy = 0;
-            my $too_busy = $LJ::WHEN_NEEDED_THRES || 300;
-            while (my $r = $sth->fetchrow_hashref) {
-                $busy++ if $r->{Command} ne "Sleep";
-            }
-            if ($busy > $too_busy) {
-                $LJ::LOCKY_CACHE{$cid} = $now;
-                return 1;
-            }
-        } else {
-            return 1;
-        }
-    }
-
-    # is there a hook for this cap name?
-    if (! $opts->{no_hook} && LJ::Hooks::are_hooks("check_cap_$cname")) {
-        die "Hook 'check_cap_$cname' requires full user object"
-            unless LJ::isu($u);
-
-        my $val = LJ::Hooks::run_hook("check_cap_$cname", $u);
-        return $val if defined $val;
-
-        # otherwise fall back to standard means
-    }
-
-    # otherwise check via other means
-    foreach my $bit (keys %LJ::CAP) {
-        next unless ($caps & (1 << $bit));
-        my $v = $LJ::CAP{$bit}->{$cname};
-        next unless (defined $v);
-        next if (defined $max && $max > $v);
-        $max = $v;
-    }
-    return defined $max ? $max : $LJ::CAP_DEF{$cname};
-}
-
-# <LJFUNC>
-# name: LJ::get_cap_min
-# des: Just like [func[LJ::get_cap]], but returns the minimum value.
-#      Although it might not make sense at first, some things are
-#      better when they're low, like the minimum amount of time
-#      a user might have to wait between getting updates or being
-#      allowed to refresh a page.
-# args: u_cap, capname
-# des-u_cap: 16 bit capability bitmask or a user object from which the
-#            bitmask could be obtained
-# des-capname: the name of a limit, defined in [special[caps]].
-# </LJFUNC>
-sub get_cap_min
-{
-    my $caps = shift;   # capability bitmask (16 bits), or user object
-    my $cname = shift;  # capability name
-    if (! defined $caps) { $caps = 0; }
-    elsif (isu($caps)) { $caps = $caps->{'caps'}; }
-    my $min = undef;
-    foreach my $bit (keys %LJ::CAP) {
-        next unless ($caps & (1 << $bit));
-        my $v = $LJ::CAP{$bit}->{$cname};
-        next unless (defined $v);
-        next if (defined $min && $min < $v);
-        $min = $v;
-    }
-    return defined $min ? $min : $LJ::CAP_DEF{$cname};
-}
-
-1;
diff -r fc856c03f49d -r 3d2583b4dc77 cgi-bin/ljlib.pl
--- a/cgi-bin/ljlib.pl	Mon Aug 22 16:26:01 2011 +0800
+++ b/cgi-bin/ljlib.pl	Mon Aug 22 17:34:35 2011 +0800
@@ -137,7 +137,7 @@
 use LJ::Tags;
 require "ljtextutil.pl";
 require "ljtimeutil.pl";
-require "ljcapabilities.pl";
+use LJ::Capabilities;
 use DW::Mood;
 require "ljrelation.pl";
 require "imageconf.pl";
diff -r fc856c03f49d -r 3d2583b4dc77 cgi-bin/ljprotocol.pl
--- a/cgi-bin/ljprotocol.pl	Mon Aug 22 16:26:01 2011 +0800
+++ b/cgi-bin/ljprotocol.pl	Mon Aug 22 17:34:35 2011 +0800
@@ -841,7 +841,7 @@
         $lastupdate = "0000-00-00 00:00:00";
     }
 
-    my $interval = LJ::get_cap_min($u, "checkfriends_interval");
+    my $interval = LJ::Capabilities::get_cap_min( $u, "checkfriends_interval" );
     $res->{'interval'} = $interval;
 
     my $filter;
diff -r fc856c03f49d -r 3d2583b4dc77 doc/raw/build/hooks/hooks2db.pl
--- a/doc/raw/build/hooks/hooks2db.pl	Mon Aug 22 16:26:01 2011 +0800
+++ b/doc/raw/build/hooks/hooks2db.pl	Mon Aug 22 17:34:35 2011 +0800
@@ -282,7 +282,7 @@
             'name' => "\$cap",
         },
     ],
-    source => ["cgi-bin/ljlib.pl", "cgi-bin/ljcapabilities.pl"],
+    source => ["cgi-bin/ljlib.pl", "cgi-bin/LJ/Capabilities.pm"],
 };
 
 $hooks{'name_caps_short'} = {
@@ -293,7 +293,7 @@
             'name' => "\$cap",
         },
     ],
-    source => ["cgi-bin/ljlib.pl", "cgi-bin/ljcapabilities.pl"],
+    source => ["cgi-bin/ljlib.pl", "cgi-bin/LJ/Capabilities.pm"],
 };
 
 $hooks{'login_add_opts'} = {
diff -r fc856c03f49d -r 3d2583b4dc77 doc/raw/ljp.book/int/cap_classes.xml
--- a/doc/raw/ljp.book/int/cap_classes.xml	Mon Aug 22 16:26:01 2011 +0800
+++ b/doc/raw/ljp.book/int/cap_classes.xml	Mon Aug 22 17:34:35 2011 +0800
@@ -7,7 +7,7 @@
 table is a 16 bit mask with a bit on for each capability class the user is a part of.
 Each site can define their own capability classes in <filename>etc/ljconfig.pl</filename>.
 Then, each capability class can define its own limits for the following things.
-The <function>LJ::get_cap()</function> and <function>LJ::get_cap_min()</function> functions
+The <function>LJ::Capabilities::get_cap()</function> and <function>LJ::Capabilities::get_cap_min()</function> functions
 will consider the limits of all the classes the member is a part of and return the max or min limit,
 depending on what it&apos;s being used for in the code.
   </para>
diff -r fc856c03f49d -r 3d2583b4dc77 htdocs/support/see_request.bml
--- a/htdocs/support/see_request.bml	Mon Aug 22 16:26:01 2011 +0800
+++ b/htdocs/support/see_request.bml	Mon Aug 22 17:34:35 2011 +0800
@@ -362,7 +362,7 @@
 
     # account type
     $ret .= "<tr><td align='right' valign='top'><b><span style='white-space: nowrap'>$ML{'.accounttype'}</span>:</b></td><td>";
-    $ret .= LJ::name_caps($u->{'caps'}) || "<i>$ML{'.unknown'}</i>";
+    $ret .= LJ::Capabilities::name_caps( $u->{caps} ) || "<i>$ML{'.unknown'}</i>";
     $ret .= "</td></tr>\n";
 
     if ($u->{'userid'}) {
diff -r fc856c03f49d -r 3d2583b4dc77 t/betafeatures.t
--- a/t/betafeatures.t	Mon Aug 22 16:26:01 2011 +0800
+++ b/t/betafeatures.t	Mon Aug 22 17:34:35 2011 +0800
@@ -4,7 +4,6 @@
 use Test::More 'no_plan';
 use lib "$ENV{LJHOME}/cgi-bin";
 require 'ljlib.pl';
-require 'ljcapabilities.pl';
 use LJ::Test qw(temp_user);
 use LJ::BetaFeatures;
 
@@ -12,7 +11,7 @@
 
 {
     ok(ref LJ::BetaFeatures->get_handler('foo') eq 'LJ::BetaFeatures::default', "instantiated default handler");
-} 
+}
 
 {
     ok(! $u->in_class('betafeatures'), "cap not set");
--------------------------------------------------------------------------------