Manual:Extension/Workflows/Activity/SetTemplateParams and AutoDoc:ContentTransfer: Difference between pages

(Difference between pages)
No edit summary
 
m (1 revision imported)
 
Line 1: Line 1:
==Description==
==DescriptionMsg==
The ''SetTemplateParams'' activity allows automatic setting a template parameter on a wiki page.
{{AutoDocDescriptionMsg
|name = ContentTransfer
|desc = {{int:contenttransfer-extension-description
}}
}}
==License==
{{AutoDocLicense
|name = GPL-3.0-only
}}
==Requirements==
{{AutoDocRequirements
|mediawiki = {{AutoDocVersion
|name = MediaWiki
|version = 1.39.0
}}
}}
==IntegratesInto==
{{AutoDocIntegratesInto
|into = {{AutoDocListItem
|item = ContentTransfer
}}
}}
==SpecialPages==
{{AutoDocSpecialPages
|SpecialPages = {{AutoDocCallback
|name = ContentTransfer
|callback = \ContentTransfer\Special\Push
}}
}}
==Permissions==
{{AutoDocPermissions
|permissions = {{AutoDocPermission
|name = content-transfer
|type = global
|roles = admin
|desc = {{int:right-content-transfer
}}
}}
}}
==Config==
{{AutoDocConfig
|config = {{AutoDocOption
|name = ContentTransferAllowTalkNamespaces
|value = <nowiki>false</nowiki>
}}
{{AutoDocOption
|name = ContentTransferEnableBetaFeatures
|value = <nowiki>false</nowiki>
}}
{{AutoDocOption
|name = ContentTransferIgnoreInsecureSSL
|value = <nowiki>false</nowiki>
}}
{{AutoDocOption
|name = ContentTransferOnlyContentNamespaces
|value = <nowiki>false</nowiki>
}}
{{AutoDocOption
|name = ContentTransferPageLimit
|value = <nowiki>200</nowiki>
}}
{{AutoDocOption
|name = ContentTransferTargets
|value = <nowiki>array (
)</nowiki>
}}
}}
==ApiModules==
{{AutoDocApiModules
|APIModules = {{AutoDocCallback
|name = content-transfer-do-push-single
|callback = \ContentTransfer\Api\PushSingle
}}
{{AutoDocCallback
|name = content-transfer-get-pages
|callback = \ContentTransfer\Api\GetPages
}}
{{AutoDocCallback
|name = content-transfer-purge-pages
|callback = \ContentTransfer\Api\PurgePages
}}
{{AutoDocCallback
|name = content-transfer-push-info
|callback = \ContentTransfer\Api\PushInfo
}}
}}
==Hooks==
{{AutoDocHooks
|Hooks = {{AutoDocCallback
|name = [https://www.mediawiki.org/wiki/Manual:Hooks/LoadExtensionSchemaUpdates LoadExtensionSchemaUpdates]
|callback = \ContentTransfer\Extension::onLoadExtensionSchemaUpdates
}}
}}


* Templates are accessed by the order of appearance on the page, starting at 0. Non-existing templates are counted as links, so they do not count in this list.
* Parameters inside the template can be specified by their name or the index in case of non-named parameters.
* Index for non-named params starts at 1 (not 0!), as to be consistent with how template params are accessed in the template itself.
* Nested templates are currently not supported.
== Profile ==
{| class="wikitable"
! colspan="2" |'''Short profile'''
|-
|Name
|SetTemplateParams
|-
|Async
|Yes
|-
|BPMN type
|<code>bpmn:task</code>
|-
|BPMN Extension Element "wf:type"
|<code>set_template_param</code>
|}
==Properties==
{| class="wikitable"
! style="vertical-align:middle;text-align:left;width:70px;" |'''Name of property'''
!'''Description'''
!'''Type'''
|-
|<code>title</code>
|Name of the page where the template parameter is changed. If it will be changed on the page where the workflow runs, the value is <code><nowiki>{{FULLPAGENAME}}</nowiki></code>
|string
|-
| style="width:70px;" |<code>user</code>
|User that is shown in the revision history
|user
|-
|<code>template-index</code>
|Index of the template on the page (starting at 0)
|number
|-
|<code>template- param</code>
|Parameter  to modify. This can be a string (in the case of a  named parameter) or a number (in case of a non-named param; starting from 1, accessor for the parameter)
|<nowiki>int|string</nowiki>
|-
|<code>value</code>
|New value of the parameter, set by the workflow
|string
|-
|<code>minor</code>
|Marks the revision as a minor edit if set to 1
|boolean
|-
|<code>revisionId</code>
|Sets a new page revision ID
|number
|-
|<code>timestamp</code>
|Sets the page revision timestamp
|timestamp
|-
|comment
|Comment that is shown in the revision history
|string
|}
== Example ==
=== Workflow task ===
This workflow task will set the value of the parameter <code><nowiki>{{{status|not set}}}</nowiki></code> to <code>Updated</code> on a page's first template.<syntaxhighlight lang="xml">
<bpmn:task id="EditTemplate" name="Edit template">
    <bpmn:extensionElements>
<wf:type>set_template_param</wf:type>
</bpmn:extensionElements>
<bpmn:property name="title" default="Testpage" validation="required,existing-title"/>
<bpmn:property name="user" default="WikiSysop" validation="existing-user"/>
<!-- Index of the template on page (starting from 0) -->
<bpmn:property name="template-index" default="0"/>
<!-- Param to modify. Can be a string in case of named params, or a number, in case of non-named params (starting from 1, accessor for the param) -->
<bpmn:property name="template-param" default="status"/>
<!-- New value to set -->
<bpmn:property name="value" default="Updated"/>
<bpmn:property name="minor" default="0"/>
<!-- Output properties -->
<bpmn:property name="revisionId"/>
<bpmn:property name="timestamp"/>
      <bpmn:incoming>Flow_1qh6vpl</bpmn:incoming>
      <bpmn:outgoing>Flow_0if1kyp</bpmn:outgoing>
    </bpmn:task>
</syntaxhighlight>
=== Template ===
The template content has the parameter <code><nowiki>{{{status}}}</nowiki></code> At the time of writing this, the workflow produced an error tif the parameter was wrapped in a <code><nowiki><div></nowiki></code> tag. Therefore, in the example below, the parameter is defined in a variable first. If the parameter is not in  a  <code>div</code> tag, using a variable is not necessary.<syntaxhighlight lang="text">
{{#vardefine:status|{{{status|not set}}}}}
<div style="background:#fbfaef;">Page status: {{#var:status}}</div>
</syntaxhighlight>
=== Full bpmn example ===
<syntaxhighlight lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:wf="http://hallowelt.com/schema/bpmn/wf">
    <bpmn:process id="SetTemplateParams-Process" isExecutable="false">
        <bpmn:extensionElements>
            <wf:context>
                <wf:contextItem name="pageId"/>
            </wf:context>
        </bpmn:extensionElements>
        <bpmn:startEvent id="TheStart">
            <bpmn:outgoing>FromTheStartToEditTemplate</bpmn:outgoing>
        </bpmn:startEvent>
        <bpmn:sequenceFlow id="FromTheStartToEditTemplate" sourceRef="TheStart" targetRef="EditTemplate" />
        <bpmn:task id="EditTemplate" name="Edit template">
            <bpmn:extensionElements>
                <wf:type>set_template_param</wf:type>
            </bpmn:extensionElements>
            <bpmn:property name="title" default="" validation="required,existing-title">{{FULLPAGENAME}}</bpmn:property>
            <bpmn:property name="user" default="WikiSysop" validation="existing-user">WikiSysop</bpmn:property>
            <!-- Index of the template on page (starting from 0) -->
            <bpmn:property name="template-index" default="0"/>
            <!-- Param to modify. Can be a string in case of named params, or a number, in case of non-named params (starting from 1, accessor for the param) -->
            <bpmn:property name="template-param" default="status"/>
            <!-- New value to set -->
            <bpmn:property name="value" default="Super edited param"/>
            <bpmn:property name="minor" default="1"/>
            <!-- Output properties -->
            <bpmn:property name="revisionId"/>
            <bpmn:property name="timestamp"/>
            <bpmn:incoming>FromTheStartToEditTemplate</bpmn:incoming>
            <bpmn:outgoing>FromEditTemplateToTheEnd</bpmn:outgoing>
        </bpmn:task>
        <bpmn:sequenceFlow id="FromEditTemplateToTheEnd" sourceRef="EditTemplate" targetRef="TheEnd" />
        <bpmn:endEvent id="TheEnd">
            <bpmn:incoming>FromEditTemplateToTheEnd</bpmn:incoming>
        </bpmn:endEvent>
    </bpmn:process>
</bpmn:definitions>
</syntaxhighlight>
[[de:Handbuch:Erweiterung/Workflows/Activity/SetTemplateParams]]

Latest revision as of 14:09, 1 December 2023

DescriptionMsg

Enables pushing content from one wiki to another

License

GPL-3.0-only

Requirements

  • MediaWiki: 1.39.0

IntegratesInto

  • ContentTransfer

SpecialPages

  • ContentTransfer

Permissions

Permissions

Name Description Role
content-transfer Transfer content to other wikis admin

Config

Configuration

Name Value
ContentTransferAllowTalkNamespaces false
ContentTransferEnableBetaFeatures false
ContentTransferIgnoreInsecureSSL false
ContentTransferOnlyContentNamespaces false
ContentTransferPageLimit 200
ContentTransferTargets array ( )

ApiModules

API Modules

  • content-transfer-do-push-single
  • content-transfer-get-pages
  • content-transfer-purge-pages
  • content-transfer-push-info

Hooks

Hooks




To submit feedback about this documentation, visit our community forum.

No categories assignedEdit

Discussions