24use Wikimedia\Timestamp\ConvertibleTimestamp;
40 return new static( $ts );
64 if (
$lang ===
null ) {
65 $lang = RequestContext::getMain()->getLanguage();
68 return $lang->getHumanTimestamp( $this, $relativeTo, $user );
82 $option = $user->getOption(
'timecorrection' );
83 $data = explode(
'|', $option, 3 );
86 if ( $data[0] ==
'ZoneInfo' ) {
88 $tz =
new DateTimeZone( $data[2] );
89 }
catch ( Exception
$e ) {
94 $this->timestamp->setTimezone( $tz );
95 return new DateInterval(
'P0Y' );
104 if ( $data[0] ==
'System' ) {
109 } elseif ( $data[0] ==
'Offset' ) {
111 $diff = (int)$data[1];
115 $data = explode(
':', $option );
116 if ( count( $data ) >= 2 ) {
118 $diff = abs( (
int)$data[0] ) * 60 + (int)$data[1];
119 if ( (
int)$data[0] < 0 ) {
124 $diff = (int)$data[0] * 60;
128 $interval =
new DateInterval(
'PT' . abs( $diff ) .
'M' );
130 $interval->invert = 1;
133 $this->timestamp->add( $interval );
151 array $chosenIntervals = []
153 if ( $relativeTo ===
null ) {
154 $relativeTo =
new self;
156 if ( $user ===
null ) {
157 $user = RequestContext::getMain()->getUser();
159 if (
$lang ===
null ) {
160 $lang = RequestContext::getMain()->getLanguage();
164 $diff = $this->
diff( $relativeTo );
166 'GetRelativeTimestamp',
167 [ &$ts, &$diff, $this, $relativeTo, $user,
$lang ]
169 $seconds = ( ( ( $diff->days * 24 + $diff->h ) * 60 + $diff->i ) * 60 + $diff->s );
170 $ts =
wfMessage(
'ago',
$lang->formatDuration( $seconds, $chosenIntervals ) )
171 ->inLanguage(
$lang )->text();
187 $tzMsg = $this->
format(
'T' );
188 $key =
'timezone-' . strtolower( trim( $tzMsg ) );
190 if ( $msg->exists() ) {
206 $timestamp =
new self( $ts );
$wgLocaltimezone
Fake out the timezone that the server thinks it's in.
$wgLocalTZoffset
Set an offset from UTC in minutes to use for the default timezone setting for anonymous users and new...
Internationalisation code.
Library for creating and parsing MW-style timestamps.
getRelativeTimestamp(MWTimestamp $relativeTo=null, User $user=null, Language $lang=null, array $chosenIntervals=[])
Generate a purely relative timestamp, i.e., represent the time elapsed between the given base timesta...
getHumanTimestamp(MWTimestamp $relativeTo=null, User $user=null, Language $lang=null)
Get the timestamp in a human-friendly relative format, e.g., "3 days ago".
static getInstance( $ts=false)
Get a timestamp instance in GMT.
static getLocalInstance( $ts=false)
Get a timestamp instance in the server local timezone ($wgLocaltimezone)
getTimezoneMessage()
Get the localized timezone message, if available.
offsetForUser(User $user)
Adjust the timestamp depending on the given user's preferences.
Variant of the Message class.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
also included in $newHeader if any indicating whether we should show just the diff
if the prop value should be in the metadata multi language array format
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead 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 "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
returning false will NOT prevent logging $e
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(!isset( $args[0])) $lang