From MediaWiki.org
Jump to navigation Jump to search

This page is in progress of translating to Russian. You can help translating it or go to another language version that follows:

Эта страница в процессе перевода на русский язык. Вы можете помочь в переводе или перейти на другие языковые версии, указанные ниже:

Другие языки: English  • русский
Справка по расширениям MediaWiki
OOjs UI icon advanced.svg
Свежие страницы
Статус релиза: стабильный
Реализация Tag , Hook
Описание Allows to produce a list of recently added, or random, pages
Автор(ы) Nathan Larson (Leucostictetalk)
Последняя версия 0.1.10 (2014-01-22)
MediaWiki 1.13.1, 1.14.0, 1.15.0, 1.16.0, 1.19.x, 1.22.x
Изменения БД Нет
Лицензия GPL
Пример http://wiki.mises.org/


  • $wgRecentPagesDefaultMinimumLength
  • $wgRecentPagesDefaultLimit
  • $wgRecentPagesMaxAttempts
  • $wgRecentPagesDisableOtherNamespaces
  • $wgRecentPagesDefaultSort
Переведите расширение RecentPages если оно доступно на translatewiki.net
Проверьте использование и версию.
RecentPages and Extension:BedellPenDragon can be used together to automatically add new article descriptions to glossary, quote list, etc. special pages that look similar to MediaWiki's Manual:Glossary (see example screenshot) and to "New articles" feeds that look similar to Wikipedia's "In the news" template. This saves time that would otherwise have had to be spent updating centralized templates.

The RecentPages extension adds a list of recently added pages to the current page. It can also do random pages. If used in conjunction with CustomNavBlocks can be used to add a side-panel of recent additions to the wiki. The namespace="content" option will pull back recent pages from all the namespaces specified in $wgContentNamespaces. Pages that are redirects will be excluded.

Note that the only options you have for the random pages are mainspace and all content namespaces. There are technical reasons for that having to do with how RandomPage is set up. Basically, it defaults to the content namespaces, and there's probably some way to override that, but I got tired of fooling with it. A makeshift solution is just to pull everything and then filter it, but that gets pretty expensive if you're dealing with a small subset of the content pages, and it doesn't work at all if it's not a subset of the content pages (e.g. the User space is generally not a content namespace). However, mainspace is usually a pretty big subset of the content namespaces, so I left that as an option.

Установка и настройка[edit]


  • Download и распакуйте файл(ы) в папку с названием RecentPages в вашей папке extensions/.
  • Добавьте следующий строки в конец файла LocalSettings.php:
    require_once "$IP/extensions/RecentPages/RecentPages.php";
  • Yes Готово – Перейдите на страницу Special:Version на своей вики, чтобы удостовериться в том, что расширение успешно установлено.

Конфигурирование настроек[edit]

Настройки прописываем в всё в том же LocalSettings.php.


Минимальная длина случайно выбираемой статьи

$wgRecentPagesDefaultMinimumLength = 600;


Количество выводимых статей по умолчанию

$wgRecentPagesDefaultLimit = 6;


Максимальное количество попыток получить уникальность случайной статьи

$wgRecentPagesMaxAttempts = 1000;


Из-за глюка, оставьте этот параметр как true; оно что-то делает с выбором случайных страниц. Возможно, какая-то функция пока не работает.

$wgRecentPagesDisableOtherNamespaces = true;


Нужно ли сортировать по умолчанию?

$wgRecentPagesDefaultSort = false;



Параметр Возможные значения По умолчанию Описание
bulletchar Any string blank What to use as the bullet character. If you don't put anything, it will be *.
columns 1, 2 or 3 1 How many columns to display the results in
editlink Any string Not set String to use for edit link (url encoded page title will be substituted for $1)
endlichar Any string Not set String to replace </li> with. It's probably better if you don't use this parameter
endulchar Any string Not set String to replace </ul> with
lichar Any string Not set String to replace <li> with
limit Any integer 0 or greater 6 (or whatever $wgRecentPagesDefaultLimit is set to) How many page table rows to select in the database query
maxresults Any integer 0 or greater Not set Maximum number of results to display. If not set, then there will be no maximum. But note, the limit parameter will still impose a limit on the number of results, independently of the maxresults parameter.
minimum Any integer 0 or greater 300 (or whatever $wgRecentPagesDefaultMinimumLength is set to) Minimum number of characters (page.page_len) in displayed articles
namespace "all", "content", "user", etc. or blank for mainspace only blank (i.e. mainspace only) What namespace to select in the database query
parsedendchar Any string blank What to end each line with. $1 will be replaced with the page title.
prop Any string Not set Only display pages that have the given metadata property name stored in the page_props table. The key will be prefixed bpd_ (e.g. bpd_summary in the table, but you will omit that prefix (e.g. summary). Requires Extension:BedellPenDragon.
sort Anything (it's boolean; either set or not set) Not set Sort the results alphabetically
spaces_between Anything (it's boolean) Not set Display a space between the page title and page property value.
str_replace_prop Any string Not set What to replace the page property value with. Use $1 for the page property value, if you want it to be inserted into the replacement text.
str_replace_title Any string Not set Display this text for each result. $1 will be the page title; $2 will be the html. Putting simply str_replace_title="2" usually works fine, if you just want to display titles (not properties) with their appropriate italicization and so on, depending on the displaytitle. Note that str_replace_title is handled before str_replace_prop, so you can use the two in conjunction, as demonstrated in the example below.
stripfromfront Any string Not set Strip this first occurrence of this text from the html if it is the first part of the title (not the html). Typically used to strip out, e.g., a namespace like Essay:
ulchar Any string Not set String to replace <ul> with


Pull back six most recent normal pages:
<recent />

Pull back ten most recent pages from user namespace:
<recent limit="10" namespace="user" />

Pull back six most recent pages in content namespaces:
<recent namespace="content" />

Pull back six most recent pages regardless of namespace:
<recent namespace="all" />

Pull back six most recent pages regardless of namespace and display in double-column format:
<recent columns="2" />

Pull back six most recent pages regardless of namespace and display in double-column format:
<recent columns="2" />

Pull back twelve random pages from mainspace that have a minimum length of 600 characters:
<random limit="12" namespace="main" />

Pull back twelve random pages from mainspace that have a minimum length of 1,000 characters:
<random limit="12" namespace="main" minimum="1000"/>

Pull back twelve random pages from mainspace and sort them alphabetically:
<random limit="12" namespace="main" sort/>

Display a maximum of 50 results; display only results that have a short_summary property set; put a space in between the displayed page title and displayed page property value; put the page title in bold italics and display the DISPLAYTITLE rather than the unchanged page_title:
<recent prop="short_summary" limit="2000" maxresults="50" minimum="1" spaces_between="true" namespace="content" str_replace_title="'''''[[$1|$2]]''''': "/>

For instructions and examples on how to use the extension with Extension:BedellPenDragon to generate results involving page metadata, see also this section.


How do I control the order in which pages in the new pages feed show up? I want to move one of them up/down in the sequence, either to draw attention to it, or deflect attention from it, or whatever.
There probably should be an easier way to do this, but currently all you can do is, to bring something to the top, delete the page and the undelete it. If you want to bury something, you have to create a bunch of new articles. Ideally, there would be some very intuitive and easy-to-use GUI that would just let you drag and drop the items where you want them in the list. This being MediaWiki, you know it's not going to be that easy. If this feature is implemented, it'll probably be done by, say, a MediaWiki: page that lets you add an offset changing the position of pages in the list.
But then it'll be necessary to figure out, should it be done by page title or page ID? If the former, then there will be problems if the page is moved, unless it's programmed to look at the page move log to see where it was moved to. If the latter, then there will be problems if the page is deleted and undeleted, because then it'll have a new title.
There are a couple ways to implement this; one would be to use the page_props (similarly to BedellPenDragon); another would be to create a whole new table to store the info of what should be excluded or included.
Sometimes new pages are spammy or otherwise not up to quality standards. How do I make it so that it skips the first few newest pages?
It would be easy to add a parameter to make it do this, but I haven't done it yet.

Проблемы и их решение[edit]

Страницы не показываются
Выставлено ли в параметре $wgRecentPagesDefaultMinimumLength достаточное значение, чтобы были отобраны все страницы?
Оно не работает, когда я использую namespace="main"
Это глюк; обходите такие моменты и не используйте пространство имен. По умолчанию оно - main.

Смотрите также[edit]

Другие языки: English  • русский