Index: trunk/extensions/LiquidThreads/LqtModel.php |
— | — | @@ -40,7 +40,26 @@ |
41 | 41 | return $this->moved('+1 month'); |
42 | 42 | } |
43 | 43 | function moved($str) { |
44 | | - return new Date( date('YmdHis', strtotime($this->text() . ' ' . $str)) ); |
| 44 | + // Try to set local timezone to attempt to avoid E_STRICT errors. |
| 45 | + global $wgLocaltimezone; |
| 46 | + if ( isset( $wgLocaltimezone ) ) { |
| 47 | + $oldtz = getenv( "TZ" ); |
| 48 | + putenv( "TZ=$wgLocaltimezone" ); |
| 49 | + } |
| 50 | + // Suppress warnings for installations without a set timezone. |
| 51 | + wfSuppressWarnings(); |
| 52 | + // Make the date string. |
| 53 | + $date = date( 'YmdHis', strtotime( $this->text() . ' ' . $str ) ); |
| 54 | + // Restore warnings, date no loner an issue. |
| 55 | + wfRestoreWarnings(); |
| 56 | + // Generate the date object, |
| 57 | + $date = new Date( $date ); |
| 58 | + // Restore the old timezone if needed. |
| 59 | + if ( isset( $wgLocaltimezone ) ) { |
| 60 | + putenv( "TZ=$oldtz" ); |
| 61 | + } |
| 62 | + // Return the generated date object. |
| 63 | + return $date; |
45 | 64 | } |
46 | 65 | /* function monthString() { |
47 | 66 | return sprintf( '%04d%02d', $this->year, $this->month ); |