An install of mine lost a page when it ran out of diskspace. It saved the page empty. On restoring the page from the history the user took the topic text but was not aware of the hidden meta data: i.e. the restore was done from the raw rather than debug view.
The biggest consequence of losing the meta data is that the attachments are now inaccessible. I propose that files that are do not exist in the attachment table should be automatically inserted into it when the topic is saved.
This could be written as a plugin or in the core, but generally:
on topic save (or indeed, topic view):
pseudo code:
foreach file in pub/%WEB%/%TOPIC%,
$meta = get meta data for topic
unless file already in attachment table {
my ($fileName, $filePath, $fileSize, $fileDate) = stat file
my ($fileUser, $fileComment, $attr) = ('','','')
my @attrs = (
"name" => $fileName,
"version" => "",
"path" => $filePath,
"size" => $fileSize,
"date" => $fileDate,
"user" => $fileUser,
"comment" => $fileComment,
"attr" => ""
);
$meta->put( "FILEATTACHMENT", @attrs );
}
Questions:
- Useful?
- Core or Plugin?
- Anyone want to take the credit and code it?
--
MartinCleaver - 28 Sep 2004
An alternative approach is to dispense with the attachment table in the topic altogether. Since attachments are under revision control, most of the fields stored in the META tag are duplicates of the
RCS information anyway.
--
CrawfordCurrie - 28 Sep 2004
ok, so how useful are comment and attributes? are there others too? to keep them do we just store files alongside the attachments ?
--
MartinCleaver - 28 Sep 2004
Comments can be stored as the "descriptive text" of
RCS files (-t option). Note that we can use the log message (-m option) of
RCS to provide comments on revisions. attributes most logical places would be as keywords in the descriptive text (-h at start for hidden?)
--
ColasNahaboo - 28 Sep 2004
Table data in
RCS file only: The same could be said for the topic text. The reason for the duplication is:
- Easy search on top revision only
- Get at data fast, without a system call to RCS
Discover files in attachment dir: Could be done. One issue to solve is what to do with files that are created by Plugins and stored in the topics attachment dir as suggested in the Recommended Storage of Plugin Data section in
TWikiPlugins topic. Those files are not supposed to be visible to the user. The discover algorithm could exclude files starting with underscore.
--
PeterThoeny - 29 Sep 2004