Tags:
create new tag
view all tags

TWiki lists non-writable directories in data directory as a web

Create a directory that is not writable by the web server user in the TWiki data directory. If you don't explicitly specify all webs, the TWiki:Store::webExists and TWiki::Store::getAllWebs/getSubWebs will return that directory.

This makes it difficult to keep meta data directories (in my case its the CVS tracking directory) out of the weblist unless you want to keep manually updating the TWikiPreferences topic. In any case if the web isn't writable, it can't be used as a standard twiki web allowing update via the web.

It may also be useful to allow in TWiki.cfg a list of directories that should never be shown.

Test case

Create the non-writable directory as described above.

Environment

TWiki version: Cvs alpha
TWiki plugins: none
Server OS: linux
Web server: Apache
Perl version: 5.6.1
Client OS: Windows 2000
Web Browser: IE/Opera

Fix

Change the functions so that they test for writability.

Index: TWiki/Store.pm
===================================================================
RCS file: /twiki/src/cvsroot/twiki/lib/TWiki/Store.pm,v
retrieving revision 1.1.1.3
retrieving revision 1.3
diff -c -r1.1.1.3 -r1.3
*** TWiki/Store.pm      5 Jun 2002 08:03:17 -0000       1.1.1.3
--- TWiki/Store.pm      7 Aug 2002 22:42:07 -0000       1.3
***************
*** 705,711 ****
  sub webExists
  {
      my( $theWeb ) = @_;
!     return -e "$TWiki::dataDir/$theWeb";
  }
  
  # =========================
--- 705,711 ----
  sub webExists
  {
      my( $theWeb ) = @_;
!     return -w "$TWiki::dataDir/$theWeb";
  }
  
  # =========================
***************
*** 1106,1111 ****
--- 1106,1112 ----
      my @webList = sort
          grep { s#^.+/([^/]+)$#$1# }
          grep { -d }
+         grep { -w }
          map  { "$TWiki::dataDir/$web/$_" }
          grep { ! /^\.\.?$/ } @tmpList;

-- JohnRouillard - 07 Aug 2002

Follow up

By default, all directories below the data directory should be webs.

Testing for read-only is too restrictive. There might be read-only webs for good reasons, for example as a really secure read-only measure like for webs mirrored from somewhere else.

An alternative would be to add a new variable to ignore a list of web names. Web names starting with underscore are already treated differently (template webs).

Changed BugReport to FeatureBrainstorming.

-- PeterThoeny - 10 Aug 2002

I agree with Peter, the read-only test is too primitive, but I think your idea: It may also be useful to allow in TWiki.cfg a list of directories that should never be shown has merits and should be considered. Either that, or have a well-known file name (e.g. .twiki_ignore) in sub-dirs of data that can be quickly tested for.

Hand hacked, not tested, code example:

--- 705,711 ----
  sub webExists
  {
      my( $theWeb ) = @_;
!     return -d "$TWiki::dataDir/$theWeb" && ! -f "$TWiki::dataDir/$theWeb/.twiki_ignore";
  }

-- MartinCleaver - 11 Aug 2002

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2002-08-11 - MartinCleaver
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.