Index: trunk/phase3/maintenance/dumpHTML.inc |
— | — | @@ -185,7 +185,8 @@ |
186 | 186 | $title = Title::newFromID( $id ); |
187 | 187 | if ( $title ) { |
188 | 188 | $ns = $title->getNamespace() ; |
189 | | - if ( $ns != NS_CATEGORY && $title->getPrefixedDBkey() != $mainPage ) { |
| 189 | + if ( $ns != NS_CATEGORY && $ns != NS_MEDIAWIKI && |
| 190 | + $title->getPrefixedDBkey() != $mainPage ) { |
190 | 191 | $this->doArticle( $title ); |
191 | 192 | } |
192 | 193 | } |
— | — | @@ -485,11 +486,26 @@ |
486 | 487 | fclose( $file ); |
487 | 488 | } |
488 | 489 | } |
| 490 | + |
| 491 | + wfIncrStats( 'dumphtml_article' ); |
489 | 492 | } |
490 | 493 | |
491 | 494 | /** Write the given text to the file identified by the given title object */ |
492 | 495 | function writeArticle( &$title, $text ) { |
493 | 496 | $filename = $this->getHashedFilename( $title ); |
| 497 | + |
| 498 | + # Temporary hack for current dump, this should be moved to |
| 499 | + # getFriendlyName() at the earliest opportunity. |
| 500 | + # |
| 501 | + # Limit filename length to 255 characters, so it works on ext3. |
| 502 | + # Titles are in fact limited to 255 characters, but dumpHTML |
| 503 | + # adds a suffix which may put them over the limit. |
| 504 | + $length = strlen( $filename ); |
| 505 | + if ( $length > 255 ) { |
| 506 | + print "Warning: Filename too long ($length bytes). Skipping.\n"; |
| 507 | + return; |
| 508 | + } |
| 509 | + |
494 | 510 | $fullName = "{$this->dest}/$filename"; |
495 | 511 | $fullDir = dirname( $fullName ); |
496 | 512 | |
— | — | @@ -591,13 +607,11 @@ |
592 | 608 | $wgUser->setOption( 'skin', $this->skin ); |
593 | 609 | $wgUser->setOption( 'editsection', 0 ); |
594 | 610 | |
595 | | - if ( $this->makeSnapshot ) { |
596 | | - $this->destUploadDirectory = "{$this->dest}/{$this->imageRel}"; |
597 | | - if ( realpath( $this->destUploadDirectory == $wgUploadDirectory ) ) { |
598 | | - $this->makeSnapshot = false; |
599 | | - } |
| 611 | + $this->destUploadDirectory = "{$this->dest}/{$this->imageRel}"; |
| 612 | + if ( realpath( $this->destUploadDirectory ) == realpath( $wgUploadDirectory ) ) { |
| 613 | + print "Disabling image snapshot because the destination is the same as the source\n"; |
| 614 | + $this->makeSnapshot = false; |
600 | 615 | } |
601 | | - |
602 | 616 | $this->sharedStaticDirectory = "{$this->destUploadDirectory}/shared"; |
603 | 617 | |
604 | 618 | $this->setupDone = true; |
— | — | @@ -695,9 +709,13 @@ |
696 | 710 | if ( !file_exists( $destLoc ) ) { |
697 | 711 | wfMkdirParents( dirname( $destLoc ), 0755 ); |
698 | 712 | if ( function_exists( 'symlink' ) && !$this->forceCopy ) { |
699 | | - symlink( $sourceLoc, $destLoc ); |
| 713 | + if ( !symlink( $sourceLoc, $destLoc ) ) { |
| 714 | + print "Warning: unable to create symlink at $destLoc\n"; |
| 715 | + } |
700 | 716 | } else { |
701 | | - copy( $sourceLoc, $destLoc ); |
| 717 | + if ( !copy( $sourceLoc, $destLoc ) ) { |
| 718 | + print "Warning: unable to copy $sourceLoc to $destLoc\n"; |
| 719 | + } |
702 | 720 | } |
703 | 721 | } |
704 | 722 | } |