Skip to content

Latest commit

 

History

History
89 lines (58 loc) · 2.95 KB

DEV.md

File metadata and controls

89 lines (58 loc) · 2.95 KB

WikiTeam3 internal

Images.txt structure

filename + "\t" + url + "\t" + uploader
+ "\t" + (str(size) if size else NULL)
+ "\t" + (str(sha1) if sha1 else NULL)
+ "\t" + (timestamp if timestamp else NULL)
+ "\n"

*optional fields:

  • "null" (magic None value, since wikiteam3 v4.0.0)
  • "False" (magic None value, before wikiteam3 v4.0.0)
  • not present (ancient wikiteam3 versions)

Snippets

API Output format

https://www.mediawiki.org/wiki/API:Data_formats#Output

The standard and default output format in MediaWiki is JSON. All other formats are discouraged.

The output format should always be specified using format=yourformat with yourformat being one of the following:

json: JSON format. (recommended)
php: serialized PHP format. (deprecated)
xml: XML format. (deprecated)
txt: PHP print_r() format. (removed in 1.27)
dbg: PHP var_export() format. (removed in 1.27)
yaml: YAML format. (removed in 1.27)
wddx: WDDX format. (removed in 1.26)
dump: PHP var_dump() format. (removed in 1.26)
none: Returns a blank response. 1.21+

In our practice, json is not available for some old wikis.

Allpages

https://www.mediawiki.org/wiki/API:Allpages (>= 1.8)

Allimages

https://www.mediawiki.org/wiki/API:Allimages (>= 1.13)

Redirects

https://www.mediawiki.org/wiki/Manual:Redirect_table

Logs

https://www.mediawiki.org/wiki/Manual:Logging_table

Continuation

https://www.mediawiki.org/wiki/API:Continue (≥ 1.26) https://www.mediawiki.org/wiki/API:Raw_query_continue (≥ 1.9)

From MediaWiki 1.21 to 1.25, it was required to specify continue= (i.e. with an empty string as the value) in the initial request to get continuation data in the format described above. Without doing that, API results would indicate there is additional data by returning a query-continue element, explained in Raw query continue. Prior to 1.21, that raw continuation (query-continue) was the only option.

If your application needs to use the raw continuation in MediaWiki 1.26 or later, you must specify rawcontinue= to request it.

Workarounds

truncated API response causes infinite loop

mediawiki-client-tools#166 https://phabricator.wikimedia.org/T86611

wikiteam3 workaround: https://github.com/saveweb/wikiteam3/commit/76465d34898b80e8c0eb6d9652aa8efa403a7ce7

MWUnknownContentModelException

"The content model xxxxxx is not registered on this wiki;"

Some extensions use custom content models for their own purposes, but they did not register a handler to export their content.

wikiteam3 workaround: https://github.com/saveweb/wikiteam3/commit/fd5a02a649dcf3bdab7ac1268445b0550130e6ee

Insecure SSL

https://docs.openssl.org/1.1.1/man1/ciphers/ https://docs.openssl.org/master/man1/openssl-ciphers/

wikiteam3 workaround:

class WakeTLSAdapter(requests.adapters.HTTPAdapter):
"""
Workaround for bad SSL/TLS
"""
def init_poolmanager(self, connections, maxsize, block=False):
# https://www.openssl.org/docs/manmaster/man1/openssl-ciphers.html
ctx = create_urllib3_context(ciphers="ALL:COMPLMENTOFDEFAULT:eNULL:@SECLEVEL=0")
ctx.options &= ~ssl.OP_NO_TLSv1_3 & ~ssl.OP_NO_TLSv1_2 & ~ssl.OP_NO_TLSv1_1 & ~ssl.OP_NO_TLSv1
with warnings.catch_warnings():
warnings.filterwarnings("ignore",category=DeprecationWarning)
ctx.minimum_version = ssl.TLSVersion.TLSv1
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
self.poolmanager = PoolManager(
num_pools=connections,
maxsize=maxsize,
block=block,
ssl_context=ctx
)