r112939 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112938‎ | r112939 | r112940 >
Date:11:49, 3 March 2012
Author:aaron
Status:ok
Tags:
Comment:
[DatabaseBase] Made encodeExpiry() recognize 'infinity' and added a decodeExpiry() function
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/Database.php
@@ -3443,20 +3443,31 @@
34443444 }
34453445
34463446 /**
3447 - * Encode an expiry time
 3447+ * Encode an expiry time into the DBMS dependent format
34483448 *
34493449 * @param $expiry String: timestamp for expiry, or the 'infinity' string
34503450 * @return String
34513451 */
34523452 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 );
34583456 }
34593457
34603458 /**
 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+ /**
34613472 * Allow or deny "big selects" for this session only. This is done by setting
34623473 * the sql_big_selects session variable.
34633474 *

Follow-up revisions

RevisionCommit summaryAuthorDate
r112941[FlaggedRevs] Fixed various deprecation notices, cleaning up block expiry han...aaron11:54, 3 March 2012

Status & tagging log