Extension talk:TopTenPages/Archive

Restrict to namespaces
Is there any way to restrict the output to certain namespaces? --Flominator 13:07, 15 August 2007 (UTC)


 * As a first workaround, you could edit this line (42) in your TopTenPages.php


 * Replace NS_MAIN by the namespace of your choice, e.g. NS_USER, NS_IMAGE, See Manual:$wgNamespacesToBeSearchedDefault for a completet list of Namspaces. Please leave the dots before and after the namespace, because they are tell the parser to connect the text-strings. If you'd like to see the most frequented discussions, you could write:


 * Of course, this would affect all Occurrences.
 * An existing page may show the pages of the old namespace until all (Browser and Server) caches are cleared. Testing by editing a new page and looking at preview showed changes immediately.


 * I just made available via variable. I'll publish it tomorrow or so.
 * New Version available. Includes Namespace-Selection. For Details, see Extension-Page. --Sascha 12:52, 4 September 2007 (UTC)

User-Namespaces
Hi there, thanks for the modification above. Meanwhile I faced a new problem. I want to list pages in custom made namespaces, like the ones I definied in localSettings.php: Unfortunately TopTenPages didn't support it, so I had to write a quick workaround and added the following lines:

Maybe you want to include a way to specify the namespace per number or something around those lines. Thanks, --Flominator 11:28, 10 October 2007 (UTC)


 * We also needed this. Maybe you could iterate through the $wgExtraNamespaces array? --Samdutton 12:43, 25 January 2008 (UTC)

I tried to use it but I am getting error as function "wfMsgExt" not defined. Any help? this look like a good extension that I would like to use on ny WIKI but I couldnt make it to work due to that error. I have version 1.6 Any help will be highly appreciated. Thanks!!

Some cleanup? Namespaces, user and built in.
I rewrote the code to handle user namespaces and built in namespaces. Using MediaWiki 1.11.1, all the code is already there in the built-in Namespace code. I don't know about older versions. There is no longer any dependency on specific namespace strings. Replace getSQL with the following functions:

PS: Thanks for writing this extension - saved me a lot of time!

Dangers?

 * "For use in Low-Risk-Environment"

Does the above quote from disclaimer mean that there are some dangers or vulnerabilities in the extension? Or just that the author doesn't know enough to know if there are? If it is the latter, case, can anyone else weigh in? This seems like a good extension, but the disclaimer makes me wary. Smaug  15:41, 12 April 2008 (UTC)
 * I'm not an expert, but I think the user just wanted to make sure he did nothing wrong. Maybe we should ask some of our experts about it. --Flominator 17:36, 14 April 2008 (UTC)

within an article?

 * "Shows the most popular Pages within an article."

Should be "within a wiki" I assume? --Chriswaterguy 13:46, 21 October 2008 (UTC)

I just came here to ask the same thing??? 74.45.250.155 03:29, 13 February 2009 (UTC)

Does it not self-update?
I have this working on the main page to my Wiki, and while it counts up okay, it will only refresh the counts when I update the page.

Does anybody else have this issue (if it is an issue)? Or, does anybody have a fix?

Cheers!

It happens exacly the same ting to me... some pages update fine but not on the Main page [mailto:mgalego@gmail.com Miguel Galego] --195.245.189.166 15:42, 7 April 2010 (UTC)

Try changing this: To this:

How to list only new article?
Hi this extension is very useful, but is it possible to load only new articles created less than 7 days? Keep showing the most popular articles of all time may mean that the list will rarely change, and users will not know any new popular articles. --Dullmau 13:45, 10 June 2010 (UTC)

Warning: Conflicts with Extension:CurrentUsers
I'm unsure of the conflict, though I do know that using Extension:CurrentUsers on the same page as the TopTenPages code causes the latter to fail. This is easily resolved by not having Template:CurrentUsers on the same page. ^^ -- JoJo 14:28, 3 August 2010 (UTC)

Main Page
How do I remove the main page of the top ten list? Thanks! --177.19.24.22 17:41, 30 November 2011 (UTC)

Problem solved. line 104: WHERE page_namespace=".$namespace_constant_no." AND page_is_redirect=0 AND page_id <> 1";

It appears the code has changed since this problem was resolved. There isn't a line 104. Can someone provide another solution? Thanks. -update 06/20/2014. The solution provided below works. Thank you so much!

To exclude home page, add this code inside the class:

SpecialTopTenPages.php function getQueryInfo { return array(		'tables' => array( 'page' ),		'fields' => array( 'namespace' => 'page_namespace', 'title' => 'page_title', 'value' => 'page_counter' ),		'conds' => "page_is_redirect = 0 AND page_id != 1 AND page_namespace = '".MWNamespace::getContentNamespaces."'"	); }

The above solution did not work for me. I had to use the following getQueryInfo changes to override HitCounters\SpecialPopularPages:

MediaWiki 1.26alpha (afdbf42) 10:50, 2 September 2015

function getQueryInfo { global $wgDBprefix;

return array(			'tables' => array( 'page', 'hit_counter' ),			'fields' => array( 'namespace' => 'page_namespace', 'title' => 'page_title', 'value' => 'page_counter' ),			'conds' => array( 'page_is_redirect' => 0, 'page_namespace' => MWNamespace::getContentNamespaces, $wgDBprefix. 'page.page_id != 1' ),			'join_conds' => array( 'page' => array( 'INNER JOIN', $wgDBprefix . 'page.page_id = ' . $wgDBprefix .					'hit_counter.page_id' ) )		);	}
 * Note that for most people, these modifications are not necessary, since the Main Page is almost always the most popular. You can just use:
 *  --Ike @ WikiWorks 21:00, 8 September 2015 (UTC)


 * Using offset=1 displays a numbered list that starts with a #2. If you want your top ten list to start with a #1, use the above method.

mediawiki 1.19

None of the above worked for me, perhaps due to a different version of the extension or mediawiki itself. I used the following getQueryInfo implementation:

SpecialTopTenPages.php function getQueryInfo { return array (       'tables' => array( 'page' ),        'fields' => array( 'page_namespace AS namespace', 'page_title AS title', 'page_counter AS value'),       'conds' => "page_is_redirect = 0 AND page_id != 1 AND page_namespace = '".MWNamespace::getContentNamespaces."'"    ); }

Strict Standards error
If you are getting a Strict Standards error, modify line 258:

function getSQL { change to: function getSQL($select_namespace) {

--Tosfos (talk) 19:23, 9 May 2012 (UTC)

White screen of death
I get the white screen of death with I try to use this extension.

I am using MW 1.21.1

Thanks,

Wade

Will not work with MW>=1.25 (FIXED)
Note that Hit Counters are disabled in future MediaWiki releases, beginning with version 1.25. So this extension (and anything similar) will not work. --Ike @ WikiWorks 22:14, 15 December 2014 (UTC)
 * Link to https://gerrit.wikimedia.org/r/#/c/150699/ . I updated the page to reflect this. User:Sascha / User:Krinkle, just a ping so you know about this. Multichill (talk) 11:50, 25 February 2015 (UTC)
 * This now works, in conjunction with Extension:HitCounters. --Ike @ WikiWorks 18:17, 28 June 2015 (UTC)

Top 10 in a Category
Is there a way to display the top ten for a certain category?

Keep getting "Data is cached" message
Installed extension with hitcounters extension and tested with. I keep getting the following message "The following data is cached and may not be up to date. A maximum of 1,000 results are available in the cache.". What can I do to make the extension work properly?

Wikimanz (talk) 22:16, 16 November 2015 (UTC)