Commit graph

21 commits

Author SHA1 Message Date
jenkins-bot
6d0a4f463e Merge "Added new MWTimestamp::getRelativeTimestamp for pure relative." 2013-09-27 17:45:26 +00:00
Tyler Anthony Romeo
fa84729e54 Added new MWTimestamp::getRelativeTimestamp for pure relative.
Since MWTimestamp::getHumanTimestamp just makes a pretty
timestamp, and not a purely relative one, this commit adds
MWTimestamp::getRelativeTimestamp, which does just that.

Change-Id: I8b3e3fc6eeb4afd58f85fa7d05b5ea1a51b0afb6
2013-09-24 19:40:48 -04:00
MatmaRex
df8ec1e216 No spaces after (casts)
Also removed some unnecessary ones. I think I've caught them all.

The spaceless version already appears in core ~300 times (after
accounting for false positives when grepping). Some consistency would
be nice.

Change-Id: I607655b5f4366e66dc78730d5fd2f57ed8776cae
2013-09-04 20:05:43 +02:00
umherirrender
251f82eff4 Include original exception when throw TimestampException
Also adjust some spaces in exception messages.

Change-Id: I7bbe70f45aea49a2caaaeba82ab64e06b96347d0
2013-07-08 17:08:27 +02:00
umherirrender
0a810a5a87 Avoid date()/gmdate() for date formatting
Added a MWTimestamp::format method to format a timestamp object in the
given pattern. This avoids date(), which needs the local time
zone corretly set on the server, which is assumed at the moment in
Setup.php

Added MWTimestamp::getInstance for gmdate() and
MWTimestamp::getLocalInstance for date() to create a MWTimestamp object
and use it as inline statement.
Also MWTimestamp::setTimezone and MWTimestamp::getTimzone was added for
timezone handling.

Change-Id: I812aa013be2f4380e0cf10dc465202756fe8347b
2013-07-08 04:14:12 +00:00
umherirrender
6f79eef473 Fixed spacing around parenthesis in includes
Change-Id: Ie8adc00f4ee8ecec4554e584c18d5d2073415397
2013-04-28 15:50:07 +00:00
Platonides
e30a27945e Fix case of $wgLocalTZoffset from 7e3386d4
The variable is called $wgLocalTZoffset, with lowercase O.
And php variable names are case-sensitive.

This commit is a simple
 sed -i 's/wgLocalTZOffset/wgLocalTZoffset/' includes/Timestamp.php

Change-Id: Iddf9b363c9ddc95938ba8b5e0c134d9ec734109c
2013-04-23 13:20:01 +02:00
Tyler Anthony Romeo
7e3386d417 Refactor MWTimestamp::getHumanTimestamp and add hook.
Changed logic in MWTimestamp::getHumanTimestamp so that
all the message and formatting was offloaded into the
Language class, keeping only actual timestamp logic in
the MWTimestamp class.

Also added a hook so extensions can override the
human timestamp format.

Change-Id: Ie667088010e24eb6cb569f9e8e8e2553005223eb
2013-04-22 12:07:22 -07:00
umherirrender
ef2f507d23 Fixed spacing in files direct in includes folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Ibb8dd102db045522d12ff939075ba7420d95ab6b
2013-04-21 06:38:49 +00:00
umherirrender
6c278b6d7e fix some spacing
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
  calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays

Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
2013-03-25 22:22:46 +00:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
Chad Horohoe
6f4448dd71 Remove DB2 support
Change-Id: I9b294a213a4000f503c0010d88757db6dda927c0
2013-02-25 13:47:03 -08:00
Juliusz Gonera
424dcde4fe Add months and years to Timestamp::getHumanTimestamp()
Now if the difference between $now and $then is >= 30 days, "X months
ago" or "X years ago" is returned.

Month is defined as 30 days, but it shouldn't cause problems  in this
case. The "X time ago" messages are approximate anyway.

Change-Id: I228a11e23783484b64c29db94c3607a415fa81a8
2013-01-03 12:57:59 -08:00
umherirrender
91e9fb60b7 parse argument for message 'ago' in MWTimestamp::getHumanTimestamp
Change-Id: I8ec8052f949313f5a3bcef2b9e668d139d7cbf6d
2012-12-07 12:28:17 +01:00
daniel
bb51a58e57 Cleanup of Wikidata branch.
This cleans up several issues raised in comments to I3b2dad3a,
mostly style and merge artifacts.

Change-Id: I99f5e300a671db1353db151cd187ffd2e4478d03
2012-10-08 17:34:47 +02:00
Chad Horohoe
4f1f27b664 Remove some PHP 5.1 cruft (DateTime has existed since 5.2.0)
Change-Id: Id1fc9c874906dcc44abab5b557c8138e6b7ecc50
2012-09-24 10:03:30 -04:00
jeroendedauw
d440bc6cdc Added @since tags
Change-Id: Ibfaa5efcb40f4087c4333e9f83b717fc1877b9a5
2012-09-21 21:17:48 +02:00
Reedy
87c53575f3 Add some trailing whitespace
Change-Id: I0d43d82e2d78f86e50fac82f10bd1d7cebac176c
2012-09-06 22:29:10 +01:00
Reedy
301b7cbd67 Handle '\0\0\0\0\0\0\0\0\0\0\0\0\0\0' in setTimestamp
Also tidied up/fleshed out method function type documentation

Change-Id: I3d1b1862d0f2f1968e0e4c9b01dc34de955377d2
2012-09-05 14:57:36 +01:00
Alexandre Emsenhuber
d3e0168c67 Added missing GPLv2 headers in new files.
Also improved file documentation.

Change-Id: Ia5a383110769cf51603305dc639616d904ebbab2
2012-09-01 21:56:38 +02:00
Tyler Anthony Romeo
e738203a8e Added PHP complement for mw.Time.
Figured since a JS Timestamp class was being implemented
it might be appropriate to create a complementary PHP
Timestamp class. Much of code is taken from wfTimestamp().

Note: Another change (I53dcf547) is attempting a related
issue. Not sure how much of scope overlap there is.

Change-Id: I68eb9f27eebe80df757187f634392e1bcba5551f
Signed-off-by: Tyler Romeo <tylerromeo@gmail.com>
2012-08-30 20:44:09 -04:00