= [[wiki:plugin:repository|Репозиторий расширений]]
====== Руководство по плагину репозитория ======
[[wiki:plugin:repository|Репозиторий расширений]] используется [[world>]]www.dokuwiki.org для организации информации о плагинах и шаблонах.
===== Источник =====
Исходный код доступен по адресу [[github>]][[https://github.com/dokuwiki/dokuwiki-plugin-pluginrepo]]
Разработка DokuWiki движется в сторону одинакового отношения к плагинам и шаблонам. В репозитории плагинов шаблоны — это просто плагин типа == 32. Это облегчает совместное использование тегов (пользователи, ищущие боковые панели, должны видеть и плагины, и шаблоны) и «Больше вкладов одного автора».
:!: шаблоны идентифицируются по используемому пространству имен.
===== Функциональность =====
Плагин имеет несколько компонентов синтаксиса (см. раздел [[#Syntax]] ниже):
* Записи для ввода свойств
* плагин ''%%---- plugin ----%%''
* или шаблон ''%%---- template ----%%'' .
* Таблица репозитория ''%%---- pluginrepo ----%%'' в которой перечислены сохраненные плагины или шаблоны.
* Информационное поле с некоторыми (случайными) моментами ''%%---- pluginnews -----%%''
* Список результатов заданного запроса, полезный для администраторов вики ''%%---- pluginquery -----%%''
Для использования информации о расширениях во внешних инструментах доступны некоторые API:
* API позволяет запрашивать список доступных расширений DokuWiki. Доступно по адресу \\ Available at ''/lib/plugins/pluginrepo/api.php?[parameters]'' (см . также [[wiki:plugin:repository:api]])
* Старая конечная точка ''/lib/plugins/pluginrepo/repository.php?[parameters]'' \\ (все еще используется, например, [[teams:translate-tool]]) (см. также [[wiki:plugin:repository:api]])
* Creates output in different formats of the usage statistics of DokuWiki \\ Available at ''/lib/plugins/pluginrepo/popularity.php?[parameters]'' \\ Examples at [[:popularity]] \\ (see for parameters details: [[https://github.com/splitbrain/dokuwiki-plugin-pluginrepo/blob/master/popularity.php|source]])
And maintenance tasks are performed by:
* ''/lib/plugins/pluginrepo/cron.php''
* Calculate popularity
* Check for version and base discrepancies and update the [[devel:badextensions]] page
===== Синтаксис =====
==== Entry Component ====
Besides the [[plugin:repository|entry component details]] it's worth mentioning that the ''securitywarning'' field has some predefined values
* **informationleak** -- 'This plugin expose information that might be valuable to a hacker. It is not recommended in a public installation.'
* **allowsscript** -- 'This plugin will allow execution of scripts. It should only be used when you trust ALL editors, best suited in private personal wikis.'
* **requirespatch** -- 'The plugin requires patching the DokuWiki core. Manual patches may break compatibility with other plugins and make it harder to secure your installation by upgrading to latest version.'
* **partlyhidden** -- 'Hiding parts of a DokuWiki page is not supported by the core. Most attempts to introduce ACL control for parts of a page will leak information through RSS feed, search or other core functionality.'
Of course free text could be used as well.
==== Pluginrepo (Table) Component ====
The "table" component comes in two variants, classic and a new more compact version with download buttons etc. An additional navigation feature "Jump to plugins starting with A B C.." is present for both. The new table also shows "tags" for each plugin.
The pluginrepo syntax component accepts parameters if supplied, which overrides parameters in HTTP request.
Available:
* **plugintype** -- [integer] 1, 2, 4, 8, 16, 32=templates, or combination
* **plugintag** -- [string] filter by this tag
* **pluginsort** -- [string] sort by author(a), lastupdate(d), type (t), compatibility (v), popularity %%(c)%%, plugin (p) otherwise sorted by most recent compatible release. Shortcuts can be used. If results are equal then further sorted by basename.
* **showall** -- [yes] returns plugins regardless of security or obsolete status, normally skipped.
* **includetemplates** -- [yes] returns templates AND plugins, normally only plugins returned. Combine with ''plugintype=32'' to return templates only.
* **showscreenshot** -- [yes] shows screenshot thumbnail column
* **showcompatible** -- [yes] shows latest compatible DokuWiki version column
* **cloudmin** -- [integer] needed number of occurrences for a tag to be included in navigation cloud
Example:
---- pluginrepo ----
cloudmin: 2
----
==== News Component ====
---- pluginnews -----
headline: Example News
link: wiki:plugins
linktext: More plugins >>
-----
Creates a right float box with one or more featured plugin/templates. Besides the repository API, additional parameters are:
Syntax definition:
---- pluginnews -----
headline:
style:
showscreenshot:
random:
entries:
link:
linktext:
-----
Parameters
* **style** -- ''sameauthor'' will display a list of plugins/templates by same author. Only usable in plugin/template homepages.
* **headline** -- [string] headline of the news block
* **link** -- [string] add link at bottom of the news block
* **linktext** -- [string] if combined with ''link'', it sets the link text
* **entries** -- [int] number of plugins displayed
* **random** -- [yes], set to ''no'' to disable random picked extensions
* **showscreenshot** -- [no], set to ''yes'' to show screenshot
* **onlyrecent** -- [yes], set to ''no'' to show bundled and older than 2 releases as well
==== Query Component ====
A tool tailored for [[teams:plugins_templates|Plugins & templates team]] to make wiki gardening easier.
The query results are displayed as a configurable table looking something like this:
---- pluginquery -----
SELECT : plugin, downloadurl
WHERE : author = ?
VALUES : Håkan Sandell
-----
Syntax definition:
---- pluginquery -----
SELECT :
WHERE :
VALUES :
HEADLINE :
-----
**Allowed fields:** plugin, name, description, author, email, bestcompatible, compatible, lastupdate, type, securityissue, securitywarning, updatemessage, screenshot, downloadurl, bugtracker, sourcerepo, donationurl, tags, popularity
All fields are allowed in WHERE clause together with AND, OR, NOT, NULL, LIKE, ''%'', ''<'', ''>'', ''='', ''('', '')''. All values in where clause should be replaced by ''?''.
For values of ''bestcompatible'' four placeholders can be used: ''@DATEMOSTRECENT@'', ''@DATESECONDMOSTRECENT@'', ''@DATETHIRDMOSTRECENT@'' and ''@DATEFOURTHMOSTRECENT@''.
Syntax examples:
---- pluginquery -----
WHERE : downloadurl IS null AND popularity > ?
VALUES : 400
-----
---- pluginquery -----
SELECT : author type
WHERE : (type & ?) AND (author LIKE ?)
VALUES : 3, %Andreas Gohr%
-----
---- pluginquery -----
SELECT : compatible
WHERE : ?
VALUES : 1
HEADLINE : All plugins and templates
-----
===== Configuration =====
There are some config settings for the dokuwiki.org admin
* ''db_name'' -- contain the DataSourceName, which consists of the PDO driver name, followed by a colon, followed by the PDO driver-specific connection syntax. See also: [[http://se2.php.net/manual/en/pdo.construct.php]] \\ Example: 'mysql:dbname=testdb;host=127.0.0.1' or 'sqlite:C:\DokuWikiStickNew\dokuwiki\repo.sqlite' \\ SQLITE2 not supported
* ''db_user'' -- database login username (leave blank for sqlite).
* ''db_pass'' -- database login password (leave blank for sqlite).
* ''bundled'' -- comma separated list of plugins that are bundled.
* ''releases'' -- comma separated list of releases (YYYY-MM-DD "") newest MUST be first.
Repository plugin honors [[config:allowdebug|allowdebug]] for SQL debugging.
=====Дополнения и Файлы=====
[[https://www.dokuwiki.org/plugin:repository:manual|Ссылка на оригинальную статью]]