return null;
}
-
/**
* Get all blocks that match any IP from an array of IP addresses
*
* Host for UDP profiler.
*
* The host should be running a daemon which can be obtained from MediaWiki
- * Git at:
+ * Git at:
* http://git.wikimedia.org/tree/operations%2Fsoftware.git/master/udpprofile
*/
$wgUDPProfilerHost = '127.0.0.1';
}
}
-
// Analyze $serverUrl to obtain its protocol
$bits = wfParseUrl( $serverUrl );
$serverHasProto = $bits && $bits['scheme'] != '';
* @param array $limits optional array with limits(filesize, memory, time, walltime)
* this overwrites the global wgShellMax* limits.
* @param array $options Array of options:
- * - duplicateStderr: Set this to true to duplicate stderr to stdout,
+ * - duplicateStderr: Set this to true to duplicate stderr to stdout,
* including errors from limit.sh
- *
+ *
* @return string collected stdout as a string
*/
function wfShellExec( $cmd, &$retval = null, $environ = array(),
$logMsg = false;
// According to the documentation, it is possible for stream_select()
- // to fail due to EINTR. I haven't managed to induce this in testing
- // despite sending various signals. If it did happen, the error
- // message would take the form:
+ // to fail due to EINTR. I haven't managed to induce this in testing
+ // despite sending various signals. If it did happen, the error
+ // message would take the form:
//
// stream_select(): unable to select [4]: Interrupted system call (max_fd=5)
//
wfRunHooks( 'ResetSessionID', array( $oldSessionId, $newSessionId ) );
}
-
/**
* Initialise php session
*
$attribs['class'] = array( 'mw-htmlform-submit' );
if ( $this->isVForm() ) {
- // mw-ui-block is necessary because the buttons aren't necessarily in an
+ // mw-ui-block is necessary because the buttons aren't necessarily in an
// immediate child div of the vform.
array_push( $attribs['class'], 'mw-ui-button', 'mw-ui-big', 'mw-ui-primary', 'mw-ui-block' );
}
$wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
}
-
// Default value is either the suhosin limit or -1 for unlimited
if ( $wgResourceLoaderMaxQueryLength === false ) {
$maxValueLength = ini_get( 'suhosin.get.max_value_length' );
}
}
-
/**
* Redirect from Special:PermanentLink/### to index.php?oldid=###
*/
}
}
-
/**
* Normalize a string if it is a valid storage path
*
*/
protected function assertWritableRepo() {}
-
/**
* Return information about the repository.
*
$dbw->commit( __METHOD__ ); // commit before anything bad can happen
}
-
wfProfileOut( __METHOD__ . '-edit' );
# Save to cache and purge the squid
class TraditionalImageGallery extends ImageGalleryBase {
-
/**
* Return a HTML representation of the image gallery
*
) . "<br />\n" :
'';
-
$galleryText = $textlink . $text . $fileSize;
$galleryText = $this->wrapGalleryText( $galleryText, $thumb );
return $output;
}
-
/**
* Add the wrapper html around the thumb's caption
*
</div></div>
-
<div id="mw-panel">
<div class="portal" id="p-logo">
<a style="background-image: url(../skins/common/images/mediawiki.png);"
return false;
}
-
UploadBase::setSessionStatus(
$this->params['filekey'],
array( 'result' => 'Poll', 'stage' => 'publish', 'status' => Status::newGood() )
imagejpeg( $dst_image, $thumbPath, 95 );
}
-
/**
* Returns whether the current scaler supports rotation (im and gd do)
*
return $image->getWidth() * $image->getHeight();
}
-
/**
* @param $file File
* @return string
$xml = $this->preprocessToXml( $text, $flags );
}
-
// Fail if the number of elements exceeds acceptable limits
// Do not attempt to generate the DOM
$this->parser->mGeneratedPPNodeCount += substr_count( $xml, '<' );
/**
* ProfilerSimpleUDP class, that sends out messages for 'udpprofile' daemon
- * (the one from
+ * (the one from
* http://git.wikimedia.org/tree/operations%2Fsoftware.git/master/udpprofile)
* @ingroup Profiler
*/
$blobs = array();
}
-
foreach ( $missing as $name ) {
$states[$name] = 'missing';
}
return call_user_func( array( self::$allowedTypes[$typeName], 'suggestTarget' ), $target, $ids );
}
-
/**
* Checks if a revision still exists in the revision table.
* If it doesn't, returns the corresponding ar_timestamp field
private $mOriginalPageOutCallback = null;
private $mLogItemCount = 0;
-
/**
* @param WikiImporter $importer
* @param $upload
$this->setCategory( $cat );
}
-
if ( !$this->category && $categoryStr ) {
$this->setHeaders();
$this->getOutput()->addWikiMsg( 'randomincategory-invalidcategory',
return true;
}
-
/**
* Verifies that it's ok to include the uploaded file
*
}
}
-
$handler = MediaHandler::getHandler( $mime );
if ( $handler ) {
$handlerStatus = $handler->verifyUpload( $this->mTempPath );
return false;
}
-
/**
* Check a whitelist of xml encodings that are known not to be interpreted differently
* by the server's xml parser (expat) and some common browsers.
*/
class LanguageBs extends Language {
-
/**
* Convert from the nominative form of a noun to some other case
* Invoked with {{GRAMMAR:case|word}}
# Variable for ending
$ending = '';
-
# CHecking if the $word is in plural form
if ( preg_match( '/тæ$/u', $word ) ) {
$word = mb_substr( $word, 0, -1 );
* @ingroup Language
*/
-
/**
* Turkish (Türkçe)
*
$this->output( "\n" );
}
-
// Script specific parameters not defined on construction by
// Maintenance::addDefaultParams()
$scriptSpecificParams = array_diff_key(
*/
protected $db;
-
/**
* Drop the database connection $this->db and try to get a new one.
*
throw new MWException( __METHOD__ . " rotating DB failed to obtain new load balancer (" . $e->getMessage() . ")" );
}
-
// 2. The Connection, through the load balancer.
try {
$this->db = $this->lb->getConnection( DB_SLAVE, 'dump' );
}
}
-
function initProgress( $history = WikiExporter::FULL ) {
parent::initProgress();
$this->timeOfCheckpoint = $this->startTime;
return "";
}
-
/**
* May throw a database error if, say, the server dies during query.
* @param $id
require_once __DIR__ . '/commandLine.inc';
require_once __DIR__ . '/backupTextPass.inc';
-
$dumper = new TextPassDumper( $argv );
if ( !isset( $options['help'] ) ) {
$this->mSharedSupplement = true;
}
}
- $this-> { $this->mAction } ( $this->mShared );
+ $this->{ $this->mAction } ( $this->mShared );
if ( $this->mSharedSupplement ) {
$this->fetchUsed( true );
}
*/
public $findex;
-
/**
* A resource pointing to a sitemap file
*
continue;
}
-
$this->output( $source->getPrefixedText() . ' --> ' . $dest->getPrefixedText() );
$dbw->begin( __METHOD__ );
$err = $source->moveTo( $dest, false, $reason, !$noredirects );
$user->load();
return $user;
}
-
-
}
$maintClass = "ReassignEdits";
}
}
-
$maintClass = 'RefreshImageMetadata';
require_once RUN_MAINTENANCE_IF_MAIN;
}
}
-
$maintClass = "BatchedQueryRunner";
require_once RUN_MAINTENANCE_IF_MAIN;
$this->output( sprintf( "without session: %-10d %6.2f%%\n", $noSession, $noSession / $total * 100 ) );
$this->output( sprintf( "total: %-10d %6.2f%%\n", $total, 100 ) );
-
$this->output( "\nParser cache\n" );
$hits = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_hit' ) ) );
$expired = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_miss_expired' ) ) );
$cs->check( $fix, $xml );
}
-
// ----------------------------------------------------------------------------------
/**
}
}
-
function error( $type, $msg, $ids ) {
if ( is_array( $ids ) && count( $ids ) == 1 ) {
$ids = reset( $ids );
}
$type = isset( $options['type'] ) ? $options['type'] : 'ConcatenatedGzipHistoryBlob';
-
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select(
array( 'page', 'revision', 'text' ),
require __DIR__ . '/../commandLine.inc';
-
if ( count( $args ) < 1 ) {
echo "Usage: php trackBlobs.php <cluster> [... <cluster>]\n";
echo "Adds blobs from a given ES cluster to the blob_tracking table\n";
}
}
-
/**
* This is used to check options. Only needed on construction
*
}
}
-
/** Change our users options */
private function CHANGER() {
$this->warn();
$lines[] = $this->getSkin()->getLanguage()->pipeList( array_filter( $element ) );
-
// Second row. Privileged actions.
$element = array();
$lines[] = $this->getSkin()->getLanguage()->pipeList( array_filter( $element ) );
-
// Third row. Language links.
$lines[] = $this->otherLanguages();
}
$bar = $this->sidebarAdditions( $bar );
}
-
// Fill out special sidebar items with content
$orig_bar = $bar;
$bar = array();
}
}
-
// Output the sidebar
// CologneBlue uses custom messages for some portlets, but we should keep the ids for consistency
$idToMessage = array(
<?php
}
} // end of class
-
-
print <<<EOT
ParserTest-specific options:
-
--regex="<regex>" Only run parser tests that match the given regex
--file="<filename>" File describing parser tests
--keep-uploads Re-use the same upload directory for each test, don't delete it
-
Database options:
--use-normal-tables Use normal DB tables.
--reuse-db Init DB only if tables are missing and keep after finish.
-
Debugging options:
--debug-tests Log testing activity to the PHPUnitCommand log channel.
"expected article not being created if empty"
);
-
$this->assertEdit(
'MediaWiki:January',
null,
);
}
-
/**
* Lame JSON schema validation.
*
$this->assertEquals( $result, wfArrayToCgi( $array ) );
}
-
/**
* @covers ::wfArrayToCgi
*/
$this->assertEquals( $matches, array( 'title' => "Lorem_ipsum_dolor_sit_amet,_consectetur_adipisicing_elit,_sed_do_eiusmod_tempor_incididunt_ut_labore_et_dolore_magna_aliqua._Ut_enim_ad_minim_veniam,_quis_nostrud_exercitation_ullamco_laboris_nisi_ut_aliquip_ex_ea_commodo_consequat._Duis_aute_irure_dolor_in_reprehenderit_in_voluptate_velit_esse_cillum_dolore_eu_fugiat_nulla_pariatur._Excepteur_sint_occaecat_cupidatat_non_proident,_sunt_in_culpa_qui_officia_deserunt_mollit_anim_id_est_laborum." ) );
}
-
/**
* Ensure that the php passed site of parameter values are not urldecoded
*/
$this->assertRevEquals( $orig, $rev );
}
-
/**
* @covers Revision::newFromArchiveRow
*/
}
}
-
/**
* @covers Revision::getContentFormat
*/
$this->assertEquals( $expectedText, $rev->getRawText( $audience ) );
}
-
public function dataGetSize() {
return array(
array( "hello world.", CONTENT_MODEL_WIKITEXT, 12 ),
$this->assertEquals( "bar", $content->getText() ); // clones should be independent
}
-
/**
* Tests whether $rev->getContent() returns the same object repeatedly if appropriate.
*
*/
public function testCleanParams( $cleanCallback, $params, $expected ) {
$method = new ReflectionMethod( 'Status', 'cleanParams' );
- $method->setAccessible(TRUE);
+ $method->setAccessible( true );
$status = new Status();
$status->cleanCallback = $cleanCallback;
);
}
-
/**
* @dataProvider provideIsCountable
* @covers WikiPage::isCountable
more stuff
";
-
public function dataReplaceSection() {
//NOTE: assume the Help namespace to contain wikitext
return array(
$this->assertTrue( $exception, "Got exception" );
}
-
/**
* @depends testLogin
*/
unlink( $filePath );
}
-
/**
* @depends testLogin
*/
unlink( $filePath );
}
-
/**
* @depends testLogin
*/
unlink( $filePaths[1] );
}
-
/**
* @depends testLogin
*/
)
);
-
public function __construct( $options = array() ) {
foreach ( array( 'dictionaryFile', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight', 'shapesToDraw' ) as $property ) {
if ( isset( $options[$property] ) ) {
return $filenames;
}
-
/**
* Figure out how we write images. This is a factor of both format and the local system
* @param $format (a typical extension like 'svg', 'jpg', etc.)
return $filenames;
}
-
/**
* Generate data representing an image of random size (within limits),
* consisting of randomly colored and sized upward pointing triangles against a random background color
);
}
-
/**
* Based on an image specification, write such an image to disk, using the command line ImageMagick program ('convert').
*
$this->assertEquals( $expected, $quoted );
}
-
/**
* Feeds testAddIdentifierQuotes
*
class MWDebugTest extends MediaWikiTestCase {
-
protected function setUp() {
parent::setUp();
// Make sure MWDebug class is enabled
);
}
-
const TEST_WIDTH = 100;
const TEST_HEIGHT = 200;
$this->mediaPath = __DIR__ . '/../../data/media/';
-
-
$this->setMwGlobals( 'wgShowEXIF', true );
}
$this->assertEquals( $expected, $res['XMP'] );
}
-
public function testIPTCHashComparisionNoHash() {
$segments = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-xmp-psir.jpg' );
$res = JpegMetadataExtractor::doPSIR( $segments['PSIR'][0] );
$this->filePath = __DIR__ . '/../../data/media/';
-
$this->setMwGlobals( 'wgShowEXIF', true );
$this->backend = new FSFileBackend( array(
$this->assertEquals( 1, $meta['bitDepth'] );
}
-
public function testPngIndexColour() {
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'Png-native-test.png' );
parent::tearDown();
}
-
/**
* First checks the return code
* of UploadBase::getTitle() and then the actual returned title
'Wrong CD start disk error' );
}
-
public function testCentralDirectoryGap() {
$this->readZipAssertError( 'cd-gap.zip', 'zip-bad',
'CD gap error' );
$this->assertConverted( $text, 'sr-ec', $msg );
}
-
/** Wrapper for converter::convertTo() method*/
protected function convertTo( $text, $variant ) {
return $this->getLang()
);
}
-
/**
* @dataProvider provideFormatDuration
* @covers Language::formatDuration
$this->assertConverted( $text, 'uz-cyrl', $msg );
}
-
/** Wrapper for converter::convertTo() method*/
protected function convertTo( $text, $variant ) {
return $this->getLang()->mConverter->convertTo( $text, $variant );
throw new MWException( "Could not determine revision id (" . $status->getWikiText() . ")" );
}
-
/**
* gunzips the given file and stores the result in the original file name
*
}
}
-
/**
* Step the current XML reader until node end of given name is found.
*
}
}
-
/**
* Asserts that the xml reader is at an element of given tag that contains a given text,
* and skips over the element.
$this->testCase = $testCase;
}
-
// --- Making protected functions visible for test
public function output( $out, $channel = null ) {
return call_user_func_array( array( "parent", __FUNCTION__ ), func_get_args() );
}
-
// --- Requirements for getting instance of abstract class
public function execute() {
*/
class MaintenanceTest extends MediaWikiTestCase {
-
/**
* The main Maintenance instance that is used for testing.
*
*/
private $m;
-
protected function setUp() {
parent::setUp();
$this->m = new MaintenanceFixup( $this );
parent::tearDown();
}
-
/**
* asserts the output before and after simulating shutdown
*
$this->expectOutputString( $postShutdownOutput );
}
-
// Although the following tests do not seem to be too consistent (compare for
// example the newlines within the test.*StringString tests, or the
// test.*Intermittent.* tests), the objective of these tests is not to describe
$this->assertPrefetchEquals( "BackupDumperTestP2Text1", 2, 2 );
}
-
/**
* Constructs a temporary file that can be used for prefetching
*
$this->checkpointHelper( "gzip" );
}
-
/**
* Creates a stub file that is used for testing the text pass of dumps
*
*/
class BackupDumperLoggerTest extends DumpTestCase {
-
// We'll add several log entries and users for this test. The following
// variables hold the corresponding ids.
private $userId1, $userId2;
}
}
-
/**
* asserts that the xml reader is at the beginning of a log entry and skips over
* it while analyzing it.
$this->assertDumpEnd();
}
-
function testXmlDumpsBackupUseCase() {
// xmldumps-backup typically performs a single dump that that writes
// out three files
*/
private $mockInvocations = array( 'getStdin' => 0 );
-
/**
* Data for the fake stdin
*
private $textId4;
private $textId5;
-
/**
* @var Exception|null As the current MediaWikiTestCase::run is not
* robust enough to recover from thrown exceptions directly, we cannot
throw new MWException( "Could not determine text id" );
}
-
function addDBData() {
$this->tablesUsed[] = 'page';
$this->tablesUsed[] = 'revision';
}
}
-
protected function setUp() {
parent::setUp();
$this->fetchText = new SemiMockedFetchText();
}
-
/**
* Helper to relate FetchText's input and output
*/
$this->expectOutputString( $expectedOutput );
}
-
// Instead of the following functions, a data provider would be great.
// However, as data providers are evaluated /before/ addDBData, a data
// provider would not know the required ids.
);
}
-
#### Attributes for external links ##########################
private function getAttribs() {
# Sidebar text we will use everytime
return false;
}
-
/**
* Clear section name and its data
*/
return;
}
-
// Check the source file storage path
if ( !$img->exists() ) {
$redirectedLocation = false;
unset( $params['r'] ); // ignore 'r' because we unconditionally pass File::RENDER
unset( $params['f'] ); // We're done with 'f' parameter.
-
// Get the normalized thumbnail name from the parameters...
try {
$thumbName = $img->thumbName( $params );