Commit Graph

86 Commits

Author SHA1 Message Date
c0nnex
085a4032f0 Fixed error because of global missing 2015-10-09 17:22:30 +02:00
c0nnex
dca10de21f Fixed Hooks only to process pags in wanted namespaces. Fixes ugly autolinking in Sidebar and breaking imagepages 2015-10-02 02:44:42 +02:00
c0nnex
124e92aafd * Fixed linking in Namespace pages
* added paramters to cli interface
  --page={pagename}   only process that page
  --log : show some output about the process
  --debug : show debug output in cli
* changed pagecount on SpecialPage to use COUNT instead of selecting all rows
2015-10-02 02:35:47 +02:00
c0nnex
70c679f757 Debug Namespace clutches 2015-10-01 04:57:40 +02:00
c0nnex
40c1e73818 Namspeces 2 2015-10-01 04:04:55 +02:00
c0nnex
d7464ac995 NS Check 1 2015-10-01 03:40:16 +02:00
c0nnex
5e58bc0dfc Added namepsace-support to cli and specialpage 2015-09-30 02:48:10 +02:00
c0nnex
c75fe391ce Made debug logging private (explicit turn on). Final 2015-09-30 02:28:01 +02:00
c0nnex
b18350efdd Fix 7 2015-09-30 02:25:05 +02:00
c0nnex
70f4d87bf7 Fix 6 2015-09-30 02:23:34 +02:00
c0nnex
1b8ef249b6 Fix 4 2015-09-30 02:18:53 +02:00
c0nnex
bed28dd61c Fix 3 2015-09-30 02:15:26 +02:00
c0nnex
8d3ccce48c Fix 2 2015-09-30 02:05:09 +02:00
c0nnex
1c6692d9d0 Fix 1 2015-09-30 02:00:03 +02:00
c0nnex
1e155be6c6 Added Namespace support 2015-09-30 01:52:17 +02:00
c0nnex
4c3c5e4931 Revert "Added Namespace support"
This reverts commit a9840b77e8.
2015-09-30 01:50:19 +02:00
c0nnex
a9840b77e8 Added Namespace support 2015-09-30 01:47:51 +02:00
Daniel Kraus
e850f3e367 Cache delimiters used in regular expressions.
- CHANGE: Improve performance.
2015-02-28 14:24:12 +01:00
Daniel Kraus
5314331e5f Do not link inside <file>...</file> tags.
- IMPROVEMENT: Do not link inside <file>...</file> tags.
2015-02-05 20:30:48 +01:00
Daniel Kraus
5a8e54eab2 Do not link template parameters. 2014-09-03 15:06:30 +02:00
Daniel Kraus
0ced2cff44 Do not re-link links inside curly braces. 2014-08-29 14:16:46 +02:00
Daniel Kraus
cfeafc7751 Prevent linking inside multiline templates. 2014-08-29 12:13:38 +02:00
Daniel Kraus
3c930eb90a Do not touch piped links in template parameters. 2014-08-29 07:57:30 +02:00
Daniel Kraus
2915c6c798 Fix region exclusion with multiple lines.
Added the 's' modifier so that the regex that detects not-to-be-linked
regions that span several lines (e.g., multiline <pre></pre> section).
2014-08-28 16:07:36 +02:00
Daniel Kraus
c800862990 Fix word detection with non-ASCII characters.
Use the unicode character property \pL together with look-behind and
look-ahead assertions rather than '\b' escape sequences (which do not work
with non-ASCII characters).
2014-08-28 15:57:49 +02:00
Daniel Kraus
b722774f68 Fix return value if __NOAUTOLINKS__ is present. 2014-06-11 17:10:02 +02:00
Daniel Kraus
dd34719f0d Fix page black list. 2014-06-11 16:55:25 +02:00
Daniel Kraus
284b0695fe Implement InternalParseBeforeLinks hook.
This replaces the ArticleAfterFetchContent hook and enables the extension to
parse output produced by templates for links.
2014-06-11 12:00:06 +02:00
Daniel Kraus
35d1b57f38 Change signature of parseContent function.
To be able to use the InternalParseBeforeLinks hook (to be implemented), a
different signature was needed. This entailed subsequent changes to calling
functions.
2014-06-11 08:02:50 +02:00
Daniel Kraus
600b545477 Use typed parameters in functions. 2014-06-11 06:17:48 +02:00
Daniel Kraus
d4923fb9f7 Change names of private static variables. 2014-06-10 19:06:37 +02:00
Daniel Kraus
eef4e793e7 Use GetDoubleUnderscoreIDs hook to remove magic words.
Prevously, the magic words were removed by hooking onto ParserBeforeTidy.
Since the Parser class provides its own mechanism for removing magic words
that are surrounded by double underscores, we now use this (undocumented)
hook.
2014-06-10 19:04:27 +02:00
Daniel Kraus
5fcf92861f Make compatible with PHP 5.3 again.
The anonymous callback functions that were handed over to
preg_replace_callback called private static methods of the LinkTitles class,
which worked fine with PHP 5.5.9, but not with PHP 5.3.3.

The functions were not turned (back) into static methods, and the callback
is given in the array form, as described in the PHP documentation.
2014-06-10 18:54:46 +02:00
Daniel Kraus
1cafdc4b1a Use WikiPage::doQuickEditContent for speed up batch.
WikiPage::doEditContent was extremely slow, because it updated link tables
etc. For batch processing, we now use WikiPage::doQuickEditContent, which is
considerably faster.
2014-06-10 16:45:23 +02:00
Daniel Kraus
d7571c4922 Use preg_replace_callback throughout; lazy checks.
The checks for whether a page is a potential link target or not (depending
on the absence of the __NOAUTOLINKTARGET__ magic word and if it is not a
redirect to the current page) have now been moved into the callback
functions, so that they are only performed if a page really is a candidate
for linking (i.e, its title occurs on the currently edited page).

The change resulted in a ~10-fold increase in speed.
2014-06-10 16:22:28 +02:00
Daniel Kraus
4ca1225fd0 Fix saving of modified content.
A bug caused text to be saved only if links were added by smart mode
algorithm, not by normal algorithm.
2014-06-10 13:56:40 +02:00
Daniel Kraus
34720765da Implement config for check-redirect and magic word.
Added two new configuration variables, $wgLinkTitlesCheckRedirect and
$wgLinkTitlesEnableNoTargetMagicWord, that can be used to increase
performance. If both are overridden to be false, the target page content
will not be fetched from the database to check for redirect or the
occurrence of a magic word, which saves a lot of time.
2014-06-10 13:41:35 +02:00
Daniel Kraus
5842430021 Check if content was modified before committing. 2014-06-10 11:55:55 +02:00
Daniel Kraus
e5008b9997 Use ArticleAfterFetchContentObject hook.
No longer use deprecated ArticleAfterFetchContent hook. The new hook
requires MediaWiki 1.21 or later.
2014-06-08 22:52:36 +02:00
Daniel Kraus
adbc1ea5cd Use PageContentSave rather than ArticleSave hook.
This commit also contains some refactoring which should lend itself to
increased performance.
2014-06-08 19:21:41 +02:00
Daniel Kraus
1542901551 Complete documentation of source code. 2014-06-05 22:41:09 +02:00
Daniel Kraus
56dc484949 Remove entry point warning from body file. 2014-06-03 21:44:47 +02:00
Daniel Kraus
3ea8d9509f Change bot message for batch processing, add user. 2014-06-03 19:16:23 +02:00
Daniel Kraus
b32d48bdc9 Move the page processing function to LinkTitles class.
A public static function was created to DRY things up.
2014-06-03 18:52:04 +02:00
Daniel Kraus
ffb8daa1ad Remove superfluous variable; comment code. 2014-06-03 18:28:25 +02:00
Daniel Kraus
256f905c69 Prevent linking inside attributes etc.
Includes prevention of linking in class and style attributes of WikiTables.
2014-06-02 19:58:01 +02:00
Daniel Kraus
cf792072dd Prevent creating indirect links to self.
Added code to check if a target page redirects to the current page, and
prevents linking to that target page. Note that this does not catch
situations where a page title exists twice, once with first capital letter
and once with first lowercase letter (should happen on test systems only).
2014-06-02 18:55:02 +02:00
Daniel Kraus
821d6d6b34 Prevent parsing in pre, html, and script tags. 2014-06-02 18:26:39 +02:00
Daniel Kraus
3d37b2d8ba Refactor smart mode code for increased performance.
The preg_replace_callback callback functions were removed as static
functions and declared inline; the callback function for $wgCapitalLinks ==
false was simplified to speed up the process.
2014-06-02 18:22:53 +02:00
Daniel Kraus
7cb5b713ab Add __NOAUTOLINKTARGET__ magic word; refactor.
The magic word __NOAUTOLINKTARGET__ will prevent a page from being
automatically linked to.

Some minor refactoring was performed.
2014-06-02 16:25:03 +02:00