Jump to content

Extension talk:Dynamic Article List

Add topic
From mediawiki.org
Latest comment: 12 years ago by Karanosov in topic MediaWiki 1.19.2
The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).
Warning:: These pages can be modified by others. Use with caution!

Use all namespaces

[edit]

Is it possible for the extension to use all available namespaces? For instance the namespaces File: and Template: aren't detected. Thanks

PDF problem

[edit]

Yes I agree, sharing source code in PDF form is utterly retarded.

I couldn't get the extension to work - I get this message:

Parse error: parse error, unexpected T_CLASS in /home/mart1633/public_html/wiki/includes/CategoryTravelerBase.php on line 9

Steadymarvin 22:19, 11 January 2006 (UTC)Reply


The method of cutting and pasting from pdfs seems unnecessarily complex - why not provide a zip of the files?

I have the same situation...

[edit]

Parse error: parse error, unexpected T_CLASS in /home/dental/public_html/wiki/includes/CategoryTravelerBase.php on line 9

same problem

[edit]

Parse error: parse error, unexpected T_CLASS in /home/worldnom/public_html/wiki/includes/CategoryTravelerBase.php on line 9

Ditto

[edit]

Except my parse error is on line 2. A quick glance around and it looks like this may be a database error. Does this use the database? Do we need SQL code? Or does the PHP need to be configured somehow? --Laveaux 02:55, 5 February 2006 (UTC)Reply

...Actually, something different is happening. I assume this requires Dynamic Page List to work. I get the parse error with that active, but when I "//" the "include("extensions/DynamicPageList.php");" line in LocalSettings, the parse error goes away, however the Dynamic Article List code does not work.

I have T_CLASS error too. Do you have php5?

[edit]

This requires php5, i am using php 4.3.10-16.

I'll get php5 and hope it fixes it. Jcobbers

This fixes it: you NEED php5 http://www.debian-administration.org/articles/258 explains how for debian, googling around will explain for others. the basic process (for debian) is update the list of sources to include php5 and other required stuff.

"Found an article saying basically add the repositories to /etc/apt/sources.list and;
apt-get update # Of course
apt-get install libapache2-mod-php5 php5 php5-mysql" (from the link above). 

Your mileage may differ, make sure you get the right php5-mysql version (check what version of mysql you have, <=4.0 or >= 4.1)

Only a white page

[edit]

If i install this expension they way told here, then i only get a white Page with only HTML Headers and nothing else. I got PHP5, error_log from Server shows nothing. Im Using Mediawiki 1.5.6

And i don't got any Idea from what this error is coming.

Is there any alternative to Dynamic Article List ? Maybee something using PHP4

I have the same problem with version 1.5.6. Blank white page.

== For PHP Version 4 == (Does this code go in a file named DynamicArticleList.php? -> Yes, it does. And it works fine for me)

Issue is with the Category filter. Removed that from the script and now works in PHP 4.
- Smcnaught (05:24, 1 April 2006 (UTC))

<?php
/*
 * Purpose: Dynamic Output of Article List (Main Page always not in list)
 * Note: Currently support four types (new, hot, update, discussion).
 *      new             => Newly Posted Articles
 *      update          => Recently Updated Articles
 *      hot             => Most Popular Articles
 *      discussion      => Recently Updated Discussion
 * @author: Zeng Ji (zengji@gmail.com)
 *
 * To install, add following to LocalSettings.php
 * require_once ("extensions/DynamicArticleList.php");
 */

$wgExtensionFunctions[] = "wfDynamicArticleList";

function wfDynamicArticleList() {
       global $wgParser;

       $wgParser->setHook( "DynamicArticleList", "DynamicArticleList" );
}

// The callback function for converting the input text to HTML output
function DynamicArticleList( $input ) {

       $dbr =& wfGetDB( DB_SLAVE );

       // INVALIDATE CACHE
       global $wgTitle;
       $wgTitle->invalidateCache();

       // Default Values
       $listTitle = false;
       $listType = 'new';
       $listCount = 5;

// ###### PARSE PARAMETERS ######
       $aParams = explode("\n", $input);
       foreach($aParams as $sParam) {
              $aParam = explode("=", $sParam);
              if( count( $aParam ) < 2 )
                      continue;
              $sType = trim($aParam[0]);
              $sArg = trim($aParam[1]);

              switch ($sType) {
                     case 'title':
                              $listTitle = $sArg;
                               break;

                       case 'type':
                               if ( in_array($sArg, array('new','hot','update', 'discussion')) )
                                        $listType = $sArg;
                               break;

                       case 'count':
                               $listCount = IntVal( $sArg );
                               break;

               }
       }

// ###### CHECKS ON PARAMETERS ######
       if ($listTitle!=false && strlen($listTitle)==0)
                $listTitle=false;

// ###### BUILD SQL QUERY ######
       $sql = genSQL($listType, $listCount);

// ###### PROCESS SQL QUERY ######
       global $wgUser;
       global $wgLang;
       global $wgContLang;

      $res = $dbr->query($sql);
      $sk =& $wgUser->getSkin();
      if ($dbr->numRows( $res ) != 0) {
                 while( $row = $dbr->fetchObject ( $res ) ) {
                          $title = Title::makeTitle( $row->namespace, $row->title);
                          if ($listType == 'discussion')
                                   $sLink = $sk->makeKnownLinkObj($title, $wgContLang->convertHtml($title->getText()), '', '', 'Discussion: ');
                          else
                                   $sLink = $sk->makeKnownLinkObj($title, $wgContLang->convertHtml($title->getText()));

                       // Generate 'View Count' String (for 'hot')
                       if ($listType == 'hot')
                                $aViews[] = ' - ( ' . $row->count . ' views ) ';
                       else
                                $aViews = false;

                       // Generate 'Time' String (for 'new', 'update', 'discussion')
                       if ($listType != 'hot') {
                                $aDates[] = ' - [ ' . $wgLang->timeanddate($row->timestamp, true) . ' ] ';
                                $editorID = $row->user;
                                if ($editorID == 0) {
                                        $editor = wfMsg('anonymous');
                                        $aEditors[] = ' (' . $editor . ')';
                                } else {
                                        $editor = User::whoIs($editorID);
                      $aEditors[] = ' ( ' . $sk->makeLink($wgContLang->getNsText(NS_USER) . ':' . $editor,
htmlspecialchars($editor)) . ' )';
                                }
                      }         else {
                                $aDates = false;
                                $aEditors = false;
                      }

                       $aArticles[] = $sLink;
               }
       }
       $dbr->freeResult( $res );

// ###### GENERATE OUTPUT ######
       return OutputList($aArticles, $aEditors, $aDates, $aViews, $listTitle);
}

function genSQL( $type, $count) {
       $dbr =& wfGetDB( DB_SLAVE );
       $sPageTable = $dbr->tableName( 'page' );
       $sRevisionTable = $dbr->tableName( 'revision' );
       $sRecentChangesTable = $dbr->tableName( 'recentchanges' );


       $sql = '';
       if ($type == 'hot') {

                     $sql = "
                             SELECT DISTINCT
                             page_title as title,
                             page_namespace AS namespace,
                             page_counter as count
                             FROM $sPageTable
                             WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0 AND
page_id!=1
                             ORDER by count DESC
                             LIMIT $count
                     ";

      } elseif ($type == 'update') {

            // Step 1: Get revision list order by rev_id

                    $sql = "
                            SELECT
                             page_id,
                             MAX(rev_id) AS max_rev_id
                            FROM $sPageTable
                            INNER JOIN $sRevisionTable ON page_id=rev_page

                             WHERE page_is_new!=1 AND page_namespace=0 AND page_is_redirect=0
AND page_id!=1
                             GROUP BY page_id
                             ORDER by max_rev_id DESC
                             LIMIT $count
                     ";

             // Step 2: According to revision list, generate SQL to retrieve article page information.
             $res = $dbr->query($sql);
             $inClause = '';
             if ($dbr->numRows( $res ) == 0) {
                     $inClause = "-1";
             } else {
                     while( $obj = $dbr->fetchObject( $res ) ) {
                             if( isset( $obj->max_rev_id ) ) {
                                      $inClause .= $obj->max_rev_id . ',';
                             }
                     }
                     $inClause = substr($inClause, 0, -1);   //delete tailing ','
             }
             $dbr->freeResult( $res );

             $sql = "
                     SELECT
                      page_title AS title,
                      page_namespace AS namespace,
                      rev_user AS user,
                      rev_timestamp AS timestamp
                     FROM $sRevisionTable, $sPageTable
                     WHERE rev_page=page_id AND rev_id IN (". $inClause . ")
                     ORDER BY rev_id DESC";

      } elseif ($type == 'discussion') {

             // Step 1: Get revision list order by rev_id.
                     $sql = "
                             SELECT
                              p1.page_id,
                              MAX(rev_id) AS max_rev_id
                             FROM $sPageTable AS p1
                             INNER JOIN $sRevisionTable ON p1.page_id=rev_page
                            WHERE p1.page_is_redirect=0 AND p1.page_namespace=1
                            GROUP BY rev_page
                            ORDER by max_rev_id DESC
                            LIMIT $count
                    ";

            // Step 2: According to revision list, generate SQL to retrieve discussion page information.
            $res = $dbr->query($sql);
            $inClause = '';
            if ($dbr->numRows( $res ) == 0) {
                    $inClause = "-1";
            } else {
                    while( $obj = $dbr->fetchObject( $res ) ) {
                            if( isset( $obj->max_rev_id ) ) {
                                     $inClause .= $obj->max_rev_id . ',';
                            }
                    }
                    $inClause = substr($inClause, 0, -1);        //delete tailing ','
            }
            $dbr->freeResult( $res );

            $sql = "
                    SELECT
                     page_title AS title,
                     page_namespace AS namespace,
                     rev_user AS user,
                     rev_timestamp AS timestamp
                    FROM $sRevisionTable, $sPageTable
                    WHERE rev_page=page_id AND rev_id IN (". $inClause . ")
                    ORDER BY rev_id DESC";

      }     else { // default type is 'new'

                       $sql = "
                               SELECT DISTINCT
                                page_title AS title,
                                page_namespace AS namespace,
                                rc_user AS user,
                                rc_timestamp AS timestamp
                               FROM $sPageTable
                               INNER JOIN $sRecentChangesTable ON page_id=rc_cur_id
                               WHERE rc_new=1 AND rc_namespace=0 AND page_is_redirect=0 AND
page_id!=1
                               ORDER by rc_id DESC
                               LIMIT $count
                      ";
       }

       return $sql;
}

function OutputList ( $aArticles, $aEditors, $aDates, $aViews, $listTitle ) {
       if ($listTitle != false) {
                $r .= " <h3>" . $listTitle . "</h3>\n";
                $r .= " <hr/>\n";
       }

       $sStartList = '<ul>';
       $sEndList = '</ul>';
       $sStartItem = '<li>';
       $sEndItem = '</li>';

       $r .= $sStartList . "\n";
       for ($i=0; $i<count($aArticles); $i++) {
               $editorString = "";
               $dateString = "";
               $viewString = "";

               if ($aEditors != false)
                      $editorString = "<font size=-2>" . $aEditors[$i] . "</font>";
               if ($aDates != false)
                      $dateString = "<font size=-2>" . $aDates[$i] . "</font>";
               if ($aViews != false)
                      $viewString = "<font size=-2>" . $aViews[$i] . "</font>";

               $r .= $sStartItem . $aArticles[$i] . $editorString . $dateString . $viewString . $sEndItem . "\n";
       }
       $r .= $sEndList . "\n";

       return $r;
}
?>

Mediawiki 1.6.3

[edit]

Is there a Chance anyone can make this and DynamicPageList working with mediawiki 1.6.3 ?


Mediawiki 1.6.5

[edit]

Would be most grateful if anyone could make DynamicPageList work with mediawiki 1.6.5. Had no luck myself.

Slow Updating?

[edit]

On the above note i have this working with mediawiki 1.6.7 fine. However, it seems to take a very long time to refresh the lists. The new articles updates within a few hours, but the recentchanges can sometimes take days to refresh. Does anyone else have the problem or a fix? (I have turned off mediawiki clearing the recent changes aswel)l btw.

--202.72.148.102 02:49, 6 July 2006 (UTC)Reply

Mediawiki 1.6.7

[edit]

It works with Mediawiki 1.6.7 but .... I have to use the Dynamic_Article_List_for_PHP4 code to make it works even if I have PHP 5.1.2 installed. I have tried the PDF version of the code and the text file version provided above with no luck. The problem is that I have PHP 5.1.2 (My server is Windows 2003 and IIS is used as web server) and I have the same T_CLASS error if I try to use the extension Dynamic Article List. I am not a PHP programmer but it seems to me a bug related to this extension and not PHP.

Update

Upgraded to PHP 5.1.4 (full stuff) and have this error :

Parse error: parse error, unexpected T_STRING, expecting T_FUNCTION in D:\mediawiki\includes\CategoryTravelerBase.php on line 158

Update 2

Ok, I have donwloaded and install all code from the PDF files to be sure (the error message above indicate maybe that there is a conflict somewhere in the function calls) and receive this error this time :

A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was: 
(SQL query hidden)
from within function "CategoryUtil::buildOneCategory". 

MySQL returned error "1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version

for the right syntax to use near 's_Group_Policies') ORDER BY page_title' at line 1 (localhost)".

Fix :

This error is because I use the option 'categoryRoot' with the wrong name, I have to use the category name and NOT the Category display name.

--Romainp 17:52, 7 July 2006 (UTC)Reply

Feture Request

[edit]

Is there a way to get new and update together with the time order. for ex.
B (new)
A (updated)
C (new)
D (new)


Mediawiki 1.7.1

[edit]

Just to let you know that I have upgraded from 1.6.x to 1.7.1 and the extension works, however, I have noticed those bugs :

Bug1 : Can't purge or preview the page

Everytime I try to purge the cache for a page that have the extension, or when I want to preview it, I have got this error :

Notice: Undefined variable:r in D:\mediawiki\extensions\DynamicArticleList.php on line 311

Bug2 : The option 'CategoryRoot' does not seems to work well

I have a general category called 'Knowledge Base' with several subs categories. If I use the extension to see all the latest articles in the 'Knowledge Base' Category, I have got also some articles that are not in this category but contains the words 'Knowledge Base'.

Maybe it is a bug in the query or the extension, maybe the problem is located elsewhere (the caching of the page ??).

Please everybody comment about that if you have the same problem.

Update : Ok, I think that the problem is not related to the name of the category but with the fact that the extension does not seems to work well to retreive all articles in sub categories, starting with a root category. I have an SQL Error each time I try to run it :

A database query syntax error has occurred. 
This may indicate a bug in the software. The last attempted database query was:
 
(SQL query hidden)

from within function "CategoryUtil::buildOneCategory". MySQL returned error "1064: 
You have an error in your SQL syntax; check the manual that corresponds to your 
MySQL server version for the right syntax to use near 's_Group_Policies') ORDER BY page_title' at line 1 (localhost)".

With the parameters :

<DynamicArticleList>
  title=Newly Posted Articles
  type=new
  count=5
  categoryRoot=Knowledge Base
</DynamicArticleList>

Is it possible that the code maintainer or the actual coder of this great extension can help us ?

Fix : In fact, my problem was that use the ' caracter in a category name and that bot seem to make mediawiki happy. I have created a new category and remove the problematic category (by remving in it the root category) and now all is working perfectly !

--Romainp 13:52, 10 July 2006 (UTC)Reply

I have the same error:

Database error
From Front Tools wiki
Jump to: navigation, search
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

    (SQL query hidden)

from within function "". MySQL returned error "1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER by rc_id DESC LIMIT 5' at line 9 (localhost)".
But i'm not sure to understand how you have solved yout pb !

Any help is welcome --Ctof 18:13, 24 July 2006 (UTC)Reply

This error seems to occur any time the category does not exist, which means, in particular, that it doesn't work in templates. (The <DynamicArticleList> tag is executed before the substitution, so unless you have a category called {{{1}}} it fails.) I've been looking through the code to find a better way to handle query failuers, but if anyone knows one, that would be great. --Jimmy 18:42, 24 July 2006 (UTC)Reply

Bug 3 : categoryRoot=MyCat dosn't list the sames numbers of article as when we click on a link like [[Category:MyCat]] ? --Ctof 11:34, 27 July 2006 (UTC)Reply

after readinf the code,I know what, it's because by default the sql request is limited to the default namespace and i have article ino other namespace. is it possbible to add an attribute to specify the namespace ? --Ctof 13:34, 27 July 2006 (UTC)Reply

Wikimarkup Feature

[edit]

Is it possible to allow Wikimarkup, particularly links, in the title field?

Two New Features

[edit]

I added two features to Zeng Ji's great extension:

  • Options to surpress view count, editor, and timestamp, as pertain to each list type
  • Renders wikitext in the title field

I included the code on my user page at User:Socoljam/DynamicArticleList (enhanced). I hope someone finds this useful, besides myself that is! --Socoljam 23:25, 23 July 2006 (UTC)Reply

Error when used with DPL

[edit]

When using DynamicArticleList on the same page as DynamicPageList2 I get one of these errors for each use of DynamicArticleList :-

Notice: Undefined variable: r in /my/site/directory/wiki/extensions/DynamicArticleList.php on line 282

My System :-

  • MediaWiki: 1.7.1
  • PHP: 5.0.5-2ubuntu1.3 (apache2handler)
  • MySQL: 4.0.24_Debian-10ubuntu2.3-log

A fix?

I had it happening on line 274/275, so changed them to look like this:

if (isset($r)) { $r .= " <h3>" . $listTitle . "</h3>\n"; }
if (isset($r)) { $r .= " <hr/>\n"; }

Appears to work for me!

If you are having errors, make sure code copy from pdf was good

[edit]

I had two spurrious newlines that got inserted into the code in CategoryTravelerBase.php. This caused odd "unexpected T_STRING expected T_FUNCTION ..." type errors, similar to what other people have reported on this page. 71.142.84.12 14:34, 29 September 2006 (UTC)Reply

The "Undefined variable: r" error

[edit]

I have Mediawiki 1.8.1 and the extension installed (from the PDF file).

I have also the "Undefined variable: r" in several lines. I have tested the fix describe above :

if (isset($r)) { $r .= " <h3>" . $listTitle . "</h3>\n"; }
if (isset($r)) { $r .= " <hr/>\n"; }

I have apply the if (isset(%r)) {...} on each lines where I have an error AND where the r variable appear. Now there is no errors but ... the extension does not work anymore ...

Any ideas someone ?

--Romain 14:50, 18 October 2006 (UTC)Reply

I'm just adding in that I'm having the error, with the fix applied, on version 1.8.3, PHP 5.1.2, and MySQL 4.1.14-Debian_5-log. The script still appears to work for me, though, except that I need to go into the page with the dynamic lists, edit, and save the page to update the lists. Refreshing the page clears the errors, but it doesn't update the lists. Er, I'd also like support on getting this so I don't need to edit pages to update lists... It kinda defeats the whole "Dynamic" part of the script. --216.170.23.236 04:20, 30 January 2007 (UTC)Reply

--Special:Contributions 13:59, 14 March 2011 (UTC) Just add $r = ""; after the function OutputList in line 274. It will work!

Mediawiki 1.8.2

[edit]

I got the pdf version and that works fine

Using Namespaces

[edit]

I add a feature in the file Text version - DynamicArticleList.php with namespace: choice of namespace for the listing.

You can use the name or directly the number of the namespace.

Use like that :

<DynamicArticleList>
  title=my_listing 
  type=new
  count=5
  namespace=my_namespace
  categoryRoot=my_category
</DynamicArticleList>

Ncante 09:53, 14 February 2007 (UTC)Reply

Mediawiki 1.9.2 with Namespace version

[edit]

I have downloaded the Text version - DynamicArticleList.php with namespace Fixed the Undefined variable:r error by adding $r = ""; at the start of the OutputList() function.

As people have said at the end of this discussion it is not updating.

I have added the $wgCacheEpoch = gmdate( 'YmdHis' ); line and when I specify a namespace it seems to work, but on my home page, where I want to check all namespaces it is just not updating even if I edit the page.

--Markw21 20:42, 9 March 2007 (UTC)Reply

Problem with refresh?

[edit]

At first i thought, that all works well, but it doesn't. This dynamic List don't refresh. Only if i edit something on the page, where my dynamic list is. I must say, that i have not done what is described in Dynamic_Article_List#Prerequisite. I have version 1.9.2 Can anyone help me? --192.164.38.126 08:45, 22 February 2007 (UTC)Reply


I am reporting the same problem. Just moved from 1.6.7 to 1.9.3 and my dynamic article list doesn't refresh anymore. Only when I am saving the page with the list again. In 1.6.7 it DID refresh very well grz B.Vahrmeijer - LeerWiki.nl


Solved Vahrmeijer 9-3-2007 see http://www.leerwiki.nl use in Localsettings: $wgCacheEpoch = gmdate( 'YmdHis' );

No refresh for me either.

[edit]

My 1.93 wiki is also having trouble with main page updates.

I have placed $wgCacheEpoch = gmdate( 'YmdHis' ); into the local setting file, but the page still only updates when I edit/save. I really like having the recent changes on the front page and would like to get this feature working. Has anyone else fixed this issue?

Thanks

Incompatibility with Semantic MediaWiki?

[edit]

I installed the DynamicAL put three lists on my Main_Page and upon accessing it or refreshing it I get a JavaScript alert-like box saying "Failed to derive URL prefix for Timeline API code files" the worst thing is that that after clicking "OK" or closing the alert box I get a completely correctly rendered page as usual.

So and since WikiMedia is very user friendly software that anyone even users with basic knowledge can use I had to search the entire file system as to what could the cryptic "Timeline API" stand for. The only fiel on my computer having a reference to timeline api is a javascript file for SimileTimeline - a fancy DHTML-based AJAXy widget for visualizing time-based events, that comes with Semantic MediaWiki (I would've never known I have it lol). Any help would be appreciated (although I'll prolly simply have to dump one of the extensions to solve this :D)

for refernce here's the timeline-api.js

/*==================================================
 *  Timeline API
 *
 *  This file will load all the Javascript files
 *  necessary to make the standard timeline work.
 *  It also detects the default locale.
 *
 *  Include this file in your HTML file as follows:
 *
 *    <script src="http://simile.mit.edu/timeline/api/scripts/timeline-api.js" type="text/javascript"></script>
 *
 *==================================================
 */
 
var Timeline = new Object();
Timeline.Platform = new Object();
    /*
        HACK: We need these 2 things here because we cannot simply append
        a <script> element containing code that accesses Timeline.Platform
        to initialize it because IE executes that <script> code first
        before it loads timeline.js and util/platform.js.
    */

(function() {
    var javascriptFiles = [
        "timeline.js",
        
        "util/platform.js",
        "util/debug.js",
        "util/xmlhttp.js",
        "util/dom.js",
        "util/graphics.js",
        "util/date-time.js",
        "util/data-structure.js",
        
        "units.js",
        "themes.js",
        "ethers.js",
        "ether-painters.js",
        "labellers.js",
        "sources.js",
        "layouts.js",
        "painters.js",
        "decorators.js"
    ];
    var cssFiles = [
        "timeline.css",
        "ethers.css",
        "events.css"
    ];
    
    var localizedJavascriptFiles = [
        "timeline.js",
        "labellers.js"
    ];
    var localizedCssFiles = [
    ];
    
    // ISO-639 language codes, ISO-3166 country codes (2 characters)
    var supportedLocales = [
        "en",       // English
        "es",       // Spanish
        "fr",       // French
        "it",       // Italian
        "ru",       // Russian
        "se",       // Swedish
        "vi",       // Vietnamese
        "zh"        // Chinese
    ];
    
    try {
        var desiredLocales = [ "en" ];
        var defaultServerLocale = "en";
        
        var parseURLParameters = function(parameters) {
            var params = parameters.split("&");
            for (var p = 0; p < params.length; p++) {
                var pair = params[p].split("=");
                if (pair[0] == "locales") {
                    desiredLocales = desiredLocales.concat(pair[1].split(","));
                } else if (pair[0] == "defaultLocale") {
                    defaultServerLocale = pair[1];
                }
            }
        };
        
        (function() {
            if (typeof Timeline_urlPrefix == "string") {
                Timeline.urlPrefix = Timeline_urlPrefix;
                if (typeof Timeline_parameters == "string") {
                    parseURLParameters(Timeline_parameters);
                }
            } else {
                var heads = document.documentElement.getElementsByTagName("head");
                for (var h = 0; h < heads.length; h++) {
                    var scripts = heads[h].getElementsByTagName("script");
                    for (var s = 0; s < scripts.length; s++) {
                        var url = scripts[s].src;
                        var i = url.indexOf("timeline-api.js");
                        if (i >= 0) {
                            Timeline.urlPrefix = url.substr(0, i);
                            var q = url.indexOf("?");
                            if (q > 0) {
                                parseURLParameters(url.substr(q + 1));
                            }
                            return;
                        }
                    }
                }
                throw new Error("Failed to derive URL prefix for Timeline API code files");
            }
        })();
        
        var includeJavascriptFiles;
        var includeCssFiles;
        if ("SimileAjax" in window) {
            includeJavascriptFiles = function(urlPrefix, filenames) {
                SimileAjax.includeJavascriptFiles(document, urlPrefix, filenames);
            }
            includeCssFiles = function(urlPrefix, filenames) {
                SimileAjax.includeCssFiles(document, urlPrefix, filenames);
            }
        } else {
            var getHead = function() {
                return document.getElementsByTagName("head")[0];
            };
            var includeJavascriptFile = function(url) {
                if (document.body == null) {
                    document.write("<script src='" + url + "' type='text/javascript'></script>");
                } else {
                    var script = document.createElement("script");
                    script.type = "text/javascript";
                    script.language = "JavaScript";
                    script.src = url;
                    getHead().appendChild(script);
                }
            };
            var includeCssFile = function(url) {
                if (document.body == null) {
                    document.write("<link rel='stylesheet' href='" + url + "' type='text/css'/>");
                } else {
                    var link = document.createElement("link");
                    link.setAttribute("rel", "stylesheet");
                    link.setAttribute("type", "text/css");
                    link.setAttribute("href", url);
                    getHead().appendChild(link);
                }
            }
            
            includeJavascriptFiles = function(urlPrefix, filenames) {
                for (var i = 0; i < filenames.length; i++) {
                    includeJavascriptFile(urlPrefix + filenames[i]);
                }
            };
            includeCssFiles = function(urlPrefix, filenames) {
                for (var i = 0; i < filenames.length; i++) {
                    includeCssFile(urlPrefix + filenames[i]);
                }
            };
        }
        
        /*
         *  Include non-localized files
         */
        includeJavascriptFiles(Timeline.urlPrefix + "scripts/", javascriptFiles);
        includeCssFiles(Timeline.urlPrefix + "styles/", cssFiles);
        
        /*
         *  Include localized files
         */
        var loadLocale = [];
        loadLocale[defaultServerLocale] = true;
        
        var tryExactLocale = function(locale) {
            for (var l = 0; l < supportedLocales.length; l++) {
                if (locale == supportedLocales[l]) {
                    loadLocale[locale] = true;
                    return true;
                }
            }
            return false;
        }
        var tryLocale = function(locale) {
            if (tryExactLocale(locale)) {
                return locale;
            }
            
            var dash = locale.indexOf("-");
            if (dash > 0 && tryExactLocale(locale.substr(0, dash))) {
                return locale.substr(0, dash);
            }
            
            return null;
        }
        
        for (var l = 0; l < desiredLocales.length; l++) {
            tryLocale(desiredLocales[l]);
        }
        
        var defaultClientLocale = defaultServerLocale;
        var defaultClientLocales = ("language" in navigator ? navigator.language : navigator.browserLanguage).split(";");
        for (var l = 0; l < defaultClientLocales.length; l++) {
            var locale = tryLocale(defaultClientLocales[l]);
            if (locale != null) {
                defaultClientLocale = locale;
                break;
            }
        }
        
        for (var l = 0; l < supportedLocales.length; l++) {
            var locale = supportedLocales[l];
            if (loadLocale[locale]) {
                includeJavascriptFiles(Timeline.urlPrefix + "scripts/l10n/" + locale + "/", localizedJavascriptFiles);
                includeCssFiles(Timeline.urlPrefix + "styles/l10n/" + locale + "/", localizedCssFiles);
            }
        }
        
        Timeline.Platform.serverLocale = defaultServerLocale;
        Timeline.Platform.clientLocale = defaultClientLocale;
    } catch (e) {
        alert(e);
    }
})();

354d 15:58, 28 September 2007 (UTC)Reply

Warning: Cannot modify header information

[edit]

I installed the extension in MediaWiki 1.11.0 and got two times the warning:

Warning: Cannot modify header information - headers already sent by (output started at <PATH>/mediawiki-1.11.0/extensions/DynamicArticleList.php:307) in <PATH>/mediawiki-1.11.0/includes/WebResponse.php on line 10

and german umlaute like ä, Ü, ß ... will not be displayed.

--AlexSommer 14:22, 5 October 2007 (UTC)

The same Problem with MediaWiki 1.10.0

[edit]

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/mediawiki-extensions/DynamicArticleList/DynamicArticleList.php:298) in /usr/share/mediawiki1.10/includes/WebResponse.php on line 10

not realy a Solution

[edit]

i' ve put following lines in index.php:

error_reporting( E_ALL );
header( "Content-type: text/html; charset=utf-8" );
@ini_set( "display_errors", false );

the pdf files are shit

[edit]

i thought that's my iceweasel, which make this problem. then i download those *.pdf (aka php) files with wget, and with other programs and i allways get strange pdf like file encoded dadaistical texts. i realy don't understand why there is an file.extension upload restructor in mediawiki. i had to install acrobatreader and to copy out these files.

Blank page with 1.11

[edit]

I upgraded to 1.11 and now when I enable this extension I just get blank pages. Anyone willing to update this extension ?

Deleted by poster

[edit]

Refresh

[edit]

mediawiki 1.32. How to make it refresh properly?

Feature Request: hideminor for update

[edit]

For the type "update" a feature only to show the majorupdates would be perfect. The "recentchanges" List has the possiblility to hide minorupdates. Maybe it is possible to integrate this. With the mark of minorupdates on updated pages the editor could decide if the change should be diplayed in the Dynamic list.


I would also find this feature quite helpful, were it to be added. --Exor314 13:04, 28 April 2011 (UTC)Reply

MediaWiki 1.16

[edit]

Worked for me with MediaWiki 1.16.

I copied all 4 php files into $IP/extensions/DynamicArticleList

I added require_once( "$IP/extensions/DynamicArticleList/DynamicArticleList.php" ); to my LocalSettings.php

All worked as expected.

jcoreil 2010-08-03

Mediawiki 1.15

[edit]

It works for me, but if I turn on error display

- adding near top to LocalSettings.php error_reporting( E_ALL ); ini_set( 'display_errors', 1 );

I see the following error repeated 4 times.

Notice:  Undefined variable: r in C:\htdocs\wkbv_wiki_copy\extensions\DynamicArticleList\DynamicArticleList.php on line 266

--Mark 10:21, 15 September 2010 (UTC)Reply

How to change output of type=new

[edit]

The output shown for the DynamicArticleList when set to type=new includes the title, the author and the date/time it was created.

I would like only the title to be shown. Does anyone have the expertise to share how this might be done? What file do I need to adjust and what lines do I need to edit/delete? Thanks!!

Problem with output by using type=new

[edit]

I installed Dynamic Article List a long time ago. I'm running Mediawiki version 1.16. Suddenly, the list output counts only more 8 articles (type=new) despite the fact that count is still set to 10 articles. As compared to the list of the most favourite articles it works correctly. Any idea what could be causing this? --Safetyplan 06:54, 4 October 2011 (UTC)Reply

MediaWiki 1.18

[edit]

Does not appear to work. Error: Call to undefined method SkinVector::makeLink --66.227.253.139 20:28, 5 November 2011 (UTC)Reply

FIX: Remove this error by replacing line (100 in my editor):

$aEditors[] = ' ( ' . $sk->makeLink($wgContLang->getNsText(NS_USER) . ':' . $editor, htmlspecialchars($editor)) . ' )';

with

$aEditors[] = ' ( ' . $sk->userLink($wgContLang->getNsText(NS_USER) . ':' . $editor, htmlspecialchars($editor)) . ' )';

Many thanks to the various users who have posted on this issue. I have added the above fix into the text file for this extension. This fix has been tested and working in Mediawiki 1.18.5. I have not tested it in 1.19.x. Perhaps someone could comment here if this fix also work for 1.19.x.

MediaWiki 1.17

[edit]

Does not work off the bat. In DynamicArticleList I had to change the following on line 21:

from

require_once ('CategoryUtil.php');

to

require_once ('/path/to/my/wikiinstall/includes/CategoryUtil.php');

--RichyL 20:26, 24 November 2011 (UTC)Reply

MediaWiki 1.19.2

[edit]

In DynamicArticleList.php change the following:

Add path to line 23

require_once ('/var/www/html/mediawiki/includes/CategoryUtil.php');

comment line 89

//$aEditors[] = ' ( ' . $sk->makeLink($wgContLang->getNsText(NS_USER) . ':' . $editor, htmlspecialchars($editor)) . ' )';

Working great till for the last one hour will post any changes or updates.

--Dushyant Sharma (talk) 09:41, 29 November 2012 (UTC)Reply

MediaWiki 1.19.3

[edit]

The above hint works for version 1.19.3 as well :)

Karanosov (talk) 22:50, 17 December 2012 (UTC)Reply

MediaWiki 1.20 ?

[edit]

When will there be an update to 1.20? Is there anyone who is developing an update?

...just did the update for MW 1.20+ (fan update... ;) )

[edit]

I liked this extension very much since some years, so I just updated it with the help of your comments to work with MW 1.20 (see the main extension page for download and installation instructions, look at tab "Pending Changes" until the update gets verified). It works on my server fine with MW 1.20.5, hopefully it does the same on your installations. If not, please comment.

"New" page list subject to expiry

[edit]

The "New" setting lists new articles and keeps them listed for as limited time. We do not have a very active Knowledge Base (yet), so even if articles aren't "new" anymore, we'd like to keep them visible until they get replaced by new ones. Any fix (e.g. "forcing" a longer expiry count in the extension settings) or something to that regard?

Want to hide author or last editor at Update listings

[edit]

Does anyone can help me how to hide author or last editor in list

Samples how it currently works

[edit]

A sample snapshot of Dynamic Article List is shown below.

When "type" is set to new ,
The output record format would be Page Title (author) - [create time]
When "type" is set to update or discussion ,
The output record format would be Page Title (last editor) - [update time]

[edit]

If you wish to include internal wiki links in the title attributes, edit the following first few lines of the OutputList function as follows:

function OutputList ( $aArticles, $aEditors, $aDates, $aViews, $listTitle ) {
  if ($listTitle != false) {
    global $wgParser;
    $r .= " <h3>" . $wgParser->replaceInternalLinks($listTitle) . "</h3>\n";
    $r .= " <hr/>\n";
  }
  ...

Dynamic Article List in MW 1.26

[edit]

Getting these in MW 1.26: Strict Standards: Only variables should be assigned by reference in D:\QAWiki\mediawiki-1.26.2\extensions\DynamicArticleList\CategoryTravelerBase.php on line 19 Strict Standards: Only variables should be assigned by reference in D:\QAWiki\mediawiki-1.26.2\extensions\DynamicArticleList\DynamicArticleList.php on line 71 Strict Standards: Only variables should be assigned by reference in D:\QAWiki\mediawiki-1.26.2\extensions\DynamicArticleList\DynamicArticleList.php on line 28 Strict Standards: Only variables should be assigned by reference in D:\QAWiki\mediawiki-1.26.2\extensions\DynamicArticleList\DynamicArticleList.php on line 107 Strict Standards: Only variables should be assigned by reference in D:\QAWiki\mediawiki-1.26.2\extensions\DynamicArticleList\CategoryTravelerBase.php on line 19 Strict Standards: Only variables should be assigned by reference in D:\QAWiki\mediawiki-1.26.2\extensions\DynamicArticleList\DynamicArticleList.php on line 71

and most importantly, the page using the extension with the 'hot' option crashes - page counters no longer exist in MW core since 1.25: https://www.mediawiki.org/wiki/MediaWiki_1.25#Hit_counters_removed

DatabaseBase::query: Writes done: SELECT DISTINCT page_title as title, page_namespace AS namespace, page_counter as count FROM `qawiki_page` INNER JOIN `qawiki_categorylinks` ON page_id=cl_from WHERE page_namespace=N AND page_is_redirect=N AND page_id!=N AND cl_to IN ('X') ORDER by count DESC LIMIT N
SQL ERROR: Unknown column 'page_counter' in 'field list' (localhost)

Also it's not clear if the plugin (with 'hot') would be compatible with https://www.mediawiki.org/wiki/Extension:HitCounters.

Updates for MW 1.26.0+

[edit]

The following code provides updates following various changes in MW 1.26 and 1.27. Compared to version 2.0 (current latest as of 27 Jul 2016) the following changes have been made:

  • Code migrated into a class structure. Main file renamed to DynamicArticleList_body.php in line with current (2016) naming conventions.
  • Changed the extension loading method to use wfLoadExtension method (addition of extension.json file). Now call wfLoadExtension( 'DynamicArticleList' ); in LocalSettings.php instead of requireOnce(...);
  • Removed the Most Popular functionality, aka 'Hot'. Page counters have been removed from MW core and database schema since 1.26.0, so the feature is obsolete.
    • Could be re-implemented by either merging in another extension (eg HitCounters) or enabling the feature IF HitCounters is installed/enabled
  • Updated the link creation code to remove obsolete use of $wgUser->getSkin(). Now uses static call to Linker class. See Manual:RequestContext.php.
  • Addition of file DynamicArticleList.i18n.php.

Code

[edit]

extension.json

[edit]
{
	"name": "DynamicArticleList",
	"version": "3.0",
	"author": [
		"Manuel Schneider",
		"Ben Wetherill (mg169706)"
		],
	"license-name": "GPL-2.0+",
	"requires": {
		"MediaWiki": ">= 1.26.0"
		},
	"url": "http://www.mediawiki.org/wiki/Extension:Dynamic_Article_List",
	"descriptionmsg": "dynamicarticlelist-desc",
	"type": "parserhook",
	"ExtensionMessagesFiles": {
		"DynamicArticleList": "DynamicArticleList.i18n.php"
	},
	"ResourceFileModulePaths": {
		"localBasePath": "",
		"remoteExtPath": "DynamicArticleList"
	},
	"AutoloadClasses": {
		"DynamicArticleList": "DynamicArticleList_body.php"
	},
	"Hooks": {
        	"ParserFirstCallInit" : [
		"DynamicArticleList::onParserSetup"
        	]
    	},
	"manifest_version": 1
}

DynamicArticleList.i18n.php

[edit]
<?php
// Internationalization file for BreadCrumbs extension

$messages = array();
$messages['en'] = array(
	'dynamicarticlelist-desc' => 'Displays dynamic article lists to show new and recently updated articles.',
);
?>

DynamicArticleList_body.php

[edit]
<?php
/*
* Dynamic Article List v3.0
*
* Original author: Zeng Ji (zengji@gmail.com) (designed for Mediawiki 1.5)
*
* Modified und updated to work with Mediawiki 1.20: May 2013 by Onestone
*
* Modified und updated to work with Mediawiki 1.27: July 2016 by mg169706
*
* Purpose: Dynamic Output of Article List (Main Page always not in list)
* Note: Currently support three types (new, update, discussion).
* new => Newly Posted Articles
* update => Recently Updated Articles
* discussion => Recently Updated Discussion
*
* To install, add the following to LocalSettings.php
* require_once ("$IP/extensions/DynamicArticleList/DynamicArticleList.php");
*/
//$wgHooks['ParserFirstCallInit'][] = 'DynamicArticleList::onParserSetup';

class DynamicArticleList {
	public static function onParserSetup( &$parser ) {
		$parser->setHook( 'DynamicArticleList', 'DynamicArticleList::renderTag' );
		return true;
	}

	// The callback function for converting the input text to HTML output
	public static function renderTag( $input, $args, $parser ) {
		require_once ('CategoryUtil.php');
		$dbr = wfGetDB( DB_SLAVE );

		// INVALIDATE CACHE
		global $wgTitle, $wgDAPMaxCacheTime;
		if ( $wgDAPMaxCacheTime !== false ) {
		     $parser->getOutput()->updateCacheExpiry( $wgDAPMaxCacheTime );
		}

		// Default Values
		$listTitle = false;
		$listType = 'new';
		$listCount = 5;
		$categoryRoot = false;

		// ###### PARSE PARAMETERS ######
		$aParams = explode("\n", $input);

		foreach($aParams as $sParam) {
			$aParam = explode("=", $sParam);
			if( count( $aParam ) < 2 )
				continue;

			$sType = trim($aParam[0]);
			$sArg = trim($aParam[1]);

			switch ($sType) {
				case 'title':
					$listTitle = $sArg;
					break;
				case 'type':
					if ( in_array($sArg, array('new','update', 'discussion')) )
						$listType = $sArg;
					break;
				case 'count':
					$listCount = IntVal( $sArg );
					break;
				case 'categoryRoot':
					$categoryRoot = $sArg;
					break;
			}
		}

		// ###### CHECKS ON PARAMETERS ######
		if ($listTitle!=false && strlen($listTitle)==0)
			$listTitle=false;

		// ###### BUILD SQL QUERY ######
		$sql = DynamicArticleList::genSQL($listType, $listCount, $categoryRoot);

		// ###### PROCESS SQL QUERY ######
		global $wgLang;
		global $wgContLang;

		$res = $dbr->query($sql);

		if ($dbr->numRows( $res ) != 0) {
			while( $row = $dbr->fetchObject ( $res ) ) {
				$title = Title::makeTitle( $row->namespace, $row->title);
				$sLink = Linker::linkKnown($title, $title, [], []);

				// Generate 'Time' String (for 'new', 'update', 'discussion')
				$aDates[] = ' - [ ' . $wgLang->timeanddate($row->timestamp, true) . ' ] ';
				$editorID = $row->user;

				if ($editorID == 0) {
					$editor = wfMessage('anonymous')->text();
					$aEditors[] = ' (' . $editor . ')';
				} else {
					$editor = User::whoIs($editorID);
					$aEditors[] = ' ( ' . Linker::userLink($wgContLang->getNsText(NS_USER) . ':' . $editor, htmlspecialchars($editor)) . ' )';
				}

				$aArticles[] = $sLink;
			}
		}

		$dbr->freeResult( $res );

		// ###### GENERATE OUTPUT ######
		return DynamicArticleList::OutputList($aArticles, $aEditors, $aDates, $listTitle);
	}

	public static function genSQL( $type, $count, $categoryRoot=false ) {
		$dbr = wfGetDB( DB_SLAVE );
		$sPageTable = $dbr->tableName( 'page' );
		$sRevisionTable = $dbr->tableName( 'revision' );
		$sRecentChangesTable = $dbr->tableName( 'recentchanges' );
		$sCategoryLinksTable = $dbr->tableName( 'categorylinks' );
		$categoryUtil = new CategoryUtil();
		$sql = '';

		// Step 1: Get revision list order by rev_id
		if($type == 'update') {
			if ($categoryRoot != false) {
				$cNameList = $categoryUtil->getCNameList($categoryRoot);
				$sql = "
				SELECT
					page_id,
				MAX(rev_id) AS max_rev_id
				FROM $sPageTable
				INNER JOIN $sRevisionTable ON page_id=rev_page
				INNER JOIN $sCategoryLinksTable ON page_id=cl_from
				WHERE page_is_new!=1 AND page_namespace=0 AND page_is_redirect=0 AND page_id!=1 AND cl_to IN ".$cNameList."
				GROUP BY page_id
				ORDER by max_rev_id DESC
				LIMIT $count
				";
			} else {
				$sql = "
				SELECT
					page_id,
				MAX(rev_id) AS max_rev_id
				FROM $sPageTable
				INNER JOIN $sRevisionTable ON page_id=rev_page
				WHERE page_is_new!=1 AND page_namespace=0 AND page_is_redirect=0 AND page_id!=1
				GROUP BY page_id
				ORDER by max_rev_id DESC
				LIMIT $count
				";
			}

			// Step 2: According to revision list, generate SQL to retrieve article page information.
			$res = $dbr->query($sql);
			$inClause = '';

			if ($dbr->numRows( $res ) == 0) {
				$inClause = "-1";
			} else {
				while( $obj = $dbr->fetchObject( $res ) ) {
					if( isset( $obj->max_rev_id ) ) {
						$inClause .= $obj->max_rev_id . ',';
					}
				}
				$inClause = substr($inClause, 0, strlen($inClause)-1); //delete tailing ','
			}

			$dbr->freeResult( $res );
			$sql = "
			SELECT
				page_title AS title,
				page_namespace AS namespace,
				rev_user AS user,
				rev_timestamp AS timestamp
			FROM $sRevisionTable, $sPageTable
			WHERE rev_page=page_id AND rev_id IN (". $inClause . ")
			ORDER BY rev_id DESC";
		} elseif ($type == 'discussion') {
			// Step 1: Get revision list order by rev_id.
			if ($categoryRoot != false) {
				$cNameList = $categoryUtil->getCNameList($categoryRoot);
				$sql = "
				SELECT
					p1.page_id,
				MAX(rev_id) AS max_rev_id
				FROM $sPageTable AS p1
				INNER JOIN $sPageTable AS p2 ON p1.page_title=p2.page_title
				INNER JOIN $sRevisionTable ON p1.page_id=rev_page
				INNER JOIN $sCategoryLinksTable ON p2.page_id=cl_from
				WHERE p1.page_is_redirect=0 AND p1.page_namespace=1 AND p2.page_namespace=0 AND cl_to IN ".$cNameList."
				GROUP BY rev_page
				ORDER by max_rev_id DESC
				LIMIT $count
				";
			} else {
				$sql = "
				SELECT
					p1.page_id,
				MAX(rev_id) AS max_rev_id
				FROM $sPageTable AS p1
				INNER JOIN $sRevisionTable ON p1.page_id=rev_page
				WHERE p1.page_is_redirect=0 AND p1.page_namespace=1
				GROUP BY rev_page
				ORDER by max_rev_id DESC
				LIMIT $count
				";
			}

			// Step 2: According to revision list, generate SQL to retrieve discussion page information.
			$res = $dbr->query($sql);
			$inClause = '';
			if ($dbr->numRows( $res ) == 0) {
				$inClause = "-1";
			} else {
				while( $obj = $dbr->fetchObject( $res ) ) {
					if( isset( $obj->max_rev_id ) ) {
						$inClause .= $obj->max_rev_id . ',';
					}
				}
				$inClause = substr($inClause, 0, strlen($inClause)-1); //delete tailing ','
			}
			$dbr->freeResult( $res );
			$sql = "
			SELECT
				page_title AS title,
				page_namespace AS namespace,
				rev_user AS user,
				rev_timestamp AS timestamp
			FROM $sRevisionTable, $sPageTable
			WHERE rev_page=page_id AND rev_id IN (". $inClause . ")
			ORDER BY rev_id DESC";
		} else { // default type is 'new'
			if ($categoryRoot != false) {
				$cNameList = $categoryUtil->getCNameList($categoryRoot);
				$sql = "
				SELECT DISTINCT
					page_title AS title,
					page_namespace AS namespace,
					rc_user AS user,
					rc_timestamp AS timestamp
				FROM $sPageTable
				INNER JOIN $sRecentChangesTable ON page_id=rc_cur_id
				INNER JOIN $sCategoryLinksTable ON page_id=cl_from
				WHERE rc_new=1 AND rc_namespace=0 AND page_is_redirect=0 AND page_id!=1 AND cl_to IN ".$cNameList."
				ORDER by rc_id DESC
				LIMIT $count
				";
			} else {
				$sql = "
				SELECT DISTINCT
					page_title AS title,
					page_namespace AS namespace,
					rc_user AS user,
					rc_timestamp AS timestamp
				FROM $sPageTable
				INNER JOIN $sRecentChangesTable ON page_id=rc_cur_id
				WHERE rc_new=1 AND rc_namespace=0 AND page_is_redirect=0 AND page_id!=1
				ORDER by rc_id DESC
				LIMIT $count
				";
			}
		}

		return $sql;
	}

	public static function OutputList ( $aArticles, $aEditors, $aDates, $listTitle ) {
		$r = "";
		if ($listTitle != false) {
			$r .= " <h3>" . $listTitle . "</h3>\n";
			$r .= " <hr/>\n";
		}

		$sStartList = '<ul>';
		$sEndList = '</ul>';
		$sStartItem = '<li>';
		$sEndItem = '</li>';
		$r .= $sStartList . "\n";

		for ($i=0; $i<count($aArticles); $i++) {
			$editorString = "";
			$dateString = "";
			$viewString = "";

			if ($aEditors != false)
				$editorString = "<font size=-2>" . $aEditors[$i] . "</font>";

			if ($aDates != false)
				$dateString = "<font size=-2>" . $aDates[$i] . "</font>";

			$r .= $sStartItem . $aArticles[$i] . $editorString . $dateString . $viewString . $sEndItem . "\n";
		}

		$r .= $sEndList . "\n";
		return $r;
	}
}
?>

MW 1.27 drops support for global wgUser getSkin

[edit]

This patch removed the use of getSkin and uses the Linker methods to make links. NB: This patch is included in the code from the previous post.

67a68
>     global $wgUser;
68a70
>     global $wgContLang;
69a72
>     $sk = $wgUser->getSkin();
78c81
<                 $sLink = Linker::linkKnown( "Talk:" . $title );
---
>                 $sLink = $sk->makeKnownLinkObj($title, $wgContLang->convertHtml($title->getText()), '', '', 'Discussion: ');
80c83
<                 $sLink = Linker::linkKnown( $title );
---
>                 $sLink = $sk->makeKnownLinkObj($title, $wgContLang->convertHtml($title->getText()));
95c98
<                     $aEditors[] = ' ( ' . Linker::userLink( $editorID, $editor ) . ' )';
---
>                     $aEditors[] = ' ( ' . $sk->userLink($wgContLang->getNsText(NS_USER) . ':' . $editor, htmlspecialchars($editor)) . ' )';

Note: I don't know how to code mediawiki extensions, so this may not be the correct way to do it, but it gets the extension working under 1.27.1

Decrepitation of wgTitle

[edit]

DynamicArticleList_body.php

[edit]

Old Code:

global $wgTitle, 
$wgTitle->invalidateCache();

New code:

global $wgTitle, $wgDAPMaxCacheTime;
if ( $wgDAPMaxCacheTime !== false ) {
     $parser->getOutput()->updateCacheExpiry( $wgDAPMaxCacheTime );
}

LocalSettings.php

[edit]
     $wgDAPMaxCacheTime = 60*15;          // How long to cache pages in seconds

PHP Notice in Mediawiki 1.31

[edit]

After downloaded the archive , extracted it to $IP/extensions/DynamicArticleList, created the files extension.json, DynamicArticleList.i18n.php and DynamicArticleList_body.php (as above) and configured it in LocalSettings.php like:

wfLoadExtension( 'DynamicArticleList' );

the extension works, but the following warning occurs:

PHP Notice: Only variables should be assigned by reference in [...]/extensions/DynamicArticleList/CategoryTravelerBase.php on line 19

It seems the solution is to remove the ampersand.

Before:

$this->dbr =& wfGetDB( DB_SLAVE );

After

$this->dbr = wfGetDB( DB_SLAVE );