From 183851b06bd6c52f3cae5375f433da720d410447 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 11 Oct 2006 18:12:39 +0000 Subject: MediaWiki 1.7.1 wiederhergestellt --- install-utils.inc | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 install-utils.inc (limited to 'install-utils.inc') diff --git a/install-utils.inc b/install-utils.inc new file mode 100644 index 00000000..0ba6eca6 --- /dev/null +++ b/install-utils.inc @@ -0,0 +1,146 @@ +sourceFile( $fname ); + if ( $error !== true ) { + print $error; + exit(1); + } +} + +# Obsolete, use Database::fieldExists() +function field_exists( $table, $field ) { + $fname = 'Update script: field_exists'; + $db =& wfGetDB( DB_SLAVE ); + $res = $db->query( "DESCRIBE $table", $fname ); + $found = false; + + while ( $row = $db->fetchObject( $res ) ) { + if ( $row->Field == $field ) { + $found = true; + break; + } + } + return $found; +} + +# Obsolete Database::tableExists() +function table_exists( $db ) { + global $wgDBname; + $res = mysql_list_tables( $wgDBname ); + if( !$res ) { + echo "** " . mysql_error() . "\n"; + return false; + } + for( $i = mysql_num_rows( $res ) - 1; $i--; $i > 0 ) { + if( mysql_tablename( $res, $i ) == $db ) return true; + } + return false; +} + +# Obsolete, use Database:fieldInfo() +function field_info( $table, $field ) { + $res = mysql_query( "SELECT * FROM $table LIMIT 1" ); + $n = mysql_num_fields( $res ); + for( $i = 0; $i < $n; $i++ ) { + $meta = mysql_fetch_field( $res, $i ); + if( $field == $meta->name ) { + return $meta; + } + } + return false; +} + +?> -- cgit v1.2.2