TEXT REPLACE ACTION

version 0.10

{{admin_replace [page="cluster"] [options=1] [mute=1] [max=NUMBER]}}


Long awaited admin tool for no longer advise users to this:

UPDATE prefix_page SET body = REPLACE(body, '/Doc/Русский/Obnovlenie', '/Doc/Русский/Обновление');

The core functionalitiy works well. Requirers at least 3 characters.


INSTALLATION:
Copy the action files to your action folder. Requirers at least 559826e7f0f6f7951c2b5576065af26a76a69ea8.


SETTINGS:
Default is 50 matches, set max=100 in action for more.
  - average processing time may vary (on my local XAMPP stack 1 second per replaced match), it runs per match up to 12 queries (Change the max=NUMBER if it exceeds the max execution time.)
  - 'max' is limited by get_list_count() -> range: ... 100
  - 'options' showing additional filters like language and categories
  - 'mute' is on by default, else it will send notifications for every watched page it changes (you likely want avoid that)

  
USAGE:
	[A] search & replace form
	[B] target matches selection form
	[C] replace target text with replacement text

After replacing the first batch of results, it reloads the selection form with the next batch of results.
It remembers all processed and not selected record ids via 'replace_unset' session array and excludes them in the next search query.


TODO: 
  - more filter options like use page owner and other criteria.
  - work with line breaks (\r\n -> \n), applies to page 'body'
  - file description, file caption and page description field? - not part of save_page()
  - check validation and sanitization
  - add option to suppress notifications: set $mute parameter with save_page() and send only one email for each batch instead
  - modify or suppress adding 'target' and 'replacement' to edit note, especially large chunks
  - test it and improve it
  - optimize replace procedure
  - if well enough we can add it to the core

There are certaily cases where the use of this tool is not advised.
