*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
- * @package MediaWiki
- * @subpackage Maintenance
+ * @addtogroup Maintenance
*/
$optionsWithArgs = array( 'report' );
function handleRevision( $rev ) {
$title = $rev->getTitle();
if (!$title) {
+ $this->progress( "Got bogus revision with null title!" );
return;
}
- $display = $title->getPrefixedText();
- $timestamp = $rev->getTimestamp();
+ #$timestamp = $rev->getTimestamp();
+ #$display = $title->getPrefixedText();
#echo "$display $timestamp\n";
$this->revCount++;
$filename = 'compress.zlib://' . $filename;
}
$file = fopen( $filename, 'rt' );
- $this->importFromHandle( $file );
+ return $this->importFromHandle( $file );
}
function importFromStdin() {
$file = fopen( 'php://stdin', 'rt' );
- $this->importFromHandle( $file );
+ return $this->importFromHandle( $file );
}
function importFromHandle( $handle ) {
$this->importCallback = $importer->setRevisionCallback(
array( &$this, 'handleRevision' ) );
- $importer->doImport();
+ return $importer->doImport();
}
}
+if( wfReadOnly() ) {
+ wfDie( "Wiki is in read-only mode; you'll need to disable it for import to work.\n" );
+}
+
$reader = new BackupReader();
if( isset( $options['quiet'] ) ) {
$reader->reporting = false;
}
if( isset( $options['report'] ) ) {
- $reader->reportingInterval = IntVal( $options['report'] );
+ $reader->reportingInterval = intval( $options['report'] );
}
if( isset( $options['dry-run'] ) ) {
$reader->dryRun = true;
}
if( isset( $args[0] ) ) {
- $reader->importFromFile( $args[0] );
+ $result = $reader->importFromFile( $args[0] );
+} else {
+ $result = $reader->importFromStdin();
+}
+
+if( WikiError::isError( $result ) ) {
+ echo $result->getMessage() . "\n";
} else {
- $reader->importFromStdin();
+ echo "Done!\n";
+ echo "You might want to run rebuildrecentchanges.php to regenerate\n";
+ echo "the recentchanges page.";
}
?>