Index: tags/extensions/SemanticUpdateOnPurge/REL_0_4_1/RELEASE-NOTES |
— | — | @@ -0,0 +1,15 @@ |
| 2 | + Changelog: |
| 3 | + ========== |
| 4 | + * December 5, 2011 -- Version 0.4.1 Localisation release, support for several languages added. |
| 5 | + * November 6, 2011 -- Version 0.4 |
| 6 | + - Language file for extension description added. |
| 7 | + - Extension added into wikimedia.org svn repository and put under ISC License. |
| 8 | + |
| 9 | + * September 28, 2011 -- Version 0.3.1.1: Minor update letting the extension appear as semantic extension on [[Special:Version]]. |
| 10 | + * September 23, 2011 -- Version 0.3.1: PHP notice will not appear anymore when purging pages without semantic data. |
| 11 | + * September 20, 2011 -- Version 0.3: Internal extension structure redesigned, works with SMW 1.6.1 (probably 1.6 as well). |
| 12 | + |
| 13 | + * February 14, 2011 -- Version 0.2.1: Minor code changes, added 'VERSION' constant into 'ExtSemanticUpdateOnPurge' class. |
| 14 | + * March 10, 2010 -- Version 0.2: Redesign of how the update happens. Doesn't use an update job any longer. |
| 15 | + |
| 16 | + * March 9, 2010 -- Version 0.1: First experimental release of 'SemanticUpdateOnPurge'. |
Property changes on: tags/extensions/SemanticUpdateOnPurge/REL_0_4_1/RELEASE-NOTES |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 17 | + native |
Index: tags/extensions/SemanticUpdateOnPurge/REL_0_4_1/COPYING |
— | — | @@ -0,0 +1,13 @@ |
| 2 | +Copyright (c) 2010 - 2011 by Daniel Werner < danweetz@web.de > |
| 3 | + |
| 4 | +Permission to use, copy, modify, and/or distribute this software for any |
| 5 | +purpose with or without fee is hereby granted, provided that the above |
| 6 | +copyright notice and this permission notice appear in all copies. |
| 7 | + |
| 8 | +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 | +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 11 | +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 | +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 13 | +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
\ No newline at end of file |
Property changes on: tags/extensions/SemanticUpdateOnPurge/REL_0_4_1/COPYING |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 15 | + native |
Index: tags/extensions/SemanticUpdateOnPurge/REL_0_4_1/SemanticUpdateOnPurge.i18n.php |
— | — | @@ -0,0 +1,98 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation file of the 'SemanticUpdateOnPurge' extension |
| 5 | + * |
| 6 | + * @since 0.4 |
| 7 | + * |
| 8 | + * @file SemanticUpdateOnPurge.i18n.php |
| 9 | + * @ingroup SemanticUpdateOnPurge |
| 10 | + * @author Daniel Werner < danweetz@web.de > |
| 11 | + */ |
| 12 | + |
| 13 | +$messages = array(); |
| 14 | + |
| 15 | +/** English |
| 16 | + * @author Daniel Werner |
| 17 | + */ |
| 18 | +$messages['en'] = array( |
| 19 | + 'suop-desc' => 'Updates semantic attributes of a wiki page when purging the page', |
| 20 | +); |
| 21 | + |
| 22 | +/** Asturian (Asturianu) |
| 23 | + * @author Xuacu |
| 24 | + */ |
| 25 | +$messages['ast'] = array( |
| 26 | + 'suop-desc' => "Anueva los atributos semánticos d'una páxina wiki al purgar la páxina", |
| 27 | +); |
| 28 | + |
| 29 | +/** German (Deutsch) |
| 30 | + * @author Daniel Werner |
| 31 | + * @author Kghbln |
| 32 | + */ |
| 33 | +$messages['de'] = array( |
| 34 | + 'suop-desc' => 'Aktualisiert die semantischen Attribute auf einer Wiki-Seite, wenn deren Seitencache durch die Aktion „purge“ geleert wird', |
| 35 | +); |
| 36 | + |
| 37 | +/** French (Français) |
| 38 | + * @author Sherbrooke |
| 39 | + */ |
| 40 | +$messages['fr'] = array( |
| 41 | + 'suop-desc' => "Met à jour les attributs sémantiques d'une page wiki quand son cache est purgé", |
| 42 | +); |
| 43 | + |
| 44 | +/** Galician (Galego) |
| 45 | + * @author Toliño |
| 46 | + */ |
| 47 | +$messages['gl'] = array( |
| 48 | + 'suop-desc' => 'Actualiza os atributos semánticos dunha páxina wiki ao purgar a páxina', |
| 49 | +); |
| 50 | + |
| 51 | +/** Upper Sorbian (Hornjoserbsce) |
| 52 | + * @author Michawiki |
| 53 | + */ |
| 54 | +$messages['hsb'] = array( |
| 55 | + 'suop-desc' => 'Aktualizuje semantiske atributy wikistrony, hdyž so pufrowak strony wuprózdnja', |
| 56 | +); |
| 57 | + |
| 58 | +/** Interlingua (Interlingua) |
| 59 | + * @author McDutchie |
| 60 | + */ |
| 61 | +$messages['ia'] = array( |
| 62 | + 'suop-desc' => 'Actualisa le attributos semantic de un pagina wiki quando le pagina es purgate', |
| 63 | +); |
| 64 | + |
| 65 | +/** Luxembourgish (Lëtzebuergesch) |
| 66 | + * @author Robby |
| 67 | + */ |
| 68 | +$messages['lb'] = array( |
| 69 | + 'suop-desc' => "Aktualiséiert déi semantesch Attributer vun enger Wiki-Säit wann d'Säite komplett eidel gemaach gëtt (purging the page)", |
| 70 | +); |
| 71 | + |
| 72 | +/** Macedonian (Македонски) |
| 73 | + * @author Bjankuloski06 |
| 74 | + */ |
| 75 | +$messages['mk'] = array( |
| 76 | + 'suop-desc' => 'Ги подновува семантичките атрибути на една вики-страница при нејзино пречистување (на кешот)', |
| 77 | +); |
| 78 | + |
| 79 | +/** Malay (Bahasa Melayu) |
| 80 | + * @author Anakmalaysia |
| 81 | + */ |
| 82 | +$messages['ms'] = array( |
| 83 | + 'suop-desc' => 'Mengemaskinikan atribut-atribut semantik pada laman wiki sewaktu menyingkirkan laman', |
| 84 | +); |
| 85 | + |
| 86 | +/** Dutch (Nederlands) |
| 87 | + * @author Siebrand |
| 88 | + */ |
| 89 | +$messages['nl'] = array( |
| 90 | + 'suop-desc' => 'Werkt semantische eigenschappen van een wikipagina bij als de pagina uit de cache wordt verwijderd', |
| 91 | +); |
| 92 | + |
| 93 | +/** Norwegian (bokmål) (Norsk (bokmål)) |
| 94 | + * @author Event |
| 95 | + */ |
| 96 | +$messages['no'] = array( |
| 97 | + 'suop-desc' => 'Oppdater semantiske attributter for en wikiside når siden blir ryddet', |
| 98 | +); |
| 99 | + |
Property changes on: tags/extensions/SemanticUpdateOnPurge/REL_0_4_1/SemanticUpdateOnPurge.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 100 | + native |
Index: tags/extensions/SemanticUpdateOnPurge/REL_0_4_1/SemanticUpdateOnPurge.php |
— | — | @@ -0,0 +1,125 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Updates Semantic MediaWikis properties of an article when the article is purged. |
| 6 | + * SMW standard behavior is to update properties only on page save (as of SMW 1.6) |
| 7 | + * |
| 8 | + * Documentation: http://www.mediawiki.org/wiki/Extension:SemanticUpdateOnPurge |
| 9 | + * Support: http://www.mediawiki.org/wiki/Extension_talk:SemanticUpdateOnPurge |
| 10 | + * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticUpdateOnPurge |
| 11 | + * |
| 12 | + * @version: 0.4.1 |
| 13 | + * @license: ISC license |
| 14 | + * @author: Daniel Werner < danweetz@web.de > |
| 15 | + * |
| 16 | + * @file SemanticUpdateOnPurge.php |
| 17 | + * @ingroup SemanticUpdateOnPurge |
| 18 | + */ |
| 19 | + |
| 20 | +if ( !defined( 'MEDIAWIKI' ) ) { die(); } |
| 21 | + |
| 22 | +# Credits |
| 23 | +$wgExtensionCredits[ defined( 'SEMANTIC_EXTENSION_TYPE' ) ? 'semantic' : 'other' ][] = array( |
| 24 | + 'path' => __FILE__, |
| 25 | + 'name' => 'SemanticUpdateOnPurge', |
| 26 | + 'descriptionmsg' => 'suop-desc', |
| 27 | + 'version' => ExtSemanticUpdateOnPurge::VERSION, |
| 28 | + 'author' => '[http://www.mediawiki.org/wiki/User:Danwe Daniel Werner]', |
| 29 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:SemanticUpdateOnPurge', |
| 30 | +); |
| 31 | + |
| 32 | +// language file: |
| 33 | +$wgExtensionMessagesFiles['SemanticUpdateOnPurge'] = ExtSemanticUpdateOnPurge::getDir() . '/SemanticUpdateOnPurge.i18n.php'; |
| 34 | + |
| 35 | +// hooks registration: |
| 36 | +$wgHooks[ 'ArticlePurge' ][] = 'ExtSemanticUpdateOnPurge::onArticlePurge'; |
| 37 | +$wgHooks[ 'ParserAfterTidy' ][] = 'ExtSemanticUpdateOnPurge::onParserAfterTidy'; |
| 38 | + |
| 39 | + |
| 40 | +/** |
| 41 | + * Extension class with all the extension functionality |
| 42 | + */ |
| 43 | +class ExtSemanticUpdateOnPurge { |
| 44 | + |
| 45 | + /** |
| 46 | + * Version of the RegexFun extension. |
| 47 | + * |
| 48 | + * @since 0.2.1 |
| 49 | + * |
| 50 | + * @var string |
| 51 | + */ |
| 52 | + const VERSION = '0.4.1'; |
| 53 | + |
| 54 | + /** |
| 55 | + * contains Title::getPrefixedDBkey() values as keys, and 'true' as value |
| 56 | + * if the titles semantics should be updated. Usually only one title, just make sure |
| 57 | + * this will also work if there are some weird internal purge processing is going on |
| 58 | + * or several parser processes running recursivelly |
| 59 | + * |
| 60 | + * @since 0.3 |
| 61 | + * |
| 62 | + * @var Array |
| 63 | + */ |
| 64 | + private static $mUpdateTitles = array(); |
| 65 | + |
| 66 | + /** |
| 67 | + * Returns the extensions base installation directory. |
| 68 | + * |
| 69 | + * @since 0.4 |
| 70 | + * |
| 71 | + * @return string |
| 72 | + */ |
| 73 | + public static function getDir() { |
| 74 | + static $dir = null; |
| 75 | + |
| 76 | + if( $dir === null ) { |
| 77 | + $dir = dirname( __FILE__ ); |
| 78 | + } |
| 79 | + return $dir; |
| 80 | + } |
| 81 | + |
| 82 | + public static function onArticlePurge( &$article ) { |
| 83 | + self::addUpdateTitle( $article->getTitle() ); |
| 84 | + return true; |
| 85 | + } |
| 86 | + |
| 87 | + /* Note: SMW uses the hook "LinksUpdateConstructed" for this which apparently won't get |
| 88 | + * called when purging the article. So we have to stick with this one here. |
| 89 | + */ |
| 90 | + public static function onParserAfterTidy( &$parser, &$text ) { |
| 91 | + $title = $parser->getTitle(); |
| 92 | + // make sure this isn't some title we didn't wanted to purge in the first place: |
| 93 | + if( self::hasUpdateTitle( $title ) ) { |
| 94 | + /* |
| 95 | + * Note: don't use SMWUpdateJob here because it would parse the whole article again and |
| 96 | + * could cause some problems with very dynamic extensions like Extension:Variables. |
| 97 | + */ |
| 98 | + $output = $parser->getOutput(); |
| 99 | + |
| 100 | + // only update if the page contains semantic data: |
| 101 | + if( isset( $output->mSMWData ) ) { |
| 102 | + SMWParseData::storeData( $output, $title, true ); |
| 103 | + } |
| 104 | + self::removeUpdateTitle( $title ); |
| 105 | + } |
| 106 | + return true; |
| 107 | + } |
| 108 | + |
| 109 | + private static function addUpdateTitle( Title $title ) { |
| 110 | + self::$mUpdateTitles[ $title->getPrefixedDBkey() ] = true; |
| 111 | + } |
| 112 | + |
| 113 | + private static function removeUpdateTitle( Title $title ) { |
| 114 | + if( self::hasUpdateTitle( $title ) ) { |
| 115 | + unset( self::$mUpdateTitles[ $title->getPrefixedDBkey() ] ); |
| 116 | + return true; |
| 117 | + } |
| 118 | + return false; |
| 119 | + } |
| 120 | + |
| 121 | + private static function hasUpdateTitle( Title $title ) { |
| 122 | + $key = $title->getPrefixedDBkey(); |
| 123 | + return ( isset( self::$mUpdateTitles[ $key ] ) && self::$mUpdateTitles[ $key ] === true ); |
| 124 | + } |
| 125 | + |
| 126 | +} |
\ No newline at end of file |
Property changes on: tags/extensions/SemanticUpdateOnPurge/REL_0_4_1/SemanticUpdateOnPurge.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 127 | + native |
Index: tags/extensions/SemanticUpdateOnPurge/REL_0_4_1/README |
— | — | @@ -0,0 +1,30 @@ |
| 2 | +== About == |
| 3 | + |
| 4 | +'SemanticUpdateOnPurge' is a 'Semantic MediaWiki' [0] extension by Daniel Werner. It updates Semantic MediaWikis |
| 5 | +properties of an article whenever the article is purged. |
| 6 | +SMW standard behavior is to update properties only on page save (as of SMW 1.6) |
| 7 | + |
| 8 | + |
| 9 | +== Installation == |
| 10 | + |
| 11 | +Once you have downloaded the code, place the 'SemanticUpdateOnPurge' directory within your MediaWiki 'extensions' |
| 12 | +directory. Then add the following code to your [[Manual:LocalSettings.php|LocalSettings.php]] file: |
| 13 | + |
| 14 | + # SemanticUpdateOnPurge |
| 15 | + require_once( "$IP/extensions/SemanticUpdateOnPurge/SemanticUpdateOnPurge.php" ); |
| 16 | + |
| 17 | + |
| 18 | +== Compatibility == |
| 19 | + |
| 20 | +Versions 0.2.1 to 0.4 are tested on SMW 1.6.1 and 1.6.2 (propably working with 1.6 too) There have been some issues |
| 21 | +with some versions of the SMW 1.5.x branch, where in early versions the extension seemed to work, then it didn't. |
| 22 | + |
| 23 | + |
| 24 | +== Contributing == |
| 25 | + |
| 26 | +If you have bug reports or requests, please add them to the 'SemanticUpdateOnPurge' Talk page [1]. |
| 27 | +You can also send them to Daniel Werner < danweetz@web.de > |
| 28 | + |
| 29 | + |
| 30 | +[0] 'Semantic MediaWiki' is a MediaWiki extension. More information at: http://semantic-mediawiki.org |
| 31 | +[1] http://www.mediawiki.org/w/index.php?title=Extension_talk:SemanticUpdateOnPurge |
\ No newline at end of file |
Property changes on: tags/extensions/SemanticUpdateOnPurge/REL_0_4_1/README |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 32 | + native |