Difference between revisions of "CommandLine"
(→Usage) |
|||
(10 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
The main purpose of transfer mode is to push pages from one wiki to another including all files on the page. | The main purpose of transfer mode is to push pages from one wiki to another including all files on the page. | ||
== Example == | == Example == | ||
+ | <source lang='bash' highlight='2'> | ||
+ | ./run -s wikipedia_org_test -t wikipedia_org_test2 -p PictureTestPage | ||
+ | Mar 16, 2020 10:29:22 AM com.bitplan.mediawiki.japi.SSLWiki login | ||
+ | INFORMATION: https://test2.wikipedia.org/w/api.php?:Success | ||
+ | File:Mona Lisa one two one two this is just a test.jpg | ||
+ | https://upload.wikimedia.org/wikipedia/test/8/81/Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg | ||
+ | Mar 16, 2020 10:29:29 AM com.bitplan.mediawiki.japi.MediaWikiApiImpl handleError | ||
+ | SCHWERWIEGEND: error code=fileexists-shared-forbidden info:'A file with this name exists already in the shared file repository. If you still want to upload your file, please go back and use a new name. [[File:Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg|thumb|center|Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg]]' | ||
+ | Mar 16, 2020 10:29:29 AM com.bitplan.mediawiki.japi.MediaWikiApiImpl handleError | ||
+ | SCHWERWIEGEND: error: fileexists-shared-forbidden info: A file with this name exists already in the shared file repository. If you still want to upload your file, please go back and use a new name. [[File:Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg|thumb|center|Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg]] | ||
+ | Exception:error: fileexists-shared-forbidden info: A file with this name exists already in the shared file repository. If you still want to upload your file, please go back and use a new name. [[File:Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg|thumb|center|Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg]] | ||
+ | </source> | ||
+ | |||
+ | The Content of https://test.wikipedia.org/wiki/PictureTestPage is transferred to https://test2.wikipedia.org/wiki/PictureTestPage with a warning that the Mona Lisa file can not be transmitted. | ||
+ | |||
+ | == Check setup and credentials == | ||
+ | To check the setup and credentials for the wikis you'd like to use you might want to run: | ||
+ | <source lang='bash' highlight='1'> | ||
+ | ./run --test -a | ||
+ | </source> | ||
+ | |||
+ | === Example === | ||
+ | <source lang='bash' highlight='1'> | ||
+ | ./run --test -a | ||
+ | wf_wikipedia_org_test2.ini ✅: | ||
+ | url=https://test2.wikipedia.org | ||
+ | scriptPath=/w | ||
+ | user=** | ||
+ | e-mail=** | ||
+ | Mar 16, 2020 9:58:33 AM com.bitplan.mediawiki.japi.SSLWiki login | ||
+ | INFORMATION: https://test2.wikipedia.org/w/api.php?:Success | ||
+ | version: MediaWiki 1.35.0-wmf.23✅ | ||
+ | sitename: Wikipedia | ||
+ | lang: en | ||
+ | wf_royals.ini ✅: | ||
+ | url=http://royal-family.bitplan.com | ||
+ | scriptPath= | ||
+ | user=** | ||
+ | e-mail=** | ||
+ | Mar 16, 2020 9:58:39 AM com.bitplan.mediawiki.japi.SSLWiki login | ||
+ | INFORMATION: http://royal-family.bitplan.com/api.php?:Success | ||
+ | version: MediaWiki 1.33.2✅ | ||
+ | sitename: BITPlan royal-family Wiki | ||
+ | lang: en | ||
+ | wf_wiki.ini ✅: | ||
+ | url=http://wiki.bitplan.com | ||
+ | scriptPath= | ||
+ | user=** | ||
+ | e-mail=** | ||
+ | Mar 16, 2020 9:58:41 AM com.bitplan.mediawiki.japi.SSLWiki login | ||
+ | INFORMATION: http://wiki.bitplan.com/api.php?:Success | ||
+ | version: MediaWiki 1.27.3✅ | ||
+ | sitename: BITPlan Wiki | ||
+ | lang: en | ||
+ | wf_mediawiki-japi.ini ✅: | ||
+ | url=http://mediawiki-japi.bitplan.com | ||
+ | scriptPath= | ||
+ | user=** | ||
+ | e-mail=** | ||
+ | Mar 16, 2020 9:58:45 AM com.bitplan.mediawiki.japi.SSLWiki login | ||
+ | INFORMATION: http://mediawiki-japi.bitplan.com/api.php?:Success | ||
+ | version: MediaWiki 1.33.2✅ | ||
+ | sitename: BITPlan mediawiki-japi Wiki | ||
+ | lang: en | ||
+ | There are 0 problems | ||
+ | </source> | ||
== Usage == | == Usage == | ||
Line 43: | Line 109: | ||
= Credential mode = | = Credential mode = | ||
+ | Credential mode stores your wikis settings and credentials in an ini file in your client system's user's home directory. The password is encrypted which means its not visible. Anyone with access to the ini file can still decrypt it. | ||
Credential mode is activated by using the -u option. If you just want to see the usage it's sufficient to supply an invalid username like x | Credential mode is activated by using the -u option. If you just want to see the usage it's sufficient to supply an invalid username like x | ||
− | <source lang='bash'> | + | <source lang='bash' highlight='1'> |
./run -h -u x | ./run -h -u x | ||
− | -e (--email) WERT | + | usage: java com.bitplan.mediawiki.japi.user.WikiUser |
− | -h (--help) | + | Please visit http://mediawiki-japi.bitplan.com for usage instructions |
− | + | ||
− | -p (--password) WERT : password | + | -a (--all) : all available wikis (Vorgabe: false) |
− | -u (--user) WERT | + | -e (--email) WERT : email |
− | -w (--wikiId) WERT | + | -h (--help) : help |
− | -y (--store) | + | show this usage (Vorgabe: true) |
+ | -l (--url) WERT : url | ||
+ | -p (--password) WERT : password | ||
+ | -s (--scriptPath) WERT : scriptPath (Vorgabe: /) | ||
+ | -t (--test) : test (Vorgabe: false) | ||
+ | -u (--user) WERT : username (Vorgabe: x) | ||
+ | -v (--version) WERT : version of the wiki | ||
+ | -w (--wikiId) WERT : wiki id | ||
+ | -y (--store) : store without asking (Vorgabe: false) | ||
+ | </source> | ||
+ | == Example == | ||
+ | You might want to add the real information for | ||
+ | * -u - User | ||
+ | * -e - Email | ||
+ | * --password - Password | ||
+ | where <nowiki>**</nowiki> is shown as a placeholder | ||
+ | <source lang='bash' highlight='1'> | ||
+ | ./run -w can4eve -u ** -e ** -l http://can4eve.bitplan.com -s '' -v 'MediaWiki 1.27.3' -y --password '**' | ||
+ | created/updated properties in /Users/wf/.mediawiki-japi/wf_can4eve.ini | ||
</source> | </source> | ||
Latest revision as of 14:10, 20 May 2020
https://github.com/WolfgangFahl/Mediawiki-Japi/issues/49 has (finally) introduced command line support. The CommandLine has two modes:
- Transfer mode
- Credential mode
Transfer mode
The main purpose of transfer mode is to push pages from one wiki to another including all files on the page.
Example
./run -s wikipedia_org_test -t wikipedia_org_test2 -p PictureTestPage
Mar 16, 2020 10:29:22 AM com.bitplan.mediawiki.japi.SSLWiki login
INFORMATION: https://test2.wikipedia.org/w/api.php?:Success
File:Mona Lisa one two one two this is just a test.jpg
https://upload.wikimedia.org/wikipedia/test/8/81/Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg
Mar 16, 2020 10:29:29 AM com.bitplan.mediawiki.japi.MediaWikiApiImpl handleError
SCHWERWIEGEND: error code=fileexists-shared-forbidden info:'A file with this name exists already in the shared file repository. If you still want to upload your file, please go back and use a new name. [[File:Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg|thumb|center|Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg]]'
Mar 16, 2020 10:29:29 AM com.bitplan.mediawiki.japi.MediaWikiApiImpl handleError
SCHWERWIEGEND: error: fileexists-shared-forbidden info: A file with this name exists already in the shared file repository. If you still want to upload your file, please go back and use a new name. [[File:Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg|thumb|center|Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg]]
Exception:error: fileexists-shared-forbidden info: A file with this name exists already in the shared file repository. If you still want to upload your file, please go back and use a new name. [[File:Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg|thumb|center|Mona_Lisa_one_two_one_two_this_is_just_a_test.jpg]]
The Content of https://test.wikipedia.org/wiki/PictureTestPage is transferred to https://test2.wikipedia.org/wiki/PictureTestPage with a warning that the Mona Lisa file can not be transmitted.
Check setup and credentials
To check the setup and credentials for the wikis you'd like to use you might want to run:
./run --test -a
Example
./run --test -a
wf_wikipedia_org_test2.ini ✅:
url=https://test2.wikipedia.org
scriptPath=/w
user=**
e-mail=**
Mar 16, 2020 9:58:33 AM com.bitplan.mediawiki.japi.SSLWiki login
INFORMATION: https://test2.wikipedia.org/w/api.php?:Success
version: MediaWiki 1.35.0-wmf.23✅
sitename: Wikipedia
lang: en
wf_royals.ini ✅:
url=http://royal-family.bitplan.com
scriptPath=
user=**
e-mail=**
Mar 16, 2020 9:58:39 AM com.bitplan.mediawiki.japi.SSLWiki login
INFORMATION: http://royal-family.bitplan.com/api.php?:Success
version: MediaWiki 1.33.2✅
sitename: BITPlan royal-family Wiki
lang: en
wf_wiki.ini ✅:
url=http://wiki.bitplan.com
scriptPath=
user=**
e-mail=**
Mar 16, 2020 9:58:41 AM com.bitplan.mediawiki.japi.SSLWiki login
INFORMATION: http://wiki.bitplan.com/api.php?:Success
version: MediaWiki 1.27.3✅
sitename: BITPlan Wiki
lang: en
wf_mediawiki-japi.ini ✅:
url=http://mediawiki-japi.bitplan.com
scriptPath=
user=**
e-mail=**
Mar 16, 2020 9:58:45 AM com.bitplan.mediawiki.japi.SSLWiki login
INFORMATION: http://mediawiki-japi.bitplan.com/api.php?:Success
version: MediaWiki 1.33.2✅
sitename: BITPlan mediawiki-japi Wiki
lang: en
There are 0 problems
Usage
./run -h
Help
Mediawiki-Japi version 0.1.05
Please visit http://mediawiki-japi.bitplan.com for usage instructions
Mediawiki-Japi Version: 0.1.05
github: https://github.com/WolfgangFahl/Mediawiki-Japi
usage: java com.bitplan.mediawiki.japi.MediawikiMain
--cookie WERT : use given cookie for download
-c (--check) : check mode - tries access without writing to target
(Vorgabe: false)
-d (--debug) : debug
adds debugging output (Vorgabe: false)
-h (--help) : help
show this usage (Vorgabe: true)
-i (--imageLimit) N : the maximum number of images per page to push
(Vorgabe: 100)
-l (--login) : login to source wiki for access permission (Vorgabe:
false)
-p (--pages) STRING[] : the pages to be transferred
-s (--source) WERT : the source wiki
-t (--target) WERT : the target wiki
-u (--user) WERT : activates credential mode
use -u -h to see options
see http://mediawiki-japi.bitplan.com/index.php/Command
Line
-v (--version) : showVersion
show current version if this switch is used (Vorgabe:
false)
Credential mode
Credential mode stores your wikis settings and credentials in an ini file in your client system's user's home directory. The password is encrypted which means its not visible. Anyone with access to the ini file can still decrypt it. Credential mode is activated by using the -u option. If you just want to see the usage it's sufficient to supply an invalid username like x
./run -h -u x
usage: java com.bitplan.mediawiki.japi.user.WikiUser
Please visit http://mediawiki-japi.bitplan.com for usage instructions
-a (--all) : all available wikis (Vorgabe: false)
-e (--email) WERT : email
-h (--help) : help
show this usage (Vorgabe: true)
-l (--url) WERT : url
-p (--password) WERT : password
-s (--scriptPath) WERT : scriptPath (Vorgabe: /)
-t (--test) : test (Vorgabe: false)
-u (--user) WERT : username (Vorgabe: x)
-v (--version) WERT : version of the wiki
-w (--wikiId) WERT : wiki id
-y (--store) : store without asking (Vorgabe: false)
Example
You might want to add the real information for
- -u - User
- -e - Email
- --password - Password
where ** is shown as a placeholder
./run -w can4eve -u ** -e ** -l http://can4eve.bitplan.com -s '' -v 'MediaWiki 1.27.3' -y --password '**'
created/updated properties in /Users/wf/.mediawiki-japi/wf_can4eve.ini
Installation
./build