~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to MoinMoin/script/old/migration/12_to_13_mig04.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mfrom: (0.9.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080622211713-fpo2zrq3s5dfecxg
Tags: 1.7.0-3
Simplify /etc/moin/wikilist format: "USER URL" (drop unneeded middle
CONFIG_DIR that was wrongly advertised as DATA_DIR).  Make
moin-mass-migrate handle both formats and warn about deprecation of
the old one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
    * data/user/<uid>.bookmark -> convert to usecs
7
7
    * data/edit-log and data/pages/PageName/edit-log -> convert to usecs
8
8
    * data/event-log -> convert to usecs
9
 
    
 
9
 
10
10
    Steps for a successful migration:
11
11
 
12
12
        1. Stop your wiki and make a backup of old data and code
55
55
    return long(ts_to) # must be long for py 2.2.x
56
56
 
57
57
def convert_eventlog(file_from, file_to):
58
 
    if not os.path.exists(file_from): 
 
58
    if not os.path.exists(file_from):
59
59
        return
60
60
    f = open(file_to, 'a')
61
61
    for l in open(file_from):
66
66
        data = '\t'.join(data)
67
67
        f.write(data)
68
68
    f.close()
69
 
        
 
69
 
70
70
def convert_editlog(file_from, file_to):
71
 
    if not os.path.exists(file_from): 
 
71
    if not os.path.exists(file_from):
72
72
        return
73
73
    f = open(file_to, 'a')
74
74
    for l in open(file_from):
79
79
        data = '\t'.join(data)
80
80
        f.write(data)
81
81
    f.close()
82
 
        
 
82
 
83
83
def convert_pagedir(dir_from, dir_to, is_backupdir=0):
84
84
    os.mkdir(dir_to)
85
85
    for pagedir in listdir(dir_from):
87
87
        text_to = opj(dir_to, pagedir, 'text')
88
88
        os.mkdir(opj(dir_to, pagedir))
89
89
        copy_file(text_from, text_to)
90
 
        
 
90
 
91
91
        backupdir_from = opj(dir_from, pagedir, 'backup')
92
92
        backupdir_to = opj(dir_to, pagedir, 'backup')
93
93
        if os.path.exists(backupdir_from):
97
97
                backup_from = opj(backupdir_from, ts)
98
98
                backup_to = opj(backupdir_to, ts_usec)
99
99
                copy_file(backup_from, backup_to)
100
 
        
 
100
 
101
101
        editlog_from = opj(dir_from, pagedir, 'edit-log')
102
102
        editlog_to = opj(dir_to, pagedir, 'edit-log')
103
103
        convert_editlog(editlog_from, editlog_to)
104
 
        
 
104
 
105
105
        #cachedir_from = opj(dir_from, pagedir, 'cache')
106
106
        #cachedir_to = opj(dir_to, pagedir, 'cache')
107
107
        #if os.path.exists(cachedir_from):