User:Leucosticte/Doing the Newgon stuff
Appearance
- Check out http://www.newgon.com/w/api.php?action=query&list=allpages&apnamespace=6&aplimit=500 and compare it to what's in the down folder. Anything new? If so, make a note of it for later.
Do LoggedOutAllPages.php to get the page titlesAin't nobody got time for thatDo LoggedOutExportAll.php to export the page titlesThat file doesn't exist either- Do this: http://en.boywiki.org/w/api.php?action=query&list=allpages&aplimit=500&apnamespace=0
- And this: http://en.boywiki.org/w/api.php?action=query&list=allpages&aplimit=500&apnamespace=0&apfrom= (put the query-continue at the end)
- And this: http://www.newgon.com/w/api.php?action=query&list=allpages&aplimit=500&apnamespace=0
- And this: http://www.newgon.com/w/api.php?action=query&list=allpages&aplimit=500&apnamespace=0&apfrom= (put the query-continue at the end)
- Copy and paste as you go into two tabs of Calc, boywiki and newgon.
- B1: =SEARCH("title",A1,1)
- C1: =SEARCH("/>",A1,B1)
- D1: =MID(A1,B1+7,C1-B1-9)
- Copy all the way down. Paste into: (but be sure to keep the XML files with the template pages separate from the other XML files, otherwise you'll be putting a bunch of crap {{x content}} in your templates. If you do accidentally put all that crap in there, the best thing to do is wreak a holocaust of the entire Template: namespace and then re-import. Do this before you import a bunch of other stuff on top of it that will get deleted if you pull a Special:DeleteBatch. Bear in mind, at last count Newgon had 44 templates and BoyWiki 203, for a total of 247.)
- http://en.boywiki.org/wiki/Special:Export (don't check "Include only the current revision, not the full history"; don't check "Include templates".)
- http://www.newgon.com/wiki/Special:Export
- In Komodo Edit, Ctrl-Shift-H. Do check Multiline. Find what: </text> Replace with: {{boywiki content}}</text> (skip a couple lines before {{boywiki content}}</text>) Select appropriate directory
- In Komodo Edit, Ctrl-Shift-H. Do check Multiline. Find what: </text> Replace with: {{newgon content}}</text> (skip a couple lines before {{newgon content}}</text>) Select appropriate directory
- PS1="[\u@\h:\w ] $ "
- mkdir ~/childwiki.net/boywiki
- mkdir ~/childwiki.net/newgon
- nathan@nathan-Inspiron-518:~/Downloads/boywikiXML$ scp * stauffenbergssh@nathania.org:~/childwiki.net/boywiki
- nathan@nathan-Inspiron-518:~/Downloads/newgonXML$ scp * stauffenbergssh@nathania.org:~/childwiki.net/newgon
- Narrow the window so there's only one column of files
- [stauffenbergssh@ipe:~/childwiki.net/boywiki ] $ ls
- Copy and paste result into your favorite editor
- [stauffenbergssh@ipe:~/childwiki.net/w/maintenance ] $ pico childLoop.php
<?php
$cmd = array (
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111070838.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111070901.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111070920.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111071115.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111071144.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111071159.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111071219.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111071234.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111071249.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111071303.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111071321.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111071338.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111071353.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111071407.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111071422.xml',
'/usr/local/php53/bin/php importDump.php < ~/childwiki.net/boywiki/BoyWiki-20131111071436.xml'
);
foreach ( $cmd as $thisCmd ) {
echo "$thisCmd\n";
shell_exec ( $thisCmd );
}
- Or better yet:
<?php
$files = array (
'NewgonWiki-20131111072018.xml',
'NewgonWiki-20131111072043.xml',
'NewgonWiki-20131111072059.xml',
'NewgonWiki-20131111072116.xml',
'NewgonWiki-20131111072149.xml',
'NewgonWiki-20131111072204.xml',
'NewgonWiki-20131111072239.xml',
'NewgonWiki-20131111072258.xml',
'NewgonWiki-20131111072403.xml',
'NewgonWiki-20131111072429.xml',
'NewgonWiki-20131111072445.xml',
'NewgonWiki-20131111072501.xml',
'NewgonWiki-20131111072516.xml',
'NewgonWiki-20131111072534.xml',
'NewgonWiki-20131111072645.xml',
'NewgonWiki-20131111072659.xml'
);
foreach ( $files as $file ) {
$cmd = '/usr/local/php53/bin/php importDump.php < ~/childwiki.net/newgon/' . $file;
echo "$cmd\n";
shell_exec ( $cmd );
}
- [stauffenbergssh@ipe:~/childwiki.net/w/maintenance ] $ php childLoop.php
- Get a cup of coffee
- Repeat for newgon
- Find out the file extensions of the images. If you want to have fun, use getAllFileExtensions.php:
<?php
// Usage: php getAllFileExtensions.php path/to/files
$number = 0;
$path = '.';
if ( isset ( $argv[1] ) ) {
$path = $argv[1];
}
$extensions = array();
if ( $handle = opendir ( $path ) ) {
while (false !== ( $entry = readdir ( $handle ) ) ) {
if ( $entry != "." && $entry != ".." ) {
$extensions[] = pathinfo ( $entry, PATHINFO_EXTENSION );
$number++;
}
}
closedir ( $handle );
}
echo "$number images\n";
$isFirst = true;
$extensions = array_unique ( $extensions );
foreach ( $extensions as $ext ) {
if ( !$isFirst ) {
echo ', ';
}
echo $ext;
$isFirst = false;
}
- However, I'll you right now that the extensions are png, jpg, mp3, mp4, gif, JPG, PNG, pdf, jpeg, txt.
- importImages.php --extensions=png,jpg,mp3,mp4,gif,JPG,PNG,pdf,jpeg,txt ~/down/down (maybe you don't even need the extensions, as long as you get the right directory. On second thought, better use those extensions; who knows if you have them as allowable ones)
- (Do Manual:importImages.php after importing the file description pages)