Jump to content

User talk:Subfader/Archive 1

Add topic
From mediawiki.org
Latest comment: 12 years ago by Subfader in topic Extension:ExternalLinks patch

Default User Page header

[edit]

Have you considered Extension:HeaderFooter ? Jean-Lou Dupont 13:55, 14 May 2008 (UTC)Reply

Hi, thanks. Will check, if not I think I found another way: Hack monobook, include MW message, problem: get DB data.--Subfader 15:21, 14 May 2008 (UTC)Reply

Category Sorting Rules

[edit]

Here's a first draft for your 'Category Sorting Rules' extension. There's a mechanism already built in for this, but after having a quick play with it, it has a few little bugs, which I tried to fix (hence the edits to core Mediawiki files).

languages/Language.php (or in the language plugin for the language you are using): Change (lines 1383-1385):

        function convertCategoryKey( $key ) {
                return $this->mConverter->convertCategoryKey( $key );
        }

To:

        function convertCategoryKey( $key ) {
                global $wgSortkeyRegexes;
                # Do the standard conversion
                $key = $this->mConverter->convertCategoryKey( $key );
                # Convert to lowercase
                $key = mb_strtolower( $key );
                # Apply any other transformations (such as accents)
                $key = preg_replace( array_keys( $wgSortkeyRegexes ), array_values( $wgSortkeyRegexes ), $key );
                return $key;
        }

includes/Title.php: After (line 1910):

        function moveTo( &$nt, $auth = true, $reason = '' ) {

Add:

        global $wgContLang;

Change (lines 1929-1932):

        $sql = "UPDATE $categorylinks SET cl_sortkey=" . $dbw->addQuotes( $nt->getPrefixedText() ) .
                " WHERE cl_from=" . $dbw->addQuotes( $pageid ) .
                " AND cl_sortkey=" . $dbw->addQuotes( $this->getPrefixedText() );
        $dbw->query( $sql, 'SpecialMovepage::doSubmit' );

To:

        $sql = "UPDATE $categorylinks SET cl_sortkey=" . $dbw->addQuotes( $wgContLang->convertCategoryKey( $nt->getPrefixedText() ) ) .
                " WHERE cl_from=" . $dbw->addQuotes( $pageid ) .
                " AND cl_sortkey=" . $dbw->addQuotes( $wgContLang->convertCategoryKey( $this->getPrefixedText() ) );
        $dbw->query( $sql, 'SpecialMovepage::doSubmit' );

In LocalSettings.php (or wherever seems appropriate), include a set of sort rules (as regular expressions). For example:

        $wgSortkeyRegexes = array(
                '/[aàáâãäå]/'  => 'a',
                '/[èéêë]/'     => 'e',
                '/[$¢£¥]/'     => '¤',
                '/^the +/'     => '',
                '/^le +/'      => ''
        );

Hope this is of some use to you. I can always work on a more user-friendly extension if you prefer. --MrAngel 12:22, 2 June 2008 (UTC)Reply

[edit]

I've got an extension on a couple of my sites that does something similar, although it's not implemented as a gadget. Is this of any interest to you?

Staying with my parents for a while now, and forgot to bring the extension code with me. I'll continue that when I get back. While I'm here, I'm having a look at your other requests instead - something like this suit your needs? Just need to add the show/hide links now (with 'hide' by default, because generating this list is quite intensive on the database). --MrAngel 14:33, 15 June 2008 (UTC)Reply
Yeah, absolutely as I described! Looks like we have much in common wiki-wise :D --Subfader 14:40, 15 June 2008 (UTC)Reply
OK ... not sure how to paste a PHP file on here without it trying to parse bits as wikitext, so I emailed it to you. (Somehow I've ended up with more experience in writing extensions than actually using the thing). The show/hide link reloads the page at present ... I tried putting it in javascript, but generating the lists of links puts such a big load on the database that I figured we should only do it when the user actually wants it. --MrAngel 04:36, 16 June 2008 (UTC)Reply

Unsigned user request

[edit]

Hi if you have interesting to add replace per-word will be great. I described the problem here http://www.mediawiki.org/wiki/Extension_talk:Replace_Text#Problems Yaron doesn't want to implement it. Any chance? --Unsigned User

I dunno how check boxes for every match per page should work for Extension:Replace Text, but this is not the place to request it. --Subfader 10:45, 2 July 2008 (UTC)Reply
Hi Subfader, I just requested this here because i saw MrAngel user is implementing some functions to ReplaceText extension so as Yaron doesn't want to implement it, i thought MrAngel could. But thanks for listening me.

Search-Replace-Move extension

[edit]

I've just started working on an extension for this one, but am stopping work for today because my neighbour's music is making working here unbearable. I'll hopefully have a result for you in a couple of days. --MrAngel 18:04, 30 June 2008 (UTC)Reply

Awesome :) Def check Extension:Replace Text to see how they do it; although I don't like that you#re not able to restrict it to "only pages in category X". --Subfader 19:08, 30 June 2008 (UTC)Reply
So far, I've got the code to find and change the titles done, so I just need to do the forms. I'm looking at integrating it with the existing Replace Text extension, so you have a dropdown list option for "Change [page text/titles/both]". I think that putting the two functions together makes a lot of sense - if your search/replace is moving a page, you might also want it to change links on other pages; and if you're doing a search/replace on page texts, you might want it to avoid breaking links.
I'll have a look at being able to limit to certain categories - might be a bit challenging to make the extension work with all the databases (I use PostgreSQL, most people use MySQL, so I always prefer to write portable code even if it takes a bit longer). --MrAngel 22:42, 30 June 2008 (UTC)Reply
Whoa straight forward eh? :) The integration on Special:Replace Text would be ace as I indeed requested it for the extension. The only thing bad about Extenions:Replace Text is the user problem while the job queue is running.
Changing [[Article Links]]? in page content is great, didn't think of the fact that you wouldn't look at Whatlinkshere in such a batch list of course. Looking forward to it. --Subfader 07:01, 1 July 2008 (UTC)Reply
I just posted on the extension's talk page with a fix for the user problem. Was just testing and I noticed that it also confused my Per-User Sidebar extension, so figured fixing that would be a higher priority.
At first, I expected changing the links to be a big job, but it seems it'll be relatively simple to pull out the contents of the linkcache. --MrAngel 17:08, 1 July 2008 (UTC)Reply
OK, got a first prototype ready. Not tested yet, though, and still needs some work on the link-finding thing. Actually, I'm tempted to add a TitleMoveComplete hook, so that when you move/rename a page manually it presents a button to automatically search/replace [[oldtitle]] with [[newtitle]]. --MrAngel 16:10, 5 July 2008 (UTC)Reply
Oh yes that would be awesome as it's missing completely in MW and now that you brought up the idea I wonder why it wasn't implented before. --Subfader 19:20, 5 July 2008 (UTC)Reply
Actually, it makes sense not to include that feature on a big site like wikipedia. Its slower, and a lot more memory intensive, than simply turning the old name into a redirect. However, I think it could be a worthwhile addition now, especially on smaller sites, as servers have become a lot faster in the last few years. Should have a working demo for you in a couple of days (neighbours and their loud music permitting) --MrAngel 22:28, 5 July 2008 (UTC)Reply
Hehe. Turn yours louder!
1) So that checkbox will appear when you move a page the normal way and when you use the Move function integrated in Extension:Replace Text?
2) About the server load: In the case of the Extension it searches the pages anyway, so no extra load caused by it.? On single moves the search could be done slowly in a job queue after the move action itself.
3) Those link replaces should be done as minor edits for not annoying people having the affected articles in their watchlists ;)
4) Maybe those link edits could even be done by a different user you are able to define in the extension (as I use a dummy user for the Replace Text actions since it's not really me doing all the work). --Subfader 22:49, 5 July 2008 (UTC)Reply

ArticleComments extension: Return to article page after submitting a comment

[edit]

If you are still interested I have posted a solution which works for me (MW 1.10) on the extensions discussion page! Optimale 11:09, 10 July 2008 (UTC)Reply

Proper Ajax Rating

[edit]

Hi. I just wanted to ask you whether you know if someone is already woking on the Proper Ajax Rating extension. Because I already started with it and have done some good pieces so it wouldn't be the nicest thing to find out that someone else is already doing the same. Thanks in advance. PS. Sorry for my bad english.

Nope, nobody doing anything from my requests atm. You work on it? Coolio! With proper mediawiki integration? I'm in love with IMDB's voting system :) --Subfader 16:48, 10 March 2009 (UTC)Reply
Yep, I have my own provisory Ajax hadling but I'll port it to the MediaWiki handler.  mgrabovský | talk  (DJ Jeri)  MW Support Team 17:10, 10 March 2009 (UTC)Reply
By the way do you have any IM, like MSN, ICQ, Steam or similar?  mgrabovský | talk  (DJ Jeri)  MW Support Team 17:04, 15 March 2009 (UTC)Reply
eiceekuh: [removed]--Subfader 18:34, 15 March 2009 (UTC)Reply
Try out the newest version of Ratingbar Extension:Rating_Bar that now supports stars... the only thing still missing is that it doesn't display on every site like AjaxStarRating AndiRay 11:45, 27 May 2009 (UTC)Reply
Thanks, will install & play around when I have more time in summer. --Subfader 19:17, 27 May 2009 (UTC)Reply

Hide Category

[edit]

Hi, have you found a way to hide the ugly categories (on the category special page) that are needed for the Calendar extension? AndiRay 08:06, 30 April 2009 (UTC)Reply

Nope, we live with them :) --Subfader 13:28, 30 April 2009 (UTC)Reply

ConfirmEdit

[edit]

Can you add ConfirmEdit to ArticleComments. This is an example of Captcha but I don't know how to add it on to my wiki. Can you help? I seen your User:Subfader/Article Comments and thought you might know something. Sachein 16:06, 13 May 2009 (UTC)Reply

I use ConfirmEdit only for account registration. No time to test how to implent it to ArtcileComments though. You got problems with Spam or massive crap comments? Cpatchas for comments are the worst solution to stop spam imo cos it is simply uncomfortable for all the users. --Subfader 00:52, 14 May 2009 (UTC)Reply
Thanks for the reply. :) Is it possible to hide tabs such as 'history' 'discussion' for logged in users. Basically only sysop can see it. Sachein 13:30, 14 May 2009 (UTC)Reply
Sorry, no time to answer. You'll get better helped at http://www.mwusers.com/forums/ --Subfader 18:37, 14 May 2009 (UTC)Reply


JSKitComments

[edit]

Hi, Not sure if you seen this extension: JSKitComments, but it is like ArticleComments but more cooler and more complex. The comments go for moderation and you just approve it. Sachein 13:09, 8 June 2009 (UTC)Reply

Thanks for the head-up. I'm happy with ArticleComments and don't want to aprove them first. --Subfader 17:44, 8 June 2009 (UTC)Reply

Ummm....

[edit]

Is this image being used for something useful? I was about to delete it as out of scope (which it seems to be), but I figured I'd ask first since you're an active community member (and not just a drive-by spammer :p). Thanks, ^demon 18:47, 6 August 2009 (UTC)Reply

Please delete it. I needed some colorful example image to test imagemagick. Thanks for asking. --Subfader 23:22, 6 August 2009 (UTC)Reply

Manual:Article count

[edit]

Hello. Can you provide evidence of [1]?

Specifically, I don't think that the points "are no stubs containing a link," and "are not disambiguation pages." to be correct, as I don't find anything in the code that does so.

The "containing one wiki link or categorized on at least one category" is not the most correct one (it looks for the substring [[ in the page) but good enough. However, I don't see where do the stubs and disambiguation information come from.

Platonides 22:13, 7 August 2009 (UTC)Reply

I didn't add the stubs and disambiguation info. I only added the "or is categorized to at least one category." part. If a category tag counts as link (not the same) it's ok but imo my addition makes it more clear. --Subfader 01:09, 8 August 2009 (UTC)Reply

Hidden tabs

[edit]

Hi, I found out how to hide tabs: DynamicTabs. Thanks for asking. Sachein 11:30, 11 August 2009 (UTC)Reply

Sifting through categories

[edit]

Hi Subfader, I noticed that in 2008 you've inquired about ways to limit / filter article searches by category (for instance, on Extension talk:InputBox and Extension talk:Multi-Category Search). Did you, in the meantime, discover a way to do it? It looks like a more memory intensive search engine like Lucene or Sphinx cannot handle it either (as reported here and here). Regards, Cavila 10:04, 7 February 2011 (UTC)Reply

Yep, I paid a dev to write me an extension for exactly that, but users don't use it much. I don't use Lucene, just the simple MySQL based search. It works fine, just not sure if this would be applicable to big scale wikis like WP. --Subfader 12:33, 7 February 2011 (UTC)Reply
Ok thanks for replying so quickly. It would have been a useful for finetuning search queries, but unless perhaps you're using a wiki for a number of unrelated projects (and need to get rid of the 'noise' in your search results), it's not an absolute must. Cavila 15:16, 7 February 2011 (UTC)Reply
I needed it because cats play a major role on my wiki (while on WP it's def not). The cat search is another special page "Advanced Search". I'd liek to have it integrated on the normal Special:Search tho. --Sub
Well, there's at least one category where I would like both readers and users to be able to search only the pages that have been assigned to it. If you're using Semantic MediaWiki, the Enhanced Retrieval extension (related to Halo) might provide such a search facility. I've yet to install it, but the description sounds promising. Cavila 13:32, 9 February 2011 (UTC)Reply

Extension request

[edit]

I've requested an extension creation here:

http://www.mediawiki.org/wiki/Extension_requests#Private_message_extension

Imperator Sascha 21:02, 8 February 2012 (UTC)Reply

[edit]
Thank you for your help with that. Works perfectly, and with your help I now have this.
Yummy! --Subfader (talk) 15:05, 2 April 2012 (UTC)Reply

Sie erhalten einen Orden!

[edit]
Der Wikiorden
Thanks for your great "hide page tabs" manual! SBachenberg (talk) 12:56, 14 May 2012 (UTC)Reply

Moving sandbox

[edit]

Hello, I've just moved your test edit on this (wrong) page, here. Regards, --Frigotoni ...i'm here; 12:34, 11 June 2012 (UTC)Reply

Extension:MultiUpload

[edit]

You have added a warning to the Extension:MultiUpload that says: "please reset the pledge".

What does that mean? do you mean that I should rollback the pledge and no longer use that extension, or that it's OK to continue using it?

Generally, can I use that extension now or not? I'm using MediaWiki 1.19.2

Mr.TAMER.Shlash (talk) 09:43, 3 October 2012 (UTC)Reply

I did nothing. The "Incompatible" template just reads the date and user of the last page edit which ahppens to be an unreleated edit by me. --Subfader (talk) 21:54, 3 October 2012 (UTC)Reply
[edit]

Some ideas to improve Extension:ExternalLinks

  1. Add per-page check: add it to the top level menu (tab).
    • This has the advantage that it can also be made available for users without edit rights, because they get a subset of the data they are already allowed to see. (all links from the page they are viewing)
  2. background checking of links
    • Not sure how to do this in PHP as it does not seem to support proper threading. In Java I can easily make an application that simultaneously checks 30 (or more) urls and stores results in a table linked to the externallinks table.
  3. more information about each link (using data provided by background process)
    • Provide latest date of link working properly
    • Statistiscs (say 75% OK)
    • Response time

--Hbswn

Thanks for the ideas.
  • "Add per-page check": Yep, sounds good.
  • "background checking of links": Like a non-stop running script? I guess that would produce too much CPU load. You need time to fix the broken links anyway, that is when I use the extension.
  • "Provide latest date of link working properly": Sounds reasonable. Could only be the date when it was last checked and working. But would it help much if the URL doesn't work right now?
  • "Statistiscs (say 75% OK)": Only possible per page = no use.
  • "Response time": What's the use of this? I only want to check if an URL works or not. Bad URLs will return a timeout anyway.
--Subfader (talk) 14:51, 14 October 2012 (UTC)Reply
  • "background checking of links": Like a once-a-day or even -week cronjob. But indeed, for large wiki's that could be a high load. An alternative could be to record broken links when they are used by wiki users. (But that can only be done by the core mediawiki, I guess.)

My link-validation took quite a while, because:

  • some sites were slow
  • the url order did not match my edit work flow
  • I never checked all before (I have about 400 links)

so I started thinking about what can be improved. First I did was: order by page id, so I could edit all urls on one page at once. And then: ExternalLinks check is only a snapshot. It will not tell much about user experience. If you take more samples over time and store them, you could get a different picture.

But even then: this check is a lot better than manually going through all links.

--Hbswn (Mon Oct 15 18:24:16 UTC 2012)

Yes, I'm aware that proper link checkers would check URLs several times before reporting them as dead. As you pointed out that would be complicated. I wrote this extension because previously I returned used URLs via Extension:DynamicPageList (third-party) and checking them with the Firefox addon Pinger which was extremely uncomfortable. I have 60k URLs and the extension can slow down the server. I currently add the per page check. --Subfader (talk) 20:54, 15 October 2012 (UTC)Reply
"Per-page check" added in version 1.1 now --Subfader (talk) 20:46, 16 October 2012 (UTC)Reply
[edit]

Nothing regarding the discussion in the previous section, but I've found some issues, while using ExternalLinks:

diff -bur ExternalLinks/ExternalLinks.i18n.php externallinks/ExternalLinks.i18n.php
--- ExternalLinks/ExternalLinks.i18n.php	2012-07-14 17:23:22.000000000 +0200
+++ externallinks/ExternalLinks.i18n.php	2012-10-15 21:08:10.000000000 +0200
@@ -5,7 +5,7 @@
 $messages['en'] = array(
 	'externallinks' => "External links", // title of the Special page
 	'el-desc' => "Provides a [[Special:ExternalLinks|special page]] for a list of all external links (URLs) on the wiki and the pages they're used on",
-	'el-intro' => 'You might want to use some link-checker to validate URLs, e.g. [https://addons.mozilla.org/en-US/firefox/addon/pinger/ Pinger] for Firefox.<p>When you remove boroken links, you will miss some entries when you click "Next ...". Better: Navigate to the last results page and navigate backwards.</p>',
+	'el-intro' => 'You might want to use some link-checker to validate URLs, e.g. [https://addons.mozilla.org/en-US/firefox/addon/pinger/ Pinger] for Firefox.<p>When you remove broken links, you will miss some entries when you click "Next ...". Better: Navigate to the last results page and navigate backwards.</p>',
 	'el-th-page' => "Used on",
 	'el-filterURL' => "URL includes:",
 	'el-filterURLnot' => "URL includes not:",
diff -bur ExternalLinks/SpecialExternalLinks.php externallinks/SpecialExternalLinks.php
--- ExternalLinks/SpecialExternalLinks.php	2012-07-19 09:25:40.000000000 +0200
+++ externallinks/SpecialExternalLinks.php	2012-10-15 21:08:16.000000000 +0200
@@ -280,19 +280,19 @@
 			return false;
 		}
 		
-		$query = "`el_to` LIKE '%".$filterURL."%'";
+		$cond_arr = array("el_to LIKE '%".$filterURL."%'");
 		
 		if( $filterURLnot != NULL ) {
-			$query .= " AND (`el_to` NOT LIKE '%".$filterURLnot."%')";
+			$cond_arr[] = "el_to NOT LIKE '%".$filterURLnot."%'";
 		}
 		
 		if( $showEmail == NULL ) {
-			$query .= " AND (`el_to` NOT LIKE 'mailto:%')";
+			$cond_arr[] = "el_to NOT LIKE 'mailto:%'";
 		}
 		
 		if( is_numeric($lastValidation) ) {
 			$lastValidationBefore = date("Y-m-d", strtotime("-".$lastValidation." days"));
-			$query .= " AND (`el_last_validated` < '".$lastValidationBefore."')";
+			$cond_arr[] = "el_last_validated < '".$lastValidationBefore."'";
 		}
 		
 		// dummy query for number of all results (needed for pagination)
@@ -303,9 +303,7 @@
 					'el_from',
 					'el_to',
 				),
-				array(
-					$query
-				),
+				$cond_arr,
 				__METHOD__
 		);
 		$numAll = $resAll->numRows();
@@ -317,9 +315,7 @@
 					'el_from',
 					'el_to',
 				),
-				array(
-					$query
-				),
+				$cond_arr,
 				__METHOD__,
 				array(
 					'ORDER BY' => 'el_to DESC, el_from DESC',
@@ -437,7 +433,7 @@
 									$respNum = "Domain Not Found?";
 								}
 								$respType = preg_replace(array('/; charset=.+/', '/\//'), array('', ' / '), curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
-								$header_size = $curl_info[header_size];
+								$header_size = $curl_info['header_size'];
 								$header = substr($buffer, 0, $header_size);
 								curl_close($ch);
 				        break;


In the order in the patch:

  • typo
  • to use it on Postgres (and hopefully others)
  • warning that "header_size is not a constant" (with error_reporting enabled in LocalSettings.php).

I've only tested this on PostgreSQL. --Hbswn (Mon Oct 15 19:58:44 UTC 2012)

Cheers, added for the next version including the "per-page check". Would that be correct for =?
$query .= " AND (`el_from` = '".$pageID."')";
$cond_arr[] = "el_from = '".$pageID."'";
--Subfader (talk) 20:58, 15 October 2012 (UTC)Reply


That should produce proper SQL, I think.

But where do you get "$pageID" from?

You do not want to select the Special::ExternalLinks page.

Please see Version 1.1 --Subfader (talk) 20:45, 16 October 2012 (UTC)Reply
[edit]

I found how to get an 'externallinks' item in the header with a URL like /wiki/index.php/Special:ExternalLinks/ThisPage for page /wiki/index.php/ThisPage.

See:

I use 1.15 on my server. (Debian/stable)


SpecialExternalLinks gets the "/ThisPage" part in the parameter of the execute() function. Then use that to find the original page.

--Hbswn (Tue Oct 16 20:41 UTC 2012)

I don't understand what this hsould be useful for?
How would you otherwise invoke ExternalLinks from a page?
(Maybe I've missed something. I'm not that much into Mediawiki, yet)
I tried to do something like "MovePage".
--Hbswn (Tue Oct 16 20:54 UTC 2012)
Sorry, I still don't get it. What do you want to do?

A context-sensitive menu/tab item (like edit, move, protect), so that ExternalLinks can check the page you're working on.

--Hbswn (Tue Oct 16 21:30:28 UTC 2012)
As, said. See version 1.1. of the extension. It's added in the toolbox in the sidebar on the right. --Subfader (talk) 21:40, 16 October 2012 (UTC)Reply