r23032 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23031‎ | r23032 | r23033 >
Date:16:26, 16 June 2007
Author:mulligen
Status:old
Tags:
Comment:
update for creating the wikidata set
Modified paths:
  • /trunk/extensions/Wikidata/Database+scripts/Convenience/Create+wikidata.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/Database scripts/Convenience/Create wikidata.php
@@ -2,17 +2,22 @@
33
44 # this module create a wikidata extension for mediawiki
55 # it generates the tables in a database (passed as parameter) with a defined prefix (passed as parameter)
6 -
 6+
77 $wgUseMasterForMaintenance = true;
8 -require_once( "../../../../maintenance/commandLine.inc");
9 -#require_once( "../../../../LocalSettings.php");
10 -#require_once( "install-utils.inc" );
11 -#require_once( "AdminSettings.php");
12 -#require_once( "GlobalFunctions.php" );
13 -#require_once( "ProfilerStub.php");
14 -#require_once( "Exception.php" );
15 -#require_once( "Database.php" );
16 -
 8+
 9+$sep = PATH_SEPARATOR;
 10+$IP = realpath( dirname( __FILE__ ) . "../../../../../" );
 11+$currentdir = dirname( __FILE__ );
 12+chdir( $IP );
 13+
 14+ini_set( 'include_path', ".$sepIP$sep$IP/includes$sep$IP/languages$sep$IP/maintenance" );
 15+
 16+require_once( "StartProfiler.php" );
 17+require_once( "includes/Exception.php");
 18+require_once( "includes/GlobalFunctions.php");
 19+require_once( "includes/Database.php");
 20+
 21+
1722 function ReadSQLFile( $database, $pattern, $prefix, $filename ){
1823 $fp = fopen( $filename, 'r' );
1924 if ( false === $fp ) {
@@ -60,7 +65,7 @@
6166 $user = $wgDBadminuser;
6267 $password = $wgDBadminpassword;
6368 $server = $wgDBserver;
64 -
 69+
6570 # Parse arguments
6671 for( $arg = reset( $argv ); $arg !== false; $arg = next( $argv ) ) {
6772 if ( substr( $arg, 0, 7 ) == '-prefix' ) {
@@ -110,7 +115,6 @@
111116 echo( "AdminSettings.sample for more details.\n\n" );
112117 exit();
113118 }
114 -
115119 # Attempt to connect to the database as a privileged user
116120 # This will vomit up an error if there are permissions problems
117121 $wdDatabase = new $dbclass( $server, $user, $password, $database, 1 );
@@ -121,8 +125,8 @@
122126 echo( "values of \$wgDBadminuser and \$wgDBadminpassword.\n" );
123127 exit();
124128 }
125 -
126 -ReadSQLFile( $wdDatabase, "/*\$wgWDprefix*/", $wgWDprefix, $wgWDtemplate );
 129+
 130+ReadSQLFile( $wdDatabase, "/*\$wgWDprefix*/", $wgWDprefix, $currentdir . DIRECTORY_SEPARATOR . $wgWDtemplate );
127131 $wdDatabase->query( "DELETE FROM wikidata_sets WHERE set_prefix = '$prefix'" );
128132 $wdDatabase->query( "INSERT INTO wikidata_sets (set_prefix,set_fallback_name,set_dmid) VALUES ('$prefix','$comment',0)" );
129133

Status & tagging log