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

No edit summary
Tag: 2017 source edit
No edit summary
Line 5: Line 5:


== Usage ==
== Usage ==
  <code>php extensions/ContentTransfer/maintenance/executeTransfer.php --category=GlobalPage --targets=Target1,Target2,Target3</code>
   
There 3 ways to specify pages to transfer:  
There are three ways to specify pages which pages to transfer:  


* <code>--category</code> (as it is done above),
* <code>'''--category'''</code>: This option lets you transfer based on category:<syntaxhighlight lang="php">
* <code>--namespace</code> (similar with <code>--category</code>) and
php extensions/ContentTransfer/maintenance/executeTransfer.php --category=GlobalPage --targets=Target1,Target2,Target3
* <code>--pages</code><span>.</span> <code>--pages</code> option let you explicitly specify pages needed to transfer:
</syntaxhighlight>
 
* <code>'''--namespace'''</code>: This option lets you transfer based on namespace:<syntaxhighlight lang="php">
<code>php extensions/ContentTransfer/maintenance/executeTransfer.php --pages=Page1,Demo:Page2,Page3 --targets=Target1,Target2,Target3</code>
php extensions/ContentTransfer/maintenance/executeTransfer.php --namespace=QM --targets=Target1,Target2,Target3
</syntaxhighlight>
* <code>'''--pages'''</code> This option lets you explicitly specify which pages to transfer:<syntaxhighlight lang="php">
php extensions/ContentTransfer/maintenance/executeTransfer.php --pages=Page1,Demo:Page2,Page3 --targets=Target1,Target2,Target3
</syntaxhighlight>


== Configuration ==
== Configuration ==
Maintenance script can consume JSON file with necessary configuration. Sample JSON file is located by this path: <code>extensions/ContentTransfer/docs/transfer-config.json.example</code>. This file can be used to create JSON configuration file somewhere to not type all options in CLI each time.
The maintenance script can consume a JSON file with the necessary configuration. A sample JSON file is located at this path: <code>extensions/ContentTransfer/docs/transfer-config.json.example</code>. This file can be used to create a JSON configuration file somewhere, so that it is not necessary to type all options in the CLI each time.


For that, <code>--json-config</code> option can be used. There can be specified path to the file with JSON configuration.
For that, <code>--json-config</code> can be used. There can be a specified path to the file with the JSON configuration.


If you need to create your own JSON configuration file, copy sample JSON file somewhere and edit it to set necessary configuration.
If you need to create your own JSON configuration file, copy the sample JSON file somewhere and edit it to set the necessary configuration.


For example, you have file <code>/home/some_user/config/transfer-config.json</code>. Then it can be used like that:
For example, you have the file <code>/home/some_user/config/transfer-config.json</code>. Then it can be used like that:
  <code>php extensions/ContentTransfer/maintenance/executeTransfer.php --json-config=/home/some_user/config/transfer-config.json</code>
  <code>php extensions/ContentTransfer/maintenance/executeTransfer.php --json-config=/home/some_user/config/transfer-config.json</code>
You can specify either absolute file path from the root or relative path from present working directory.
You can specify either an absolute file path from the root or a relative path from the present working directory.




'''Note!'''
'''Note!'''


It is also possible to use JSON file and additionally pass options from CLI. In that case options from CLI will have greater priority and '''will override''' same options from JSON file.
It is also possible to use a JSON file and additionally pass options from the CLI. In that case, the options from CLI will have greater priority and '''will override''' the same options from JSON file.


Example:
Example:
  <code>php extensions/ContentTransfer/maintenance/executeTransfer.php --json-config=/home/some_user/config/transfer-config.json --pages=Page1,Demo:Page2,Page3 --targets=Target1,Target2,Target3</code>
  <code>php extensions/ContentTransfer/maintenance/executeTransfer.php --json-config=/home/some_user/config/transfer-config.json --pages=Page1,Demo:Page2,Page3 --targets=Target1,Target2,Target3</code>
Here script will read configuration from the JSON file specified, but '''“pages”''' and '''“targets”''' options '''will be overridden''' from CLI (if they are presented in JSON).
Here, the script will read the configuration from the specified JSON file , but the '''“pages”''' and '''“targets”''' options '''will be overridden''' from the CLI (if they are presented in JSON). The same is true for the other options.
 
Same with other options.


== Options ==
== Options ==


* <code>--user</code>Context user of "sending" wiki who will be used to transfer wiki pages. Actually it\'s just about recording transfer in DB. Default: '''“MediaWiki default”'''
* <code>--user</code>: The context user of the "sending" wiki who will be used to transfer wiki pages. This is just about recording the transfer in the DB. Default: '''“MediaWiki default”'''
* <code>--only-modified</code>If page should be transferred only if it was modified since last transfer. '''It's just a flag, it can be passed or not.'''
* <code>--only-modified</code>: If the page should be transferred only if it was modified since the last transfer. '''It's just a flag, it can be passed or not.'''
* <code>--modified-since</code>Transfer page only if was modified since specified date. Date must be specified in format '''"DD.MM.YYYY"'''. Default: '''“”'''
* <code>--modified-since</code>:Transfer the page only if it was modified since the specified date. The date must be specified in the format '''"DD.MM.YYYY"'''. Default: '''“”'''
* <code>--include-related</code>If all related wiki pages should also be transferred. Like templates, files, links which are used on transferring page. '''It's just a flag, it can be passed or not.'''
* <code>--include-related</code>:If all related wiki pages should also be transferred (templates, files, links, and so on, which are used on the page to be transferred. '''It's just a flag, it can be passed or not.'''
* <code>--force</code>Transfer page if it is protected on receiving wiki. '''It's just a flag, it can be passed or not.'''
* <code>--force</code>:Transfer the page even if it is protected on the receiving wiki. '''It's just a flag, it can be passed or not.'''
 
Also there is <code>--dry</code> option (it's a flag too), which may be useful if user just wants to take a look at transferring titles, but without actual changes in “receiving” wikis.


Also there is a <code>--dry</code> option (it's a flag too), which may be useful if a user just wants to take a look at transferring titles, but without actual changes in “receiving” wikis.


Complete list of possible options with descriptions can be got by such command:
You can see a complete list of possible options with descriptions by the following command:
   <code>php extensions/ContentTransfer/maintenance/executeTransfer.php --help</code>
   <code>php extensions/ContentTransfer/maintenance/executeTransfer.php --help</code>




If there is a need to set specific user for creating pages in target wiki (in case with multiple available for that users), it can be done by that way:
If there is a need to set a specific user for creating pages in the target wiki , it can be done that way:
  <code>php extensions/ContentTransfer/maintenance/executeTransfer.php ... --targets=Target1=User1,Target2=User2,Target3...</code>
  <code>php extensions/ContentTransfer/maintenance/executeTransfer.php ... --targets=Target1=User1,Target2=User2,Target3...</code>

Revision as of 15:51, 21 April 2023

all maintenance scripts

Reference

BlueSpice Extension: ContentTransfer

Usage

There are three ways to specify pages which pages to transfer:

  • --category: This option lets you transfer based on category:
    php extensions/ContentTransfer/maintenance/executeTransfer.php --category=GlobalPage --targets=Target1,Target2,Target3
    
  • --namespace: This option lets you transfer based on namespace:
    php extensions/ContentTransfer/maintenance/executeTransfer.php --namespace=QM --targets=Target1,Target2,Target3
    
  • --pages This option lets you explicitly specify which pages to transfer:
    php extensions/ContentTransfer/maintenance/executeTransfer.php --pages=Page1,Demo:Page2,Page3 --targets=Target1,Target2,Target3
    

Configuration

The maintenance script can consume a JSON file with the necessary configuration. A sample JSON file is located at this path: extensions/ContentTransfer/docs/transfer-config.json.example. This file can be used to create a JSON configuration file somewhere, so that it is not necessary to type all options in the CLI each time.

For that, --json-config can be used. There can be a specified path to the file with the JSON configuration.

If you need to create your own JSON configuration file, copy the sample JSON file somewhere and edit it to set the necessary configuration.

For example, you have the file /home/some_user/config/transfer-config.json. Then it can be used like that:

php extensions/ContentTransfer/maintenance/executeTransfer.php --json-config=/home/some_user/config/transfer-config.json

You can specify either an absolute file path from the root or a relative path from the present working directory.


Note!

It is also possible to use a JSON file and additionally pass options from the CLI. In that case, the options from CLI will have greater priority and will override the same options from JSON file.

Example:

php extensions/ContentTransfer/maintenance/executeTransfer.php --json-config=/home/some_user/config/transfer-config.json --pages=Page1,Demo:Page2,Page3 --targets=Target1,Target2,Target3

Here, the script will read the configuration from the specified JSON file , but the “pages” and “targets” options will be overridden from the CLI (if they are presented in JSON). The same is true for the other options.

Options

  • --user: The context user of the "sending" wiki who will be used to transfer wiki pages. This is just about recording the transfer in the DB. Default: “MediaWiki default”
  • --only-modified: If the page should be transferred only if it was modified since the last transfer. It's just a flag, it can be passed or not.
  • --modified-since:Transfer the page only if it was modified since the specified date. The date must be specified in the format "DD.MM.YYYY". Default: “”
  • --include-related:If all related wiki pages should also be transferred (templates, files, links, and so on, which are used on the page to be transferred. It's just a flag, it can be passed or not.
  • --force:Transfer the page even if it is protected on the receiving wiki. It's just a flag, it can be passed or not.

Also there is a --dry option (it's a flag too), which may be useful if a user just wants to take a look at transferring titles, but without actual changes in “receiving” wikis.

You can see a complete list of possible options with descriptions by the following command:

 php extensions/ContentTransfer/maintenance/executeTransfer.php --help


If there is a need to set a specific user for creating pages in the target wiki , it can be done that way:

php extensions/ContentTransfer/maintenance/executeTransfer.php ... --targets=Target1=User1,Target2=User2,Target3...



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

No categories assignedEdit

Discussions