Index: trunk/phpwiki/fpw/wikiPage.php |
— | — | @@ -1081,6 +1081,8 @@ |
1082 | 1082 | mysql_select_db ( $wikiSQLServer , $connection ) ; |
1083 | 1083 | $sql = "UPDATE cur SET cur_cache=\"$this->cache\", cur_timestamp=cur_timestamp WHERE cur_title=\"$this->secureTitle\"" ; |
1084 | 1084 | 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 ) ; |
1085 | 1087 | #mysql_close ( $connection ) ; |
1086 | 1088 | |
1087 | 1089 | |
Index: trunk/phpwiki/fpw/special_recentchanges.php |
— | — | @@ -2,13 +2,29 @@ |
3 | 3 | include_once ( "special_recentchangeslayout.php" ) ; |
4 | 4 | |
5 | 5 | function recentchanges () { |
6 | | - global $THESCRIPT , $user ; |
| 6 | + global $THESCRIPT , $user , $useCachedPages ; |
7 | 7 | global $vpage , $maxcnt , $daysAgo , $from , $wikiRecentChangesText , $wikiRecentChangesTitle ; |
8 | 8 | global $wikiRecentChangesLastDays , $wikiRecentChangesSince , $wikiViewLastDays , $wikiViewMaxNum , $wikiListOnlyNewChanges ; |
9 | 9 | $vpage->special ( $wikiRecentChangesTitle ) ; |
10 | 10 | $vpage->makeSecureTitle() ; |
11 | 11 | if ( !isset ( $maxcnt ) ) $maxcnt = 50 ; |
12 | 12 | 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 | + } |
13 | 29 | |
14 | 30 | $from2 = substr ( $from , 0 , 4 ) . "-" . substr ( $from , 4 , 2 ) . "-" . substr ( $from , 6 , 2 ) ; |
15 | 31 | $from2 .= " " . substr ( $from , 8 , 2 ) . ":" . substr ( $from , 10 , 2 ) . ":" . substr ( $from , 12 , 2 ) ; |
— | — | @@ -89,6 +105,16 @@ |
90 | 106 | |
91 | 107 | #mysql_close ( $connection ) ; |
92 | 108 | $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 | + |
93 | 119 | return $ret ; |
94 | 120 | } |
95 | 121 | |