From c8ae7f8143e5c8292173601ecae4bf792a83c73a Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Thu, 5 Feb 2015 20:47:24 +0100 Subject: [PATCH 01/36] Modify release script to not commit stuff. --- release.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/release.sh b/release.sh index c852b76..e975e2f 100755 --- a/release.sh +++ b/release.sh @@ -16,13 +16,13 @@ FILENAME="release/LinkTitles-$1.tar.gz" # root path "LinktTitles". tar cvzf $FILENAME gpl-*.txt README.md NEWS *.php --exclude '*~' --transform 's,^,LinkTitles/,' -if [[ $? -eq 0 ]]; then - # Add the tarball to the repository, commit it, then tag the commit and push to origin. - git add $FILENAME - git commit -m --amend - git tag -a $1 -m "Version $1." - git push - git push --tags -else - echo "tar had errors, did not push." -fi +# if [[ $? -eq 0 ]]; then +# # Add the tarball to the repository, commit it, then tag the commit and push to origin. +# git add $FILENAME +# git commit -m --amend +# git tag -a $1 -m "Version $1." +# git push +# git push --tags +# else +# echo "tar had errors, did not push." +# fi From e850f3e3674d0b3c1b8371626db3c90cb9fc7fd6 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Sat, 28 Feb 2015 14:24:12 +0100 Subject: [PATCH 02/36] Cache delimiters used in regular expressions. - CHANGE: Improve performance. --- LinkTitles.body.php | 132 +++++++++++++++++++++++++------------------- 1 file changed, 74 insertions(+), 58 deletions(-) diff --git a/LinkTitles.body.php b/LinkTitles.body.php index 93f0795..64744a4 100755 --- a/LinkTitles.body.php +++ b/LinkTitles.body.php @@ -44,6 +44,14 @@ /// as a string. private static $targetTitleText; + /// Delimiter used in a regexp split operation to seperate those parts + /// of the page that should be parsed from those that should not be + /// parsed (e.g. inside pre-existing links etc.). + private static $delimiter; + + private static $wordStartDelim; + private static $wordEndDelim; + /// Setup function, hooks the extension's functions to MediaWiki events. public static function setup() { global $wgLinkTitlesParseOnEdit; @@ -56,6 +64,7 @@ $wgHooks['InternalParseBeforeLinks'][] = 'LinkTitles::onInternalParseBeforeLinks'; }; $wgHooks['GetDoubleUnderscoreIDs'][] = 'LinkTitles::onGetDoubleUnderscoreIDs'; + self::BuildDelimiters(); } /// Event handler that is hooked to the PageContentSave event. @@ -95,69 +104,17 @@ // Configuration variables need to be defined here as globals. global $wgLinkTitlesPreferShortTitles; global $wgLinkTitlesMinimumTitleLength; - global $wgLinkTitlesParseHeadings; global $wgLinkTitlesBlackList; - global $wgLinkTitlesSkipTemplates; global $wgLinkTitlesFirstOnly; - global $wgLinkTitlesWordStartOnly; - global $wgLinkTitlesWordEndOnly; global $wgLinkTitlesSmartMode; global $wgCapitalLinks; - // Use unicode character properties rather than \b escape sequences - // to detect whole words containing non-ASCII characters as well. - // Note that this requires the use of the '/u' switch, and you need - // to have PHP with a PCRE library that was compiled with - // --enable-unicode-properties - ( $wgLinkTitlesWordStartOnly ) ? $wordStartDelim = '(?.*?<.nowiki>|.*?<\/code>|' . // nowiki/code - '
.*?<\/pre>|.*?<\/html>|' .      // pre/html
-				'