Go to the documentation of this file.
65 $timestamp = 0, $auto = 0, $expiry =
'', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0,
72 if ( count( func_get_args() ) > 0 ) {
74 # wfDeprecated( __METHOD__ . " with arguments" );
78 if ( $this->target instanceof
User &&
$user ) {
79 $this->forcedTargetID =
$user;
86 $this->mReason = $reason;
90 $this->
prevents(
'createaccount', $createAccount );
91 if ( $expiry ==
'infinity' || $expiry ==
wfGetDB(
DB_SLAVE )->getInfinity() ) {
92 $this->mExpiry =
'infinity';
97 $this->mHideName = $hideName;
98 $this->
prevents(
'sendemail', $blockEmail );
101 $this->mFromMaster =
false;
110 public static function newFromID( $id ) {
114 self::selectFields(),
115 array(
'ipb_id' => $id ),
140 'ipb_create_account',
141 'ipb_enable_autoblock',
145 'ipb_allow_usertalk',
146 'ipb_parent_block_id',
160 (
string)$this->target == (
string)$block->target
161 && $this->type == $block->type
162 && $this->mAuto == $block->mAuto
164 && $this->
prevents(
'createaccount' ) == $block->
prevents(
'createaccount' )
165 && $this->mExpiry == $block->mExpiry
167 && $this->mHideName == $block->mHideName
169 && $this->
prevents(
'editownusertalk' ) == $block->
prevents(
'editownusertalk' )
170 && $this->mReason == $block->mReason
184 protected function newLoad( $vagueTarget =
null ) {
187 if ( $this->
type !==
null ) {
189 'ipb_address' =>
array( (
string)$this->target ),
195 # Be aware that the != '' check is explicit, since empty values will be
196 # passed by some callers (bug 29116)
197 if ( $vagueTarget !=
'' ) {
201 # Slightly weird, but who are we to argue?
202 $conds[
'ipb_address'][] = (string)
$target;
206 $conds[
'ipb_address'][] = (string)
$target;
208 $conds = $db->makeList( $conds,
LIST_OR );
213 $conds[
'ipb_address'][] = (string)
$target;
215 $conds = $db->makeList( $conds,
LIST_OR );
219 throw new MWException(
"Tried to load block with invalid type" );
223 $res = $db->select(
'ipblocks', self::selectFields(), $conds, __METHOD__ );
225 # This result could contain a block on the user, a block on the IP, and a russian-doll
226 # set of rangeblocks. We want to choose the most specific one, so keep a leader board.
229 # Lower will be better
230 $bestBlockScore = 100;
232 # This is begging for $this = $bestBlock, but that's not allowed in PHP :(
233 $bestBlockPreventsEdit =
null;
235 foreach (
$res as $row ) {
238 # Don't use expired blocks
243 # Don't use anon only blocks on users
249 # This is the number of bits that are allowed to vary in the block, give
250 # or take some floating point errors
251 $end = wfBaseconvert( $block->
getRangeEnd(), 16, 10 );
253 $size = log( $end - $start + 1, 2 );
255 # This has the nice property that a /32 block is ranked equally with a
256 # single-IP block, which is exactly what it is...
257 $score = self::TYPE_RANGE - 1 + (
$size / 128 );
263 if ( $score < $bestBlockScore ) {
264 $bestBlockScore = $score;
266 $bestBlockPreventsEdit = $block->
prevents(
'edit' );
270 if ( $bestRow !==
null ) {
272 $this->
prevents(
'edit', $bestBlockPreventsEdit );
285 public static function getRangeCond( $start, $end =
null ) {
286 if ( $end ===
null ) {
289 # Per bug 14634, we want to include relevant active rangeblocks; for
290 # rangeblocks, we want to include larger ranges which enclose the given
291 # range. We know that all blocks must be smaller than $wgBlockCIDRLimit,
292 # so we can improve performance by filtering on a LIKE clause
295 $like =
$dbr->buildLike( $chunk,
$dbr->anyString() );
297 # Fairly hard to make a malicious SQL statement out of hex characters,
298 # but stranger things have happened...
299 $safeStart =
$dbr->addQuotes( $start );
300 $safeEnd =
$dbr->addQuotes( $end );
302 return $dbr->makeList(
304 "ipb_range_start $like",
305 "ipb_range_start <= $safeStart",
306 "ipb_range_end >= $safeEnd",
320 if ( substr( $hex, 0, 3 ) ==
'v6-' ) {
321 return 'v6-' . substr( substr( $hex, 3 ), 0, floor( $wgBlockCIDRLimit[
'IPv6'] / 4 ) );
323 return substr( $hex, 0, floor( $wgBlockCIDRLimit[
'IPv4'] / 4 ) );
334 if ( $row->ipb_by ) {
335 $this->
setBlocker( User::newFromID( $row->ipb_by ) );
340 $this->mReason = $row->ipb_reason;
342 $this->mAuto = $row->ipb_auto;
343 $this->mHideName = $row->ipb_deleted;
344 $this->mId = $row->ipb_id;
345 $this->mParentBlockId = $row->ipb_parent_block_id;
349 if ( $row->ipb_expiry == $db->getInfinity() ) {
350 $this->mExpiry =
'infinity';
358 $this->
prevents(
'createaccount', $row->ipb_create_account );
359 $this->
prevents(
'sendemail', $row->ipb_block_email );
360 $this->
prevents(
'editownusertalk', !$row->ipb_allow_usertalk );
380 public function delete() {
385 if ( !$this->
getId() ) {
386 throw new MWException(
"Block::delete() requires that the mId member be filled\n" );
390 $dbw->delete(
'ipblocks',
array(
'ipb_parent_block_id' => $this->
getId() ), __METHOD__ );
391 $dbw->delete(
'ipblocks',
array(
'ipb_id' => $this->
getId() ), __METHOD__ );
393 return $dbw->affectedRows() > 0;
404 public function insert( $dbw =
null ) {
405 wfDebug(
"Block::insert; timestamp {$this->mTimestamp}\n" );
407 if ( $dbw ===
null ) {
411 # Don't collide with expired blocks
415 $row[
'ipb_id'] = $dbw->nextSequenceValue(
"ipblocks_ipb_id_seq" );
423 $affected = $dbw->affectedRows();
424 $this->mId = $dbw->insertId();
428 return array(
'id' => $this->mId,
'autoIds' => $auto_ipd_ids );
441 public function update() {
442 wfDebug(
"Block::update; timestamp {$this->mTimestamp}\n" );
445 $dbw->startAtomic( __METHOD__ );
454 $affected = $dbw->affectedRows();
461 array(
'ipb_parent_block_id' => $this->
getId() ),
468 array(
'ipb_parent_block_id' => $this->
getId() ),
473 $dbw->endAtomic( __METHOD__ );
477 return array(
'id' => $this->mId,
'autoIds' => $auto_ipd_ids );
492 $expiry = $db->encodeExpiry( $this->mExpiry );
494 if ( $this->forcedTargetID ) {
497 $uid = $this->target instanceof
User ? $this->target->getID() : 0;
501 'ipb_address' => (
string)$this->target,
503 'ipb_by' => $this->
getBy(),
505 'ipb_reason' => $this->mReason,
506 'ipb_timestamp' => $db->timestamp( $this->mTimestamp ),
509 'ipb_create_account' => $this->
prevents(
'createaccount' ),
511 'ipb_expiry' => $expiry,
514 'ipb_deleted' => intval( $this->mHideName ),
515 'ipb_block_email' => $this->
prevents(
'sendemail' ),
516 'ipb_allow_usertalk' => !$this->
prevents(
'editownusertalk' ),
528 'ipb_by' => $this->
getBy(),
530 'ipb_reason' => $this->mReason,
531 'ipb_create_account' => $this->
prevents(
'createaccount' ),
532 'ipb_deleted' => (
int)$this->mHideName,
533 'ipb_allow_usertalk' => !$this->
prevents(
'editownusertalk' ),
545 # If autoblock is enabled, autoblock the LAST IP(s) used
550 'PerformRetroactiveAutoblock',
array( $this, &$blockIds ) );
571 if ( !$wgPutIPinRC ) {
583 $res =
$dbr->select(
'recentchanges',
array(
'rc_ip' ), $conds,
586 if ( !
$res->numRows() ) {
587 # No results, don't autoblock anything
588 wfDebug(
"No IP found to retroactively autoblock\n" );
590 foreach (
$res as $row ) {
613 $key =
wfMemcKey(
'ipb',
'autoblock',
'whitelist' );
616 $lines = explode(
"\n",
wfMessage(
'autoblock_whitelist' )->inContentLanguage()->plain() );
620 wfDebug(
"Checking the autoblock whitelist..\n" );
624 if ( substr(
$line, 0, 1 ) !==
'*' ) {
628 $wlEntry = substr(
$line, 1 );
629 $wlEntry = trim( $wlEntry );
631 wfDebug(
"Checking $ip against $wlEntry..." );
633 # Is the IP in this range?
635 wfDebug(
" IP $ip matches $wlEntry, not autoblocking\n" );
652 # If autoblocks are disabled, go away.
657 # Check for presence on the autoblock whitelist.
658 if ( self::isWhitelistedFromAutoblocks( $autoblockIP ) ) {
662 # Allow hooks to cancel the autoblock.
663 if ( !
wfRunHooks(
'AbortAutoblock',
array( $autoblockIP, &$this ) ) ) {
664 wfDebug(
"Autoblock aborted by hook.\n" );
668 # It's okay to autoblock. Go ahead and insert/update the block...
670 # Do not add a *new* block if the IP is already blocked.
673 # Check if the block is an autoblock and would exceed the user block
674 # if renewed. If so, do nothing, otherwise prolong the block time...
675 if ( $ipblock->mAuto &&
678 # Reset block timestamp to now and its expiry to
679 # $wgAutoblockExpiry in the future
680 $ipblock->updateTimestamp();
685 # Make a new block object with the desired properties.
686 $autoblock =
new Block;
687 wfDebug(
"Autoblocking {$this->getTarget()}@" . $autoblockIP .
"\n" );
688 $autoblock->setTarget( $autoblockIP );
689 $autoblock->setBlocker( $this->
getBlocker() );
691 ->inContentLanguage()->plain();
694 $autoblock->mAuto = 1;
695 $autoblock->prevents(
'createaccount', $this->
prevents(
'createaccount' ) );
696 # Continue suppressing the name if needed
698 $autoblock->prevents(
'editownusertalk', $this->
prevents(
'editownusertalk' ) );
701 if ( $this->mExpiry ==
'infinity' ) {
702 # Original block was indefinite, start an autoblock now
705 # If the user is already blocked with an expiry date, we don't
706 # want to pile on top of that.
710 # Insert the block...
711 $status = $autoblock->insert();
725 wfDebug(
"Block::deleteIfExpired() -- deleting\n" );
729 wfDebug(
"Block::deleteIfExpired() -- not expired\n" );
743 wfDebug(
"Block::isExpired() checking current " .
$timestamp .
" vs $this->mExpiry\n" );
745 if ( !$this->mExpiry ) {
764 if ( $this->mAuto ) {
769 $dbw->update(
'ipblocks',
771 'ipb_timestamp' => $dbw->timestamp( $this->mTimestamp ),
772 'ipb_expiry' => $dbw->timestamp( $this->mExpiry ),
775 'ipb_address' => (
string)$this->
getTarget()
788 switch ( $this->
type ) {
797 throw new MWException(
"Block with invalid type" );
807 switch ( $this->
type ) {
816 throw new MWException(
"Block with invalid type" );
825 public function getBy() {
848 public function getId() {
859 return wfSetVar( $this->mFromMaster, $x );
870 # You can't *not* hardblock a user
871 return $this->
getType() == self::TYPE_USER
879 # You can't put an autoblock on an IP or range as we don't have any history to
880 # look over to get more IPs from
881 return $this->
getType() == self::TYPE_USER
892 public function prevents( $action, $x =
null ) {
895 # For now... <evil laugh>
898 case 'createaccount':
899 return wfSetVar( $this->mCreateAccount, $x );
902 return wfSetVar( $this->mBlockEmail, $x );
904 case 'editownusertalk':
905 return wfSetVar( $this->mDisableUsertalk, $x );
917 if ( $this->mAuto ) {
920 array(
'class' =>
'mw-autoblockid' ),
924 return htmlspecialchars( $this->
getTarget() );
935 global $wgAutoblockExpiry;
948 $method = __METHOD__;
950 $dbw->onTransactionIdle(
function() use ( $dbw, $method ) {
951 $dbw->delete(
'ipblocks',
952 array(
'ipb_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ), $method );
976 public static function newFromTarget( $specificTarget, $vagueTarget =
null, $fromMaster =
false ) {
982 } elseif (
$target ===
null && $vagueTarget ==
'' ) {
983 # We're not going to find anything useful here
984 # Be aware that the == '' check is explicit, since empty values will be
985 # passed by some callers (bug 29116)
992 $block =
new Block();
995 if (
$type !==
null ) {
999 if ( $block->
newLoad( $vagueTarget ) ) {
1017 if ( !count( $ipChain ) ) {
1023 foreach ( array_unique( $ipChain )
as $ipaddr ) {
1024 # Discard invalid IP addresses. Since XFF can be spoofed and we do not
1025 # necessarily trust the header given to us, make sure that we are only
1026 # checking for blocks on well-formatted IP addresses (IPv4 and IPv6).
1027 # Do not treat private IP spaces as special as it may be desirable for wikis
1028 # to block those IP ranges in order to stop misbehaving proxies that spoof XFF.
1032 # Don't check trusted IPs (includes local squids which will be in every request)
1036 # Check both the original IP (to check against single blocks), as well as build
1037 # the clause to check for rangeblocks for the given IP.
1038 $conds[
'ipb_address'][] = $ipaddr;
1042 if ( !count( $conds ) ) {
1047 if ( $fromMaster ) {
1052 $conds = $db->makeList( $conds,
LIST_OR );
1054 $conds =
array( $conds,
'ipb_anon_only' => 0 );
1056 $selectFields = array_merge(
1057 array(
'ipb_range_start',
'ipb_range_end' ),
1060 $rows = $db->select(
'ipblocks',
1067 foreach ( $rows
as $row ) {
1096 if ( !count( $blocks ) ) {
1098 } elseif ( count( $blocks ) == 1 ) {
1106 usort( $blocks,
function(
Block $a,
Block $b ) {
1109 return strcmp( $bWeight, $aWeight );
1112 $blocksListExact =
array(
1114 'disable_create' =>
false,
1118 $blocksListRange =
array(
1120 'disable_create' =>
false,
1124 $ipChain = array_reverse( $ipChain );
1126 foreach ( $blocks
as $block ) {
1129 if ( !$block->isHardblock() && $blocksListExact[
'hard'] ) {
1131 } elseif ( !$block->prevents(
'createaccount' ) && $blocksListExact[
'disable_create'] ) {
1135 foreach ( $ipChain
as $checkip ) {
1137 if ( (
string)$block->getTarget() === $checkip ) {
1138 if ( $block->isHardblock() ) {
1139 $blocksListExact[
'hard'] = $blocksListExact[
'hard'] ?: $block;
1140 } elseif ( $block->prevents(
'createaccount' ) ) {
1141 $blocksListExact[
'disable_create'] = $blocksListExact[
'disable_create'] ?: $block;
1142 } elseif ( $block->mAuto ) {
1143 $blocksListExact[
'auto'] = $blocksListExact[
'auto'] ?: $block;
1145 $blocksListExact[
'other'] = $blocksListExact[
'other'] ?: $block;
1149 } elseif ( array_filter( $blocksListExact ) ==
array()
1150 && $block->getRangeStart() <= $checkipHex
1151 && $block->getRangeEnd() >= $checkipHex
1153 if ( $block->isHardblock() ) {
1154 $blocksListRange[
'hard'] = $blocksListRange[
'hard'] ?: $block;
1155 } elseif ( $block->prevents(
'createaccount' ) ) {
1156 $blocksListRange[
'disable_create'] = $blocksListRange[
'disable_create'] ?: $block;
1157 } elseif ( $block->mAuto ) {
1158 $blocksListRange[
'auto'] = $blocksListRange[
'auto'] ?: $block;
1160 $blocksListRange[
'other'] = $blocksListRange[
'other'] ?: $block;
1167 if ( array_filter( $blocksListExact ) ==
array() ) {
1168 $blocksList = &$blocksListRange;
1170 $blocksList = &$blocksListExact;
1173 $chosenBlock =
null;
1174 if ( $blocksList[
'hard'] ) {
1175 $chosenBlock = $blocksList[
'hard'];
1176 } elseif ( $blocksList[
'disable_create'] ) {
1177 $chosenBlock = $blocksList[
'disable_create'];
1178 } elseif ( $blocksList[
'other'] ) {
1179 $chosenBlock = $blocksList[
'other'];
1180 } elseif ( $blocksList[
'auto'] ) {
1181 $chosenBlock = $blocksList[
'auto'];
1184 throw new MWException(
"Proxy block found, but couldn't be classified." );
1188 return $chosenBlock;
1201 # We may have been through this before
1208 } elseif (
$target ===
null ) {
1209 return array(
null,
null );
1215 # We can still create a User if it's an IP address, but we need to turn
1216 # off validation checking (which would exclude IP addresses)
1223 # Can't create a User from an IP range
1227 # Consider the possibility that this is not a username at all
1228 # but actually an old subpage (bug #29797)
1229 if ( strpos(
$target,
'/' ) !==
false ) {
1230 # An old subpage, drill down to the user behind it
1231 $parts = explode(
'/',
$target );
1236 if ( $userObj instanceof
User ) {
1237 # Note that since numbers are valid usernames, a $target of "12345" will be
1238 # considered a User. If you want to pass a block ID, prepend a hash "#12345",
1239 # since hash characters are not valid in usernames or titles generally.
1242 } elseif ( preg_match(
'/^#\d+$/',
$target ) ) {
1243 # Autoblock reference in the form "#12345"
1248 return array(
null,
null );
1313 $this->blocker =
$user;
1327 $link =
"[[{$blockerUserpage->getPrefixedText()}|{$blockerUserpage->getText()}]]";
1333 if ( $reason ==
'' ) {
1334 $reason = $context->
msg(
'blockednoreason' )->text();
1343 $this->mAuto ?
'autoblockedtext' :
'blockedtext',
1349 $lang->formatExpiry( $this->mExpiry ),
prevents( $action, $x=null)
Get/set whether the Block prevents a given action.
static toHex( $ip)
Return a zero-padded upper case hexadecimal representation of an IP address.
isHardblock( $x=null)
Get/set whether the Block is a hardblock (affects logged-in users on a given IP/range.
equals(Block $block)
Check if two blocks are effectively equal.
Integer $type
Block::TYPE_ constant.
getType()
Get the type of target for this particular block.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
getId()
Get the user's ID.
static getIpFragment( $hex)
Get the component of an IP address which is certain to be the same between an IP address and a rangeb...
isExpired()
Has the block expired?
static newFromID( $id)
Load a blocked user from their block id.
wfSetVar(&$dest, $source, $force=false)
Sets dest to source and returns the original value of dest If source is NULL, it just returns the val...
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
getBy()
Get the user id of the blocking sysop.
static chooseBlock(array $blocks, array $ipChain)
From a list of multiple blocks, find the most exact and strongest Block.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
update()
Update a block in the DB with new parameters.
wfProfileIn( $functionname)
Begin profiling of a function.
static newFromTarget( $specificTarget, $vagueTarget=null, $fromMaster=false)
Given a target and the target's type, get an existing Block object if possible.
wfReadOnly()
Check whether the wiki is in read-only mode.
msg()
Get a Message object with context set.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
isValid()
Is the block address valid (i.e.
initFromRow( $row)
Given a database row from the ipblocks table, initialize member variables.
getUserPage()
Get this user's personal page title.
getRangeEnd()
Get the IP address at the end of the range in Hex form.
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
deleteIfExpired()
Check if a block has expired.
insert( $dbw=null)
Insert a block into the block table.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
getRedactedName()
Get the block name, but with autoblocked IPs hidden as per standard privacy policy.
newLoad( $vagueTarget=null)
Load a block from the database which affects the already-set $this->target: 1) A block directly on th...
wfMemcKey()
Get a cache key.
static parseTarget( $target)
From an existing Block, get the target and the type of target.
static getRangeCond( $start, $end=null)
Get a set of SQL conditions which will select rangeblocks encompassing a given range.
doAutoblock( $autoblockIP)
Autoblocks the given IP, referring to this Block.
__construct( $address='', $user=0, $by=0, $reason='', $timestamp=0, $auto=0, $expiry='', $anonOnly=0, $createAccount=0, $enableAutoblock=0, $hideName=0, $blockEmail=0, $allowUsertalk=0, $byText='')
Constructor.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
static isWhitelistedFromAutoblocks( $ip)
Checks whether a given IP is on the autoblock whitelist.
getAutoblockUpdateArray()
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
static isInRange( $addr, $range)
Determine if a given IPv4/IPv6 address is in a given CIDR network.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
return false to override stock group addition can be modified try getUserPermissionsErrors userCan checks are continued by internal code can override on output return false to not delete it return false to override the default password checks this Boolean value will be checked to determine if the password was valid return false to implement your own hashing method this String will be used as the hash which may be added to this hook is run right before returning the options to the caller which means it s potentially called dozens or hundreds of times You may want to cache the results of non trivial operations in your hook function for this reason change this to override email change this to override email authentication timestamp whether or not the user is blocked from that page & $allowUsertalk
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
static getBlocksForIPList(array $ipChain, $isAnon, $fromMaster=false)
Get all blocks that match any IP from an array of IP addresses.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
getTargetAndType()
Get the target and target type for this particular Block.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
doRetroactiveAutoblock()
Retroactively autoblocks the last IP used by the user (if it is a user) blocked by this Block.
updateTimestamp()
Update the timestamp on autoblocks.
static parseRange( $range)
Given a string range in a number of formats, return the start and end of the range in hexadecimal.
getBlocker()
Get the user who implemented this block.
setBlocker( $user)
Set the user who implemented (or will implement) this block.
fromMaster( $x=null)
Get/set a flag determining whether the master is used for reads.
getTarget()
Get the target for this particular Block.
static purgeExpired()
Purge expired blocks from the ipblocks table.
static isValid( $ip)
Validate an IP address.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
wfIsTrustedProxy( $ip)
Checks if an IP is a trusted proxy provider.
Interface for objects which can provide a context on request.
static sanitizeIP( $ip)
Convert an IP into a verbose, uppercase, normalized form.
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
static selectFields()
Return the list of ipblocks fields that should be selected to create a new block.
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getRangeStart()
Get the IP address at the start of the range in Hex form.
getPermissionsError(IContextSource $context)
Get the key and parameters for the corresponding error message.
getRequest()
Get the WebRequest object.
getDatabaseArray( $db=null)
Get an array suitable for passing to $dbw->insert() or $dbw->update()
getByName()
Get the username of the blocking sysop.
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
static newFromRow( $row)
Create a new Block object from a database row.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static isValidBlock( $ipblock)
Validate an IP Block (valid address WITH a valid prefix).
getName()
Get the user name, or the IP of an anonymous user.
static defaultRetroactiveAutoblock(Block $block, array &$blockIds)
Retroactively autoblocks the last IP used by the user (if it is a user) blocked by this Block.
static sanitizeRange( $range)
Gets rid of unneeded numbers in quad-dotted/octet IP strings For example, 127.111....
Integer $forcedTargetID
Hack for foreign blocking (CentralAuth) *.
setTarget( $target)
Set the target for this block, and update $this->type accordingly.
getLanguage()
Get the Language object.
static getAutoblockExpiry( $timestamp)
Get a timestamp of the expiry for autoblocks.