Once a story is marked ND or deleted otherwise not viewable, its
.shtml file needs to be removed. This is actually trickier than it
sounds. The best way is probably to scan the files on disk
periodically and look for sids that aren't viewable. But we should
also unlink files at story deletion time.
Logged In: YES
user_id=3889
Also, for a story that has had its topics changed to remove it from a
given nexus, its .shtml file in that nexus needs to have the 'articlemoved'
template dropped in its place, to redirect readers to the correct URL.
There was code to do this before, but it depended on a story_param that
never got written. The only decent way to do it, I think, is to scan files
on disk that match a sid regex and don't belong where they are. Here's
the code I took out:
- # if we wrote a section page previously replace
- # old pages with a redirect to the current
- # article
-
- my @old_sect = $slashdb->getPrevSectionsForSid($sid);
- if (@old_sect) {
- for my $old_sect (@old_sect) {
- next if $old_sect eq $skinname;
- my $url = "$gSkin->{rootdir}/$skinname/
$sid.shtml";
- my $fn = "$basedir/$old_sect/$sid.shtml";
- if (-e $fn) {
- my $fh = gensym();
- if (!open($fh, ">", $fn)) {
- warn("Couldn't open file: $fn for
writing");
- } else {
- print $fh slashDisplay("articlemoved",
{ url => $url },
- { Return => 1 } );
- close $fh;
- }
- }
- }
- $slashdb->clearPrevSectionsForSid($sid);
- }
Logged In: YES
user_id=3660
Notes to self:
Redirection should be handled automatically by 404.pl. It works in my
tests. I plan to remove the articlemoved template, which is not being
used currently.
So I plan to add a task that runs maybe once a week, to delete .shtml
files for sids that are not viewable. Also, make sure that when a story is
deleted, its shtml file is removed.
And I will do something like what you have there for topics.