Ignore:
Timestamp:
Apr 2, 2012, 9:35:16 AM (10 years ago)
Author:
kake
Message:

Fixed bug where missing metadata search was picking up redirect pages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/OpenGuides.pm

    r1309 r1317  
    20102010=item B<show_missing_metadata>
    20112011
    2012 Search for nodes which don't have a certain kind of metadata. Optionally
    2013 also excludes Locales and Categories
     2012Search for nodes which don't have a certain kind of metadata.  Excludes nodes
     2013which are pure redirects, and optionally also excludes locales and categories.
    20142014
    20152015=cut
     
    20332033    if($metadata_type) {
    20342034        $done_search = 1;
    2035         @nodes = $wiki->list_nodes_by_missing_metadata(
     2035        my @all_nodes = $wiki->list_nodes_by_missing_metadata(
    20362036                            metadata_type => $metadata_type,
    20372037                            metadata_value => $metadata_value,
     
    20392039        );
    20402040
    2041         # Do we need to filter some nodes out?
    2042         if($exclude_locales || $exclude_categories) {
    2043             my @all_nodes = @nodes;
    2044             @nodes = ();
    2045 
    2046             foreach my $node (@all_nodes) {
    2047                 if($exclude_locales && $node =~ /^Locale /) { next; }
    2048                 if($exclude_categories && $node =~ /^Category /) { next; }
    2049                 push @nodes, $node;
    2050             }
     2041        # Filter out redirects; also filter out locales/categories if required.
     2042        foreach my $node ( @all_nodes ) {
     2043            next if ( $exclude_locales && $node =~ /^Locale / );
     2044            next if ( $exclude_categories && $node =~ /^Category / );
     2045            my $content = $wiki->retrieve_node( $node );
     2046            next if OpenGuides::Utils->detect_redirect( content => $content );
     2047            push @nodes, $node;
    20512048        }
    20522049    }
Note: See TracChangeset for help on using the changeset viewer.