Questions answered by this recipe
This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.
- How can I view just some part of the RecentPages without having to resort to the overhead of a pagelist?
- How can I see changes just by one author?
- How can I see changes made during a certain date range?
- How can I see changes made to just certain pages?
Search RecentChanges entries by page name, author, date, etc. and list matching lines.
Download attach:greprc.php and put it in your cookbook directory.
Include this line in your config.php or farmconfig.php:
Optionally set any default values in $GrepRCDefaults array.
If you have changed your RecentChanges format then you will need to set a new value for $GrepRCPat. This will require some knowledge of regular expressions.
(:recentchanges:) markup on a page in the location you want to view the subset of lines. (Include arguments to that markup or include arguments in your URL to specify the search.)
The following arguments are honored:
name=x,y,-zjust like pagelist syntax, but applied to the page names row by row in RecentChanges
group=a,b,-cyeah, like pagelist again
list=default(or all or whatever) once again, the pagelist syntax thing
scanlines=100Only scan the first 100 lines of the RecentChanges page (default 1000)
after=datestringonly list lines where the date occurs after this date string (date can be anything strtodate() recognizes -- "yesterday", "last week", "November 21, 2007", "last Monday", etc.)
afterbut before. (isn't that profound?)
authname=Sam,Jane*Specify just like
group=but it applies to author names instead (wildcards accepted)
source=Site.AllRecentChangesGet the lines from a different page besides $Group.RecentChanges.
Arguments can be specified in one of 3 ways, each successive one superseding the prior one:
- Defaults set in config.php by setting in the $GrepRCDefaults array
$GrepRCDefaults['scanlines'] = 500;
$GrepRCDefaults['after'] = "last week";
- Arguments specified in the
(:recentchanges:)markup (put quotes around arguments with spaces)
(:recentchanges scanlines=500 after="last week":)
- Parameters in the URL (replace spaces with
Defaults are overridden by markup arguments. Markup arguments are overridden by parameters in the URL. This allows an administrator to set global defaults but a page author can set it up to see what he wants to see and then a page viewer can change those defaults without editing the page. (The URL parameters also allow forms to be created to do the search very easily.)
Note that most (all?) of this capability and more could be easily created via pagelists. However, a pagelist can easily take tens of seconds to generate if it is at all complicated (see WatchLists) whereas this recipe can quickly scan through a single page without taking hardly any time or system resources.
Changes to your RecentChanges format or to your standard time format or etc. will have significant impact on this recipe and will require potential re-coding or at least re-configuring.
I cannot verify whether it will work for sites in other languages.
A form could very easily be set up like this, allowing dynamic searches to be done:
(:input form method="GET":) (:input default request=1:) || border=1 width=50% || Page Names:|| (:input text name:) || || Group Name(s):|| (:input text group:) || || Author Name(s):|| (:input text authname:) || || Show changes '''before''' this date:|| (:input text before:) || || Show changes '''after''' this date:|| (:input text after:) || || ||(:input submit Search Search:) || (:input end:)
- Release 2010-02-05 Initial release
See discussion at GrepRC-Talk