//--------------------------------------------------------------------------- MwImporter - Generic batch file converter/importer, with extensions for Html->Mediawiki import http://www.donationcoder.com/Forums/bb/index.php?topic=22715.0 v2.0, 5/13/10 mouser@donationcoder.com | JavaJones //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- Open Source license: You may use this internally for personal or commercial use; but you may not sell any service or products based on this script or modifications of it. if you would like help modifying this script for your commercial needs you may contact us on the donationcoder.com forum or via the email address listed above. For questions and comments please visit http://www.donationcoder.com/Forums/bb/index.php?topic=22715.0 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // sample (dos) commandline invocation, running from directory where jrfconvert.php is: php.exe jrfconvert.php "--inputdir=sampledata" "--mwdir=E:\WebsiteHttp\mediawiki" --recurse=1 "--mw_header=PAGE TOP" "--mw_footer=PAGE BOTTOM" "--mw_category=IMPORT" "--mw_dircat_sepdir" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- !!!WARNING!!! Running this script can result in many pages and files being added to your mediawiki. It is *ESSENTIAL* that you back up your mediawiki database before you run it for the first time. and be prepared to restore your database to it's original state so that you can try the import safely and repeatedly. Even on a blank wiki, it is highly recommended that you back up the database prior to running this script for the first time so that you may undo the import and try again. // The mediawiki extension "Nuke" is also extremely helpful in mass deleting large numbers of added pages and image files. //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- General Commandline Options: --deletetempfiles : delete each temp file as its used up (not just on program start) --justclean : delete any temp files but dont do any conversion --test : dont do any conversion or deletion, but show operations that would take place --filepatterns=PATTERNLIST : pattern list is comma separate like "*.html,*.htm,*.png,*.gif,*.jpg" --excludepatterns=PATTERNLIST : same as above -- files matching this pattern will be ignored --recurse : recurse into directories --basedir DIR : optional DIR from which inputdir is relative --inputdir DIR : directory where input files are to be read from //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- MediaWiki Import Commandline Options: --mwdir DIR : points to base mediawiki directory (required!) --mw_unprotect : overwrite images or pages found -- ATTN: if set to 0, entries with same name will be SKIPPED --mw_overwriteimg : overwrite images or pages found -- ATTN: if set to 0, entries with same name will be SKIPPED --mw_overwritepage : overwrite images or pages found -- ATTN: if set to 0, entries with same name will be SKIPPED --mw_savewiki2 : save intermediate post-processed wiki files for debugging --mw_header : options to add wiki text to top or bottom of every imported page --mw_footer : options to add wiki text to top or bottom of every imported page --mw_titleprefix : ability to set custom prefix on page titles --mw_category CATEGORYSTR : adds [[CATEGORY CATEGORYSTR]] tag to EVERY page --mw_comment COMMENTSTR : comment added to EDIT entries --mw_norc : set this to bypass revision control updates that preserver prior versions //---------------------------------------------------------------------------