When a page is created with the versioning turned on, it creates the
initial metadata about the page for version 1 under the OLD/{page_name}
directory in the page.properties file.  The  VersioningFileProvider depends
on that metadata to exist to determine if the file exists (which is a
reasonable assumption in normal cases since it creates the metadata
normally upon page creation).

You could create those metadata when you initially populate the wiki
contents.  The script below won't overwrite any existing files, only create
ones that don't currently exist.

#!/bin/bash

addr=$(host $(hostname) | cut -d ' ' -f 4)
if [[ ! -d OLD ]]; then
  echo "OLD directory doesn't exist.  Wrong PWD?"
  exit
fi

for file in *.txt
do
  base=$(basename "$file" .txt)
  if [[ ! -d "OLD/$base" ]]; then
    mkdir "OLD/$base"
  fi
  if [[ ! -f "OLD/$base/page.properties" ]]; then
    echo "Creating properties file for ${base}"
    echo "# JSPWiki page properties for ${base}. DO NOT MODIFY!" >
"OLD/$base/page.properties"
    echo "#$(date)" >> "OLD/$base/page.properties"
    echo "1.author=${addr}" >> "OLD/$base/page.properties"
  fi
done


On Tue, Sep 22, 2015 at 5:19 AM Paul Illingworth <
paul.illingwo...@saaconsultants.com> wrote:

> Dear all,
>
> I have an install of JSPWiki (2.10.1) that has been preloaded with a set
> of (my own) wiki pages. These pages are dropped into the
> ${jspwiki.fileSystemProvider.pageDir} directory as just .txt files. There
> are no property files and I have no OLD directory. The page provider is
> set to the VersioningFileProvider.
>
> With page caching on all works as expected.
>
> When I turn page caching off [*] none of my pages get displayed and
> instead I get "This page does not exist. Why don’t you go and create it?".
> If I say yes the page is loaded for me to edit. If I change the page and
> save it it then becomes visible.
>
> It seems that the issue is with
> org.apache.wiki.providers.VersioningFileProvider.pageExists(String, int)
> and org.apache.wiki.providers.CachingProvider.pageExists(String, int)
> returning different values if page caching is on or off.
>
> With caching on
>
> org.apache.wiki.providers.CachingProvider.pageExists(String, int) returns
> true
>
> With caching off
>
> org.apache.wiki.providers.VersioningFileProvider.pageExists(String, int)
> returns false
>
> It seems that this is because the OLD/pageName directory does not exist
> (e.g. for the MAIN page jspwiki/pages/OLD/Main does not exist) and
> org.apache.wiki.providers.VersioningFileProvider.pageExists(String, int)
> does not handle this situation.
>
> I guess this is a bug?
>
> Paul I.
>
>
>
> [*]: I am investigating load balancing JWPWiki and page caching needs to
> be off for different nodes to see changes made by other nodes.
>
>
>

Reply via email to