Ticket #2279 (closed defect: fixed)
Update Old disabled domain style to the new
| Reported by: | nuxwin | Owned by: | nuxwin |
|---|---|---|---|
| Priority: | major | Milestone: | ispCP ω 1.0.5 |
| Component: | Frontend (GUI) | Version: | ispCP ω 1.0.4 |
| Severity: | Medium | Keywords: | |
| Cc: |
Description
IspCP 1.0.4 has introduced a new manner/style to disable a domain (customer account).
Some domain set to disabled before the upgrade to 1.0.4 can use the old style, so, the Update process must perform an additionnal task to update the old style to the new.
Thank to benedikt for this issue.
Change History
comment:2 Changed 2 years ago by nuxwin
Code draft (no tested - Compile OK):
# Update old disabled domain style to new
sub update_old_disabled_dmn_style {
push_el(\@main::el, 'update_old_disabled_dmn_style()', 'Starting...');
# Avoid useless execution of this code // move that to executor
if($main::cfg{'BuildDate'} <= 20100228) {
my ($rs, $rdata, $index_tpl) = (undef, undef, undef);
my $disabled_dmn_skel_dir = "$main::cfg{'GUI_ROOT_DIR'}/domain_disable_page";
# Retrieve all disabled domains (eg /var/www/virtual/domain.tld.disabled)
# and update these to new disabled domain layout
foreach(map{m@(.*\.disabled)$@} glob "$main::cfg{'APACHE_WWW_DIR'}/*") {
# First, we rename the domain DocumentRoot
if(-e "$_/htdocs") {
$rs = sys_command_rs(
"$main::cfg{'CMD_MV'} $_/htdocs $_/htdocs.disabled"
);
return $rs if($rs != 0);
}
# Copy the disabled directory skeleton to htdocs
$rs = sys_command_rs(
"$main::cfg{CMD_CP} -p $disabled_dmn_skel_dir $_/htdocs"
);
return $rs if($rs != 0);
# Building the disabled page - Begin
# Get toUnicode domain name
my $decoded_dmn_name = idn_to_unicode(m@.*\/(.*)\.disabled$@, 'utf-8');
# Get the disabled raw page
($rs, $index_tpl) = get_file("$_/htdocs/index.html");
return $rs if ($rs != 0);
# Prepare tags
my %tag_hash = (
'{DOMAIN_NAME}' => $decoded_dmn_name,
'{BASE_SERVER_VHOST}' => $main::cfg{'BASE_SERVER_VHOST'}
);
# Replace tags
($rs, $rdata) = prep_tpl(\%tag_hash, $index_tpl);
return $rs if ($rs != 0);
# Store the file with proper permissions
$rs = store_file(
"$_/htdocs/index.html",
$rdata,
$main::cfg{'APACHE_USER'},
$main::cfg{'APACHE_GROUP'},
0644
);
return $rs if ($rs != 0);
# Building of the disabled page - End
# Set permissions for htdocs
$rs = setfmode(
"$_/htdocs",
$main::cfg{'APACHE_USER'},
$main::cfg{'APACHE_GROUP'},
0755
);
return $rs if ($rs != 0);
# Set permissions for htdocs/images directory
$rs = setfmode(
"$_/htdocs/images",
$main::cfg{'APACHE_USER'},
$main::cfg{'APACHE_GROUP'},
0755
);
return $rs if ($rs != 0);
# Set permissions for all files under /htdocs/images
chmod 0644, glob "$_/htdocs/images/*";
chown $main::cfg{'APACHE_USER'}, $main::cfg{'APACHE_GROUP'}, glob "$_/htdocs/images/*";
}
}
push_el(\@main::el, 'update_old_disabled_dmn_style()', 'Starting...');
0;
}
Note: See
TracTickets for help on using
tickets.


