Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mahara-scripts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
mahara
mahara-scripts
Commits
0b3a4174
Commit
0b3a4174
authored
May 24, 2011
by
Richard Mansfield
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitorious.org:mahara/mahara-scripts
parents
a40b2a02
4908e2bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
30 deletions
+14
-30
mt2mw/mt2mw.py
mt2mw/mt2mw.py
+11
-18
mt2mw/page.py
mt2mw/page.py
+1
-10
release.sh
release.sh
+2
-2
No files found.
mt2mw/mt2mw.py
View file @
0b3a4174
# mt2mw -- package for migrating a Mindtouch wiki to MediaWiki
# Copyright (C) 2010 Catalyst IT Ltd
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# system library
import
ConfigParser
as
cp
...
...
@@ -26,19 +9,24 @@ cfg = cp.SafeConfigParser()
cfg
.
read
(
'config.ini'
)
# get the root element in the page structure
print
"Attempting to get the mindtouch wiki layout"
mtwiki
=
MTWiki
(
cfg
.
get
(
'config'
,
'mindtouch_url'
))
homepage
=
mtwiki
.
get_sitemap
()
if
homepage
:
print
"Have mindtouch layout."
directdb
=
cfg
.
get
(
'config'
,
'direct_db'
)
dbconfig
=
None
if
directdb
:
dbconfig
=
{
'host'
:
cfg
.
get
(
'config'
,
'mediawiki_db_host'
),
'port'
:
cfg
.
get
(
'config'
,
'mediawiki_db_port'
),
'database'
:
cfg
.
get
(
'config'
,
'mediawiki_db'
),
'user'
:
cfg
.
get
(
'config'
,
'mediawiki_db_user'
),
'password'
:
cfg
.
get
(
'config'
,
'mediawiki_db_password'
),
}
print
"Attempting to create mediawiki connection"
mwwiki
=
MWWiki
(
cfg
.
get
(
'config'
,
'mediawiki_url'
),
cfg
.
get
(
'config'
,
'mediawiki_user'
),
...
...
@@ -46,10 +34,15 @@ mwwiki = MWWiki(
dbconfig
,
cfg
.
get
(
'config'
,
'dataroot'
),
)
if
mwwiki
:
print
"MediaWiki Connection created"
print
"Creating MediaWiki from mindtouch site..."
mwwiki
.
create_from_mindtouch
(
homepage
)
print
"MediaWiki updated"
# point MediaWiki:MainPage at the new homepage
print
"Updating MediaWiki homepage"
mwwiki
.
update_mainpage
(
homepage
)
mwwiki
.
done
()
print
"All done!"
mt2mw/page.py
View file @
0b3a4174
...
...
@@ -101,14 +101,5 @@ def html2wiki(html):
out
,
err
=
converter
.
communicate
(
input
=
html
)
if
err
:
raise
Exception
(
err
)
# the HTML::WikiConverter module does something funny with urlencoded characters
# in the link portion of a wiki link. The title portion appears to be fine
# we need to replace sets of two consecutive url-encoded characters (4 bytes)
# with the outer two bytes, when those sets are found between
out
=
urllib2
.
quote
(
out
)
links
=
re
.
findall
(
'%5B%5B(.*?)%7C.*?%5B%5B'
,
out
)
for
link
in
links
:
fixedlink
=
re
.
sub
(
'((%[0-9A-F]{2}){4})'
,
reducechars
,
link
)
out
=
out
.
replace
(
link
,
fixedlink
)
return
urllib2
.
unquote
(
out
)
return
out
release.sh
View file @
0b3a4174
...
...
@@ -238,8 +238,8 @@ echo "lp-project-upload mahara ${RELEASE} mahara-${RELEASE}.tar.bz2" >> ${CURREN
echo
"lp-project-upload mahara
${
RELEASE
}
mahara-
${
RELEASE
}
.zip"
>>
${
CURRENTDIR
}
/
${
CLEANUPSCRIPT
}
echo
"echo"
>>
${
CURRENTDIR
}
/
${
CLEANUPSCRIPT
}
echo
"echo
All done. Once you've checked that the files were uploaded successfully, run this:
"
>>
${
CURRENTDIR
}
/
${
CLEANUPSCRIPT
}
echo
"echo
rm -rf
${
BUILDDIR
}
"
>>
${
CURRENTDIR
}
/
${
CLEANUPSCRIPT
}
echo
"echo
\"
All done. Once you've checked that the files were uploaded successfully, run this:
\"
"
>>
${
CURRENTDIR
}
/
${
CLEANUPSCRIPT
}
echo
"echo
\"
rm -rf
${
BUILDDIR
}
\"
"
>>
${
CURRENTDIR
}
/
${
CLEANUPSCRIPT
}
chmod
700
${
CURRENTDIR
}
/
${
CLEANUPSCRIPT
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment