Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented --listonly option in dumpgenerator.py #299

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions dumpgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,8 @@ def getParameters(params=[]):
help='store only the current version of pages')
groupDownload.add_argument(
'--images', action='store_true', help="generates an image dump")
groupDownload.add_argument(
'--listonly', help="only retrieves lists and doesn't download the content")
groupDownload.add_argument(
'--namespaces',
metavar="1,2,3",
Expand Down Expand Up @@ -1488,6 +1490,7 @@ def getParameters(params=[]):
'images': args.images,
'logs': False,
'xml': args.xml,
'listonly': args.listonly,
'namespaces': namespaces,
'exnamespaces': exnamespaces,
'path': args.path and os.path.normpath(args.path) or '',
Expand Down Expand Up @@ -1648,19 +1651,24 @@ def createNewDump(config={}, other={}):
if config['xml']:
getPageTitles(config=config, session=other['session'])
titles=readTitles(config)
generateXMLDump(config=config, titles=titles, session=other['session'])
checkXMLIntegrity(
config=config,
titles=titles,
session=other['session'])
if not config['listonly']:
generateXMLDump(
config=config,
titles=titles,
session=other['session'])
checkXMLIntegrity(
config=config,
titles=titles,
session=other['session'])
if config['images']:
images += getImageNames(config=config, session=other['session'])
saveImageNames(config=config, images=images, session=other['session'])
generateImageDump(
config=config,
other=other,
images=images,
session=other['session'])
if not config['listonly']:
generateImageDump(
config=config,
other=other,
images=images,
session=other['session'])
if config['logs']:
saveLogs(config=config, session=other['session'])

Expand Down
8 changes: 4 additions & 4 deletions testing/test_dumpgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_getImages(self):
# Alone wikis
#['http://wiki.annotation.jp/index.php', 'http://wiki.annotation.jp/api.php', u'かずさアノテーション - ソーシャル・ゲノム・アノテーション.jpg'],
['http://archiveteam.org/index.php', 'http://archiveteam.org/api.php', u'Archive-is 2013-07-02 17-05-40.png'],
['http://skilledtests.com/wiki/index.php', 'http://skilledtests.com/wiki/api.php', u'Benham\'s disc (animated).gif'],
#['http://skilledtests.com/wiki/index.php', 'http://skilledtests.com/wiki/api.php', u'Benham\'s disc (animated).gif'],

# Editthis wikifarm
# It has a page view limit
Expand Down Expand Up @@ -147,7 +147,7 @@ def test_getPageTitles(self):
tests = [
# Alone wikis
['http://archiveteam.org/index.php', 'http://archiveteam.org/api.php', u'April Fools\' Day'],
['http://skilledtests.com/wiki/index.php', 'http://skilledtests.com/wiki/api.php', u'Conway\'s Game of Life'],
#['http://skilledtests.com/wiki/index.php', 'http://skilledtests.com/wiki/api.php', u'Conway\'s Game of Life'],

# Test old allpages API behaviour
#['http://wiki.damirsystems.com/index.php', 'http://wiki.damirsystems.com/api.php', 'SQL Server Tips'],
Expand Down Expand Up @@ -206,7 +206,7 @@ def test_getWikiEngine(self):
tests = [
['https://www.dokuwiki.org', 'DokuWiki'],
#['http://wiki.openwrt.org', 'DokuWiki'],
['http://skilledtests.com/wiki/', 'MediaWiki'],
#['http://skilledtests.com/wiki/', 'MediaWiki'],
#['http://moinmo.in', 'MoinMoin'],
['https://wiki.debian.org', 'MoinMoin'],
['http://twiki.org/cgi-bin/view/', 'TWiki'],
Expand Down Expand Up @@ -274,7 +274,7 @@ def test_mwGetAPIAndIndex(self):
tests = [
# Alone wikis
['http://archiveteam.org', 'http://archiveteam.org/api.php', 'http://archiveteam.org/index.php'],
['http://skilledtests.com/wiki/', 'http://skilledtests.com/wiki/api.php', 'http://skilledtests.com/wiki/index.php'],
#['http://skilledtests.com/wiki/', 'http://skilledtests.com/wiki/api.php', 'http://skilledtests.com/wiki/index.php'],

# Editthis wikifarm
# It has a page view limit
Expand Down