62867db69c5faca4919c5e93ddff1531854bc56d
[lhc/web/wiklou.git] / includes / SpecialRecentchanges.php
1 <?php
2 /**
3 *
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
7
8 /**
9 *
10 */
11 require_once( 'Feed.php' );
12 require_once( 'ChangesList.php' );
13 require_once( 'Revision.php' );
14
15 /**
16 * Constructor
17 */
18 function wfSpecialRecentchanges( $par ) {
19 global $wgUser, $wgOut, $wgLang, $wgContLang, $wgTitle, $wgMemc, $wgDBname;
20 global $wgRequest, $wgSitename, $wgLanguageCode, $wgContLanguageCode;
21 global $wgFeedClasses, $wgUseRCPatrol;
22 global $wgRCShowWatchingUsers, $wgShowUpdatedMarker;
23 global $wgLinkCache;
24 $fname = 'wfSpecialRecentchanges';
25
26 # Get query parameters
27 $feedFormat = $wgRequest->getVal( 'feed' );
28
29 $defaults = array(
30 /* int */ 'days' => $wgUser->getDefaultOption('rcdays'),
31 /* int */ 'limit' => $wgUser->getDefaultOption('rclimit'),
32 /* bool */ 'hideminor' => false,
33 /* bool */ 'hidebots' => true,
34 /* bool */ 'hideliu' => false,
35 /* bool */ 'hidepatrolled' => false,
36 /* text */ 'from' => '',
37 /* text */ 'namespace' => '',
38 /* bool */ 'invert' => false,
39 );
40
41 extract($defaults);
42
43
44 $days = $wgUser->getOption( 'rcdays' );
45 if ( !$days ) { $days = $defaults['days']; }
46 $days = $wgRequest->getInt( 'days', $days );
47
48 $limit = $wgUser->getOption( 'rclimit' );
49 if ( !$limit ) { $limit = $defaults['limit']; }
50
51 # list( $limit, $offset ) = wfCheckLimits( 100, 'rclimit' );
52 $limit = $wgRequest->getInt( 'limit', $limit );
53 if ( $limit < 0 || $limit > 5000 ) $limit = $defaults['limit'];
54
55 /* order of selection: url > preferences > default */
56 $hideminor = $wgRequest->getBool( 'hideminor', $wgUser->getOption( 'hideminor') ? true : $defaults['hideminor'] );
57
58
59 # As a feed, use limited settings only
60 if( $feedFormat ) {
61 global $wgFeedLimit;
62 if( $limit > $wgFeedLimit ) {
63 $options['limit'] = $wgFeedLimit;
64 }
65
66 } else {
67
68 $namespace = $wgRequest->getVal( 'namespace', $defaults['namespace'] );
69 $invert = $wgRequest->getBool( 'invert', $defaults['invert'] );
70 $hidebots = $wgRequest->getBool( 'hidebots', $defaults['hidebots'] );
71 $hideliu = $wgRequest->getBool( 'hideliu', $defaults['hideliu'] );
72 $hidepatrolled = $wgRequest->getBool( 'hidepatrolled', $defaults['hidepatrolled'] );
73 $from = $wgRequest->getVal( 'from', $defaults['from'] );
74
75 # Get query parameters from path
76 if( $par ) {
77 $bits = preg_split( '/\s*,\s*/', trim( $par ) );
78 if( in_array( 'hidebots', $bits ) ) $hidebots = 1;
79 if( in_array( 'bots', $bits ) ) $hidebots = 0;
80 if( in_array( 'hideminor', $bits ) ) $hideminor = 1;
81 if( in_array( 'minor', $bits ) ) $hideminor = 0;
82 if( in_array( 'hideliu', $bits) ) $hideliu = 1;
83 if( in_array( 'hidepatrolled', $bits) ) $hidepatrolled = 1;
84 }
85 }
86
87
88 # Database connection and caching
89 $dbr =& wfGetDB( DB_SLAVE );
90 extract( $dbr->tableNames( 'recentchanges', 'watchlist' ) );
91
92
93 $cutoff_unixtime = time() - ( $days * 86400 );
94 $cutoff_unixtime = $cutoff_unixtime - ($cutoff_unixtime % 86400);
95 $cutoff = $dbr->timestamp( $cutoff_unixtime );
96 if(preg_match('/^[0-9]{14}$/', $from) and $from > wfTimestamp(TS_MW,$cutoff)) {
97 $cutoff = $dbr->timestamp($from);
98 } else {
99 $from = $defaults['from'];
100 }
101
102 # 10 seconds server-side caching max
103 $wgOut->setSquidMaxage( 10 );
104
105 # Get last modified date, for client caching
106 # Don't use this if we are using the patrol feature, patrol changes don't update the timestamp
107 $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, $fname );
108 if ( $feedFormat || !$wgUseRCPatrol ) {
109 if( $lastmod && $wgOut->checkLastModified( $lastmod ) ){
110 # Client cache fresh and headers sent, nothing more to do.
111 return;
112 }
113 }
114
115 $hidem = $hideminor ? 'AND rc_minor=0' : '';
116 $hidem .= $hidebots ? ' AND rc_bot=0' : '';
117 $hidem .= $hideliu ? ' AND rc_user=0' : '';
118 $hidem .= $hidepatrolled ? ' AND rc_patrolled=0' : '';
119 $hidem .= $namespace === '' ? '' :' AND rc_namespace' . ($invert ? '!=' : '=') . $namespace;
120
121 // This is the big thing!
122
123 $uid = $wgUser->getID();
124
125 // Perform query
126 $sql2 = "SELECT *" . ($uid ? ",wl_user,wl_notificationtimestamp" : "") . " FROM $recentchanges " .
127 ($uid ? "LEFT OUTER JOIN $watchlist ON wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace " : "") .
128 "WHERE rc_timestamp > '{$cutoff}' {$hidem} " .
129 "ORDER BY rc_timestamp DESC LIMIT {$limit}";
130 $res = $dbr->query( $sql2, $fname );
131
132 // Fetch results, prepare a batch link existence check query
133 $rows = array();
134 $batch = new LinkBatch;
135 while( $row = $dbr->fetchObject( $res ) ){
136 $rows[] = $row;
137 // User page link
138 $title = Title::makeTitleSafe( NS_USER, $row->rc_user_text );
139 $batch->addObj( $title );
140
141 // User talk
142 $title = Title::makeTitleSafe( NS_USER_TALK, $row->rc_user_text );
143 $batch->addObj( $title );
144
145 }
146 $dbr->freeResult( $res );
147
148 // Run existence checks
149 $batch->execute( $wgLinkCache );
150
151 if( $feedFormat ) {
152 rcOutputFeed( $rows, $feedFormat, $limit, $hideminor, $lastmod );
153 } else {
154
155 # Web output...
156
157 // Output header
158 $wgOut->addWikiText( wfMsgForContent( "recentchangestext" ) );
159
160 // Dump everything here
161 $nondefaults = array();
162
163 appendToArrayIfNotDefault( 'days', $days, $defaults, $nondefaults);
164 appendToArrayIfNotDefault( 'limit', $limit , $defaults, $nondefaults);
165 appendToArrayIfNotDefault( 'hideminor', $hideminor, $defaults, $nondefaults);
166 appendToArrayIfNotDefault( 'hidebots', $hidebots, $defaults, $nondefaults);
167 appendToArrayIfNotDefault( 'hideliu', $hideliu, $defaults, $nondefaults);
168 appendToArrayIfNotDefault( 'hidepatrolled', $hidepatrolled, $defaults, $nondefaults);
169 appendToArrayIfNotDefault( 'from', $from, $defaults, $nondefaults);
170 appendToArrayIfNotDefault( 'namespace', $namespace, $defaults, $nondefaults);
171 appendToArrayIfNotDefault( 'invert', $invert, $defaults, $nondefaults);
172
173 // Add end of the texts
174 $wgOut->addHTML( '<div class="rcoptions">' . rcOptionsPanel( $defaults, $nondefaults ) );
175 $wgOut->addHTML( namespaceForm( $namespace, $invert, $nondefaults) . '</div>');
176
177 // And now for the content
178 $sk = $wgUser->getSkin();
179 $wgOut->setSyndicated( true );
180 $list =& new ChangesList( $sk );
181 $s = $list->beginRecentChangesList();
182 $counter = 1;
183 foreach( $rows as $obj ){
184 if( $limit == 0) {
185 break;
186 }
187
188 if ( ! ( $hideminor && $obj->rc_minor ) &&
189 ! ( $hidepatrolled && $obj->rc_patrolled ) ) {
190 $rc = RecentChange::newFromRow( $obj );
191 $rc->counter = $counter++;
192
193 if ($wgShowUpdatedMarker
194 && $wgUser->getOption( 'showupdated' )
195 && !empty( $obj->wl_notificationtimestamp )
196 && ($obj->rc_timestamp >= $obj->wl_notificationtimestamp)) {
197 $rc->notificationtimestamp = true;
198 } else {
199 $rc->notificationtimestamp = false;
200 }
201
202 if ($wgRCShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) {
203 $sql3 = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_title='" . $dbr->strencode($obj->rc_title) ."' AND wl_namespace=$obj->rc_namespace" ;
204 $res3 = $dbr->query( $sql3, 'wfSpecialRecentChanges');
205 $x = $dbr->fetchObject( $res3 );
206 $rc->numberofWatchingusers = $x->n;
207 } else {
208 $rc->numberofWatchingusers = 0;
209 }
210 $s .= $list->recentChangesLine( $rc, !empty( $obj->wl_user ) );
211 --$limit;
212 }
213 }
214 $s .= $list->endRecentChangesList();
215 $wgOut->addHTML( $s );
216 }
217 }
218
219 function rcOutputFeed( $rows, $feedFormat, $limit, $hideminor, $lastmod ) {
220 global $messageMemc, $wgDBname, $wgFeedCacheTimeout;
221 global $wgFeedClasses, $wgTitle, $wgSitename, $wgContLanguageCode;
222
223 if( !isset( $wgFeedClasses[$feedFormat] ) ) {
224 wfHttpError( 500, "Internal Server Error", "Unsupported feed type." );
225 return false;
226 }
227
228 $timekey = "$wgDBname:rcfeed:$feedFormat:timestamp";
229 $key = "$wgDBname:rcfeed:$feedFormat:limit:$limit:minor:$hideminor";
230
231 $feedTitle = $wgSitename . ' - ' . wfMsgForContent( 'recentchanges' ) .
232 ' [' . $wgContLanguageCode . ']';
233 $feed = new $wgFeedClasses[$feedFormat](
234 $feedTitle,
235 htmlspecialchars( wfMsgForContent( 'recentchangestext' ) ),
236 $wgTitle->getFullUrl() );
237
238 /**
239 * Bumping around loading up diffs can be pretty slow, so where
240 * possible we want to cache the feed output so the next visitor
241 * gets it quick too.
242 */
243 $cachedFeed = false;
244 if( $feedLastmod = $messageMemc->get( $timekey ) ) {
245 /**
246 * If the cached feed was rendered very recently, we may
247 * go ahead and use it even if there have been edits made
248 * since it was rendered. This keeps a swarm of requests
249 * from being too bad on a super-frequently edited wiki.
250 */
251 if( time() - wfTimestamp( TS_UNIX, $feedLastmod )
252 < $wgFeedCacheTimeout
253 || wfTimestamp( TS_UNIX, $feedLastmod )
254 > wfTimestamp( TS_UNIX, $lastmod ) ) {
255 wfDebug( "RC: loading feed from cache ($key; $feedLastmod; $lastmod)...\n" );
256 $cachedFeed = $messageMemc->get( $key );
257 } else {
258 wfDebug( "RC: cached feed timestamp check failed ($feedLastmod; $lastmod)\n" );
259 }
260 }
261 if( is_string( $cachedFeed ) ) {
262 wfDebug( "RC: Outputting cached feed\n" );
263 $feed->httpHeaders();
264 echo $cachedFeed;
265 } else {
266 wfDebug( "RC: rendering new feed and caching it\n" );
267 ob_start();
268 rcDoOutputFeed( $rows, $feed );
269 $cachedFeed = ob_get_contents();
270 ob_end_flush();
271
272 $expire = 3600 * 24; # One day
273 $messageMemc->set( $key, $cachedFeed );
274 $messageMemc->set( $timekey, wfTimestamp( TS_MW ), $expire );
275 }
276 return true;
277 }
278
279 function rcDoOutputFeed( $rows, &$feed ) {
280 global $wgSitename, $wgFeedClasses, $wgContLanguageCode;
281
282 $feed->outHeader();
283
284 # Merge adjacent edits by one user
285 $sorted = array();
286 $n = 0;
287 foreach( $rows as $obj ) {
288 if( $n > 0 &&
289 $obj->rc_namespace >= 0 &&
290 $obj->rc_cur_id == $sorted[$n-1]->rc_cur_id &&
291 $obj->rc_user_text == $sorted[$n-1]->rc_user_text ) {
292 $sorted[$n-1]->rc_last_oldid = $obj->rc_last_oldid;
293 } else {
294 $sorted[$n] = $obj;
295 $n++;
296 }
297 $first = false;
298 }
299
300 foreach( $sorted as $obj ) {
301 $title = Title::makeTitle( $obj->rc_namespace, $obj->rc_title );
302 $talkpage = $title->getTalkPage();
303 $item = new FeedItem(
304 $title->getPrefixedText(),
305 rcFormatDiff( $obj ),
306 $title->getFullURL(),
307 $obj->rc_timestamp,
308 $obj->rc_user_text,
309 $talkpage->getFullURL()
310 );
311 $feed->outItem( $item );
312 }
313 $feed->outFooter();
314 }
315
316 /**
317 *
318 */
319 function rcCountLink( $lim, $d, $page='Recentchanges', $more='' ) {
320 global $wgUser, $wgLang, $wgContLang;
321 $sk = $wgUser->getSkin();
322 $s = $sk->makeKnownLink( $wgContLang->specialPage( $page ),
323 ($lim ? $wgLang->formatNum( "{$lim}" ) : wfMsg( 'recentchangesall' ) ), "{$more}" .
324 ($d ? "days={$d}&" : '') . 'limit='.$lim );
325 return $s;
326 }
327
328 /**
329 *
330 */
331 function rcDaysLink( $lim, $d, $page='Recentchanges', $more='' ) {
332 global $wgUser, $wgLang, $wgContLang;
333 $sk = $wgUser->getSkin();
334 $s = $sk->makeKnownLink( $wgContLang->specialPage( $page ),
335 ($d ? $wgLang->formatNum( "{$d}" ) : wfMsg( 'recentchangesall' ) ), $more.'days='.$d .
336 ($lim ? '&limit='.$lim : '') );
337 return $s;
338 }
339
340 /**
341 * Used by Recentchangeslinked
342 */
343 function rcDayLimitLinks( $days, $limit, $page='Recentchanges', $more='', $doall = false, $minorLink = '',
344 $botLink = '', $liuLink = '', $patrLink = '' ) {
345 if ($more != '') $more .= '&';
346 $cl = rcCountLink( 50, $days, $page, $more ) . ' | ' .
347 rcCountLink( 100, $days, $page, $more ) . ' | ' .
348 rcCountLink( 250, $days, $page, $more ) . ' | ' .
349 rcCountLink( 500, $days, $page, $more ) .
350 ( $doall ? ( ' | ' . rcCountLink( 0, $days, $page, $more ) ) : '' );
351 $dl = rcDaysLink( $limit, 1, $page, $more ) . ' | ' .
352 rcDaysLink( $limit, 3, $page, $more ) . ' | ' .
353 rcDaysLink( $limit, 7, $page, $more ) . ' | ' .
354 rcDaysLink( $limit, 14, $page, $more ) . ' | ' .
355 rcDaysLink( $limit, 30, $page, $more ) .
356 ( $doall ? ( ' | ' . rcDaysLink( $limit, 0, $page, $more ) ) : '' );
357 $shm = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink, $patrLink );
358 $note = wfMsg( 'rclinks', $cl, $dl, $shm );
359 return $note;
360 }
361
362
363 /**
364 * Makes change an option link which carries all the other options
365 */
366 function makeOptionsLink( $title, $override, $options ) {
367 global $wgUser, $wgLang, $wgContLang;
368 $sk = $wgUser->getSkin();
369 return $sk->makeKnownLink( $wgContLang->specialPage( 'Recentchanges' ),
370 $title, wfArrayToCGI( $override, $options ) );
371 }
372
373 /**
374 * Creates the options panel
375 */
376 function rcOptionsPanel( $defaults, $nondefaults ) {
377 global $wgLang;
378
379 $options = $nondefaults + $defaults;
380
381 if( $options['from'] )
382 $note = wfMsg( 'rcnotefrom', $wgLang->formatNum( $options['limit'] ), $wgLang->timeanddate( $options['from'], true ) );
383 else
384 $note = wfMsg( 'rcnote', $wgLang->formatNum( $options['limit'] ), $wgLang->formatNum( $options['days'] ) );
385
386 // limit links
387 $cl = '';
388 $options_limit = array(50, 100, 250, 500);
389 $i = 0;
390 while ( $i+1 < count($options_limit) ) {
391 $cl .= makeOptionsLink( $options_limit[$i], array( 'limit' => $options_limit[$i] ), $nondefaults) . ' | ' ;
392 $i++;
393 }
394 $cl .= makeOptionsLink( $options_limit[$i], array( 'limit' => $options_limit[$i] ), $nondefaults) ;
395
396 // day links, reset 'from' to none
397 $dl = '';
398 $options_days = array(1, 3, 7, 14, 30);
399 $i = 0;
400 while ( $i+1 < count($options_days) ) {
401 $dl .= makeOptionsLink( $options_days[$i], array( 'days' => $options_days[$i], 'from' => '' ), $nondefaults) . ' | ' ;
402 $i++;
403 }
404 $dl .= makeOptionsLink( $options_days[$i], array( 'days' => $options_days[$i], 'from' => '' ), $nondefaults) ;
405
406 // show/hide links
407 $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ));
408 $minorLink = makeOptionsLink( $showhide[1-$options['hideminor']],
409 array( 'hideminor' => 1-$options['hideminor'] ), $nondefaults);
410 $botLink = makeOptionsLink( $showhide[1-$options['hidebots']],
411 array( 'hidebots' => 1-$options['hidebots'] ), $nondefaults);
412 $liuLink = makeOptionsLink( $showhide[1-$options['hideliu']],
413 array( 'hideliu' => 1-$options['hideliu'] ), $nondefaults);
414 $patrLink = makeOptionsLink( $showhide[1-$options['hidepatrolled']],
415 array( 'hidepatrolled' => 1-$options['hidepatrolled'] ), $nondefaults);
416
417 $hl = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink, $patrLink );
418
419 // show from this onward link
420 $now = $wgLang->timeanddate( wfTimestampNow(), true );
421 $tl = makeOptionsLink( $now, array( 'from' => wfTimestampNow()), $nondefaults );
422
423 $rclinks = wfMsg( 'rclinks', $cl, $dl, $hl );
424 $rclistfrom = wfMsg( 'rclistfrom', $tl );
425 return "$note<br />$rclinks<br />$rclistfrom";
426
427 }
428
429 /**<F2>
430 * Creates the choose namespace selection
431 *
432 * @access private
433 *
434 * @param mixed $namespace The key of the currently selected namespace, empty string
435 * if there is none
436 * @param bool $invert Whether to invert the namespace selection
437 * @param array $nondefaults An array of non default options to be remembered
438 *
439 * @return string
440 */
441 function namespaceForm ( $namespace, $invert, $nondefaults ) {
442 global $wgContLang, $wgScript;
443 $t = Title::makeTitle( NS_SPECIAL, 'Recentchanges' );
444
445 $namespaceselect = "<select name='namespace' id='nsselectbox'>";
446 $namespaceselect .= '<option value="" ' . ($namespace === '' ? ' selected="selected"' : '') . '>' . wfMsg( 'contributionsall' ) . '</option>';
447 $arr = $wgContLang->getFormattedNamespaces();
448 foreach ( $arr as $ns => $name ) {
449 if( $ns < NS_MAIN )
450 continue;
451 $n = $ns === NS_MAIN ? wfMsg ( 'blanknamespace' ) : $name;
452 $sel = $namespace === (string) $ns ? ' selected="selected"' : '';
453 $namespaceselect .= "<option value='$ns'$sel>$n</option>";
454 }
455 $namespaceselect .= '</select>';
456
457 $out = '';
458 $out .= "<div class='namespaceselector'><form method='get' action='{$wgScript}'>\n";
459 foreach ( $nondefaults as $key => $value ) {
460 if ($key != 'namespace' && $key != 'invert')
461 $out .= "<input type='hidden' name='$key' value='$value' />";
462 }
463
464 $submitbutton = '<input type="submit" value="' . wfMsg( 'allpagessubmit' ) . '" />';
465 $invertbox = "<input type='checkbox' name='invert' value='1' id='nsinvert'" . ( $invert ? ' checked="checked"' : '' ) . ' />';
466
467
468 $out .= '<input type="hidden" name="title" value="'.$t->getPrefixedText().'" />';
469 $out .= "
470 <div id='nsselect' class='recentchanges'>
471 <label for='nsselectbox'>" . wfMsg('namespace') . "</label>
472 $namespaceselect $submitbutton $invertbox <label for='nsinvert'>" . wfMsg('invert') . "</label>
473 </div>";
474 $out .= '</form></div>';
475 return $out;
476 }
477
478
479 /**
480 * Format a diff for the newsfeed
481 */
482 function rcFormatDiff( $row ) {
483 $fname = 'rcFormatDiff';
484 wfProfileIn( $fname );
485
486 require_once( 'DifferenceEngine.php' );
487 $comment = "<p>" . htmlspecialchars( $row->rc_comment ) . "</p>\n";
488
489 if( $row->rc_namespace >= 0 ) {
490 global $wgContLang;
491
492 #$diff =& new DifferenceEngine( $row->rc_this_oldid, $row->rc_last_oldid, $row->rc_id );
493 #$diff->showDiffPage();
494
495 $titleObj = Title::makeTitle( $row->rc_namespace, $row->rc_title );
496 $dbr =& wfGetDB( DB_SLAVE );
497 $newrev =& Revision::newFromTitle( $titleObj, $row->rc_this_oldid );
498 if( $newrev ) {
499 $newtext = $newrev->getText();
500 } else {
501 $diffText = "<p>Can't load revision $row->rc_this_oldid</p>";
502 wfProfileOut( $fname );
503 return $comment . $diffText;
504 }
505
506 if( $row->rc_last_oldid ) {
507 wfProfileIn( "$fname-dodiff" );
508 $oldrev =& Revision::newFromId( $row->rc_last_oldid );
509 if( !$oldrev ) {
510 $diffText = "<p>Can't load old revision $row->rc_last_oldid</p>";
511 wfProfileOut( $fname );
512 return $comment . $diffText;
513 }
514 $oldtext = $oldrev->getText();
515
516 # Old entries may contain illegal characters
517 # which will damage output
518 $oldtext = UtfNormal::cleanUp( $oldtext );
519
520 global $wgFeedDiffCutoff;
521 if( strlen( $newtext ) > $wgFeedDiffCutoff ||
522 strlen( $oldtext ) > $wgFeedDiffCutoff ) {
523 $diffLink = $titleObj->escapeFullUrl(
524 'diff=' . $row->rc_this_oldid .
525 '&oldid=' . $row->rc_last_oldid );
526 $diffText = '<a href="' .
527 $diffLink .
528 '">' .
529 htmlspecialchars( wfMsgForContent( 'difference' ) ) .
530 '</a>';
531 } else {
532 $diffText = DifferenceEngine::getDiff( $oldtext, $newtext,
533 wfMsg( 'revisionasof', $wgContLang->timeanddate( $row->rc_timestamp ) ),
534 wfMsg( 'currentrev' ) );
535 }
536 wfProfileOut( "$fname-dodiff" );
537 } else {
538 $diffText = '<p><b>' . wfMsg( 'newpage' ) . '</b></p>' .
539 '<div>' . nl2br( htmlspecialchars( $newtext ) ) . '</div>';
540 }
541
542 wfProfileOut( $fname );
543 return $comment . $diffText;
544 }
545
546 wfProfileOut( $fname );
547 return $comment;
548 }
549
550
551 /**
552 * Appends to second array if $value differs from that in $default
553 */
554 function appendToArrayIfNotDefault( $key, $value, $default, &$changed )
555 {
556 if ( is_null( $changed ) ) {
557 die();
558 }
559 if ( $default[$key] !== $value ) {
560 $changed[$key] = $value;
561 }
562 }
563
564 ?>