Skip to content

Commit

Permalink
Merge pull request #1491 from UlrichB22/upd_quickinstall
Browse files Browse the repository at this point in the history
Remove import19 from quickinstall, add logging conf example, upd docs.
  • Loading branch information
RogerHaase authored Sep 2, 2023
2 parents 78fde08 + 81747a5 commit 6ec941d
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 38 deletions.
8 changes: 4 additions & 4 deletions docs/admin/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ has one parameter - the index directory::
the `temporary location`.


moin index script reference
===========================
You can use the ``moin index-*`` group of script commands to manage indexes.
moin index subcommand reference
===============================
You can use the ``moin index-*`` group of cli subcommands to manage indexes.

Many of the script commands for index management support a `--tmp` option to use
Many of the cli commands for index management support a `--tmp` option to use
the temporary index location. This is useful if you want to do index operations
in parallel to a running wiki which is still using the index at the normal
index location.
Expand Down
2 changes: 0 additions & 2 deletions docs/admin/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ Typing "./m" (or "m" on Windows) will display a menu similar to:
new-wiki create empty wiki
sample create wiki and load sample data
restore * create wiki and restore wiki/backup.moin *option, specify file
import19 <dir> import a moin 1.9 wiki/data instance from <dir>

run * run built-in wiki server *options (--port 8081)
backup * roll 3 prior backups and create new backup *option, specify file
Expand Down Expand Up @@ -265,7 +264,6 @@ help by reporting bugs), then some logical menu choices are::
./m docs # create docs, see User tab, Documentation (local)
./m del-wiki # get rid of the sample data
./m new-wiki # create empty wiki or
./m import19 ... # import moin 1.9 data
./m backup # backup wiki data as needed or as scheduled

If you installed moin2 by cloning the repository,
Expand Down
15 changes: 8 additions & 7 deletions docs/admin/upgrade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,18 @@ log for each deleted page.

Importing your moin 1.9 data
----------------------------
Assuming you have no moin2 storage and no index directories created yet, include the
-s and -i options to create the storage and an index.
Before importing your existing wiki data please ensure you have created an instance
and index as described in the install section above using commands::

The import19 argument to the `moin` script will read your 1.9 data_dir (pages, attachments and users),
moin create-instance
moin index-create

The import19 cli subcommand will read your 1.9 data_dir (pages, attachments and users),
convert the data, write it to your moin2 storage and build the index::

moin import19 -s -i --data_dir /<path to moin1.9>/wiki/data 1>import19out.log 2>import19err.log
moin import19 --data_dir /<path to moin1.9>/wiki/data

If you use the command as given, it will write all stdout and stderr output into two log files.
Please review them to find out whether the importer had critical issues with your
data.
Please review the logfile to find out whether the importer had critical issues with your data.

By default, all items using moin 1.9 markup are converted to moin 2 markup. The converted
revision will have a timestamp one second later than the last revision's timestamp to preserve
Expand Down
43 changes: 43 additions & 0 deletions docs/examples/config/logging/logfile_cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[DEFAULT]
# Logfile to create.
# Make sure the running moin process has create/write rights there.
logfile=/var/log/moin.cli.log

# Default loglevel, to adjust verbosity: DEBUG, INFO, WARNING, ERROR, CRITICAL
loglevel=DEBUG

[loggers]
disable_existing_loggers=1
keys=root

[handlers]
keys=logfile,console

[formatters]
keys=logfile,console

[logger_root]
level=%(loglevel)s
propagate=0
handlers=logfile,console

[handler_logfile]
class=FileHandler
formatter=logfile
level=%(loglevel)s
args=('%(logfile)s', 'a')

[handler_console]
class=StreamHandler
level=INFO
formatter=console
args=(sys.stdout,)

[formatter_logfile]
format=%(asctime)s %(levelname)s %(name)s:%(lineno)d %(message)s
datefmt=
class=logging.Formatter

[formatter_console]
format=%(asctime)s %(levelname)s %(message)s

26 changes: 6 additions & 20 deletions quickinstall.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/python3
# Copyright: 2013 MoinMoin:BastianBlank
# Copyright: 2013-2018 MoinMoin:RogerHaase
# Copyright: 2023 MoinMoin:UlrichB
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
"""
Create a virtual environment and install moin2 and all requirements in development mode.
Expand Down Expand Up @@ -112,8 +113,6 @@
new-wiki create empty wiki
sample create wiki and load sample data
restore * create wiki and restore wiki/backup.moin *option, specify file
import19 <dir> <args> import a moin1.9 wiki/data instance from <dir> with <args>
where <args> = "--markup_out moinwiki" or markdown,rst,html,...
run * run built-in wiki server *options (--port 8081)
backup * roll 3 prior backups and create new backup *option, specify file
Expand Down Expand Up @@ -344,7 +343,7 @@ def log_help(logs):

def cmd_new_wiki(self, *args):
"""create empty wiki"""
command = 'moin index-create -s -i'
command = 'moin index-create'
print('Creating a new empty wiki...')
make_wiki(command) # share code with loading sample data and restoring backups

Expand All @@ -354,7 +353,7 @@ def cmd_sample(self):

def cmd_restore(self, *args):
"""create wiki and load data from wiki/backup.moin or user specified path"""
command = 'moin index-create -s -i{0} moin load --file %s{0} moin index-build'.format(SEP)
command = 'moin index-create{0} moin load --file %s{0} moin index-build'.format(SEP)
filename = BACKUP_FILENAME
if args:
filename = args[0]
Expand All @@ -367,26 +366,13 @@ def cmd_restore(self, *args):
self.run_time('Restore')

def cmd_import19(self, *args):
"""import a moin 1.9 wiki directory named dir"""
if args:
dirname = args[0]
if os.path.isdir(dirname):
command = 'moin import19 -s -i --data_dir {0}'.format(dirname)
if len(args) > 1:
# expect "--markup markdown" or ?
command += ' ' + ' '.join(args[1:])
print('Creating a new wiki populated with data from {0}...'.format(dirname))
make_wiki(command)
else:
print('Error: cannot create wiki because {0} does not exist.'.format(dirname))
else:
print('Error: a path to the Moin 1.9 wiki/data data directory is required.')
self.run_time('Import19')
"""import a moin 1.9 wiki"""
print("Error: Subcommand import19 not supported. Please use 'moin import19'.")

def cmd_index(self, *args):
"""delete and rebuild index"""
if wiki_exists():
command = 'moin index-create -i{0} moin index-build'.format(SEP)
command = 'moin index-create{0} moin index-build'.format(SEP)
print('Rebuilding indexes...')
try:
with open(INDEX, 'w') as messages:
Expand Down
8 changes: 3 additions & 5 deletions src/moin/cli/migration/moin19/import19.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def cli():

def migr_logging(msg_id, log_msg):
'''
logging function writes first messages of each type with warning level
and the rest with debug level only.
TODO: add example of logging.conf
The logging function writes the first messages of each type
with warning level and the rest with debug level only.
See docs/examples/config/logging/logfile_cli for logging configuration example
'''
migr_stat[msg_id] += 1
if migr_stat[msg_id] < migr_warn_max:
Expand Down Expand Up @@ -531,8 +531,6 @@ def process_categories(meta, data, item_category_regex):
# unexpected text before and after categories survives, any text between categories is deleted
start = matches[0].start()
end = matches[-1].end()
# TODO: remove these comment lines
# print(' Converted Categories to Tags: {0}'.format(tags))
rest = categories[:start] + categories[end:]
data += '\r\n' + rest.lstrip()
data = data.rstrip() + '\r\n'
Expand Down

0 comments on commit 6ec941d

Please sign in to comment.