上次编辑整个 wiki 的日期/时间

发布于 2025-01-13 02:13:12 字数 2514 浏览 3 评论 0原文

如何找到整个 wiki 的最后一次编辑的日期/时间?我想将此日期/时间写入文本文件,然后将其作为信息显示在我的维基页面之一 如此处所述使用ExternalData扩展。

谢谢你, russ

后收到错误消息(使用ExternalData 2.3)

注 1:编辑 LocalSettings.php 在此处输入图像描述

注意 2:我在 升级到ExternalData 3.0

输入图像描述这里

注 3:将 {{#get_external_data: 替换为 {{#get_db_data:)后,我得到以下结果(使用 2.3 或 3.0):

< a href="https://i.sstatic.net/Mu6bK.png" rel="nofollow noreferrer">在此处输入图像描述

注 4:LocalSettings.php 中的相关行

$wgScriptPath = "/mediawiki-1.35.1";
$wgServer = WebRequest::detectServer();

## Database settings
$wgDBtype = "mysql";
$wgDBserver = "localhost";
$wgDBname = "mywikidbname";
$wgDBuser = "mywikidbuser";
$wgDBpassword = "*********";

# MySQL specific settings
$wgDBprefix = "";

# MySQL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";

$wgShellLocale = "C.UTF-8";

# Enabled extensions. Most of the extensions are enabled by adding
# wfLoadExtension( 'ExtensionName' );
# to LocalSettings.php. Check specific extension documentation for more details.
# The following extensions were automatically enabled:
wfLoadExtension( 'ConfirmEdit' );
wfLoadExtension( 'PdfHandler' );
wfLoadExtension( 'SpamBlacklist' );
wfLoadExtension( 'TitleBlacklist' );
#wfLoadExtension( 'VisualEditor' );
wfLoadExtension( 'WikiEditor' );
wfLoadExtension( 'MathJax' );
wfLoadExtension( 'ImageMap' );
wfLoadExtension( 'Quiz' );
wfLoadExtension( 'TextScroller' );

wfLoadExtension( 'ExternalData' );
$edgCacheExpireTime=10;
$edgFilePath['inject'] = '/home/rwp/shares/share_wiki/rwp_external_data.txt';

$wgExternalDataSources['MW DB'] = [
    'type'      => 'mysql',
    'server'    => $wgDBserver,
    'user'      => $wgDBuser,
    'password'  => $wgDBpassword,
    'name'      => $wgDBname,
    'prepared'  => [
        'last revision' => 'SELECT rev_timestamp AS last FROM revision ORDER BY rev_timestamp DESC LIMIT 1;'
    ]
];

How can I find the date/time of the last edit to my entire wiki? I would like to write this date/time to a text file and then present it as info on one of my wiki pages as described here using the ExternalData extension.

thank you,
russ

Note 1: Error message I'm getting (using ExternalData 2.3) after editing LocalSettings.php

enter image description here

Note 2: The error message I'm getting after upgrading to ExternalData 3.0

enter image description here

Note 3: After replacing {{#get_external_data: with {{#get_db_data: I get this result (using either 2.3 or 3.0):

enter image description here

Note 4: Relevant lines from LocalSettings.php

$wgScriptPath = "/mediawiki-1.35.1";
$wgServer = WebRequest::detectServer();

## Database settings
$wgDBtype = "mysql";
$wgDBserver = "localhost";
$wgDBname = "mywikidbname";
$wgDBuser = "mywikidbuser";
$wgDBpassword = "*********";

# MySQL specific settings
$wgDBprefix = "";

# MySQL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";

$wgShellLocale = "C.UTF-8";

# Enabled extensions. Most of the extensions are enabled by adding
# wfLoadExtension( 'ExtensionName' );
# to LocalSettings.php. Check specific extension documentation for more details.
# The following extensions were automatically enabled:
wfLoadExtension( 'ConfirmEdit' );
wfLoadExtension( 'PdfHandler' );
wfLoadExtension( 'SpamBlacklist' );
wfLoadExtension( 'TitleBlacklist' );
#wfLoadExtension( 'VisualEditor' );
wfLoadExtension( 'WikiEditor' );
wfLoadExtension( 'MathJax' );
wfLoadExtension( 'ImageMap' );
wfLoadExtension( 'Quiz' );
wfLoadExtension( 'TextScroller' );

wfLoadExtension( 'ExternalData' );
$edgCacheExpireTime=10;
$edgFilePath['inject'] = '/home/rwp/shares/share_wiki/rwp_external_data.txt';

$wgExternalDataSources['MW DB'] = [
    'type'      => 'mysql',
    'server'    => $wgDBserver,
    'user'      => $wgDBuser,
    'password'  => $wgDBpassword,
    'name'      => $wgDBname,
    'prepared'  => [
        'last revision' => 'SELECT rev_timestamp AS last FROM revision ORDER BY rev_timestamp DESC LIMIT 1;'
    ]
];

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

筱果果 2025-01-20 02:13:12

使用 外部数据,您可以将上次修订的时间插入 wiki,而无需文件。添加到 LocalSettings.php

$wgExternalDataSources['MW DB'] = [
    'type'      => 'mysql',
    'server'    => $wgDBserver,
    'user'      => $wgDBuser,
    'password'  => $wgDBpassword,
    'name'      => $wgDBname,
    'prepared'  => [
        'last revision' => 'SELECT MAX(rev_timestamp) AS last FROM revision;'
    ]
];

然后使用 {{#get_external_data: db = MW DB | 获取所需的时间查询 = 最后修订 |数据 = 最后 = 最后}}{{#时间:r | {{#external_value: 最后}} }}

如果您想使用文件,请使用以下 bash 脚本创建它:

mysql -h ($wgDBserver) -u ($wgDBuser) -p($wgDBpassword) ($wgDBname) -e "SELECT MAX(rev_timestamp) AS last FROM revision;" > last_revision.txt

Using External Data, you can insert the time of the last revision to the wiki without a file. Add to LocalSettings.php:

$wgExternalDataSources['MW DB'] = [
    'type'      => 'mysql',
    'server'    => $wgDBserver,
    'user'      => $wgDBuser,
    'password'  => $wgDBpassword,
    'name'      => $wgDBname,
    'prepared'  => [
        'last revision' => 'SELECT MAX(rev_timestamp) AS last FROM revision;'
    ]
];

Then get the required time with {{#get_external_data: db = MW DB | query = last revision | data = last = last}}{{#time: r | {{#external_value: last}} }}.

If you want to use a file, create it with the following bash script:

mysql -h ($wgDBserver) -u ($wgDBuser) -p($wgDBpassword) ($wgDBname) -e "SELECT MAX(rev_timestamp) AS last FROM revision;" > last_revision.txt
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文