/**
* boolean $useTemporaryTables Use temporary tables for the temporary database
*/
- private $useTemporaryTables = true;
+ private $useTemporaryTables = false;
/**
* boolean $databaseSetupDone True if the database has been set up
* Draw input from a set of test files
*/
function fuzzTest( $filenames ) {
+ $GLOBALS['wgContLang'] = Language::factory( 'en' );
$dict = $this->getFuzzInput( $filenames );
$dictSize = strlen( $dict );
$logMaxLength = log( $this->maxFuzzTestLength );
* @return Boolean: true if passed all tests, false if any tests failed.
*/
public function runTestsFromFiles( $filenames ) {
+ $GLOBALS['wgContLang'] = Language::factory( 'en' );
$this->recorder->start();
$this->setupDatabase();
$ok = true;
*/
private function setupGlobals( $opts = '', $config = '' ) {
global $wgDBtype;
- if ( !isset( $this->uploadDir ) ) {
- $this->uploadDir = $this->setupUploadDir();
- }
# Find out values for some special options.
$lang =
if ( $wgDBtype == 'oracle' ) {
- # Insert 0 and 1 user_ids to prevent FK violations
+ # Insert 0 user to prevent FK violations
# Anonymous user
$db->insert( 'user', array(
'user_id' => 0,
'user_name' => 'Anonymous' ) );
-
- # Hack-on-Hack: Insert a test user to be able to insert an image
- $db->insert( 'user', array(
- 'user_id' => 1,
- 'user_name' => 'Tester' ) );
- }
-
- # Hack: Insert an image to work with
- $db->insert( 'image', array(
- 'img_name' => 'Foobar.jpg',
- 'img_size' => 12345,
- 'img_description' => 'Some lame file',
- 'img_user' => 1,
- 'img_user_text' => 'WikiSysop',
- 'img_timestamp' => $db->timestamp( '20010115123500' ),
- 'img_width' => 1941,
- 'img_height' => 220,
- 'img_bits' => 24,
- 'img_media_type' => MEDIATYPE_BITMAP,
- 'img_major_mime' => "image",
- 'img_minor_mime' => "jpeg",
- 'img_metadata' => serialize( array() ),
- ) );
-
- # This image will be blacklisted in [[MediaWiki:Bad image list]]
- $db->insert( 'image', array(
- 'img_name' => 'Bad.jpg',
- 'img_size' => 12345,
- 'img_description' => 'zomgnotcensored',
- 'img_user' => 1,
- 'img_user_text' => 'WikiSysop',
- 'img_timestamp' => $db->timestamp( '20010115123500' ),
- 'img_width' => 320,
- 'img_height' => 240,
- 'img_bits' => 24,
- 'img_media_type' => MEDIATYPE_BITMAP,
- 'img_major_mime' => "image",
- 'img_minor_mime' => "jpeg",
- 'img_metadata' => serialize( array() ),
- ) );
+ }
# Update certain things in site_stats
$db->insert( 'site_stats', array( 'ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1 ) );
# Make a new message cache
global $wgMessageCache, $wgMemc;
$wgMessageCache = new MessageCache( $wgMemc, true, 3600 );
+
+ $this->uploadDir = $this->setupUploadDir();
+ $user = User::createNew( 'WikiSysop' );
+ $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Foobar.jpg' ) );
+ $image->recordUpload2( '', 'Upload of some lame file', 'Some lame file', array(
+ 'width' => 1941,
+ 'height' => 220,
+ 'bits' => 24,
+ 'media_type' => MEDIATYPE_BITMAP,
+ 'mime' => 'image/jpeg',
+ 'metadata' => serialize( array() ),
+ 'fileExists' => true
+ ), $db->timestamp( '20010115123500' ), $user );
+
+ # This image will be blacklisted in [[MediaWiki:Bad image list]]
+ $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Bad.jpg' ) );
+ $image->recordUpload2( '', 'zomgnotcensored', 'Borderline image', array(
+ 'width' => 320,
+ 'height' => 240,
+ 'bits' => 24,
+ 'media_type' => MEDIATYPE_BITMAP,
+ 'mime' => 'image/jpeg',
+ 'metadata' => serialize( array() ),
+ 'fileExists' => true
+ ), $db->timestamp( '20010115123500' ), $user );
}
/**
if ( !$this->databaseSetupDone ) {
return;
}
+ $this->teardownUploadDir( $this->uploadDir );
+
$this->changePrefix( $this->oldTablePrefix );
$this->databaseSetupDone = false;
if ( $this->useTemporaryTables ) {
$dir = wfTempDir() . "/mwParser-" . mt_rand() . "-images";
}
- wfDebug( "Creating upload directory $dir\n" );
+ //wfDebug( "Creating upload directory $dir\n" );
if ( file_exists( $dir ) ) {
wfDebug( "Already exists!\n" );
return $dir;
}
wfMkdirParents( $dir . '/3/3a' );
copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" );
-
wfMkdirParents( $dir . '/0/09' );
copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" );
return $dir;
foreach ( $this->savedGlobals as $var => $val ) {
$GLOBALS[$var] = $val;
}
- if ( isset( $this->uploadDir ) ) {
- $this->teardownUploadDir( $this->uploadDir );
- unset( $this->uploadDir );
- }
}
/**
* @param $line Integer: the input line number, for reporting errors
*/
public function addArticle( $name, $text, $line ) {
- $this->setupGlobals();
$title = Title::newFromText( $name );
if ( is_null( $title ) ) {
wfDie( "invalid title at line $line\n" );
$art = new Article( $title );
$art->insertNewArticle( $text, '', false, false );
-
- $this->teardownGlobals();
}
/**
$section = null;
continue;
}
+ global $wgUseTeX;
if ( $this->parser &&
- preg_match( '/\\bmath\\b/i', $data['options'] ) && !$this->parser->savedGlobals['wgUseTeX'] ) {
+ preg_match( '/\\bmath\\b/i', $data['options'] ) && !$wgUseTeX ) {
# don't run math tests if $wgUseTeX is set to false in LocalSettings
$data = array();
$section = null;