~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to debian/vhost-base/enable.d/apache2

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
 
3
 
use Debian::Vhosts;
4
 
 
5
 
$hostname = shift;
6
 
$default = (vb_config_get("apache2", "default", "/var/lib/vhost-base/$hostname/conf/apache2.conf"))[0];
7
 
 
8
 
dbmopen(%sites, "/etc/apache2/sites", 0644);
9
 
if ($default eq "true") { 
10
 
        if (defined($sites{'default'})) { 
11
 
                print(STDERR "Replacing default site $sites{'default'} with $hostname!\n"); 
12
 
                $sites{'nondefault'}[${$sites{'nondefault'}}] = $sites{'default'};
13
 
        }
14
 
        $sites{'default'} = $hostname;
15
 
        print(STDERR "New default site: $hostname\n");
16
 
}
17
 
else { 
18
 
        if ($($sites{'nondefault'}) != 0) { ($sites{'nondefault'})[${$sites{'nondefault'}}] = $hostname; }
19
 
        else { ($sites{'nondefault'})[0] = $hostname; }
20
 
}
21
 
 
22
 
 
23
 
unlink </etc/apache2/sites-enabled/*> || true;
24
 
foreach $i (</etc/apache2/sites-available/$sites{'default'}*>) {
25
 
        $i =~ s#/etc/apache2/sites-available/##;
26
 
        symlink("/etc/apache2/sites-available/$i", "/etc/apache2/sites-enabled/00-$i") || die "Failed to make symlink sites-available/$i -> site-enabled/$i\: $!";
27
 
}
28
 
 
29
 
foreach $i (@{$sites{'nondefault'}}) {
30
 
        foreach $j (</etc/apache2/sites-available/$i*>) {
31
 
                $j =~ s#/etc/apache2/sites-available/##;
32
 
                symlink("/etc/apache2/sites-available/$j", "/etc/apache2/sites-enabled/01-$j") || die "Failed to make symlink sites-available/$j -> sites-enabled/$j\: $!";
33
 
        }
34
 
}
35
 
 
36
 
dbmclose(%sites);
37
 
exit(0);