Setup:Installation Guide/Advanced/Maintenance scripts/export: Difference between revisions

(Created page with "== Running the script == The script to export wiki pages to PDF is executed from: <syntaxhighlight lang="text"> php {MW_ROOT}/extensions/BlueSpiceUniversalExport/maintenance/e...")
 
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 2: Line 2:
The script to export wiki pages to PDF is executed from: <syntaxhighlight lang="text">
The script to export wiki pages to PDF is executed from: <syntaxhighlight lang="text">
php {MW_ROOT}/extensions/BlueSpiceUniversalExport/maintenance/export.php --specification-file=spec.json
php {MW_ROOT}/extensions/BlueSpiceUniversalExport/maintenance/export.php --specification-file=spec.json
</syntaxhighlight>The specification file spec.json can have the following content:<syntaxhighlight lang="text">
</syntaxhighlight>The specification file <code>spec.json</code> can have the following content:<syntaxhighlight lang="text">
{
{
     "module": "pdf",
     "module": "pdf",
     "attachments": 1,
     "attachments": 1,
     "recursive": 1,
     "recursive": 1,
     "title": "PDF",
     "title": "MyPDF",
     "target": "localfilesystem",
     "target": "localfilesystem",
     "target-file-name": "All.pdf",
     "target-file-name": "All.pdf",
     "target-file-path": "/path/to/target-file"
     "target-file-path": "/path/to/target-file"
}
}
</syntaxhighlight>
</syntaxhighlight>It is possible to export either a set of  wiki pages or a single book.
{| class="wikitable" style="width: 100%;"
{| class="wikitable" style="width: 100%;"
|+
|+Key/value pairs for the specification file
! style="width:200px;" |Key
! style="width:200px;" |key
! style="width:200px;" |Value
! style="width:200px;" |possible values
!Description
!module='''pdf'''
|-
(exports a set of wiki pages)
| style="width:200px;" |module
!module='''bookpdf'''
| style="width:200px;" |pdf
(exports a single book)
|
|-
|-
| style="width:200px;" |attachments
| style="width:200px;" |attachments
| style="width:200px;" |1
| style="width:200px;" |1
0
0
|
| colspan="2" |0 = no attachments are included
1 = attachments (links to "media" files) are included
|-
|-
| style="width:200px;" |recursive
| style="width:200px;" |recursive
| style="width:200px;" |1
| style="width:200px;" |1
0
0
|
|0 = no linked pages are included
1 = linked pages (one level deep) are included
|value '''has to be'''  "1" or the pdf contains no pages!
|-
|-
| style="width:200px;" |title
| style="width:200px;" |title
| style="width:200px;" |string
| style="width:200px;" |string
|
|Title of the [[Setup:Installation Guide/Advanced/Maintenance scripts/export#Creating a page list for the export|wiki page that contains the list of pages to be exported]]. '''The pages need to be links.'''
|Title of the book page. Exporting multiple books requires running separate scripts for each book.
<code>"title":"Book:Mybookname"</code>
|-
|-
| style="width:200px;" |target
| style="width:200px;" |target
| style="width:200px;" |localfilesystem
| style="width:200px;" |localfilesystem
|
| colspan="2" |The file is exported to a local file system
|-
|-
| style="width:200px;" |target-file-name
| style="width:200px;" |target-file-name
| style="width:200px;" |
| style="width:200px;" |
|
| colspan="2" |Name of the exported PDF file
|-
|-
| style="width:200px;" |target-file-path
| style="width:200px;" |target-file-path
| style="width:200px;" |
| style="width:200px;" |
|
| colspan="2" |Target file location
|}
|}


== Creating a page list for the export ==
== Creating a page list for the export ==
The pages to be exported are defined in the wiki page that is shown as the <code>title</code> in the json-file. (In the example above, this is the page <code>PDF</code> .)
The export list is defined in the wiki page that is shown as the <code>title</code> in the json-file. (In the example above, this is the page <code>MyPDF</code> .)


The page <code>PDF</code> now needs to list all pages  that will be exported to PDF.  
The page <code>MyPDF</code> now needs to list all pages  that will be exported to PDF.  


This list can be created with an [[SMW queries|SMW inline query]] (BlueSpice free) or with a [[Manual:Extension/DynamicPageList3|DPL3 list]] (BlueSpice free).
This list can be created with an [[SMW queries|SMW inline query]] (BlueSpice free) or with a [[Manual:Extension/DynamicPageList3|DPL3 list]] (BlueSpice free).
Example of an SMW query to create an export for all pages in the categories <code>Process</code> and <code>Work instruction</code>:


 
You would add the following to your <code>MyPDF</code> page in the wiki:<syntaxhighlight lang="text">
Example of an SMW query to create an export for all pages in the categories <code>Process</code> and <code>Work instruction</code>:<syntaxhighlight lang="text">
==All processes==
==All processes==
{{#ask:[[Process:+]]|format=ul|limit=99999}}
{{#ask:[[Process:+]]|format=ul|limit=99999}}
Line 74: Line 78:
== Setting up a CronJob ==
== Setting up a CronJob ==
To automate the export, the following CronJob is available:<syntaxhighlight lang="text">
To automate the export, the following CronJob is available:<syntaxhighlight lang="text">
CronJob für Export
php {MW_ROOT}/extensions/BlueSpiceUniversalExport/maintenance/export.php --specification-file={MW_ROOT}/extensions/BlueSpiceFoundation/data/spec.json
 
php {MW_ROOT}/extensions/BlueSpiceUniversalExport/maintenance/export.php --specification-file={MW_ROOT}/extensions/BlueSpiceFoundation/data/notfall.json
</syntaxhighlight>
</syntaxhighlight>
__FORCETOC__

Latest revision as of 10:34, 21 May 2024

Running the script

The script to export wiki pages to PDF is executed from:

php {MW_ROOT}/extensions/BlueSpiceUniversalExport/maintenance/export.php --specification-file=spec.json

The specification file spec.json can have the following content:

{
    "module": "pdf",
    "attachments": 1,
    "recursive": 1,
    "title": "MyPDF",
    "target": "localfilesystem",
    "target-file-name": "All.pdf",
    "target-file-path": "/path/to/target-file"
}

It is possible to export either a set of wiki pages or a single book.

Key/value pairs for the specification file
key possible values module=pdf

(exports a set of wiki pages)

module=bookpdf

(exports a single book)

attachments 1

0

0 = no attachments are included

1 = attachments (links to "media" files) are included

recursive 1

0

0 = no linked pages are included

1 = linked pages (one level deep) are included

value has to be "1" or the pdf contains no pages!
title string Title of the wiki page that contains the list of pages to be exported. The pages need to be links. Title of the book page. Exporting multiple books requires running separate scripts for each book.

"title":"Book:Mybookname"

target localfilesystem The file is exported to a local file system
target-file-name Name of the exported PDF file
target-file-path Target file location

Creating a page list for the export

The export list is defined in the wiki page that is shown as the title in the json-file. (In the example above, this is the page MyPDF .)

The page MyPDF now needs to list all pages that will be exported to PDF.

This list can be created with an SMW inline query (BlueSpice free) or with a DPL3 list (BlueSpice free). Example of an SMW query to create an export for all pages in the categories Process and Work instruction:

You would add the following to your MyPDF page in the wiki:

==All processes==
{{#ask:[[Process:+]]|format=ul|limit=99999}}

==All work instructions==
{{#ask:[[Work instruction:+]]|format=ul|limit=99999}}

The same list can be created with the following DPL3 syntax:

==All processes==
{{#dpl:category=Process}}

==All work instructions==
{{#dpl:category=Work instruction}}

Setting up a CronJob

To automate the export, the following CronJob is available:

php {MW_ROOT}/extensions/BlueSpiceUniversalExport/maintenance/export.php --specification-file={MW_ROOT}/extensions/BlueSpiceFoundation/data/spec.json



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

No categories assignedEdit

Discussions