mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-12-23 06:05 pm

[dw-free] Make dw-free work alone

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

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

Work on making dw-free operate on its own, without dw-nonfree.

Patch by [personal profile] exor674.

Files modified:
  • cgi-bin/LJ/User.pm
  • cgi-bin/ljdefaults.pl
  • htdocs/_config.bml
--------------------------------------------------------------------------------
diff -r 780a3e3275f7 -r a39b223b012c cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Wed Dec 23 17:32:02 2009 +0000
+++ b/cgi-bin/LJ/User.pm	Wed Dec 23 18:05:01 2009 +0000
@@ -8066,18 +8066,13 @@ sub journal_base
 {
     my ($user, $vhost) = @_;
 
-    if (! isu($user) && LJ::Hooks::are_hooks("journal_base")) {
-        my $u = LJ::load_user($user);
-        $user = $u if $u;
-    }
-
-    if (isu($user)) {
-        my $u = $user;
-
+    my $u = LJ::isu( $user ) ? $user : LJ::load_user( $user );
+    $user = $u->user if $u;
+
+    if ( $u && LJ::Hooks::are_hooks("journal_base") ) {
         my $hookurl = LJ::Hooks::run_hook("journal_base", $u, $vhost);
         return $hookurl if $hookurl;
 
-        $user = $u->user;
         unless (defined $vhost) {
             if ($LJ::FRONTPAGE_JOURNAL eq $user) {
                 $vhost = "front";
@@ -8086,7 +8081,22 @@ sub journal_base
             } elsif ( $u->is_community ) {
                 $vhost = "community";
             }
-
+        }
+    }
+ 
+    if ( $LJ::ONLY_USER_VHOSTS ) {
+        my $rule = $u ? $LJ::SUBDOMAIN_RULES->{$u->journaltype} : undef;
+        $rule ||= $LJ::SUBDOMAIN_RULES->{P};
+
+        # if no rule, then we don't have any idea what to do ...
+        die "Site misconfigured, no %LJ::SUBDOMAIN_RULES."
+            unless $rule && ref $rule eq 'ARRAY';
+
+        if ( $rule->[0] && $user !~ /^\_/ && $user !~ /\_$/ ) {
+            $user =~ s/_/-/g;
+            return "http://$user.$LJ::DOMAIN";
+        } else {
+            return "http://$rule->[1]/$user";
         }
     }
 
diff -r 780a3e3275f7 -r a39b223b012c cgi-bin/ljdefaults.pl
--- a/cgi-bin/ljdefaults.pl	Wed Dec 23 17:32:02 2009 +0000
+++ b/cgi-bin/ljdefaults.pl	Wed Dec 23 18:05:01 2009 +0000
@@ -317,6 +317,12 @@
         settings_design => 1,
     );
 
+    $SUBDOMAIN_RULES = {
+        P => [ 1, "users.$LJ::DOMAIN" ],
+        Y => [ 1, "syndicated.$LJ::DOMAIN" ],
+        C => [ 1, "community.$LJ::DOMAIN" ],
+    };
+
     $LJ::USERSEARCH_METAFILE_PATH ||= "$HOME/var/usersearch.data";
 
     # default to limit to 2000 results
diff -r 780a3e3275f7 -r a39b223b012c htdocs/_config.bml
--- a/htdocs/_config.bml	Wed Dec 23 17:32:02 2009 +0000
+++ b/htdocs/_config.bml	Wed Dec 23 18:05:01 2009 +0000
@@ -1,5 +1,6 @@ LookRoot $LJHOME/cgi-bin/bml/scheme
 LookRoot $LJHOME/cgi-bin/bml/scheme
 DefaultLanguage en
+DefaultScheme blueshift
 IncludePath inc/
 
 AllowOldSyntax 0
--------------------------------------------------------------------------------