[pmwiki-users] Questions about PTV and PTV mass edit

Petko Yotov 5ko at 5ko.fr
Fri Jul 5 08:05:56 PDT 2024


On 04/07/2024 21:34, ABClf wrote:
> Now change that pattern (one word) to see what will happen in real life 
> :
> grep -rl %0apréface: | xargs sed -i 's/%0apréface:/%0apreface:/g'

This may work well.

I'd still recommend making a backup snapshot in case something goes 
wrong.

> Change is done ; timestamp's files are updated to time of change
> (sadly no option in sed to preserve file time) ; pageindex doesn't
> look to bother (is not regenerated) ; browse page still work ;
> replacement is not in history of course ; PmWiki keep showing page
> last modified time according to time= if it exists.
> 
> It might look rustic or brutal but it looks like it works (sure it
> works, PmWiki flat file need only 2 lines, plus 1 line for link list –
> PmWiki/PageFileFormat) ;
> question is what is the price to pay when :
> lose replacement step in history,

May not be a problem.

The problem with external edits and page history is when there are 
changes on multiple lines not included in the internal page history. If 
someone tries to restore an earlier version from the ?action=diff page, 
it may or may not work. The diff restore-merge function restores the 
lines per the line numbers at the time of every edit, starting with the 
latest text. If at some point the text was externally modified and the 
line numbers were changed, it may restore earlier versions wrong.

I feel in your case, single word replacement, this will not be a 
problem.

> have pageindex not up to date,

Not likely a problem. It may affect search results for "préface" or 
"preface"

If UnaccentUTF8 is enabled, as you only remove accents, pageindex 
doesn't need updating:

   https://www.pmwiki.org/wiki/Cookbook/UnaccentUTF8

If .pageindex returns pages that do not match the terms, PmWiki will 
reindex these pages.

> time= different than file timestamp. Probably fastcache, if you use
> it, will have to regenerate cached files when they are browsed.

Looking closer into FastCache, it would only delete the cache and 
regenerate the page after you edit it on the wiki.

Depending on $FastCacheInvalidateAllOnUpdate, changing any page should 
delete all cache (by default) or will update only the cache for the 
edited page.

This means, visitors may still see the previously cached page before 
your mass editing. If the PTVs are visible on the rendered page, 
visitors may see in your pages "préface:" instead of "preface:".

I don't expect this to be a major problem: purists on a linguistic 
website are unlikely to be offended when a word is written correctly.

OTOH the word is not capitalized so they well may. :-P

> Something else ?

I'd still recommend making a backup snapshot in case something goes 
wrong. :-)

Petko



More information about the pmwiki-users mailing list