Index: trunk/phase3/includes/db/Database.php |
— | — | @@ -3443,20 +3443,31 @@ |
3444 | 3444 | } |
3445 | 3445 | |
3446 | 3446 | /** |
3447 | | - * Encode an expiry time |
| 3447 | + * Encode an expiry time into the DBMS dependent format |
3448 | 3448 | * |
3449 | 3449 | * @param $expiry String: timestamp for expiry, or the 'infinity' string |
3450 | 3450 | * @return String |
3451 | 3451 | */ |
3452 | 3452 | public function encodeExpiry( $expiry ) { |
3453 | | - if ( $expiry == '' || $expiry == $this->getInfinity() ) { |
3454 | | - return $this->getInfinity(); |
3455 | | - } else { |
3456 | | - return $this->timestamp( $expiry ); |
3457 | | - } |
| 3453 | + return ( $expiry == '' || $expiry == 'infinity' || $expiry == $this->getInfinity() ) |
| 3454 | + ? $this->getInfinity() |
| 3455 | + : $this->timestamp( $expiry ); |
3458 | 3456 | } |
3459 | 3457 | |
3460 | 3458 | /** |
| 3459 | + * Decode an expiry time into a DBMS independent format |
| 3460 | + * |
| 3461 | + * @param $expiry String: DB timestamp field value for expiry |
| 3462 | + * @param $format integer: TS_* constant, defaults to TS_MW |
| 3463 | + * @return String |
| 3464 | + */ |
| 3465 | + public function decodeExpiry( $expiry, $format = TS_MW ) { |
| 3466 | + return ( $expiry == '' || $expiry == $this->getInfinity() ) |
| 3467 | + ? 'infinity' |
| 3468 | + : wfTimestamp( $format, $expiry ); |
| 3469 | + } |
| 3470 | + |
| 3471 | + /** |
3461 | 3472 | * Allow or deny "big selects" for this session only. This is done by setting |
3462 | 3473 | * the sql_big_selects session variable. |
3463 | 3474 | * |