-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
yurik@svn.wikimedia.org wrote:
- static function decodeExpiry( $expiry ) {
- static function decodeExpiry( $expiry, $timestampType = TS_MW ) { if ( $expiry == '' || $expiry == Block::infinity() ) { return Block::infinity(); } else {
return wfTimestamp( TS_MW, $expiry );
} }return wfTimestamp( $timestampType, $expiry );
I don't really like this... it seems a bit odd to have it return a different timestamp format than the one that is used for all internal processing.
- -- brion vibber (brion @ wikimedia.org)
I needed that so that API users, who should not be using internal wiki timestamps but instead use ISO ones. The alternative was for me to decode expiry field value myself (the IF statement). Obviously I could go that route, but there goes the code/concepts reuse :)
On 6/18/07, Brion Vibber brion@wikimedia.org wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
yurik@svn.wikimedia.org wrote:
static function decodeExpiry( $expiry ) {
static function decodeExpiry( $expiry, $timestampType = TS_MW ) { if ( $expiry == '' || $expiry == Block::infinity() ) { return Block::infinity(); } else {
return wfTimestamp( TS_MW, $expiry );
return wfTimestamp( $timestampType, $expiry ); } }
I don't really like this... it seems a bit odd to have it return a different timestamp format than the one that is used for all internal processing.
- -- brion vibber (brion @ wikimedia.org)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGdu8pwRnhpk1wk44RAl16AJwOK65mbFg1BsGOoJdRHZgTZ3q1BQCguFNa YsJ3BhAMFX05xgVst5U9G6c= =apff -----END PGP SIGNATURE-----
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
On 18/06/07, Yuri Astrakhan yuriastrakhan@gmail.com wrote:
I needed that so that API users, who should not be using internal wiki timestamps but instead use ISO ones. The alternative was for me to decode expiry field value myself (the IF statement). Obviously I could go that route, but there goes the code/concepts reuse :)
You could just pass the result through wfTimestamp() and get it converted to the desired format...
Rob Church
no, Block::infinity() is a non-timestamp string.
On 6/18/07, Rob Church robchur@gmail.com wrote:
On 18/06/07, Yuri Astrakhan yuriastrakhan@gmail.com wrote:
I needed that so that API users, who should not be using internal wiki timestamps but instead use ISO ones. The alternative was for me to decode expiry field value myself (the IF statement). Obviously I could go that route, but there goes the code/concepts reuse :)
You could just pass the result through wfTimestamp() and get it converted to the desired format...
Rob Church
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Rob Church wrote:
On 18/06/07, Yuri Astrakhan yuriastrakhan@gmail.com wrote:
I needed that so that API users, who should not be using internal wiki timestamps but instead use ISO ones. The alternative was for me to decode expiry field value myself (the IF statement). Obviously I could go that route, but there goes the code/concepts reuse :)
You could just pass the result through wfTimestamp() and get it converted to the desired format...
The difficulty is that it's _sometimes_ a timestamp and _sometimes_ the special value 'infinity', so you have to special case crap everywhere. Personally I think it's rather icky to begin with. :P :)
- -- brion vibber (brion @ wikimedia.org)
I propose we just make infinity to be an empty string, or even better - NULL value - logically it means there is no expiry value - i.e. Infinite. We still have to handle the special case in the UI and in API (show specialized value), but at least we don't have to deal with a magic value... Unless there will be more magic values... eeick.
Of course we could make infinity into 9999-12-31 - but i really don't like it :)
On 6/18/07, Brion Vibber brion@wikimedia.org wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Rob Church wrote:
On 18/06/07, Yuri Astrakhan yuriastrakhan@gmail.com wrote:
I needed that so that API users, who should not be using internal wiki timestamps but instead use ISO ones. The alternative was for me to decode expiry field value myself (the IF statement). Obviously I could go that route, but there goes the code/concepts reuse :)
You could just pass the result through wfTimestamp() and get it converted to the desired format...
The difficulty is that it's _sometimes_ a timestamp and _sometimes_ the special value 'infinity', so you have to special case crap everywhere. Personally I think it's rather icky to begin with. :P :)
- -- brion vibber (brion @ wikimedia.org)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGdvWxwRnhpk1wk44RAtMFAJ9jsqfpyxNIvmoyjGClsj2Nt8QtkwCfdKiY AmwLrjVRppNnPI0ti6Lyez4= =p76/ -----END PGP SIGNATURE-----
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
Yuri Astrakhan wrote:
I propose we just make infinity to be an empty string, or even better
- NULL value - logically it means there is no expiry value - i.e.
Infinite. We still have to handle the special case in the UI and in API (show specialized value), but at least we don't have to deal with a magic value... Unless there will be more magic values... eeick.
Of course we could make infinity into 9999-12-31 - but i really don't like it :)
The string "infinity" was chosen very carefully. "infinity" is a valid timestamp in PostgreSQL, which sorts after all other timestamp values. The string also sorts after all other 14-character timestamp values as used in our MySQL schema. This sorting behaviour is important for query efficiency in Block.php
Add the special case to wfTimestamp(). As far as I'm concerned it can be treated as a valid timestamp everywhere. Conversion to some formats (such as unix timestamp) may have to be approximate.
-- Tim Starling
I guess we should just use wfTimestamp() instead of decodeExpiry() everywhere then since they would be exact replica of one another. Except with the empty string case (why would we have an empty string?).
On 6/19/07, Tim Starling tstarling@wikimedia.org wrote:
Yuri Astrakhan wrote:
I propose we just make infinity to be an empty string, or even better
- NULL value - logically it means there is no expiry value - i.e.
Infinite. We still have to handle the special case in the UI and in API (show specialized value), but at least we don't have to deal with a magic value... Unless there will be more magic values... eeick.
Of course we could make infinity into 9999-12-31 - but i really don't like it :)
The string "infinity" was chosen very carefully. "infinity" is a valid timestamp in PostgreSQL, which sorts after all other timestamp values. The string also sorts after all other 14-character timestamp values as used in our MySQL schema. This sorting behaviour is important for query efficiency in Block.php
Add the special case to wfTimestamp(). As far as I'm concerned it can be treated as a valid timestamp everywhere. Conversion to some formats (such as unix timestamp) may have to be approximate.
-- Tim Starling
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org