r95 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94‎ | r95 | r96 >
Date:08:30, 8 February 2002
Author:vibber
Status:old
Tags:
Comment:
Cache results of default RecentChanges settings
Modified paths:
  • /trunk/phpwiki/fpw/special_recentchanges.php (modified) (history)
  • /trunk/phpwiki/fpw/wikiPage.php (modified) (history)

Diff [purge]

Index: trunk/phpwiki/fpw/wikiPage.php
@@ -1081,6 +1081,8 @@
10821082 mysql_select_db ( $wikiSQLServer , $connection ) ;
10831083 $sql = "UPDATE cur SET cur_cache=\"$this->cache\", cur_timestamp=cur_timestamp WHERE cur_title=\"$this->secureTitle\"" ;
10841084 mysql_query ( $sql , $connection ) ;
 1085+ $sql = "UPDATE cur SET cur_text=\"\", cur_timestamp=cur_timestamp WHERE cur_title=\"Log:RecentChanges\"" ;
 1086+ mysql_query ( $sql , $connection ) ;
10851087 #mysql_close ( $connection ) ;
10861088
10871089
Index: trunk/phpwiki/fpw/special_recentchanges.php
@@ -2,13 +2,29 @@
33 include_once ( "special_recentchangeslayout.php" ) ;
44
55 function recentchanges () {
6 - global $THESCRIPT , $user ;
 6+ global $THESCRIPT , $user , $useCachedPages ;
77 global $vpage , $maxcnt , $daysAgo , $from , $wikiRecentChangesText , $wikiRecentChangesTitle ;
88 global $wikiRecentChangesLastDays , $wikiRecentChangesSince , $wikiViewLastDays , $wikiViewMaxNum , $wikiListOnlyNewChanges ;
99 $vpage->special ( $wikiRecentChangesTitle ) ;
1010 $vpage->makeSecureTitle() ;
1111 if ( !isset ( $maxcnt ) ) $maxcnt = 50 ;
1212 if ( !isset ( $daysAgo ) ) $daysAgo = 3 ;
 13+
 14+ if ( $maxcnt == 50 and $daysAgo == 3 and !isset($from)
 15+ and $user->options["hideMinor"] == "no" and $user->options["changesLayout"] == "classic"
 16+ and $useCachedPages) {
 17+ # If all default settings are in use, we can show a cached version of the page if available
 18+ #echo "(caching)"; #FIXME
 19+ $canBeCached = true;
 20+ $cache = getMySQL ( "cur" , "cur_text" , "cur_title=\"Log:RecentChanges\"" ) ;
 21+
 22+ if ( $cache != "" )
 23+ return $cache;
 24+ #echo "(reforming)"; #FIXME
 25+ } else {
 26+ #echo "(not caching)"; #FIXME
 27+ $canBeCached = false;
 28+ }
1329
1430 $from2 = substr ( $from , 0 , 4 ) . "-" . substr ( $from , 4 , 2 ) . "-" . substr ( $from , 6 , 2 ) ;
1531 $from2 .= " " . substr ( $from , 8 , 2 ) . ":" . substr ( $from , 10 , 2 ) . ":" . substr ( $from , 12 , 2 ) ;
@@ -89,6 +105,16 @@
90106
91107 #mysql_close ( $connection ) ;
92108 $ret .= recentChangesLayout($arr) ;
 109+
 110+ if ( $canBeCached ) {
 111+ # Store the cached version
 112+ #echo "(saving)"; #FIXME
 113+ $p = new wikiPage ;
 114+ $p->setTitle ( "log:RecentChanges" ) ;
 115+ $p->ensureExistence () ;
 116+ $p->setEntry ( $ret , "Refresh" , 0 , "System" , 1, ",cur_timestamp=0" ) ;
 117+ }
 118+
93119 return $ret ;
94120 }
95121

Status & tagging log