URL: http://metabolomics.jp/ */ $IP = "PATH_TO_WIKIROOT"; require( "$IP/maintenance/commandLine.inc" ); global $egMolNamespace, $wgTitle; $egMolNamespace = "Mol"; if($argc >= 2){ $fp = fopen( $argv[0], "r" ); while( !feof( $fp ) ){ $line = trim( fgets( $fp, 1024 ) ); if( strlen( $line ) > 0 ) efExMolFunctionsCommandLineDataInsert( trim($line) ); } fclose( $fp ); } function efExMolFunctionsCommandLineDataInsert( $title ) { global $wgTitle, $wgExtraNamespaces, $egMolNamespace, $egJavaBin, $egMolCalculatorJar, $egMolImageJar, $egTmpPath, $egMolPath; if( strncmp( $egMolNamespace, $title, 3 ) != 0 ){ print "Invalid page name: " . $title . "\n"; return true; } $t = Title::newFromText( $title ); $wgTitle = $t; $namespace = $t->getNamespace(); $page_title = $t->getText(); # check namespace $targetNamespace = $t->getNamespace(); $molNamespace = array_search( $egMolNamespace, $wgExtraNamespaces ); if( $molNamespace === FALSE || $targetNamespace != $molNamespace ){ print "Not exists 'Mol' namespace\n"; return true; } $article = MediaWiki::articleFromTitle( $t ); $text = $article->getContent(); if( $article->exists() ){ # update database $article->doEdit( $text, '', EDIT_UPDATE ); } else { print "There is no data: " . $t . "\n"; return true; } print $title . " done.\n"; return true; }