Skip to content
This repository was archived by the owner on Sep 23, 2023. It is now read-only.

Commit bc3e798

Browse files
edg2sMatmaRex
authored andcommitted
Import pages by installed extensions
Fixes #344
1 parent f2cbfeb commit bc3e798

13 files changed

+24
-6
lines changed

new/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ php $PATCHDEMO/wikis/$NAME/w/maintenance/install.php \
1717
# apply our default settings
1818
cat $PATCHDEMO/localsettings/core.txt >> $PATCHDEMO/wikis/$NAME/w/LocalSettings.php
1919

20-
# apply extension/skin/service-sepcific setings
20+
# apply extension/skin/service-specific settings
2121
while IFS=' ' read -r repo dir; do
2222
filename=$(echo $repo | sed "s/\//-/g" | sed "s/^mediawiki-//")
2323
if [ -f $PATCHDEMO/localsettings/$filename.txt ]; then

new/postinstall.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,23 @@ if [ -d $PATCHDEMO/wikis/$NAME/w/extensions/SecurePoll ]; then
3838
php $PATCHDEMO/wikis/$NAME/w/maintenance/createAndPromote.php "Patch Demo" --force --custom-groups electionadmin
3939
fi
4040

41-
# import XML dumps
42-
for page in $(find $PATCHDEMO/pages -name "*.xml" -not -type d -printf '%P\n')
41+
# import extension/skin/service-specific XML dumps
42+
while IFS=' ' read -r repo dir; do
43+
filename=$(echo $repo | sed "s/\//-/g" | sed "s/^mediawiki-//")
44+
if [ -d $PATCHDEMO/wikis/$NAME/$dir ]; then
45+
# matches extension-foo.xml or extension-foo-*.xml
46+
for page in $(find $PATCHDEMO/pages -regextype egrep -regex ".*/$filename(-.+)?.xml" -not -type d -printf '%P\n')
47+
do
48+
echo "Importing $PATCHDEMO/pages/$page"
49+
php $PATCHDEMO/wikis/$NAME/w/maintenance/importDump.php < $PATCHDEMO/pages/$page
50+
done
51+
fi
52+
done < $PATCHDEMO/repository-lists/all.txt
53+
54+
# import generic XML dumps (core-*.xml)
55+
for page in $(find $PATCHDEMO/pages -name "core-*.xml" -not -type d -printf '%P\n')
4356
do
57+
echo "Importing $PATCHDEMO/pages/$page"
4458
php $PATCHDEMO/wikis/$NAME/w/maintenance/importDump.php < $PATCHDEMO/pages/$page
4559
done
4660

pages/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
Default page content for extensions/features
22
----
33

4-
Add per-extension or per-feature XML dumps here. XML dumps are generated by [[Special:Export]].
4+
Add XML dumps here. XML dumps are generated by [[Special:Export]].
55

6-
Any XML files in this directory will be automatically imported when wikis are created.
6+
Use the name of the extension/service/skin or as a prefix to only import the dump when it is installed,
7+
e.g. `extensions-VisualEditor.xml` or `extensions-VisualEditor-tables.xml`
78

8-
You may also include a txt file listing the pages that are included in your dump, to assist others in maintaining the dump.
9+
Use the "core-" prefix to always import a dump,
10+
e.g. `core-userpages.xml`
11+
12+
You should also include a corresponding `.txt` file listing the pages that are included in your dump, to assist others in maintaining the dump.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)