Development page for the Recentchanges action
The action which is (with wikka 1.1.6.0) named "recentchanges" is in fact a "recently changed" action (as stated on ImprovedRecentChanges by JavaWoman)
Last edited by JavaWoman:
Replaces old-style internal links with new pipe-split links.
Fri, 20 May 2016 07:38 UTC [diff]
Replaces old-style internal links with new pipe-split links.
Fri, 20 May 2016 07:38 UTC [diff]
To make a real recentchanges action, I have just copied the code from the "recently changed" action and made the necessary (small) modification.
- LoadRecentChanges() now only loads part of the pages (see first item on WikkaOptimization, thanks to DotMg)
- the limit of pages to load is now set before loading the pages
The code
don't forget to rename the old recentchanges.php into recentlychanged.php first!actions/recentchanges.php
- <?php
- if ($user = $this->GetUser()) {
- $max = $user["changescount"];
- } else {
- $max = 50;
- }
- if ($pages = $this->LoadRecentChanges($max))
- {
- $curday = "";
- print('<p><link rel="alternate" type="application/rss+xml" title="RSS" href="'.$this->href("recentchanges.xml", $this->page["tag"]).'" ><img src="images/xml.png" width="36" height="14" alt="XML" /></link></p>\n');
- //<a href=\"".$this->href("recentchanges.xml", $this->page["tag"])."\">
- foreach ($pages as $i => $page)
- {
- // day header
- if ($day != $curday)
- {
- if ($curday) print("</span><br />\n");
- print("<strong>$dateformatted:</strong><br />\n<span class=\"recentchanges\">");
- $curday = $day;
- }
- $page_edited_by = $page["user"];
- if (!$this->LoadUser($page_edited_by)) $page_edited_by .= " (unregistered user)";
- // print entry
- if ($page["note"]) $note=" <span class=\"pagenote\">[".$page["note"]."]</span>"; else $note ="";
- $pagetag = $page["tag"];
- if ($this->HasAccess("read", $pagetag)) {
- } else {
- print(" ($timeformatted) [history] - ".$page["tag"]." ⇒ $page_edited_by ".$note."<br />");
- }
- }
- print "</span>\n";
- $wikipingserver = $this->config["wikiping_server"];
- if ($wikipingserver) {
- $wikipingserver_host = $wikipingserver_url_parsed["host"];
- echo "<br /><br />[WikiPing enabled: Changes on this wiki are broadcast to <a href=\"http://$wikipingserver_host\">http://$wikipingserver_host</a>]";
- }
- }
- ?>
addition to wikka.php (right behind LoadRecentlyChanged())
function LoadRecentChanges($max=50)
{
if ($pages = $this->LoadAll("select tag, time, user, note from ".$this->config["table_prefix"]."pages order by time desc limit ".$max))
{
foreach ($pages as $page)
{
$this->CachePage($page);
}
return $pages;
}
}
{
if ($pages = $this->LoadAll("select tag, time, user, note from ".$this->config["table_prefix"]."pages order by time desc limit ".$max))
{
foreach ($pages as $page)
{
$this->CachePage($page);
}
return $pages;
}
}
CategoryDevelopmentActions CategoryDevelopmentCore