Index: trunk/phpwiki/fpw/special_wantedpages.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <? |
3 | 3 | function refreshWantedPages () { |
4 | 4 | global $showNumberPages , $linkedLinks , $unlinkedLinks , $vpage , $wikiWantedText , $wikiWantedLine ; |
5 | | - global $wikiWantedToggleNumbers ; |
| 5 | + global $wikiWantedToggleNumbers, $wikiLastRefreshed ; |
6 | 6 | $vpage->special ( "The Most Wanted Pages" ) ; |
7 | 7 | $vpage->namespace = "" ; |
8 | 8 | if ( $showNumberPages == "" ) $showNumberPages = "off" ; |
— | — | @@ -61,28 +61,44 @@ |
62 | 62 | } |
63 | 63 | } |
64 | 64 | $ret .= implode ( "" , $o ) ; |
| 65 | + |
| 66 | + $now = time () ; |
| 67 | + $lc = wikiGetDate ( $now ) . date ( ", H:i" , $now ) ; |
| 68 | + #$lc .= ", ".substr ( $now , 8 , 2 ) ; |
| 69 | + #$lc .= ":".substr ( $now , 10 , 2 ) ; |
| 70 | + $ret .= "\n<p>" . str_replace ( "$1", $lc, $wikiLastRefreshed ) . "</p>\n" ; |
65 | 71 | |
66 | 72 | return $ret ; |
67 | 73 | } |
68 | 74 | |
69 | 75 | function WantedPages () { |
70 | | - global $doRefresh , $wikiRefreshThisPage , $wikiResourcesWarning ; |
| 76 | + global $doRefresh , $wikiRefreshThisPage , $wikiResourcesWarning , $wikiNoRefresh ; |
71 | 77 | $pn = "Log:Most_Wanted" ; |
| 78 | + $minRefreshPeriod = 5*60; # Refuse to update more often than every 5 minutes |
72 | 79 | $ret = "<nowiki>" ; |
73 | 80 | |
74 | 81 | $ret .= "<p align=center><font size='+1'><b><a href=\"" ; |
75 | 82 | $ret .= wikiLink ( "special:WantedPages&doRefresh=yes" ) ; |
76 | 83 | $ret .= "\">$wikiRefreshThisPage</a></b></font><br>$wikiResourcesWarning</p></nowiki>\n" ; |
77 | 84 | if ( $doRefresh == "yes" ) { |
78 | | - $o = refreshWantedPages () ; |
79 | | - $ret .= $o ; |
80 | | - $p = new wikiPage ; |
81 | | - $p->setTitle ( $pn ) ; |
82 | | - $p->ensureExistence () ; |
83 | | - $p->setEntry ( $o , "Refresh" , 0 , "System" , 1 , ",cur_timestamp=cur_timestamp" ) ; # Storing, don't show on RC |
84 | | - } else { |
85 | | - $ret .= getMySQL ( "cur" , "cur_text" , "cur_title=\"$pn\"" ) ; |
| 85 | + $timestamp = getMySQL ( "cur" , "UNIX_TIMESTAMP(cur_timestamp)" , "cur_title=\"$pn\"" ) ; |
| 86 | + if ( ( $lastrefreshed = time() - $timestamp ) < $minRefreshPeriod ) { |
| 87 | + $ret .= "<p><i>" . str_replace ( array ( "$1", "$2" ) , |
| 88 | + array ( round ( $lastrefreshed / 60 ) , round ( ( $minRefreshPeriod - $lastrefreshed ) / 60 ) ), |
| 89 | + $wikiNoRefresh ) . "</i></p>\n\n"; |
| 90 | + } else { |
| 91 | + $o = refreshWantedPages () ; |
| 92 | + $ret .= $o ; |
| 93 | + $p = new wikiPage ; |
| 94 | + $p->setTitle ( $pn ) ; |
| 95 | + $p->ensureExistence () ; |
| 96 | + #$p->setEntry ( $o , "Refresh" , 0 , "System" , 1 , ",cur_timestamp=cur_timestamp" ) ; # Storing, don't show on RC |
| 97 | + $p->setEntry ( $o , "Refresh" , 0 , "System" , 1 , "" ) ; # Storing, don't show on RC |
| 98 | + $timestamp2 = getMySQL ( "cur" , "UNIX_TIMESTAMP(cur_timestamp)" , "cur_title=\"$pn\"" ) ; |
| 99 | + return $ret; |
| 100 | + } |
86 | 101 | } |
| 102 | + $ret .= getMySQL ( "cur" , "cur_text" , "cur_title=\"$pn\"" ) ; |
87 | 103 | return $ret ; |
88 | 104 | } |
89 | | -?> |
\ No newline at end of file |
| 105 | +?> |
Index: trunk/phpwiki/fpw/wikiTextEn.php |
— | — | @@ -337,6 +337,8 @@ |
338 | 338 | $wikiPopularPages = "Most popular" ; |
339 | 339 | $wikiRefreshThisPage = "Refresh this page" ; |
340 | 340 | $wikiResourcesWarning = "(Please, do this only when necessary, as this function uses a high amount of system resources)" ; |
| 341 | +$wikiNoRefresh = "(The page was last refreshed just $1 minutes ago; please wait another $2 minutes and try again.)" ; |
| 342 | +$wikiLastRefreshed = "Last refreshed $1" ; |
341 | 343 | |
342 | 344 | #--------------------------- |
343 | 345 | #Functions |