Changeset 352


Ignore:
Timestamp:
Jun 2, 2004, 1:34:50 PM (18 years ago)
Author:
Dominic Hargreaves
Message:

Change index node creation from being on-access to being
on-referring-node-commit.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r351 r352  
     1        Change auto-creating behaviour of index nodes (categories and
     2        locales): instead of being created on access they are created when
     3        the referring node is committed. This fixes compliance with RFC 2616
     4        section 9.1.1 and prevents corrupted index nodes being created
     5        accidentally.
     6
    170.31   
    28        Created a new macro to allow the embedding of RSS feeds into
  • trunk/wiki.cgi

    r351 r352  
    186186    my %tt_vars;
    187187
    188     # If this is a Category or Locale node, check whether it exists
    189     # and write it a stub node if it doesn't.
    190188    if ( $node =~ /^(Category|Locale) (.*)$/ ) {
    191189        my $type = $1;
     
    193191        $tt_vars{index_type} = lc($type);
    194192        $tt_vars{index_value} = $2;
    195 
    196         unless ( $wiki->node_exists($node) ) {
    197             my $category = $type eq "Category" ? "Category" : "Locales";
    198             $wiki->write_node( $node,
    199                                "\@INDEX_LINK [[$node]]",
    200                                undef,
    201                                { username => "Auto Create",
    202                                  comment  => "Auto created $tt_vars{index_type} stub page",
    203                                  category => $category
    204                                }
    205             );
    206         }
    207193    }
    208194
     
    551537    $metadata{opening_hours_text} = $q->param("hours_text") || "";
    552538
     539    # Check to make sure all the indexable nodes are created
     540    foreach my $type (qw(Category Locale)) {
     541        my $lctype = lc($type);
     542        foreach my $index (@{$metadata{$lctype}}) {
     543            $index =~ s/(.*)/\u$1/;
     544            my $node = $type . " " . $index;
     545            unless ( $wiki->node_exists($node) ) {
     546                my $category = $type eq "Category" ? "Category" : "Locales";
     547                $wiki->write_node( $node,
     548                                   "\@INDEX_LINK [[$node]]",
     549                                   undef,
     550                                   { username => "Auto Create",
     551                                     comment  => "Auto created $lctype stub page",
     552                                     category => $category
     553                                   }
     554                );
     555            }
     556        }
     557    }
     558       
    553559    foreach my $var ( qw( username comment edit_type ) ) {
    554560        $metadata{$var} = $q->param($var) || "";
Note: See TracChangeset for help on using the changeset viewer.