* Deleted DatabaseMysql.php, no longer necessary, database classes are autoloaded.
* Moved wfGetMimeMagic() to MimeMagic::singleton()
* Fixed a couple of __CLASS__.'::'.__FUNCTION__ things.
}
require_once( 'AjaxFunctions.php' );
-require_once( 'AjaxResponse.php' );
class AjaxDispatcher {
var $mode;
if( !defined( 'MEDIAWIKI' ) )
die( 1 );
-require_once('WebRequest.php');
-
/**
* Function converts an Javascript escaped string back into a string with
* specified charset (default is UTF-8).
* @package MediaWiki
*/
-/**
- * Need the CacheManager to be loaded
- */
-require_once( 'CacheManager.php' );
-
/**
* Class representing a MediaWiki article and history.
*
# diff page instead of the article.
if ( !is_null( $diff ) ) {
- require_once( 'DifferenceEngine.php' );
$wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
$de = new DifferenceEngine( $this->mTitle, $oldid, $diff, $rcid );
* action=protect handler
*/
function protect() {
- require_once 'ProtectionForm.php';
$form = new ProtectionForm( $this );
$form->show();
}
'TurckBagOStuff' => 'includes/BagOStuff.php',
'APCBagOStuff' => 'includes/BagOStuff.php',
'eAccelBagOStuff' => 'includes/BagOStuff.php',
+ 'DBABagOStuff' => 'includes/BagOStuff.php',
'Block' => 'includes/Block.php',
'CacheManager' => 'includes/CacheManager.php',
'CategoryPage' => 'includes/CategoryPage.php',
* @package MediaWiki
*/
-/** See Database::makeList() */
-define( 'LIST_COMMA', 0 );
-define( 'LIST_AND', 1 );
-define( 'LIST_SET', 2 );
-define( 'LIST_NAMES', 3);
-define( 'LIST_OR', 4);
-
/** Number of times to re-try an operation in case of deadlock */
define( 'DEADLOCK_TRIES', 4 );
/** Minimum time to wait before retry, in microseconds */
+++ /dev/null
-<?php
-/*
- * Stub database class for MySQL.
- */
-require_once('Database.php');
-?>
* @package MediaWiki
*/
-/**
- * Depends on database
- */
-require_once( 'Database.php' );
-
class OracleBlob extends DBObject {
function isLOB() {
return true;
* @package MediaWiki
*/
-/**
- * Depends on database
- */
-require_once( 'Database.php' );
-
class DatabasePostgres extends Database {
var $mInsertId = NULL;
var $mLastResult = NULL;
define( 'EDIT_DEFER_UPDATES', 32 );
/**#@-*/
+/**
+ * Flags for Database::makeList()
+ * These are also available as Database class constants
+ */
+define( 'LIST_COMMA', 0 );
+define( 'LIST_AND', 1 );
+define( 'LIST_SET', 2 );
+define( 'LIST_NAMES', 3);
+define( 'LIST_OR', 4);
+
+
?>
* @subpackage DifferenceEngine
*/
-/** */
-define( 'MAX_DIFF_LINE', 10000 );
-define( 'MAX_DIFF_XREF_LENGTH', 10000 );
-
/**
* @todo document
* @public
*/
class _DiffEngine
{
+ const MAX_XREF_LENGTH = 10000;
+
function diff ($from_lines, $to_lines) {
$fname = '_DiffEngine::diff';
wfProfileIn( $fname );
* Returns the whole line if it's small enough, or the MD5 hash otherwise
*/
function _line_hash( $line ) {
- if ( strlen( $line ) > MAX_DIFF_XREF_LENGTH ) {
+ if ( strlen( $line ) > self::MAX_XREF_LENGTH ) {
return md5( $line );
} else {
return $line;
*/
class WordLevelDiff extends MappedDiff
{
+ const MAX_LINE_LENGTH = 10000;
+
function WordLevelDiff ($orig_lines, $closing_lines) {
$fname = 'WordLevelDiff::WordLevelDiff';
wfProfileIn( $fname );
$words[] = "\n";
$stripped[] = "\n";
}
- if ( strlen( $line ) > MAX_DIFF_LINE ) {
+ if ( strlen( $line ) > self::MAX_LINE_LENGTH ) {
$words[] = $line;
$stripped[] = $line;
} else {
$wgOut->addHtml( wfHidden( 'wpAutoSummary', $autosumm ) );
if ( $this->isConflict ) {
- require_once( "DifferenceEngine.php" );
$wgOut->addWikiText( '==' . wfMsg( "yourdiff" ) . '==' );
$de = new DifferenceEngine( $this->mTitle );
* @return string HTML
*/
function getDiff() {
- require_once( 'DifferenceEngine.php' );
$oldtext = $this->mArticle->fetchContent();
$newtext = $this->mArticle->replaceSection(
$this->section, $this->textbox1, $this->summary, $this->edittime );
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# http://www.gnu.org/copyleft/gpl.html
+
/**
*
* @package MediaWiki
* @subpackage SpecialPage
*/
-/** */
-
-define( 'MW_EXPORT_FULL', 0 );
-define( 'MW_EXPORT_CURRENT', 1 );
-
-define( 'MW_EXPORT_BUFFER', 0 );
-define( 'MW_EXPORT_STREAM', 1 );
-
-define( 'MW_EXPORT_TEXT', 0 );
-define( 'MW_EXPORT_STUB', 1 );
-
-
-/**
- * @package MediaWiki
- * @subpackage SpecialPage
- */
class WikiExporter {
-
var $list_authors = false ; # Return distinct author list (when not returning full history)
var $author_list = "" ;
+ const FULL = 0;
+ const CURRENT = 1;
+
+ const BUFFER = 0;
+ const STREAM = 1;
+
+ const TEXT = 0;
+ const STUB = 1;
+
/**
- * If using MW_EXPORT_STREAM to stream a large amount of data,
+ * If using WikiExporter::STREAM to stream a large amount of data,
* provide a database connection which is not managed by
* LoadBalancer to read from: some history blob types will
* make additional queries to pull source data while the
* main query is still running.
*
* @param Database $db
- * @param mixed $history one of MW_EXPORT_FULL or MW_EXPORT_CURRENT, or an
+ * @param mixed $history one of WikiExporter::FULL or WikiExporter::CURRENT, or an
* associative array:
* offset: non-inclusive offset at which to start the query
* limit: maximum number of rows to return
* dir: "asc" or "desc" timestamp order
- * @param int $buffer one of MW_EXPORT_BUFFER or MW_EXPORT_STREAM
+ * @param int $buffer one of WikiExporter::BUFFER or WikiExporter::STREAM
*/
- function WikiExporter( &$db, $history = MW_EXPORT_CURRENT,
- $buffer = MW_EXPORT_BUFFER, $text = MW_EXPORT_TEXT ) {
+ function WikiExporter( &$db, $history = WikiExporter::CURRENT,
+ $buffer = WikiExporter::BUFFER, $text = WikiExporter::TEXT ) {
$this->db =& $db;
$this->history = $history;
$this->buffer = $buffer;
$order = 'ORDER BY page_id';
$limit = '';
- if( $this->history == MW_EXPORT_FULL ) {
+ if( $this->history == WikiExporter::FULL ) {
$join = 'page_id=rev_page';
- } elseif( $this->history == MW_EXPORT_CURRENT ) {
+ } elseif( $this->history == WikiExporter::CURRENT ) {
if ( $this->list_authors && $cond != '' ) { // List authors, if so desired
$this->do_list_authors ( $page , $revision , $cond );
}
}
$where = ( $cond == '' ) ? '' : "$cond AND";
- if( $this->buffer == MW_EXPORT_STREAM ) {
+ if( $this->buffer == WikiExporter::STREAM ) {
$prev = $this->db->bufferResults( false );
}
if( $cond == '' ) {
$revindex = '';
$straight = '';
}
- if( $this->text == MW_EXPORT_STUB ) {
+ if( $this->text == WikiExporter::STUB ) {
$sql = "SELECT $straight * FROM
$page $pageindex,
$revision $revindex
$this->outputStream( $wrapper );
}
- if( $this->buffer == MW_EXPORT_STREAM ) {
+ if( $this->buffer == WikiExporter::STREAM ) {
$this->db->bufferResults( $prev );
}
* DB accessable external objects
*
*/
-require_once( 'LoadBalancer.php' );
/** @package MediaWiki */
* @fixme Probably only works on MySQL. Abstract to the Database class?
*/
static function lock() {
- $fname = __CLASS__ . '::' . __FUNCTION__;
-
$dbw = wfGetDB( DB_MASTER );
$lockname = $dbw->addQuotes( FileStore::lockName() );
- $result = $dbw->query( "SELECT GET_LOCK($lockname, 5) AS lockstatus", $fname );
+ $result = $dbw->query( "SELECT GET_LOCK($lockname, 5) AS lockstatus", __METHOD__ );
$row = $dbw->fetchObject( $result );
$dbw->freeResult( $result );
if( $row->lockstatus == 1 ) {
return true;
} else {
- wfDebug( "$fname failed to acquire lock\n" );
+ wfDebug( __METHOD__." failed to acquire lock\n" );
return false;
}
}
* Release the global file store lock.
*/
static function unlock() {
- $fname = __CLASS__ . '::' . __FUNCTION__;
-
$dbw = wfGetDB( DB_MASTER );
$lockname = $dbw->addQuotes( FileStore::lockName() );
- $result = $dbw->query( "SELECT RELEASE_LOCK($lockname)", $fname );
+ $result = $dbw->query( "SELECT RELEASE_LOCK($lockname)", __METHOD__ );
$row = $dbw->fetchObject( $result );
$dbw->freeResult( $result );
}
}
private function copyFile( $sourcePath, $destPath, $flags=0 ) {
- $fname = __CLASS__ . '::' . __FUNCTION__;
-
if( !file_exists( $sourcePath ) ) {
// Abort! Abort!
throw new FSException( "missing source file '$sourcePath'\n" );
wfRestoreWarnings();
if( $ok ) {
- wfDebug( "$fname copied '$sourcePath' to '$destPath'\n" );
+ wfDebug( __METHOD__." copied '$sourcePath' to '$destPath'\n" );
$transaction->addRollback( FSTransaction::DELETE_FILE, $destPath );
} else {
throw new FSException(
- "$fname failed to copy '$sourcePath' to '$destPath'\n" );
+ __METHOD__." failed to copy '$sourcePath' to '$destPath'\n" );
}
}
* @return string or false if could not open file or bad extension
*/
static function calculateKey( $path, $extension ) {
- $fname = __CLASS__ . '::' . __FUNCTION__;
-
wfSuppressWarnings();
$hash = sha1_file( $path );
wfRestoreWarnings();
if( $hash === false ) {
- wfDebug( "$fname: couldn't hash file '$path'\n" );
+ wfDebug( __METHOD__.": couldn't hash file '$path'\n" );
return false;
}
if( self::validKey( $key ) ) {
return $key;
} else {
- wfDebug( "$fname: generated bad key '$key'\n" );
+ wfDebug( __METHOD__.": generated bad key '$key'\n" );
return false;
}
}
}
private function apply( $actions ) {
- $fname = __CLASS__ . '::' . __FUNCTION__;
$result = true;
foreach( $actions as $item ) {
list( $action, $path ) = $item;
$ok = unlink( $path );
wfRestoreWarnings();
if( $ok )
- wfDebug( "$fname: deleting file '$path'\n" );
+ wfDebug( __METHOD__.": deleting file '$path'\n" );
else
- wfDebug( "$fname: failed to delete file '$path'\n" );
+ wfDebug( __METHOD__.": failed to delete file '$path'\n" );
$result = $result && $ok;
}
}
return $siteNotice;
}
-/** Global singleton instance of MimeMagic. This is initialized on demand,
-* please always use the wfGetMimeMagic() function to get the instance.
-*
-* @private
-*/
-$wgMimeMagic= NULL;
-
-/** Factory functions for the global MimeMagic object.
-* This function always returns the same singleton instance of MimeMagic.
-* That objects will be instantiated on the first call to this function.
-* If needed, the MimeMagic.php file is automatically included by this function.
-* @return MimeMagic the global MimeMagic objects.
-*/
+/**
+ * BC wrapper for MimeMagic::singleton()
+ * @deprecated
+ */
function &wfGetMimeMagic() {
- global $wgMimeMagic;
-
- if (!is_null($wgMimeMagic)) {
- return $wgMimeMagic;
- }
-
- if (!class_exists("MimeMagic")) {
- #include on demand
- require_once("MimeMagic.php");
- }
-
- $wgMimeMagic= new MimeMagic();
-
- return $wgMimeMagic;
+ return MimeMagic::singleton();
}
-
/**
* Tries to get the system directory for temporary files.
* The TMPDIR, TMP, and TEMP environment variables are checked in sequence,
wfProfileOut( $fname );
return false;
}
- require_once('ExternalStore.php');
$row->old_text=ExternalStore::fetchFromUrl($url);
}
if ( $this->fileExists ) {
- $magic=& wfGetMimeMagic();
+ $magic=& MimeMagic::singleton();
$this->mime = $magic->guessMimeType($this->imagePath,true);
$this->type = $magic->getMediaType($this->imagePath,$this->mime);
# Get size in bytes
$this->size = filesize( $this->imagePath );
- $magic=& wfGetMimeMagic();
+ $magic=& MimeMagic::singleton();
# Height and width
wfSuppressWarnings();
$tempFile = $store->filePath( $row->fa_storage_key );
$metadata = serialize( $this->retrieveExifData( $tempFile ) );
- $magic = wfGetMimeMagic();
+ $magic = MimeMagic::singleton();
$mime = $magic->guessMimeType( $tempFile, true );
$media_type = $magic->getMediaType( $tempFile, $mime );
list( $major_mime, $minor_mime ) = self::splitMime( $mime );
if( !defined( 'MEDIAWIKI' ) )
die( 1 );
-require_once( 'Image.php' );
-
/**
* Special handling for image description pages
* @package MediaWiki
$wgOut->addHTML($sharedtext);
if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) {
- require_once("HttpFunctions.php");
- $ur = ini_set('allow_url_fopen', true);
- $text = wfGetHTTP($url . '?action=render');
- ini_set('allow_url_fopen', $ur);
+ $text = Http::get($url . '?action=render');
if ($text)
$this->mExtraDescription = $text;
}
* @package MediaWiki
*/
-/**
- * Depends on the database object
- */
-require_once( 'Database.php' );
-
-
-# Scale polling time so that under overload conditions, the database server
-# receives a SHOW STATUS query at an average interval of this many microseconds
-define( 'AVG_STATUS_POLL', 2000 );
-
/**
* Database load balancing object
/* private */ var $mWaitForFile, $mWaitForPos, $mWaitTimeout;
/* private */ var $mLaggedSlaveMode, $mLastError = 'Unknown error';
+ /**
+ * Scale polling time so that under overload conditions, the database server
+ * receives a SHOW STATUS query at an average interval of this many microseconds
+ */
+ const AVG_STATUS_POLL = 2000;
+
function LoadBalancer( $servers, $failFunction = false, $waitTimeout = 10, $waitForMasterNow = false )
{
$this->mServers = $servers;
# Too much load, back off and wait for a while.
# The sleep time is scaled by the number of threads connected,
# to produce a roughly constant global poll rate.
- $sleepTime = AVG_STATUS_POLL * $status['Threads_connected'];
+ $sleepTime = self::AVG_STATUS_POLL * $status['Threads_connected'];
# If we reach the timeout and exit the loop, don't use it
$i = false;
extract( $server );
# Get class for this database type
$class = 'Database' . ucfirst( $type );
- if ( !class_exists( $class ) ) {
- require_once( "$class.php" );
- }
# Create object
$db = new $class( $host, $user, $password, $dbname, 1, $flags );
* file extension,
*
* Instances of this class are stateles, there only needs to be one global instance
-* of MimeMagic. Please use wfGetMimeMagic to get that instance.
+* of MimeMagic. Please use MimeMagic::singleton() to get that instance.
* @package MediaWiki
*/
class MimeMagic {
*/
var $mExtToMime= NULL;
- /** Initializes the MimeMagic object. This is called by wfGetMimeMagic when instantiation
- * the global MimeMagic singleton object.
+ /** The singleton instance
+ */
+ private static $instance;
+
+ /** Initializes the MimeMagic object. This is called by MimeMagic::singleton().
*
* This constructor parses the mime.types and mime.info files and build internal mappings.
*/
}
+ /**
+ * Get an instance of this class
+ */
+ static function &singleton() {
+ if ( !isset( self::$instance ) ) {
+ self::$instance = new MimeMagic;
+ }
+ return self::$instance;
+ }
+
/** returns a list of file extensions for a given mime type
* as a space separated string.
*/
} elseif ( $type == CACHE_ACCEL ) {
if ( !array_key_exists( CACHE_ACCEL, $wgCaches ) ) {
if ( function_exists( 'eaccelerator_get' ) ) {
- require_once( 'BagOStuff.php' );
$wgCaches[CACHE_ACCEL] = new eAccelBagOStuff;
} elseif ( function_exists( 'apc_fetch') ) {
- require_once( 'BagOStuff.php' );
$wgCaches[CACHE_ACCEL] = new APCBagOStuff;
} elseif ( function_exists( 'mmcache_get' ) ) {
- require_once( 'BagOStuff.php' );
$wgCaches[CACHE_ACCEL] = new TurckBagOStuff;
} else {
$wgCaches[CACHE_ACCEL] = false;
}
} elseif ( $type == CACHE_DBA ) {
if ( !array_key_exists( CACHE_DBA, $wgCaches ) ) {
- require_once( 'BagOStuff.php' );
$wgCaches[CACHE_DBA] = new DBABagOStuff;
}
$cache =& $wgCaches[CACHE_DBA];
if ( $type == CACHE_DB || ( $inputType == CACHE_ANYTHING && $cache === false ) ) {
if ( !array_key_exists( CACHE_DB, $wgCaches ) ) {
- require_once( 'BagOStuff.php' );
$wgCaches[CACHE_DB] = new MediaWikiBagOStuff('objectcache');
}
$cache =& $wgCaches[CACHE_DB];
function showLogExtract( &$out ) {
# Show relevant lines from the deletion log:
$out->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'protect' ) ) . "</h2>\n" );
- require_once( 'SpecialLog.php' );
$logViewer = new LogViewer(
new LogReader(
new FauxRequest(
* @todo document
*/
-/** */
-require_once( 'Database.php' );
-
/**
* @package MediaWiki
* @todo document
wfProfileOut( $fname );
return false;
}
- require_once('ExternalStore.php');
$text=ExternalStore::fetchFromURL($url);
}
} else {
$store = $wgDefaultExternalStore;
}
- require_once('ExternalStore.php');
// Store and get the URL
$data = ExternalStore::insert( $store, $data );
if ( !$data ) {
}
// If we kept data for lazy extraction, use it now...
- $row = $this->mTextRow;
- $this->mTextRow = null;
+ if ( isset( $this->mTextRow ) ) {
+ $row = $this->mTextRow;
+ $this->mTextRow = null;
+ } else {
+ $row = null;
+ }
if( !$row ) {
// Text data is immutable; check slaves first.
*/
function specialPagesList() {
global $wgUser, $wgContLang, $wgServer, $wgRedirectScript;
- require_once('SpecialPage.php');
$a = array();
$pages = array_merge( SpecialPage::getRegularPages(), SpecialPage::getRestrictedPages() );
foreach ( $pages as $name => $page ) {
* @subpackage SpecialPage
*/
-/** */
-require_once( 'Export.php' );
-
/**
*
*/
);
$historyCheck = $wgRequest->getCheck( 'history' );
if ( $curonly ) {
- $history = MW_EXPORT_CURRENT;
+ $history = WikiExporter::CURRENT;
} elseif ( !$historyCheck ) {
if ( $limit > 0 && $limit < $wgExportMaxHistory ) {
$history['limit'] = $limit;
$page = $wgRequest->getText( 'pages', $page );
$historyCheck = $wgRequest->getCheck( 'history' );
if( $historyCheck ) {
- $history = MW_EXPORT_FULL;
+ $history = WikiExporter::FULL;
} else {
- $history = MW_EXPORT_CURRENT;
+ $history = WikiExporter::CURRENT;
}
}
if( !$wgExportAllowHistory ) {
// Override
- $history = MW_EXPORT_CURRENT;
+ $history = WikiExporter::CURRENT;
}
$list_authors = $wgRequest->getCheck( 'listauthors' );
* @subpackage SpecialPage
*/
-/**
- *
- */
-require_once( 'SpecialShortpages.php' );
-
/**
*
* @package MediaWiki
$fname = 'rcFormatDiff';
wfProfileIn( $fname );
- require_once( 'DifferenceEngine.php' );
$skin = $wgUser->getSkin();
$completeText = '<p>' . $skin->formatComment( $comment ) . "</p>\n";
* @fixme Does this belong in Image for fuller encapsulation?
*/
function listFiles() {
- $fname = __CLASS__ . '::' . __FUNCTION__;
if( $this->title->getNamespace() == NS_IMAGE ) {
$dbr =& wfGetDB( DB_SLAVE );
$res = $dbr->select( 'filearchive',
'fa_user_text',
'fa_timestamp' ),
array( 'fa_name' => $this->title->getDbKey() ),
- $fname,
+ __METHOD__,
array( 'ORDER BY' => 'fa_timestamp DESC' ) );
$ret = $dbr->resultObject( $res );
return $ret;
* @return string
*/
function getRevisionText( $timestamp ) {
- $fname = 'PageArchive::getRevisionText';
$dbr =& wfGetDB( DB_SLAVE );
$row = $dbr->selectRow( 'archive',
array( 'ar_text', 'ar_flags', 'ar_text_id' ),
array( 'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDbkey(),
'ar_timestamp' => $dbr->timestamp( $timestamp ) ),
- $fname );
+ __METHOD__ );
if( $row ) {
return $this->getTextFromRow( $row );
} else {
* Get the text from an archive row containing ar_text, ar_flags and ar_text_id
*/
function getTextFromRow( $row ) {
- $fname = 'PageArchive::getTextFromRow';
-
if( is_null( $row->ar_text_id ) ) {
// An old row from MediaWiki 1.4 or previous.
// Text is embedded in this row in classic compression format.
$text = $dbr->selectRow( 'text',
array( 'old_text', 'old_flags' ),
array( 'old_id' => $row->ar_text_id ),
- $fname );
+ __METHOD__ );
return Revision::getRevisionText( $text );
}
}
private function undeleteRevisions( $timestamps ) {
global $wgParser, $wgDBtype;
- $fname = __CLASS__ . '::' . __FUNCTION__;
$restoreAll = empty( $timestamps );
$dbw =& wfGetDB( DB_MASTER );
array( 'page_id', 'page_latest' ),
array( 'page_namespace' => $this->title->getNamespace(),
'page_title' => $this->title->getDBkey() ),
- $fname,
+ __METHOD__,
$options );
if( $page ) {
# Page already exists. Import the history, and if necessary
'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey(),
$oldones ),
- $fname,
+ __METHOD__,
/* options */ array(
'ORDER BY' => 'ar_timestamp' )
);
if( $dbw->numRows( $result ) < count( $timestamps ) ) {
- wfDebug( "$fname: couldn't find all requested rows\n" );
+ wfDebug( __METHOD__.": couldn't find all requested rows\n" );
return false;
}
'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey(),
$oldones ),
- $fname );
+ __METHOD__ );
return $restored;
}
/* private */ function showList() {
global $wgLang, $wgContLang, $wgUser, $wgOut;
- $fname = "UndeleteForm::showList";
# List undeletable articles
$result = PageArchive::listAllPages();
/* private */ function showRevision( $timestamp ) {
global $wgLang, $wgUser, $wgOut;
- $fname = "UndeleteForm::showRevision";
if(!preg_match("/[0-9]{14}/",$timestamp)) return 0;
# Show relevant lines from the deletion log:
$wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
- require_once( 'SpecialLog.php' );
$logViewer = new LogViewer(
new LogReader(
new FauxRequest(
* @subpackage SpecialPage
*/
-/**
- *
- */
-require_once 'Image.php';
+
/**
* Entry point
*/
*/
function verify( $tmpfile, $extension ) {
#magically determine mime type
- $magic=& wfGetMimeMagic();
+ $magic=& MimeMagic::singleton();
$mime= $magic->guessMimeType($tmpfile,false);
$fname= "SpecialUpload::verify";
function verifyExtension( $mime, $extension ) {
$fname = 'SpecialUpload::verifyExtension';
- $magic =& wfGetMimeMagic();
+ $magic =& MimeMagic::singleton();
if ( ! $mime || $mime == 'unknown' || $mime == 'unknown/unknown' )
if ( ! $magic->isRecognizableExtension( $extension ) ) {
/**
*
*/
-require_once( 'SpecialUpload.php' );
require_once( 'MogileFS.php' );
/**
return 'unknown/unknown';
}
else {
- $magic=& wfGetMimeMagic();
+ $magic=& MimeMagic::singleton();
return $magic->guessMimeType($filename); //full fancy mime detection
}
}
$data = $wgContLang->checkTitleEncoding( $data );
}
}
- require_once( 'normal/UtfNormal.php' );
$data = $this->normalizeUnicode( $data );
return $data;
} else {
$dumper->skipHeader = isset( $options['skip-header'] );
$dumper->skipFooter = isset( $options['skip-footer'] );
-$textMode = isset( $options['stub'] ) ? MW_EXPORT_STUB : MW_EXPORT_TEXT;
+$textMode = isset( $options['stub'] ) ? WikiExporter::STUB : WikiExporter::TEXT;
if( isset( $options['full'] ) ) {
- $dumper->dump( MW_EXPORT_FULL, $textMode );
+ $dumper->dump( WikiExporter::FULL, $textMode );
} elseif( isset( $options['current'] ) ) {
- $dumper->dump( MW_EXPORT_CURRENT, $textMode );
+ $dumper->dump( WikiExporter::CURRENT, $textMode );
} else {
$dumper->progress( <<<END
This script dumps the wiki page database into an XML interchange wrapper
class TextPassDumper extends BackupDumper {
var $prefetch = null;
var $input = "php://stdin";
- var $history = MW_EXPORT_FULL;
+ var $history = WikiExporter::FULL;
var $fetchCount = 0;
var $prefetchCount = 0;
$this->input = $url;
break;
case 'current':
- $this->history = MW_EXPORT_CURRENT;
+ $this->history = WikiExporter::CURRENT;
break;
case 'full':
- $this->history = MW_EXPORT_FULL;
+ $this->history = WikiExporter::FULL;
break;
}
}