Giter VIP home page Giter VIP logo

linktitles's Introduction

bovender

This is my inhouse C# framework that implements MVVM pattern and more.

I am an enthusiast/hobby/freelance programmer. I have created this framework because other, professional approaches such as the Prism guidance and framework were too heavy for my purposes. Of course I realize that most people won't be interested in this framework (because they would either use one of the professional large frameworks or create their own home-grown one), but since I produce open-source software, I have to put the source code somewhere...

NuGet package

This framework is available as a NuGet package to facilitate its use in multiple projects.

Required references

To build a project that uses the Bovender framework, add the following refrences:

  • PresentationCore
  • PresentationFramework
  • System.Xaml
  • WindowsBase

Documentation

Doxygen documentation can be found at the GitHub page of this project.

Versioning and changelog

This framework is semantically versioned.

Please inspect the git log for changes.

High-level overview

Here is a high-level overview of the namespaces in this framework. Please see the docs for detailed information.

Bovender.Mvvm

Bovender.ExceptionHandler

Bovender.Unmanaged

Bovender.Versioning

The Versioning namespace provides a class SemanticVersion to facilitate handling semantic versions.

Bovender.HtmlFiles

Bovender.Text

Bovender

A few classes live in the main namespace of Bovender:

  • FileHelpers: Helper methods to deal with files (currently only a static method Bovender.FileHelpers.Sha1Hash() that returns the Sha1 checksum of a file as string).
  • PathHelpers: Improvements (in my eyes) on some of the static methods provided by System.IO.Path: Bovender.PathHelpers.GetDirectoryPart() extracts the directory part of a path (where the path may end with a file name or a directory name), and Bovender.PathHelpers.GetFileNamePart() extracts the file name (if present) of a path.

License

This framework is distributed under the Apache License 2.0.

linktitles's People

Contributors

bertrandgorge avatar bluedreamer avatar bovender avatar c0nnex avatar minglecm avatar paladox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

linktitles's Issues

Call to undefined method WikiPage::doQuickEditContent()

Hello!

I'm getting this error with the script on the special page. Any clue what could cause it?

[ab1ff616fb76c7eca93ce370] /index.php?title=Special:LinkTitles Error from line 272 of /customers/0/6/c/ikabodo.se/httpd.www/w/extensions/LinkTitles/LinkTitles.body.php: Call to undefined method WikiPage::doQuickEditContent()

Backtrace:

#0 /customers/0/6/c/ikabodo.se/httpd.www/w/extensions/LinkTitles/SpecialLinkTitles.php(128): LinkTitles::processPage(string, RequestContext)
#1 /customers/0/6/c/ikabodo.se/httpd.www/w/extensions/LinkTitles/SpecialLinkTitles.php(61): SpecialLinkTitles->process(WebRequest, OutputPage)
#2 /customers/0/6/c/ikabodo.se/httpd.www/w/includes/specialpage/SpecialPage.php(522): SpecialLinkTitles->execute(NULL)
#3 /customers/0/6/c/ikabodo.se/httpd.www/w/includes/specialpage/SpecialPageFactory.php(577): SpecialPage->run(NULL)
#4 /customers/0/6/c/ikabodo.se/httpd.www/w/includes/MediaWiki.php(283): SpecialPageFactory::executePath(Title, RequestContext)
#5 /customers/0/6/c/ikabodo.se/httpd.www/w/includes/MediaWiki.php(851): MediaWiki->performRequest()
#6 /customers/0/6/c/ikabodo.se/httpd.www/w/includes/MediaWiki.php(512): MediaWiki->main()
#7 /customers/0/6/c/ikabodo.se/httpd.www/w/index.php(43): MediaWiki->run()
#8 {main}

Additional info:
Not sure if is related, but I'm getting a 500 error when using:
wfLoadExtension( 'LinkTitles' );

The extension works when i use:
require_once( "$IP/extensions/LinkTitles/LinkTitles.php" );

Edit: formatting

Blacklisted values cause database query error (PostgreSQL, ParseOnRender)

Hi,

I came across a database query error when trying to blacklist certain words. I tried to blacklist the word "Water" which then was assumed to be a column. The "Water" page is inside a custom namespace "FWDT" which has number 264.

Here are my settings:

wfLoadExtension( 'LinkTitles' );
$wgLinkTitlesParseOnEdit = false;
$wgLinkTitlesParseOnRender = true;
$wgLinkTitlesSourceNamespaces = array_merge(
        [ NS_MAIN, NS_USER ],
        array_keys( $customNamespaces )  # keys are numbers
);
$wgLinkTitlesTargetNamespaces = [ NS_MAIN, NS_USER, 2000 ];
$wgLinkTitlesBlackList = [ 'Water' ];

and the error page:

MediaWiki internal error.

Original exception: [1826e69aa243464ffb6b1bde] /wiki/FWDT:Water Wikimedia\Rdbms\DBQueryError from line 1699 of /opt/mediawiki-1.35/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?

Error 42703: ERROR: column "Water" does not exist
LINE 5: ..._LENGTH(page_title) >= 4) AND (page_title NOT IN ("Water")) ...
^

Function: LinkTitles\Targets::fetch
Query: SELECT page_title,page_namespace,CASE page_namespace WHEN 264 THEN 100
WHEN 0 THEN 200
WHEN 2 THEN 300
WHEN 2000 THEN 400
END AS "weight" FROM "page" WHERE (page_namespace IN (264, 0, 2, 2000)) AND (CHAR_LENGTH(page_title) >= 4) AND (page_title NOT IN ("Water")) ORDER BY weight ASC, CHAR_LENGTH(page_title) ASC

Backtrace:
#0 /opt/mediawiki-1.35/includes/libs/rdbms/database/Database.php(1683): Wikimedia\Rdbms\Database->getQueryException()
#1 /opt/mediawiki-1.35/includes/libs/rdbms/database/Database.php(1658): Wikimedia\Rdbms\Database->getQueryExceptionAndLog()
#2 /opt/mediawiki-1.35/includes/libs/rdbms/database/Database.php(1227): Wikimedia\Rdbms\Database->reportQueryError()
#3 /opt/mediawiki-1.35/includes/libs/rdbms/database/Database.php(1907): Wikimedia\Rdbms\Database->query()
#4 /opt/mediawiki-1.35/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->select()
#5 /opt/mediawiki-1.35/includes/libs/rdbms/database/DBConnRef.php(313): Wikimedia\Rdbms\DBConnRef->__call()
#6 /opt/mediawiki-1.35/extensions/LinkTitles/includes/Targets.php(150): Wikimedia\Rdbms\DBConnRef->select()
#7 /opt/mediawiki-1.35/extensions/LinkTitles/includes/Targets.php(91): LinkTitles\Targets->fetch()
#8 /opt/mediawiki-1.35/extensions/LinkTitles/includes/Targets.php(46): LinkTitles\Targets->__construct()
#9 /opt/mediawiki-1.35/extensions/LinkTitles/includes/Linker.php(83): LinkTitles\Targets::singleton()
#10 /opt/mediawiki-1.35/extensions/LinkTitles/includes/Extension.php(86): LinkTitles\Linker->linkContent()
#11 /opt/mediawiki-1.35/includes/HookContainer/HookContainer.php(321): LinkTitles\Extension::onInternalParseBeforeLinks()
#12 /opt/mediawiki-1.35/includes/HookContainer/HookContainer.php(132): MediaWiki\HookContainer\HookContainer->callLegacyHook()
#13 /opt/mediawiki-1.35/includes/HookContainer/HookRunner.php(2212): MediaWiki\HookContainer\HookContainer->run()
#14 /opt/mediawiki-1.35/includes/parser/Parser.php(1572): MediaWiki\HookContainer\HookRunner->onInternalParseBeforeLinks()
#15 /opt/mediawiki-1.35/includes/parser/Parser.php(850): Parser->internalParse()
#16 /opt/mediawiki-1.35/extensions/PageForms/includes/PF_ParserFunctions.php(700): Parser->recursiveTagParse()
#17 /opt/mediawiki-1.35/extensions/PageForms/includes/PF_ParserFunctions.php(197): PFParserFunctions::createFormLink()
#18 /opt/mediawiki-1.35/includes/parser/Parser.php(3340): PFParserFunctions::renderFormLink()
#19 /opt/mediawiki-1.35/includes/parser/Parser.php(3047): Parser->callParserFunction()
#20 /opt/mediawiki-1.35/includes/parser/PPFrame_Hash.php(253): Parser->braceSubstitution()
#21 /opt/mediawiki-1.35/includes/parser/Parser.php(3225): PPFrame_Hash->expand()
#22 /opt/mediawiki-1.35/includes/parser/PPFrame_Hash.php(253): Parser->braceSubstitution()
#23 /opt/mediawiki-1.35/includes/parser/Parser.php(2887): PPFrame_Hash->expand()
#24 /opt/mediawiki-1.35/includes/parser/Parser.php(1556): Parser->replaceVariables()
#25 /opt/mediawiki-1.35/includes/parser/Parser.php(651): Parser->internalParse()
#26 /opt/mediawiki-1.35/includes/content/WikitextContent.php(374): Parser->parse()
#27 /opt/mediawiki-1.35/includes/content/AbstractContent.php(590): WikitextContent->fillParserOutput()
#28 /opt/mediawiki-1.35/includes/Revision/RenderedRevision.php(263): AbstractContent->getParserOutput()
#29 /opt/mediawiki-1.35/includes/Revision/RenderedRevision.php(235): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached()
#30 /opt/mediawiki-1.35/includes/Revision/RevisionRenderer.php(215): MediaWiki\Revision\RenderedRevision->getSlotParserOutput()
#31 /opt/mediawiki-1.35/includes/Revision/RevisionRenderer.php(152): MediaWiki\Revision\RevisionRenderer->combineSlotOutput()
#32 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}()
#33 /opt/mediawiki-1.35/includes/Revision/RenderedRevision.php(197): call_user_func()
#34 /opt/mediawiki-1.35/includes/poolcounter/PoolWorkArticleView.php(216): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#35 /opt/mediawiki-1.35/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleView->doWork()
#36 /opt/mediawiki-1.35/includes/page/Article.php(810): PoolCounterWork->execute()
#37 /opt/mediawiki-1.35/includes/actions/ViewAction.php(74): Article->view()
#38 /opt/mediawiki-1.35/includes/MediaWiki.php(527): ViewAction->show()
#39 /opt/mediawiki-1.35/includes/MediaWiki.php(313): MediaWiki->performAction()
#40 /opt/mediawiki-1.35/includes/MediaWiki.php(940): MediaWiki->performRequest()
#41 /opt/mediawiki-1.35/includes/MediaWiki.php(543): MediaWiki->main()
#42 /opt/mediawiki-1.35/index.php(53): MediaWiki->run()
#43 /opt/mediawiki-1.35/index.php(46): wfIndexMain()
#44 {main}

Exception caught inside exception handler: [1826e69aa243464ffb6b1bde] /wiki/FWDT:Water Wikimedia\Rdbms\DBQueryError from line 1699 of /opt/mediawiki-1.35/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?

Error 42703: ERROR: column "Water" does not exist
LINE 5: ..._LENGTH(page_title) >= 4) AND (page_title NOT IN ("Water")) ...
^

Function: LinkTitles\Targets::fetch
Query: SELECT page_title,page_namespace,CASE page_namespace WHEN 264 THEN 100
WHEN 0 THEN 200
WHEN 2 THEN 300
WHEN 2000 THEN 400
END AS "weight" FROM "page" WHERE (page_namespace IN (264, 0, 2, 2000)) AND (CHAR_LENGTH(page_title) >= 4) AND (page_title NOT IN ("Water")) ORDER BY weight ASC, CHAR_LENGTH(page_title) ASC

Backtrace:
#0 /opt/mediawiki-1.35/includes/libs/rdbms/database/Database.php(1683): Wikimedia\Rdbms\Database->getQueryException()
#1 /opt/mediawiki-1.35/includes/libs/rdbms/database/Database.php(1658): Wikimedia\Rdbms\Database->getQueryExceptionAndLog()
#2 /opt/mediawiki-1.35/includes/libs/rdbms/database/Database.php(1227): Wikimedia\Rdbms\Database->reportQueryError()
#3 /opt/mediawiki-1.35/includes/libs/rdbms/database/Database.php(1907): Wikimedia\Rdbms\Database->query()
#4 /opt/mediawiki-1.35/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->select()
#5 /opt/mediawiki-1.35/includes/libs/rdbms/database/DBConnRef.php(313): Wikimedia\Rdbms\DBConnRef->__call()
#6 /opt/mediawiki-1.35/extensions/LinkTitles/includes/Targets.php(150): Wikimedia\Rdbms\DBConnRef->select()
#7 /opt/mediawiki-1.35/extensions/LinkTitles/includes/Targets.php(91): LinkTitles\Targets->fetch()
#8 /opt/mediawiki-1.35/extensions/LinkTitles/includes/Targets.php(46): LinkTitles\Targets->__construct()
#9 /opt/mediawiki-1.35/extensions/LinkTitles/includes/Linker.php(83): LinkTitles\Targets::singleton()
#10 /opt/mediawiki-1.35/extensions/LinkTitles/includes/Extension.php(86): LinkTitles\Linker->linkContent()
#11 /opt/mediawiki-1.35/includes/HookContainer/HookContainer.php(321): LinkTitles\Extension::onInternalParseBeforeLinks()
#12 /opt/mediawiki-1.35/includes/HookContainer/HookContainer.php(132): MediaWiki\HookContainer\HookContainer->callLegacyHook()
#13 /opt/mediawiki-1.35/includes/HookContainer/HookRunner.php(2212): MediaWiki\HookContainer\HookContainer->run()
#14 /opt/mediawiki-1.35/includes/parser/Parser.php(1572): MediaWiki\HookContainer\HookRunner->onInternalParseBeforeLinks()
#15 /opt/mediawiki-1.35/includes/parser/Parser.php(651): Parser->internalParse()
#16 /opt/mediawiki-1.35/includes/cache/MessageCache.php(1301): Parser->parse()
#17 /opt/mediawiki-1.35/includes/language/Message.php(1258): MessageCache->parse()
#18 /opt/mediawiki-1.35/includes/language/Message.php(889): Message->parseText()
#19 /opt/mediawiki-1.35/includes/language/Message.php(942): Message->toString()
#20 /opt/mediawiki-1.35/includes/skins/Skin.php(956): Message->parse()
#21 /opt/mediawiki-1.35/includes/skins/Skin.php(2514): Skin->lastModified()
#22 /opt/mediawiki-1.35/includes/skins/SkinTemplate.php(340): Skin->getFooterLinks()
#23 /opt/mediawiki-1.35/includes/skins/SkinTemplate.php(127): SkinTemplate->prepareQuickTemplate()
#24 /opt/mediawiki-1.35/includes/skins/SkinTemplate.php(144): SkinTemplate->generateHTML()
#25 /opt/mediawiki-1.35/includes/OutputPage.php(2622): SkinTemplate->outputPage()
#26 /opt/mediawiki-1.35/includes/exception/MWExceptionRenderer.php(153): OutputPage->output()
#27 /opt/mediawiki-1.35/includes/exception/MWExceptionRenderer.php(65): MWExceptionRenderer::reportHTML()
#28 /opt/mediawiki-1.35/includes/exception/MWExceptionHandler.php(106): MWExceptionRenderer::output()
#29 /opt/mediawiki-1.35/includes/exception/MWExceptionHandler.php(185): MWExceptionHandler::report()
#30 /opt/mediawiki-1.35/includes/MediaWiki.php(576): MWExceptionHandler::handleException()
#31 /opt/mediawiki-1.35/index.php(53): MediaWiki->run()
#32 /opt/mediawiki-1.35/index.php(46): wfIndexMain()
#33 {main}

Enhancement: option to link only pages modified since last linking or queue linking on save

Hello, our wiki is large (7k+ pages) and the process of linking all pages is very slow (4 days on the production server 😱).

We disabled the option to link on page saving for the same reason.

It could be nice to have an option for the command line / batch mode to ignore all pages where the last edit was made by LinkTitle.

Another nice enhancement would be to queue the link operation for runJobs.php to deal with it later...?

Inserting links to the category namespace breaks the page...

Hello, we configured our wiki to replace links to NS_Main and NS_Category.

When a link is made to a category, say : this word gets linked becomes this [[category:word | word]] gets linked, the wrong syntax is used. It should read this [[:category:word | word]] gets linked (colon at the start of the link).

I saw that having colons at the start of EVERY link doesn't harm ([[:some title]] works fine). It could be an option to simplify the fix...?

Tags get added each time a page is edited and saved.

After the great update that added autolink tags things are looking fine, but I think I've found a bug.

It adds [[]] every time you save the page. Causing issues like [[[[[[Roderick]]]]]] if the page is updated several times. It appears it only happens if within {{}}.

I'm guessing the new regex does not check for existing [[]]?

Edit: After some research, I'm getting some strange behavior. I'm getting the feeling it starts parsing after a certain length of text. Could this be it? What it's doing is adding more and more [[]] if $wgLinkTitlesSkipTemplates = true; and there is a lot of text.

http://w.ikabodo.se/index.php?title=Test3

Here is an example, according to me this page should not parse with $wgLinkTitlesSkipTemplates = true;, but it seems to be doing it. At least partly. It's an extreme example with a lot of text, but it's just for testing. Compare the first text around "463" to the second text with the same number further down. It's the exact same text, the first is parsing, the lower part is not. It's behaving as if only parsing the first word, but according to me should not parse at all.

Knowing which pages have been linked

Product | Version
MediaWiki | 1.37.1
PHP | 7.4.28 (fpm-fcgi)
MariaDB | 10.3.28-MariaDB
LinkTitles|8.0.1

This is a great extension that I am running on a quite a huge wiki with about 20,000 entries. When running it in CMD, I can see the number of pages counter increasing but I would like to know which page that is for purposes of some quality control. Is there a known way to check this?

Autolinking in templates doesn't work?

There is a reasonable chance that I'm doing something wrong, but as far as I could figure out, no links were added inside a template. I've tried to narrow it down to something simple:

{{ infobox
| above       = Test Infobox
| label1      = Some label
| data1       = Some Page Title
}}

With "Some Page Title" being one of the pages in my Wiki. After saving (as a major change) or even after running the special page, "Some Page Title" doesn't become a link.

Just to be sure, I added "$wgLinkTitlesSkipTemplates = false;" to my settings.
(Manually adding [[ ]] to the source makes it into a regular link that works)

Am I indeed doing something wrong or does this has something to do with how I used the template?

Thanks for your help in advance!

Gerard

Link replacement issues with PageForms (ParseOnRender)

Hi,

we noticed that LinkTitles doesn't work well with the PageForms extension. With ParseOnRender enabled, it tries to replace words in dropdown menus and placeholder texts in text boxes. Sometimes it works and creates a link (which is still a bit annoying in dropdown menus), other times the replacement fails and it just shows <!--LINK'" 0:0--> and the original text is not shown at all. I didn't try ParseOnEdit.

<noautolinks> acts as <nowiki>

It seems that <noautolink> removes the template formatting completely. Is this intended behaviour?

<noautolink>
{{CharacterSections
|Description text=Merlin, or Myrdyn Emrys, is the legendary sorcerer confidant of Uther and Aurelius. He is called the fatherless boy, the Arch Druid of Britain and the Sorcerer of Britain. 
}}
</noautolinks>

This causes the template not to print.

Fatal Errors in LinkTitles_Maintenance with the --page option

When running the LinkTitles_Maintenance.php command line script with the --page option gives the following errors

PHP Fatal error: Class 'LinkTitles\Title' not found in mediawiki/extensions/LinkTitles/LinkTitles_Maintenance.php on line 115

PHP Fatal error: Class 'LinkTitles\LinkTitles' not found in mediawiki/extensions/LinkTitles/LinkTitles_Maintenance.php on line 116

Call to undefined method WikiPage::doQuickEditContent()

When LinkTitles_Maintenance.php is executed with MediaWiki 1.28, the following error occurs.

Error: LinkTitles_Extension.php: Call to undefined method WikiPage::doQuickEditContent()

"WikiPage :: doQuickEditContent ()" has been deleted in 1.28

Issue with $wgLinkTitlesSkipTemplates = true;

I have added $wgLinkTitlesSkipTemplates = true; to Localsettings.php, and it's mostly working fine. But sometimes it still autolinks things within tags.

Here is an example of code where "Hillfort" is getting autotagged. After some testing I believe that your code considers the end of "{{PAGENAME}}" (the "}}"-part) to be the end of the parser. This means that any parser with magic words or similar inside of it will still be autotagged. This causes some issues with infobox related templates.

{{Infobox_manor
|Image=
|Name={{PAGENAME}}
|Other names=Longbarrows
|Holder=Ren
|Steward=Pryderi
|Hundred=[[Hillfort]]
}}

LinkTitles extension does not work with sqlite

After LinkTitles was installed on a wiki that uses sqlite.
Whenever a (non-minor) edit is made to a page, I get the following error:

A database error has occurred. Did you forget to run maintenance/update.php
after upgrading? See:
https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: SELECT page_title FROM page WHERE (page_namespace = 0) AND
(CHAR_LENGTH(page_title) >= 3) AND (page_title NOT IN ("")) ORDER BY
CHAR_LENGTH(page_title) DESC
Function: LinkTitles::parseContent
Error: 1 no such function: CHAR_LENGTH

Looks to me like the code assumes that the wiki uses mysql and therefor uses
CHAR_LENGTH function. A function that doesn't exist in sqlite.

Special:LinkTitles queries entire page table every page

Hi. I'm a security reviewer from the Miraheze wiki farm. The good news is that I don't see any security concerns in your code.

But as usual in my readthroughs, I see other things. When you mention that things might take seconds on a wiki farm if your wiki has 500 pages, I get a little worried about performance.

I was thinking about only enabling the special page. But this isn't any more efficient than a page save, because we request the whole page table every time. If there's enough pages, this can pretty easily get into the megabytes of DB traffic with a single request, just for the page names.

Can you refactor this code to only fetch page_title data once per request? Probably save it in a class variable, and then just check to see that we're not linking the current page inside parseContent().

PHP Deprecated: Creation of dynamic property LinkTitles\Target::$titleValue is deprecated

A small deprecation notice that actually comes from a line that should have been removed all together.

PHP Deprecated: Creation of dynamic property LinkTitles\Target::$titleValue is deprecated in /var/www/html/extensions/LinkTitles/includes/Target.php on line 80
https://github.com/bovender/LinkTitles/blob/c5c142ebbfd62c43ca533931b3c83ccc6f5ee507/includes/Target.php#L80C10-L80C21

$this->titleValue = $this->title->getTitleValue(); // Should be removed - $this->titleValue is never used

Titles not being linked

Hi there,

I've been having some issues with a page where some titles are not being linked as expected.
I have tried to debug the issue but I wasn't having much luck so far so I thought I'd ask for tips here first.

this is the (stripped) text in mention: wikitext.txt

the word that I expect to be linked is Katernen. I have allready quadruple checked if that page exists and even logged the list of querried titles in the routine to be sure it's retrieved.

It seems to have some thing to do with the table on te page.

Help would be greatly appreciated

Page is cached before links are inserted

With the latest version, after editing a page, the fully rendered page is being cached before links are inserted. Thus, links do not appear until the cache is purged, e.g. by appending action=purge to the URL.

noautolinks and nowiki

setting noautolinks before a nowiki tag. shouldn't the noautolinks not create any brackets [[]] nowiki the nowiki tag?

Parse on edit crashes with Postgres database.

When using a Postgres database, the extensions crashes with a database error when checking for blacklisted page titles. Evidently, the SQL query that is generated by the following lines does not agree well with Postgres:

// Targets.php
// Build a blacklist of pages that are not supposed to be link
// targets. This includes the current page.
if ( $this->config->blackList ) {
  $blackList = 'page_title NOT IN ' .
    str_replace( ' ', '_', '("' . implode( '","', str_replace( '"', '\"', $this->config->blackList ) ) . '")' );
} else {
  $blackList = null;
}

In the following statement, Postgres assumes 'blacklisted' is a column:

page_title NOT IN ("blacklisted")

Namespace Trouble (Version 5.0.6)

Hello,
we use a mediawiki for our rpg journal.
We tried LinkTitles for making editing and linking less manual.

But we have troubles to get it to work.

Our journal sites look like (german):
mediawiki/index.php?title=KM:Kampagne/Sitzung/1/Tagebuch
mediawiki/index.php?title=KM:Kampagne/Sitzung/2/Tagebuch

Example from a text within (german):
Ulgan, Gannokh, Carax und Amos befragen vergeblich 2 Banditen

For characters, npc, locations, e.g. we have custom pages like:
mediawiki/index.php?title=KM:Kampagne/Charakter/Amos
mediawiki/index.php?title=KM:Kampagne/Charakter/Carax

We tought it's possible that names are automatically linked to their corresponding pages.
But nothing happens. The extension is active.

This is the last version from LocalSettings.php

define("NS_KM", 112);
$wgExtraNamespaces[NS_KM] = "KM";
$wgLinkTitlesSourceNamespace[] = NS_KM;
$wgLinkTitlesTargetNamespaces[] = NS_KM;

define("NS_KM_TALK", 113);
$wgExtraNamespaces[NS_KM_TALK] = "KM_Diskussion";

$wgLinkTitlesWordEndOnly = true;

I little help would be great.

Regards
nowrap

$wgLinkTitlesBlackList not working

So, I have some common words, I don't want auto-linked. They are redirects, so the magic word never seems to work. I'd rather not remove them because they can make things a lot easier to have these words redirected. I don't want every occurrence of these words to be linked though, I will link them myself if I want to use them. However, I can't get the magic word nor the blacklist variable to work.

Here is my code in LocalSettings pertaining to this:
$wgLinkTitlesBlackList[] = 'Done';
$wgLinkTitlesBlacklist[] = 'drone';
$wgLinkTitlesBlackList[] = 'Drones';
$wgLinkTitlesBlackList[] = 'drones';
$wgLinkTitlesBlackList[] = 'Federation';
$wgLinkTitlesBlackList[] = 'federation';

Blacklist issue...

Ok, so this one is not me, as far as I can tell... So, first, I had a page called "Turned", now that being a common word, it was getting unintended links. So, I tried to add it to the Blacklist:

$wgLinkTitlesBlackList[] = 'Drone';
$wgLinkTitlesBlackList[] = 'Drones';
$wgLinkTitlesBlackList[] = 'Federation';
$wgLinkTitlesBlacklist[] = 'Turned';

Along with my other Blacklisted pages.

This didn't work, every time "Turned" still got auto-linked. So, I tried to use the keyword:
__NOAUTOLINKTARGET__
Was added to the TOP of the page. Still, no effect the word "turned" or "Turned" kept getting automatically linked. I finally gave up and changed the page title to "The Turned" since it was a viable replacement. Still, I can't figure out why it would do this, either of those options should have blocked the page from being autolinked according to the documentation.

Any ideas?

Namespace weight unused in parseContent()

I don't know what the point of the namespace weight is supposed to be, but I can tell that it isn't being used at all. Is that some sort of future functionality expansion, leftover code cruft, or is that just making the DB do more work for no particular reason? If you want, I can make a PR to remove it.

Database query error on page save (Sqlite backend)

Hello.
When I tried to save the changes on the page, I got an error:

A database query error has occurred. This may indicate a bug in the software.
Query:
SELECT page_title,page_namespace,CASE page_namespace WHEN 0 THEN 100 END AS "weight" FROM page WHERE (page_namespace IN (0)) AND (CHAR_LENGTH(page_title) >= 4) ORDER BY weight ASC, CHAR_LENGTH(page_title) ASC
Function: LinkTitles\Targets::fetch
Error: 1 no such function: CHAR_LENGTH

Then I tried to remove CHAR_ in Targets.php as you advised in #1 and the page was saved successfully.
diff Targets_orig.php Targets.php:

139c139
<                                               'CHAR_LENGTH(page_title) >= ' . $this->config->minimumTitleLength,
---
>                                               'LENGTH(page_title) >= ' . $this->config->minimumTitleLength,
144c144
<                               array( 'ORDER BY' => 'weight ASC, CHAR_LENGTH(page_title) ' . $sortOrder )
---
>                               array( 'ORDER BY' => 'weight ASC, LENGTH(page_title) ' . $sortOrder )

It seems like try catch just not working in the case of sql errors.

Software versions:

Mediawiki 1.27.3
PHP 7.1.10
LinkTitles 5.0.4
Sqlite 3.20.1-r1

DivisionByZero in Special.php, line 250

While creating a wiki, I was thinking that it would be so nice to have pages link automatically and was very pleased to find it already exists!

Starting with a rather empty wiki, it seems that $reloads could be 0 which causes an error in this line:
$pagesPerReload = sprintf('%0.1f', $end / $reloads);
or at least that's the error I get when running the Special LinkTitles page
A test before the division will solve this error. I'm not skilled enough in PHP to show my code, but I think it's an easy fix for the author?

Thanks for your efforts in creating this extension.

Gerard

Class 'LinkTitles\Title' not found

When trying to run LinkTitles_Maintenance.php from the command line, I get the error below:

PHP Fatal error: Class 'LinkTitles\Title' not found in mediawiki/extensions/LinkTitles/LinkTitles_Maintenance.php on line 146

How is the cli script run in v4?

Detecting whole words that contain accents

The plugin fails to correctly detect entire words when they contain non ascii letters, e.g. «déauthentification» will be partially linked to the page entitled «authentification», if it exists (in that case, the link will look like so: «dé[[authentification]]»).

Terms in <pre> blocks linked

As hinted in the title of the issue, terms in <pre></pre> blocks are modified to link to other pages of the wiki. However, those pre tags are supposed to display their content as-is (kind of like the verbatim ones), which results into an unwanted and effectless modification of the data.

To reproduce the bug:

  • create a new page in which you enclose a term that has it's own page on the wiki into pre tags (e.g <pre>Windows</pre>)
  • preview or save the page, and you should see that the page is now showing [[Windows]] instead of Windows in the a blockquote.

HTH.

Deprecated Message on Mediawiki 1.4 with latest Version

I get the following error when using the extension on Mediawiki 1.40.

image

Could somebody explain to me how to fix it?

Edit:

My LocalSettings.php does contain the following config for the extension:

LinkTitles Settings

$wgLinkTitlesParseOnEdit = true;
$wgLinkTitlesParseOnRender = true;
$wgLinkTitlesSpecialPageReloadAfter = 1;

When I disable these settings the error disappears. Do I have to change something here?

Database Error

When trying to save a page with a "quote" character in the title, it gets the error below:

A database query error has occurred. This may indicate a bug in the software.

Backtrace:

#0 mediawiki/mediawiki/includes/db/Database.php(1076): DatabaseBase->reportQueryError('You have an err...', 1064, 'SELECT  page_ti...', 'LinkTitles::par...', false)
#1 mediawiki/mediawiki/includes/db/Database.php(1600): DatabaseBase->query('SELECT  page_ti...', 'LinkTitles::par...')
#2 mediawiki/mediawiki/extensions/LinkTitles/LinkTitles.body.php(195): DatabaseBase->select('page', 'page_title', Array, 'LinkTitles::par...', Array)
#3 mediawiki/mediawiki/extensions/LinkTitles/LinkTitles.body.php(68): LinkTitles::parseContent(Object(Title), 'Test')
#4 [internal function]: LinkTitles::onPageContentSave(Object(WikiPage), Object(User), Object(WikitextContent), '', 0, NULL, NULL, 98, Object(Status))
#5 mediawiki/mediawiki/includes/Hooks.php(201): call_user_func_array('LinkTitles::onP...', Array)
#6 mediawiki/mediawiki/includes/page/WikiPage.php(1724): Hooks::run('PageContentSave', Array)
#7 [internal function]: WikiPage->doEditContent(Object(WikitextContent), '', 98, false, Object(User), 'text/x-wiki')
#8 mediawiki/mediawiki/includes/page/Article.php(2049): call_user_func_array(Array, Array)
#9 mediawiki/mediawiki/includes/EditPage.php(1957): Article->__call('doEditContent', Array)
#10 mediawiki/mediawiki/includes/EditPage.php(1957): Article->doEditContent(Object(WikitextContent), '', 98, false, Object(User), 'text/x-wiki')
#11 mediawiki/mediawiki/includes/EditPage.php(1331): EditPage->internalAttemptSave(Array, false)
#12 mediawiki/mediawiki/includes/EditPage.php(560): EditPage->attemptSave(Array)
#13 mediawiki/mediawiki/includes/actions/EditAction.php(58): EditPage->edit()
#14 mediawiki/mediawiki/includes/actions/SubmitAction.php(40): EditAction->show()
#15 mediawiki/mediawiki/includes/MediaWiki.php(490): SubmitAction->show()
#16 mediawiki/mediawiki/includes/MediaWiki.php(287): MediaWiki->performAction(Object(Article), Object(Title))
#17 mediawiki/mediawiki/includes/MediaWiki.php(714): MediaWiki->performRequest()
#18 mediawiki/mediawiki/includes/MediaWiki.php(508): MediaWiki->main()
#19 mediawiki/mediawiki/index.php(41): MediaWiki->run()
#20 docroot/index.php(17): require_once('mediawiki/...')
#21 {main}

Exclude math?

Hello!
How to exclude <math> ... </math>
In many cases I have full words in equations and LinkTitles adds links to them.

linktitles-cli.php

Hi!
Linker is great. I use it for some years. As my website has several thousand pages I use mainly linktitles-cli.php and it works very nice.

There is some improvement possible in that script. In line 171 there is:
$numPages = $res->numRows();
If someone starts with -s index it returns wrong number of pages and wrong percentage. I think it should be:
$numPages = $res->numRows() + $index;
I changed it and now it shows proper numbers.

Another change I made in line 178:
$this->output( sprintf( "\rPage #%d (%02.0f%%) ", $index, $index / $numPages * 100 ) );
I added presentation of title of current page, which looks nice:
$this->output( sprintf( "\rPage #%d (%02.0f%%) %s", $index, $index / $numPages * 100, $title2 ) );
If the title of next page is shorter than the previous some letters are being left. I solved it by adding some spaces to $title2 variable:
$title2 = $title." ";
and I put it before line 178. Maybe there is better way to do it, but it works. :-)

Thanks again!
Slawek

preg_replace_callback(): Compilation failed: missing )

Hi,

ich nutze MW 1.23.15 und die (so denke ich zumindest) dazu passende LinkTitles Version 2.2.

Ich habe 2 bis auf den Inhalt der DB identische Wikis. Bei dem einen funktioniert die Extension ohne Probleme bei dem anderen leider nicht. Sobald ich sie aktiviere und im Wiki testen möchte erhalte ich diese Fehler:
PHP Warning: preg_replace_callback(): Compilation failed: missing ) at offset 97 in /wiki/extensions/LinkTitles/LinkTitles.body.php on line 206, referer: http://wiki/...
PHP Warning: preg_replace(): Compilation failed: missing ) at offset 106 in /wiki/extensions/LinkTitles/LinkTitles.body.php on line 186, referer: http://wiki/...

Hat jmd. eine Idee?

Gruß
Sabku

Linking in Image Galleries / Exclusion Tags

I don't think that the extension should link to text within a block. If you've got a page called, say, "Ruth", and do an image in a gallery say, File:Baby-Ruth.jpg, then it will become File:Baby-[[Ruth]].jpg which will completely screw up the image.

I also think there should be some kind of tag, similar to so that a block of text, but not the whole page, can be exempted from being scanned to link. Just a thought.

Feature Request:Only autolink a subset of pages

I would like to only auto link to a few pages and I don't want to move them to a new namespace. I guess I could make a new namespace and set them to redirects to the main Namespace

With this?

$wgLinkTitlesTargetNamespaces = [NS_AutoLinks];
$wgLinkTitlesSamenamespace = false;

Articles with non (Main) namespace

Main Page is picked up correctly, but Namespace:Article or Article are not picked up.
I read that there is support for namespace, but, how do I get it?

Recursive linking of terms linked (with case) inside of a template (double braces syntax)

Whenever a term inside a template is linked to page with two different cases (upper/lower), that same word will be linked over and over everytime the page is saved.

Reproducing the bug:

  • inside of a page, instanciate a template with/without parameters: {{}}
  • inside the template body, create a link to an existing page: {{[[Windows]]}}
  • add the same term inside the link with a different case: {{[[Windows|WINDOWS]]}}
  • after saving the page several times: {{[[Windows|[[Windows|[[Windows|[[Windows|WINDOWS]]]]]]]]}}

HTH.

Multiple links even with LinkTitlesFirstOnly

I have an existing page titled 'Test'. I created a new page titled 'Test Page' with the content 'Test Page Test Page Test Page Test Page Test Page Test Page'

The content ended up with '[[Test Page]] [[Test Page]] [[Test]] Page [[Test]] Page Test Page Test Page'

'Test Page' and 'Test' are each linked twice instead of once each.

No Title Linking on Edit

Hi there,

I've installed LinkTitles on my wiki - the batch linker works great, but I can't seem to get it to link on edits. For example, after editing this page, text like "Send it" and "SciWing" should link automatically, right?

Here is my code repo, with the project deployed here.

I took a look through the configuration settings and everything seems to check out (all in the NS-MAIN namespace, etc.) As such my LocalSettings.php has the following:

## Needs to have minor checkbox edit undefaulted - but breaks button links, so disabling for now
$wgDefaultUserOptions['minordefault'] = 0;
wfLoadExtension( 'LinkTitles' );
### Autolinker configuration
#### remove case sensitivity with smart mode
$wgLinkTitlesSmartMode = true;

I know this is an older project but would appreciate any tips on this!

I'm new to wiki/PHP so let me know if you could use any other info.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.