00001 <?php
00030 $optionsWithArgs = array( 'o', 'd', 'e', 'server' );
00031
00032 require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
00033 ? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/commandLine.inc"
00034 : dirname( __FILE__ ) . '/../../../maintenance/commandLine.inc' );
00035 global $smwgIP, $wgServer;
00036
00037
00038 if ( !empty( $options['o'] ) ) {
00039 $outfile = $options['o'];
00040 } else {
00041 $outfile = false;
00042 }
00043 if ( !empty( $options['d'] ) ) {
00044 $delay = intval( $options['d'] ) * 1000;
00045 } else {
00046 $delay = 0;
00047 }
00048 if ( !empty( $options['e'] ) ) {
00049 $delayeach = intval( $options['e'] );
00050 } else {
00051 $delayeach = ( $delay === 0 ) ? 0 : 1;
00052 }
00053
00054
00055 if ( array_key_exists( 'categories', $options ) ) {
00056 $export_ns = NS_CATEGORY;
00057 } elseif ( array_key_exists( 'concepts', $options ) ) {
00058 $export_ns = SMW_NS_CONCEPT;
00059 } elseif ( array_key_exists( 'classes', $options ) ) {
00060 $export_ns = array( NS_CATEGORY, SMW_NS_CONCEPT );
00061 } elseif ( array_key_exists( 'properties', $options ) ) {
00062 $export_ns = SMW_NS_PROPERTY;
00063 } elseif ( array_key_exists( 'types', $options ) ) {
00064 $export_ns = SMW_NS_TYPE;
00065 } elseif ( array_key_exists( 'individuals', $options ) ) {
00066 $export_ns = - 1;
00067 } else {
00068 $export_ns = false;
00069 }
00070
00071 if ( isset( $options['server'] ) ) {
00072 $wgServer = $options['server'];
00073 }
00074
00075 if ( $outfile && empty( $options['q'] ) ) {
00076 print "\nWriting OWL/RDF dump to file \"$outfile\" ...\n";
00077 }
00078
00079 $exRDF = new SMWExportController( new SMWRDFXMLSerializer() );
00080 $exRDF->printAll( $outfile, $export_ns, $delay, $delayeach );