Fixed extraneous <updated>...</updated> tags for feed date/time in static rendering
[matthijs/upstream/blosxom-plugins.git] / general / entries_cache
index 7c7160e1b56d30bad9c136842a4c2e826636e3cb..1d8b2876ee5f0043635fbbac8abb7a8fa0760918 100644 (file)
@@ -1,7 +1,7 @@
 # Blosxom Plugin: entries_cache -*- perl -*-
 # Author(s): Fletcher T. Penney <http://fletcher.freeshell.org/> 
 # Modified by Steve Schwarz <http://agilitynerd.com/>
-# Version: 0.92
+# Version: 0.93
 # Based on entries_index by Rael Dornfest
 # Documentation help contributed by Iain Cheyne
 
@@ -9,7 +9,8 @@ package entries_cache;
 
 # --- Configurable variables -----
 
-$delay = 0;            # How many minutes delay before entries are re-indexed?
+$delay = 0 unless defined $delay;
+                       # How many minutes delay before entries are re-indexed?
                        # Set to 0 to force reindexing everytime - this
                        # will provide the same behavior as Rael's
                        # entries_index.  Though, I am not sure why one 
@@ -17,17 +18,20 @@ $delay = 0;         # How many minutes delay before entries are re-indexed?
                        # improve performance....
                        # SAS - I set this to zero so comments and new files
                        # are immediately visible.
-$indexname = "$blosxom::plugin_state_dir/.entries_cache.index";
-$others_indexname = "$blosxom::plugin_state_dir/.entries_cache.others";
+$indexname = "$blosxom::plugin_state_dir/.entries_cache.index" unless defined $indexname;
+$others_indexname = "$blosxom::plugin_state_dir/.entries_cache.others" unless defined $others_indexname;
 
 
-$use_date_tags = 1;    # Set to 1 to enable parsing meta- keywords
-                       # for date tags
+$use_date_tags = 1 unless defined $use_date_tags;
+       # Set to 1 to enable parsing meta- keywords
+       # for date tags
 
-$use_UK_dates = 0;     # Default is mm/dd/yy (US)
-                       # Set to 1 to use dd/mm/yy (UK)
+$use_UK_dates = 0 unless defined $use_UK_dates;
+       # Default is mm/dd/yy (US)
+       # Set to 1 to use dd/mm/yy (UK)
 
-$update_meta_date = 0;         # Add a meta_date tag if it doesn't exist
+$update_meta_date = 0 unless defined $update_meta_date;
+       # Add a meta_date tag if it doesn't exist
        # This will require that perl has write access to your story files
        # and that you are using the meta plugin.
        
@@ -56,11 +60,23 @@ $meta_timestamp = "meta-creation_timestamp:" unless defined $meta_timestamp;
 $meta_date = "meta-creation_date:" unless defined $meta_date;
        # date_tag is a human readable version
 
-$strip_meta_dates = 1;         # Strip meta-tags from story so that 
+$strip_meta_dates = 1 unless defined $strip_meta_dates;        
+       # Strip meta-tags from story so that 
        # they are not displayed.  Unnecessary if you are running the 
        # meta plugin.
 
-$debug = 0;    # Debugging flag
+$update_static_rendering = 0 unless defined $update_static_rendering;
+       # Recreate statically rendered files.
+       # When set to 0, Blosxom will not update statically rendered files
+       # even when stories are edited afterwards (Fletcher Penney's default).
+       # Set to 1 if you want to be able to fix typos in statically rendered stories.
+
+$index_umask = oct(007) unless defined $index_umask;
+       # Mask for index files : default allows Read/Write for owner and group,
+       # nothing for others.
+
+$debug = 0 unless defined $debug;
+       # Debugging flag
 
 # --------------------------------
 
@@ -174,9 +190,8 @@ sub entries {
                                                and (
                                                        param('-all') 
                                                        or !-f "$blosxom::static_dir/$1/index." . $blosxom::static_flavours[0]
-#                                                      or stat("$blosxom::static_dir/$1/index." . $blosxom::static_flavours[0])->mtime < stat($File::Find::name)->mtime
 # Trying to fix for static mode
-# Barijaona's note : you may uncomment the above instruction if you want to be able to fix typos in static rendering
+                                                       or ( $update_static_rendering && stat("$blosxom::static_dir/$1/index." . $blosxom::static_flavours[0])->mtime < stat($File::Find::name)->mtime )
                                                        or stat("$blosxom::static_dir/$1/index." . $blosxom::static_flavours[0])->mtime < $files{$File::Find::name}
                                                )
                                                and $indexes{$1} = 1
@@ -193,6 +208,7 @@ sub entries {
 
                        if ( $reindex ) {
                                # The index was recreated, so we should record the new version
+                               my $savemask = umask $index_umask ;
                                if ( open ENTRIES, "> $indexname" ) {
                                        foreach (sort keys %files) {
                                                print ENTRIES "$_=>$files{$_}\n";
@@ -210,6 +226,8 @@ sub entries {
                                } else {
                                        warn "couldn't > $others_indexname: $!\n";
                                }
+                               umask $savemask ;
+
                        }
                }
        return (\%files, \%indexes, \%others);
@@ -440,9 +458,12 @@ large number of files to be indexed.
 
 =head1 VERSION
 
-0.92
+0.93
 
 =head1 VERSION HISTORY
+0.93    Added the $update_static_rendering and $index_umask
+        configuration variables.
+
 0.92    Checks if meta-creation_date is in the future and only displays
         entry if $show_future_entries is set. Otherwise future articles
         (by meta-creation_date or file modified time) are not displayed.