/**
* Constructor from a page id
* @param $id Int article ID to load
+ * @return Article|null
*/
public static function newFromID( $id ) {
$t = Title::newFromID( $id );
/**
* Execute the uncached parse for action=view
+ * @return bool
*/
public function doViewParse() {
global $wgOut;
# Don't collide with expired blocks
Block::purgeExpired();
- $ipb_id = $dbw->nextSequenceValue( 'ipblocks_ipb_id_seq' );
$dbw->insert(
'ipblocks',
$this->getDatabaseArray(),
* This is for backwards compatibility.
* @since 1.17
*/
-
class HttpRequest extends MWHttpRequest { }
# Factory methods
+ /**
+ * @param $row
+ * @return RecentChange
+ */
public static function newFromRow( $row ) {
$rc = new RecentChange;
$rc->loadFromRow( $row );
return $rc;
}
+ /**
+ * @staticw
+ * @return RecentChange
+ */
public static function newFromCurRow( $row ) {
$rc = new RecentChange;
$rc->loadFromCurRow( $row );
return $this->mTitle;
}
+ /**
+ * @return bool|\Title
+ */
public function getMovedToTitle() {
if( $this->mMovedToTitle === false ) {
$this->mMovedToTitle = Title::makeTitle( $this->mAttribs['rc_moved_to_ns'],
return $this->mMovedToTitle;
}
- # Writes the data in this object to the database
+ /**
+ * Writes the data in this object to the database
+ */
public function save() {
global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPOmitBots;
$fname = 'RecentChange::save';
# Set the ID
$this->mAttribs['rc_id'] = $dbw->insertId();
-
+
# Notify extensions
wfRunHooks( 'RecentChange_save', array( &$this ) );
if( $wgUseEnotif || $wgShowUpdatedMarker ) {
// Users
if( $this->mAttribs['rc_user'] ) {
- $editor = ($wgUser->getId() == $this->mAttribs['rc_user']) ?
+ $editor = ($wgUser->getId() == $this->mAttribs['rc_user']) ?
$wgUser : User::newFromID( $this->mAttribs['rc_user'] );
// Anons
} else {
- $editor = ($wgUser->getName() == $this->mAttribs['rc_user_text']) ?
+ $editor = ($wgUser->getName() == $this->mAttribs['rc_user_text']) ?
$wgUser : User::newFromName( $this->mAttribs['rc_user_text'], false );
}
# @todo FIXME: This would be better as an extension hook
$this->mAttribs['rc_last_oldid'] );
}
}
-
+
public function notifyRC2UDP() {
global $wgRC2UDPAddress, $wgRC2UDPOmitBots;
# Notify external application via UDP
}
return false;
}
-
+
/**
* Remove newlines, carriage returns and decode html entites
* @param $text String
}
return $change->doMarkPatrolled( $wgUser, $auto );
}
-
+
/**
* Mark this RecentChange as patrolled
*
wfRunHooks( 'MarkPatrolledComplete', array($this->getAttribute('rc_id'), &$user, false) );
return array();
}
-
+
/**
* Mark this RecentChange patrolled, without error checking
* @return Integer: number of affected rows
return $rc;
}
- public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip='', $type,
+ /**
+ * @param $timestamp
+ * @param $title
+ * @param $user
+ * @param $actionComment
+ * @param $ip string
+ * @param $type
+ * @param $action
+ * @param $target
+ * @param $logComment
+ * @param $params
+ * @param $newId int
+ * @return bool
+ */
+ public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip='', $type,
$action, $target, $logComment, $params, $newId=0 )
{
global $wgLogRestrictions;
return $rc;
}
- # Initialises the members of this object from a mysql row object
+ /**
+ * Initialises the members of this object from a mysql row object
+ *
+ * @param $row
+ */
public function loadFromRow( $row ) {
$this->mAttribs = get_object_vars( $row );
$this->mAttribs['rc_timestamp'] = wfTimestamp(TS_MW, $this->mAttribs['rc_timestamp']);
$this->mAttribs['rc_deleted'] = $row->rc_deleted; // MUST be set
}
- # Makes a pseudo-RC entry from a cur row
+ /**
+ * Makes a pseudo-RC entry from a cur row
+ *
+ * @param $row
+ */
public function loadFromCurRow( $row ) {
$this->mAttribs = array(
'rc_timestamp' => wfTimestamp(TS_MW, $row->rev_timestamp),
return isset( $this->mAttribs[$name] ) ? $this->mAttribs[$name] : null;
}
+ /**
+ * @return array
+ */
public function getAttributes() {
return $this->mAttribs;
}
/**
* Gets the end part of the diff URL associated with this object
* Blank if no diff link should be displayed
+ * @param $forceCur
+ * @return string
*/
public function diffLinkTrail( $forceCur ) {
if( $this->mAttribs['rc_type'] == RC_EDIT ) {
return $trail;
}
+ /**
+ * @return string
+ */
public function getIRCLine() {
global $wgUseRCPatrol, $wgUseNPPatrol, $wgRC2UDPInterwikiPrefix, $wgLocalInterwiki,
$wgCanonicalServer, $wgScript;
} else {
$titleString = "\00314[[\00307$title\00314]]";
}
-
+
# see http://www.irssi.org/documentation/formats for some colour codes. prefix is \003,
# no colour (\003) switches back to the term default
$fullString = "$titleString\0034 $flag\00310 " .
"\00302$url\003 \0035*\003 \00303$user\003 \0035*\003 $szdiff \00310$comment\003\n";
-
+
return $fullString;
}
/**
* Returns the change size (HTML).
* The lengths can be given optionally.
+ * @param $old int
+ * @param $new int
+ * @return string
*/
public function getCharacterDifference( $old = 0, $new = 0 ) {
if( $old === 0 ) {
$this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
}
- $article = new Article( $title, 0 );
$res = array( 'title' => $title->getPrefixedText() );
if ( $params['unwatch'] ) {
$ignore = in_array( 'IGNORE', $insertOptions ) ? 'mw' : '';
if( is_array( $insertOptions ) ) {
- $insertOptions = implode( ' ', $insertOptions );
+ $insertOptions = implode( ' ', $insertOptions ); // FIXME: This is unused
}
if( !is_array( $selectOptions ) ) {
$selectOptions = array( $selectOptions );
}
// return the middle diagonal with maximal progress.
- return $max_progress[floor( $num_progress / 2 )];
+ return $max_progress[(int)floor( $num_progress / 2 )];
}
+ /**
+ * @return mixed
+ */
public function getLcsLength() {
if ( $this->heuristicUsed && !$this->lcsLengthCorrectedForHeuristic ) {
$this->lcsLengthCorrectedForHeuristic = true;
list( $srcRel, $archiveRel ) = $pair;
$srcPath = "{$this->directory}/$srcRel";
$archivePath = "{$this->deletedDir}/$archiveRel";
- $good = true;
if ( file_exists( $archivePath ) ) {
# A file with this content hash is already archived
wfSuppressWarnings();
$conn = $status->value;
$dbName = $this->getVar( 'wgDBname' );
- $schema = $this->getVar( 'wgDBmwschema' );
- $user = $this->getVar( 'wgDBuser' );
+ //$schema = $this->getVar( 'wgDBmwschema' );
+ //$user = $this->getVar( 'wgDBuser' );
//$safeschema = $conn->addIdentifierQuotes( $schema );
//$safeuser = $conn->addIdentifierQuotes( $user );
}
$conn = $status->value;
- $schema = $this->getVar( 'wgDBmwschema' );
+ //$schema = $this->getVar( 'wgDBmwschema' );
$safeuser = $conn->addIdentifierQuotes( $this->getVar( 'wgDBuser' ) );
$safepass = $conn->addQuotes( $this->getVar( 'wgDBpassword' ) );
//$safeschema = $conn->addIdentifierQuotes( $schema );
{
$this->use = $use;
}
-
+
private static $mHavePear = null;
/**
* Returns cached result of class_exists('pear'), to avoid calling AutoLoader numerous times
{
$this->message = $message;
}
-
+
function __toString()
{
return $this->message;
'user_id', 'user_name', 'user_editcount',
);
- $conds = array();
-
$joins = array(
// IP's don't have an entry in user table
'user' => array( 'LEFT JOIN', 'log_user=user_id' ),
}
/**
- * Set extra log parameters.
+ * Set extra log parameters.
* You can pass params to the log action message
* by prefixing the keys with a number and colon.
* The numbering should start with number 4, the
}
public function getComment() {
- $subtype = $this->entry->getSubtype();
$timestamp = wfTimestamp( TS_MW, $this->entry->getTimestamp() );
if ( $timestamp < '20080129000000' ) {
# Suppress $comment from old entries (before 2008-01-29),
}
return parent::getComment();
}
-}
\ No newline at end of file
+}
* @return bool
*/
function normaliseParams( $image, &$params ) {
-
+
if ( !parent::normaliseParams( $image, $params ) ) {
return false;
}
- $mimeType = $image->getMimeType();
# Obtain the source, pre-rotation dimensions
$srcWidth = $image->getWidth( $params['page'] );
$srcHeight = $image->getHeight( $params['page'] );
return true;
}
}
-
+
return true;
}
-
+
/**
- * Check if the file is smaller than the maximum image area for
+ * Check if the file is smaller than the maximum image area for
* thumbnailing. Check will always pass if the scaler is 'hookaborted' or
* if the scaler is 'im' and the mime type is 'image/jpeg'
- *
+ *
* @param File $image
- * @param string $scaler
+ * @param string $scaler
*/
function checkImageArea( $image, $scaler ) {
global $wgMaxImageArea;
# Don't thumbnail an image so big that it will fill hard drives and send servers into swap
# JPEG has the handy property of allowing thumbnailing without full decompression, so we make
# an exception for it.
-
-
+
+
if ( $image->getMimeType() == 'image/jpeg' && $scaler == 'im' )
{
# ImageMagick can efficiently downsize jpg images without loading
# the entire file in memory
return true;
}
-
+
if ( $scaler == 'hookaborted' )
{
- # If a hook wants to transform the image, it is responsible for
+ # If a hook wants to transform the image, it is responsible for
# checking the image size, so abort here
return true;
}
-
+
# Do the actual check
return $this->getImageArea( $image, $image->getWidth(), $image->getHeight() ) <= $wgMaxImageArea;
}
wfDebug( __METHOD__ . ": Hook to BitmapHandlerTransform created an mto\n" );
$scaler = 'hookaborted';
}
-
+
# Check max image area
if ( !$this->checkImageArea( $image, $scaler ) )
{
if ( $this->mEditSectionTokens ) {
return preg_replace_callback( ParserOutput::EDITSECTION_REGEX,
array( &$this, 'replaceEditSectionLinksCallback' ), $this->mText );
- } else {
- return preg_replace( ParserOutput::EDITSECTION_REGEX, '', $this->mText );
}
- return $this->mText;
+ return preg_replace( ParserOutput::EDITSECTION_REGEX, '', $this->mText );
}
/**
if ( count( $paramArray ) >= 2 ) {
// Different revision types use different URL params...
- $originalKey = $key = $paramArray[0];
+ $key = $paramArray[0];
// $paramArray[1] is a CSV of the IDs
$Ids = explode( ',', $paramArray[1] );
$this->getOutput()->addHtml( '<p></p>' );
return;
}
- $messageName = '';
+
if( $t->isKnown() ) {
$messageName = 'searchmenu-exists';
} elseif( $t->userCan( 'create' ) ) {
}
}
- $dbr = $this->repo->getSlaveDb();
-
if ( !isset( $this->fileMetadata[$key] ) ) {
if ( !$this->fetchFileMetadata( $key ) ) {
// If nothing was received, it's likely due to replication lag. Check the master to see if the record is there.
$usec = substr($usec, 2);
$key = wfBaseConvert( $sec . $usec, 10, 36 ) . '.' .
wfBaseConvert( mt_rand(), 10, 36 ) . '.'.
- $this->userId . '.' .
+ $this->userId . '.' .
$extension;
$this->fileProps[$key] = $fileProps;
'specialpages-summary' => '', # do not translate or duplicate this message to other languages
'specialpages-note' => '----
* Normal special pages.
-* <span class="mw-specialpagerestricted">Restricted special pages.</span>
-* <span class="mw-specialpagecached">Cached special pages (might be obsolete).</span>',
+* <span class="mw-specialpagerestricted">Restricted special pages.</span>',
'specialpages-group-maintenance' => 'Maintenance reports',
'specialpages-group-other' => 'Other special pages',
'specialpages-group-login' => 'Login / sign up',
* @param $n Integer: unused
*/
function insertPage( $pageName, $text, $ns ) {
- $dbw = $this->db;
$title = Title::newFromText( $pageName );
$user = User::newFromName( 'WikiSysop' );