ExpireDiff

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


Goal

Provide an action to remove the page revision history from a page. Also allows expiring only portions of the history older than a given number of days.

Solution

Attach:expirediff.php

Discussion

This script adds ?action=expirediff, which removes all of the page revision history information from a wiki page. It requires the user to have edit permissions to the page, and handles locking. It also creates a backup copy of the page with the page revisions intact (same as if someone had requested to delete a page).

In addition, one can add the keepdays=nn parameter, which says to keep any page history within the past nn days. For example, ?action=expirediff&keepdays=7 will remove any page history older than seven days. By default keepdays is zero, which expires the entire page history.

To install this script, simply copy it into your local/ subdirectory, and then add the line

    include_once('local/expirediff.php');

to your local/config.php file.

See Also

Contributors

pmwiki-2.5.9 -- Last modified by {{Pm}}

from IP: 85.171.160.186 ip should be disabled by default for security reasons

Array
(
    [post_max_size] => 64M
    [$_POST keys] => 
    [$_REQUEST keys] => n
    [$_SERVER] => Array
        (
            [CONTEXT_DOCUMENT_ROOT] => /home/pmwiki/public_html
            [CONTEXT_PREFIX] => 
            [DOCUMENT_ROOT] => /home/pmwiki/public_html
            [GATEWAY_INTERFACE] => CGI/1.1
            [HTTPS] => on
            [HTTP_ACCEPT] => */*
            [HTTP_ACCEPT_ENCODING] => gzip, br, zstd, deflate
            [HTTP_HOST] => www.pmwiki.org
            [HTTP_REFERER] => http://www.pmwiki.org/wiki/Cookbook-V1/ExpireDiff
            [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
            [HTTP_X_HTTPS] => 1
            [PATH] => /bin:/usr/bin
            [PHP_INI_SCAN_DIR] => /opt/cpanel/ea-php70/root/etc:/opt/cpanel/ea-php70/root/etc/php.d:.
            [QUERY_STRING] => n=Cookbook%2dV1%2fExpireDiff
            [REDIRECT_HTTPS] => on
            [REDIRECT_QUERY_STRING] => n=Cookbook%2dV1%2fExpireDiff
            [REDIRECT_SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook-V1/ExpireDiff
            [REDIRECT_SCRIPT_URL] => /wiki/Cookbook-V1/ExpireDiff
            [REDIRECT_SSL_TLS_SNI] => www.pmwiki.org
            [REDIRECT_STATUS] => 200
            [REDIRECT_UNIQUE_ID] => afRrhTJ-jNqv_2Te3At6TgAAAM4
            [REDIRECT_URL] => /wiki/Cookbook-V1/ExpireDiff
            [REMOTE_ADDR] => 216.73.216.25
            [REMOTE_PORT] => 5119
            [REQUEST_METHOD] => GET
            [REQUEST_SCHEME] => https
            [REQUEST_URI] => /wiki/Cookbook-V1/ExpireDiff
            [SCRIPT_FILENAME] => /home/pmwiki/public_html/index.php
            [SCRIPT_NAME] => /index.php
            [SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook-V1/ExpireDiff
            [SCRIPT_URL] => /wiki/Cookbook-V1/ExpireDiff
            [SERVER_ADDR] => 23.254.203.248
            [SERVER_ADMIN] => webmaster@pmwiki.org
            [SERVER_NAME] => www.pmwiki.org
            [SERVER_PORT] => 443
            [SERVER_PROTOCOL] => HTTP/1.1
            [SERVER_SIGNATURE] => 
            [SERVER_SOFTWARE] => Apache
            [SSL_TLS_SNI] => www.pmwiki.org
            [TZ] => America/Los_Angeles
            [UNIQUE_ID] => afRrhTJ-jNqv_2Te3At6TgAAAM4
            [PHP_SELF] => /index.php
            [REQUEST_TIME_FLOAT] => 1777625989.5512
            [REQUEST_TIME] => 1777625989
            [argv] => Array
                (
                    [0] => n=Cookbook%2dV1%2fExpireDiff
                )

            [argc] => 1
        )

)