pymediawikidocker API Documentation
config
Created on 2023-04-06
@author: wf
Host
Host name getter
Source code in mwdocker/config.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
get_default_host()
classmethod
get the default host as the fully qualifying hostname of the computer the server runs on
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the hostname |
Source code in mwdocker/config.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
MwClusterConfig
dataclass
Bases: MwConfig
MediaWiki Cluster configuration for multiple wikis
Source code in mwdocker/config.py
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
|
addArgs(parser)
add my arguments to the given parser
Source code in mwdocker/config.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
|
MwConfig
dataclass
MediaWiki configuration for a Single Wiki
Source code in mwdocker/config.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
|
__post_init__()
post initialization configuration
Source code in mwdocker/config.py
101 102 103 104 105 106 107 108 109 110 111 112 |
|
addArgs(parser)
add Arguments to the given parser
Source code in mwdocker/config.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
|
addExtensions(extensionNameList)
add extensions for the given list of extension names
Source code in mwdocker/config.py
278 279 280 281 282 283 284 285 286 |
|
as_dict()
return my fields as a dict dataclasses to dict conversion convenienc and information hiding
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
my fields in dict format |
Source code in mwdocker/config.py
142 143 144 145 146 147 148 149 150 151 |
|
as_json()
return me as a json string
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
my json representation |
Source code in mwdocker/config.py
153 154 155 156 157 158 159 160 161 162 |
|
create_random_password(length=15)
create a random password
Parameters:
Name | Type | Description | Default |
---|---|---|---|
length(int) |
the length of the password |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
a random password with the given length |
Source code in mwdocker/config.py
228 229 230 231 232 233 234 235 236 237 238 |
|
default_docker_path()
get the default docker path
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
$HOME/.pymediawikidocker |
Source code in mwdocker/config.py
90 91 92 93 94 95 96 97 98 99 |
|
fromArgs(args)
initialize me from the given commmand line arguments
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args(Namespace) |
the command line arguments |
required |
Source code in mwdocker/config.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
|
getExtensionMap(extensionNameList=None, extensionJsonFile=None)
get map of extensions to handle
Parameters:
Name | Type | Description | Default |
---|---|---|---|
extensionNameList(list) |
a list of extension names |
required | |
extensionJsonFile(str) |
the name of an extra extensionJsonFile (if any) |
required |
Source code in mwdocker/config.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
|
getShortVersion(separator='')
get my short version e.g. convert 1.27.7 to 127
Returns:
Name | Type | Description |
---|---|---|
str |
the short version string |
Source code in mwdocker/config.py
215 216 217 218 219 220 221 222 223 224 225 226 |
|
getWikiId()
get the wikiId
Returns:
Name | Type | Description |
---|---|---|
str |
e.g. mw-9080 |
Source code in mwdocker/config.py
240 241 242 243 244 245 246 247 248 249 250 251 |
|
get_config_path()
get my configuration base path
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the path to my configuration |
Source code in mwdocker/config.py
164 165 166 167 168 169 170 171 172 173 174 |
|
load(path=None)
load the the MwConfig from the given path of if path is None (default) use the config_path for the current configuration
restores the ExtensionMap on load
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path(str) |
the path to load from |
required |
Returns:
Name | Type | Description |
---|---|---|
MwConfig |
MwConfig
|
a MediaWiki Configuration |
Source code in mwdocker/config.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
|
reset_container_base_name(container_base_name=None)
reset the container base name to the given name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
container_base_name(str) |
the new container base name |
required |
Source code in mwdocker/config.py
132 133 134 135 136 137 138 139 140 |
|
reset_url(url)
reset my url
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url(str) |
the url to set |
required |
Source code in mwdocker/config.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
save(path=None)
save my json
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path(str) |
the path to store to - if None use {docker_path}/{container_base_name}/MwConfig.json |
required |
Returns: str: the path
Source code in mwdocker/config.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
docker
Created on 2021-08-06
@author: wf
DBStatus
dataclass
the Database Status
Source code in mwdocker/docker.py
95 96 97 98 99 100 101 102 103 104 105 |
|
DockerApplication
Bases: object
MediaWiki Docker image
Source code in mwdocker/docker.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 |
|
__init__(config)
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config |
MwClusterConfig
|
MwClusterConfig, |
required |
home |
the home directory to use |
required |
Source code in mwdocker/docker.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
check()
check me
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
exitCode: 0 if ok, 1 if not ok |
Source code in mwdocker/docker.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
checkDBConnection(timeout=10, initialSleep=4.0, factor=1.5, maxTries=9)
check database connection with retries
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout |
float
|
number of seconds for timeout |
10
|
initialSleep |
float
|
number of seconds to initially wait/sleep |
4.0
|
maxTries |
int
|
maximum number of retries before giving up between each try a sleep is done that starts |
9
|
Returns:
Name | Type | Description |
---|---|---|
dbStatus |
DBStatus
|
the status |
Source code in mwdocker/docker.py
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
|
checkDockerEnvironment(debug=False)
staticmethod
check the docker environment
Parameters:
Name | Type | Description | Default |
---|---|---|---|
debug |
bool
|
if True show debug information |
False
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
an error message or None |
Source code in mwdocker/docker.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
checkWiki(version_url)
check this wiki against the content of the given version_url
Source code in mwdocker/docker.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
|
close()
close the database
Source code in mwdocker/docker.py
371 372 373 374 375 |
|
createOrModifyWikiUser(wikiId, force_overwrite=False)
create or modify the WikiUser for this DockerApplication
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wikiId |
str
|
the wikiId to create or modify a wiki user for |
required |
force_overwrite |
bool
|
if True overwrite the wikiuser info |
False
|
Source code in mwdocker/docker.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
|
createWikiUser(wikiId=None, store=False)
create my wikiUser and optionally save it
Parameters:
Name | Type | Description | Default |
---|---|---|---|
store |
bool
|
if True save my user data to the relevant ini File |
False
|
Source code in mwdocker/docker.py
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
dbClose()
close the database connection
Source code in mwdocker/docker.py
394 395 396 397 398 399 |
|
dbConnect(timeout=10)
connect to the database and return the connection
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout |
int
|
number of seconds for timeout |
10
|
Returns:
Type | Description |
---|---|
the connection |
Source code in mwdocker/docker.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
|
doCheckDBConnection(dbStatus, timeout=10)
check the database connection of this application
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout |
int
|
how many seconds to wait |
10
|
Returns:
Type | Description |
---|---|
DBStatus |
Source code in mwdocker/docker.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
|
down(forceRebuild=False)
run docker compose down
see https://docs.docker.com/engine/reference/commandline/compose_down/ and https://gabrieldemarmiesse.github.io/python-on-whales/sub-commands/compose/#down
Source code in mwdocker/docker.py
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 |
|
execute(*commands)
execute the given variable list of command strings
Parameters:
Name | Type | Description | Default |
---|---|---|---|
commands |
str
|
str - the command strings to be executed ... |
()
|
Source code in mwdocker/docker.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
|
genComposerRequire(composerFilePath, overwrite=False)
gen the composer.local.json require file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
composerFilePath |
str
|
the name of the file to generate |
required |
Source code in mwdocker/docker.py
569 570 571 572 573 574 575 576 577 |
|
generate(templateName, targetPath, overwrite=False, **kwArgs)
generate file at targetPath using the given templateName
Parameters:
Name | Type | Description | Default |
---|---|---|---|
templateName |
str
|
the Jinja2 template to use |
required |
targetPath |
str
|
the path to the target file |
required |
overwrite |
bool
|
if True overwrite existing files |
False
|
kwArgs() |
generic keyword arguments to pass on to template rendering |
required |
Source code in mwdocker/docker.py
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 |
|
generateAll(overwrite=False)
generate all files needed for the docker handling
Parameters:
Name | Type | Description | Default |
---|---|---|---|
overwrite |
bool
|
if True overwrite the existing files |
False
|
Source code in mwdocker/docker.py
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 |
|
getComposerRequire()
get the json string for the composer require e.g. composer.local.json
Source code in mwdocker/docker.py
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 |
|
getContainerName(kind, separator)
get my container Name
Source code in mwdocker/docker.py
239 240 241 242 243 244 |
|
getContainers()
get my containers
Returns:
Type | Description |
---|---|
Tuple( |
Source code in mwdocker/docker.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
|
getJinjaEnv()
get a Jinja2 environment
Source code in mwdocker/docker.py
269 270 271 272 273 274 275 276 277 278 |
|
initDB()
initialize my SQL database
Source code in mwdocker/docker.py
280 281 282 283 284 285 286 287 288 289 |
|
installExtensions()
install all extensions
Source code in mwdocker/docker.py
291 292 293 294 295 296 |
|
optionalWrite(targetPath, content, overwrite=False)
optionally Write the modified content to the given targetPath
Parameters:
Name | Type | Description | Default |
---|---|---|---|
targetPath |
str
|
the path to write the content to |
required |
content |
str
|
the content to write |
required |
overwrite |
bool
|
if True overwrite the existing content |
False
|
Source code in mwdocker/docker.py
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
|
sqlQuery(query)
run the given SQL query
Source code in mwdocker/docker.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
|
start(forceRebuild=False, withInitDB=True)
start my containers
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forceRebuild |
bool
|
if True force rebuilding |
False
|
withInitDB |
bool
|
if True intialize my database |
True
|
Source code in mwdocker/docker.py
743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 |
|
startUp()
run startUp scripts
Source code in mwdocker/docker.py
298 299 300 301 302 303 304 305 306 307 |
|
up(forceRebuild=False)
start this docker application
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forceRebuild |
bool
|
if true stop and remove the existing containers |
False
|
Source code in mwdocker/docker.py
684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 |
|
DockerContainer
helper class for docker container info
Source code in mwdocker/docker.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
__init__(name, kind, container)
constructor
Source code in mwdocker/docker.py
52 53 54 55 56 57 58 |
|
check()
check the given docker container
print check message and Return if container is running
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dc |
the docker container |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
True if the container is not None |
Source code in mwdocker/docker.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
getHostPort(local_port=80)
get the host port for the given local port
Parameters:
Name | Type | Description | Default |
---|---|---|---|
local_port |
int
|
the local port to get the mapping for |
80
|
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
the host port or None |
Source code in mwdocker/docker.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
DockerMap
helper class to convert lists of docker elements to maps for improved lookup functionality
Source code in mwdocker/docker.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
getContainerMap()
staticmethod
get a map/dict of containers by container name
Source code in mwdocker/docker.py
35 36 37 38 39 40 41 42 43 44 |
|
html_table
Created on 2022-10-25
@author: wf
HtmlTables
Bases: WebScrape
HtmlTables extractor
Source code in mwdocker/html_table.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
__init__(url, debug=False, showHtml=False)
Constructor
url(str): the url to read the tables from debug(bool): if True switch on debugging showHtml(bool): if True show the HTML retrieved
Source code in mwdocker/html_table.py
14 15 16 17 18 19 20 21 22 23 |
|
get_tables(header_tag=None)
get all tables from my soup as a list of list of dicts
Parameters:
Name | Type | Description | Default |
---|---|---|---|
header_tag(str) |
if set search the table name from the given header tag |
required |
Return
dict: the list of list of dicts for all tables
Source code in mwdocker/html_table.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
logger
Created on 2022-10-25
@author: wf
Logger
Bases: object
simple logger
Source code in mwdocker/logger.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
check_and_log(msg, ok)
classmethod
log the given message with the given ok flag
Parameters:
Name | Type | Description | Default |
---|---|---|---|
msg(str) |
the message to log/print |
required | |
ok(bool) |
if True show ✅ marker else ❌ |
required |
Return
bool: the ok parameter for fluid syntax
Source code in mwdocker/logger.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
mariadb
Created on 2022-10-25
@author: wf
MariaDB
Maria DB handling
Source code in mwdocker/mariadb.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
getVersion(versionStr)
classmethod
get the version from the version String
Parameters:
Name | Type | Description | Default |
---|---|---|---|
versionStr(str) |
the version string to check |
required |
Return
str: the extracted version
Source code in mwdocker/mariadb.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
mw
Created on 2021-06-23
@author: wf
Extension
represents a MediaWiki extension
Source code in mwdocker/mw.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
asScript(branch='master')
return me as a shell Script command line list
Parameters:
Name | Type | Description | Default |
---|---|---|---|
branch(str) |
the branch to clone |
required |
Source code in mwdocker/mw.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
asWikiMarkup()
return me as wiki Markup
Source code in mwdocker/mw.py
102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
fromSpecialVersionTR(exttr, debug=False)
classmethod
Construct an extension from a beautifl soup TR tag derived from Special:Version
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exttr |
the beautiful soup TR tag |
required | |
debug(bool) |
if True show debugging information |
required |
Source code in mwdocker/mw.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
getDetailsFromUrl(showHtml=False, debug=False)
get more details from my url
Source code in mwdocker/mw.py
88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
getLocalSettingsLine(mwShortVersion)
get my local settings line
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mwShortVersion(str) |
the MediaWiki short version e.g. 127 |
required |
Returns:
Type | Description |
---|---|
entry for LocalSettings |
Source code in mwdocker/mw.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
ExtensionList
represents a list of MediaWiki extensions
Source code in mwdocker/mw.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
fromSpecialVersion(url, excludes=['skin', 'editor'], showHtml=False, debug=False)
classmethod
get an extension List from the given url
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url(str) |
the Special:Version MediaWiki page to read the information from |
required | |
exclude |
list
|
a list of types of extensions to exclude |
required |
showHtml(bool) |
True if the html code should be printed for debugging |
required | |
debug(bool) |
True if debugging should be active |
required |
Returns:
Name | Type | Description |
---|---|---|
ExtensionList |
an extension list derived from the url |
Source code in mwdocker/mw.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
restore()
classmethod
restore the extension list
Source code in mwdocker/mw.py
214 215 216 217 218 219 220 221 222 |
|
storeFilePrefix()
staticmethod
get my storeFilePrefix
Returns:
Name | Type | Description |
---|---|---|
str |
the path to where my stored files (e.g. JSON) should be kept |
Source code in mwdocker/mw.py
165 166 167 168 169 170 171 172 173 174 175 176 |
|
mwcluster
Created on 2021-08-06 @author: wf
MediaWikiCluster
Bases: object
a cluster of mediawiki docker Applications
Source code in mwdocker/mwcluster.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
__init__(config)
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config(MWClusterConfig) |
the MediaWiki Cluster Configuration to use |
required |
Source code in mwdocker/mwcluster.py
31 32 33 34 35 36 37 38 39 |
|
check()
check the composer applications
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
exitCode - 0 if ok 1 if failed |
Source code in mwdocker/mwcluster.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
checkDocker()
check the Docker environment
print an error message on stderr if check fails
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
exitCode - 0 if ok 1 if failed |
Source code in mwdocker/mwcluster.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
close()
close my apps
Source code in mwdocker/mwcluster.py
139 140 141 142 143 144 |
|
createApps(withGenerate=True)
create my apps
Parameters:
Name | Type | Description | Default |
---|---|---|---|
withGenerate(bool) |
if True generate the config files |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
str
|
a dict of apps by version |
Source code in mwdocker/mwcluster.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
down(forceRebuild=False)
run docker compose down
Source code in mwdocker/mwcluster.py
91 92 93 94 95 96 97 98 99 100 |
|
getDockerApplication(i, count, version)
get the docker application for the given version index and version
Parameters:
Name | Type | Description | Default |
---|---|---|---|
i(int) |
the index of the version |
required | |
count(int) |
total number of Docker applications in this cluster |
required | |
version(str) |
the mediawiki version to use |
required |
Returns:
Name | Type | Description |
---|---|---|
DockerApplication |
the docker application |
Source code in mwdocker/mwcluster.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
listWikis()
list my wikis
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
exitCode - 0 if ok 1 if failed |
Source code in mwdocker/mwcluster.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
start(forceRebuild=False, withInitDB=True)
create and start the composer applications
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
exitCode - 0 if ok 1 if failed |
Source code in mwdocker/mwcluster.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
main(argv=None)
main program.
Source code in mwdocker/mwcluster.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
version
Created on 2022-04-07
@author: wf
Version
Bases: object
Version handling for pymediawikidocker
Source code in mwdocker/version.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
webscrape
Created on 2020-08-20
@author: wf
WebScrape
Bases: object
WebScraper
Source code in mwdocker/webscrape.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
__init__(debug=False, showHtml=False)
Constructor
Source code in mwdocker/webscrape.py
16 17 18 19 20 21 22 23 |
|
getSoup(url, showHtml)
get the beautiful Soup parser
Parameters:
Name | Type | Description | Default |
---|---|---|---|
showHtml(boolean) |
True if the html code should be pretty printed and shown |
required |
Source code in mwdocker/webscrape.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
printPrettyHtml(soup)
print the prettified html for the given soup
Parameters:
Name | Type | Description | Default |
---|---|---|---|
soup(BeuatifulSoup) |
the parsed html to print |
required |
Source code in mwdocker/webscrape.py
40 41 42 43 44 45 46 47 48 |
|