use encodeURIComponent() instead of escape() in ajax.js
[lhc/web/wiklou.git] / maintenance / dumpHTML.php
index f8d7b3b..608893f 100644 (file)
@@ -9,19 +9,21 @@
  * Usage:
  * php dumpHTML.php [options...]
  *
- * -d <dest>      destination directory
- * -s <start>     start ID
- * -e <end>       end ID
- * --images       only do image description pages
- * --categories   only do category pages
- * --redirects    only do redirects
- * --special      only do miscellaneous stuff
- * --force-copy   copy commons instead of symlink, needed for Wikimedia
- * --interlang    allow interlanguage links
+ * -d <dest>          destination directory
+ * -s <start>         start ID
+ * -e <end>           end ID
+ * -k <skin>          skin to use (defaults to htmldump)
+ * --images           only do image description pages
+ * --categories       only do category pages
+ * --redirects        only do redirects
+ * --special          only do miscellaneous stuff
+ * --force-copy       copy commons instead of symlink, needed for Wikimedia
+ * --interlang        allow interlanguage links
+ * --image-snapshot   copy all images used to the destination directory
  */
 
 
-$optionsWithArgs = array( 's', 'd', 'e' );
+$optionsWithArgs = array( 's', 'd', 'e', 'k' );
 
 $profiling = false;
 
@@ -51,7 +53,7 @@ if ( !empty( $options['e'] ) ) {
        $end = $options['e'];
 } else {
        $dbr =& wfGetDB( DB_SLAVE );
-       $end = $dbr->selectField( 'page', 'max(page_id)', false );      
+       $end = $dbr->selectField( 'page', 'max(page_id)', false );
 }
 
 if ( !empty( $options['d'] ) ) {
@@ -60,36 +62,41 @@ if ( !empty( $options['d'] ) ) {
        $dest = 'static';
 }
 
-$d = new DumpHTML( array( 
-       'dest' => $dest, 
+$skin = isset( $options['k'] ) ? $options['k'] : 'htmldump';
+
+$wgHTMLDump = new DumpHTML( array(
+       'dest' => $dest,
        'forceCopy' => $options['force-copy'],
        'alternateScriptPath' => $options['interlang'],
        'interwiki' => $options['interlang'],
+       'skin' => $skin,
+       'makeSnapshot' => $options['image-snapshot'],
 ));
 
 
 if ( $options['special'] ) {
-       $d->doSpecials();
+       $wgHTMLDump->doSpecials();
 } elseif ( $options['images'] ) {
-       $d->doImageDescriptions();
+       $wgHTMLDump->doImageDescriptions();
 } elseif ( $options['categories'] ) {
-       $d->doCategories();
+       $wgHTMLDump->doCategories();
 } elseif ( $options['redirects'] ) {
-       $d->doRedirects();
+       $wgHTMLDump->doRedirects();
 } else {
        print("Creating static HTML dump in directory $dest. \n".
                "Starting from page_id $start of $end.\n");
 
        $dbr =& wfGetDB( DB_SLAVE );
-       print "Using database {$dbr->mServer}\n";
+       $server = $dbr->getProperty( 'mServer' );
+       print "Using database {$server}\n";
 
-       $d->doArticles( $start, $end );
+       $wgHTMLDump->doArticles( $start, $end );
        if ( !isset( $options['e'] ) ) {
-               $d->doImageDescriptions();
-               $d->doCategories();
-               $d->doSpecials();
+               $wgHTMLDump->doImageDescriptions();
+               $wgHTMLDump->doCategories();
+               $wgHTMLDump->doSpecials();
        }
-       
+
        /*
        if ( $end - $start > CHUNK_SIZE * 2 ) {
                // Split the problem into smaller chunks, run them in different PHP instances