Back to index

moin  1.9.0~rc2
Functions | Variables
MoinMoin.script.old.migration.12_to_13_mig04 Namespace Reference

Functions

def convert_ts
def convert_eventlog
def convert_editlog
def convert_pagedir
def convert_userdir

Variables

string origdir = 'data.pre-mig4'

Function Documentation

Definition at line 70 of file 12_to_13_mig04.py.

00070 
00071 def convert_editlog(file_from, file_to):
00072     if not os.path.exists(file_from):
00073         return
00074     f = open(file_to, 'a')
00075     for l in open(file_from):
00076         data = l.split('\t')
00077         pagename = data[0]
00078         timestamp = data[2]
00079         data[2] = str(convert_ts(float(timestamp))) # we want usecs
00080         data = '\t'.join(data)
00081         f.write(data)
00082     f.close()

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 57 of file 12_to_13_mig04.py.

00057 
00058 def convert_eventlog(file_from, file_to):
00059     if not os.path.exists(file_from):
00060         return
00061     f = open(file_to, 'a')
00062     for l in open(file_from):
00063         if not l.strip():
00064             continue
00065         data = l.split('\t')
00066         data[0] = str(convert_ts(float(data[0]))) # we want usecs
00067         data = '\t'.join(data)
00068         f.write(data)
00069     f.close()

Here is the call graph for this function:

def MoinMoin.script.old.migration.12_to_13_mig04.convert_pagedir (   dir_from,
  dir_to,
  is_backupdir = 0 
)

Definition at line 83 of file 12_to_13_mig04.py.

00083 
00084 def convert_pagedir(dir_from, dir_to, is_backupdir=0):
00085     os.mkdir(dir_to)
00086     for pagedir in listdir(dir_from):
00087         text_from = opj(dir_from, pagedir, 'text')
00088         text_to = opj(dir_to, pagedir, 'text')
00089         os.mkdir(opj(dir_to, pagedir))
00090         copy_file(text_from, text_to)
00091 
00092         backupdir_from = opj(dir_from, pagedir, 'backup')
00093         backupdir_to = opj(dir_to, pagedir, 'backup')
00094         if os.path.exists(backupdir_from):
00095             os.mkdir(backupdir_to)
00096             for ts in listdir(backupdir_from):
00097                 ts_usec = str(convert_ts(float(ts)))
00098                 backup_from = opj(backupdir_from, ts)
00099                 backup_to = opj(backupdir_to, ts_usec)
00100                 copy_file(backup_from, backup_to)
00101 
00102         editlog_from = opj(dir_from, pagedir, 'edit-log')
00103         editlog_to = opj(dir_to, pagedir, 'edit-log')
00104         convert_editlog(editlog_from, editlog_to)
00105 
00106         #cachedir_from = opj(dir_from, pagedir, 'cache')
00107         #cachedir_to = opj(dir_to, pagedir, 'cache')
00108         #if os.path.exists(cachedir_from):
00109         #    os.mkdir(cachedir_to)
00110         #    try:
00111         #        copy_file(
00112         #            opj(cachedir_from, 'hitcounts'),
00113         #            opj(cachedir_to, 'hitcounts'))
00114         #    except: pass
00115 
00116         attachdir_from = opj(dir_from, pagedir, 'attachments')
00117         attachdir_to = opj(dir_to, pagedir, 'attachments')
00118         if os.path.exists(attachdir_from):
00119             try:
00120                 copy_dir(attachdir_from, attachdir_to)
00121             except: pass
00122 

Here is the call graph for this function:

Definition at line 50 of file 12_to_13_mig04.py.

00050 
00051 def convert_ts(ts_from):
00052     if ts_from > 5000000000: # far more than 32bits?
00053         ts_to = ts_from # we already have usec kind of timestamp
00054     else:
00055         ts_to = wikiutil.timestamp2version(ts_from)
00056     return long(ts_to) # must be long for py 2.2.x

Here is the caller graph for this function:

Definition at line 123 of file 12_to_13_mig04.py.

00123 
00124 def convert_userdir(dir_from, dir_to):
00125     os.mkdir(dir_to)
00126     for fname in listdir(dir_from):
00127         if fname.endswith('.bookmark'):
00128             bm = open(opj(dir_from, fname)).read().strip()
00129             bm = str(wikiutil.timestamp2version(float(bm)))
00130             f = open(opj(dir_to, fname), 'w')
00131             f.write(bm)
00132             f.close()
00133         else:
00134             copy_file(opj(dir_from, fname), opj(dir_to, fname))
00135 

Here is the call graph for this function:


Variable Documentation

Definition at line 136 of file 12_to_13_mig04.py.