Index: trunk/extensions/SemanticTasks/SemanticTasks.php |
— | — | @@ -1,13 +1,13 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | if ( !defined( 'MEDIAWIKI' ) ) { |
5 | | - echo "Not a valid entry point"; |
| 5 | + echo 'Not a valid entry point'; |
6 | 6 | exit( 1 ); |
7 | 7 | } |
8 | 8 | |
9 | 9 | if ( !defined( 'SMW_VERSION' ) ) { |
10 | | - echo "This extension requires Semantic MediaWiki to be installed."; |
11 | | - exit( 1 ); |
| 10 | + echo 'This extension requires Semantic MediaWiki to be installed.'; |
| 11 | + exit( 1 ); |
12 | 12 | } |
13 | 13 | |
14 | 14 | # |
— | — | @@ -18,29 +18,26 @@ |
19 | 19 | $stScriptPath = $wgScriptPath . '/extensions/SemanticTasks'; |
20 | 20 | # |
21 | 21 | |
22 | | -# Informations |
| 22 | +# Extension credits |
23 | 23 | $wgExtensionCredits[defined( 'SEMANTIC_EXTENSION_TYPE' ) ? 'semantic' : 'parserhook'][] = array( |
24 | 24 | 'path' => __FILE__, |
25 | 25 | 'name' => 'SemanticTasks', |
26 | | - 'author' => 'Steren Giannini, Ryan Lane', |
27 | | - 'version' => '1.4', |
| 26 | + 'author' => array( |
| 27 | + 'Steren Giannini', |
| 28 | + 'Ryan Lane', |
| 29 | + '[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]' |
| 30 | + ), |
| 31 | + 'version' => '1.4.1', |
28 | 32 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Semantic_Tasks', |
29 | 33 | 'descriptionmsg' => 'semantictasks-desc', |
30 | 34 | ); |
31 | 35 | |
32 | | -// Do st_SetupExtension after the mediawiki setup, AND after SemanticMediaWiki setup |
33 | | -// FIXME: only hook added is ArticleSaveComplete. There appears to be no need for this. |
34 | | -$wgExtensionFunctions[] = 'SemanticTasksSetupExtension'; |
35 | | - |
36 | 36 | // i18n |
37 | 37 | $wgExtensionMessagesFiles['SemanticTasks'] = dirname( __FILE__ ) . '/SemanticTasks.i18n.php'; |
38 | 38 | |
39 | | -$dir = dirname( __FILE__ ) . '/'; |
40 | | -$wgAutoloadClasses['SemanticTasksMailer'] = $dir . 'SemanticTasks.classes.php'; |
| 39 | +// Autoloading |
| 40 | +$wgAutoloadClasses['SemanticTasksMailer'] = dirname( __FILE__ ) . '/SemanticTasks.classes.php'; |
41 | 41 | |
42 | | -function SemanticTasksSetupExtension() { |
43 | | - global $wgHooks; |
44 | | - $wgHooks['ArticleSaveComplete'][] = 'SemanticTasksMailer::mailAssigneesUpdatedTask'; |
45 | | - $wgHooks['ArticleSave'][] = 'SemanticTasksMailer::findOldValues'; |
46 | | - return true; |
47 | | -} |
| 42 | +// Hooks |
| 43 | +$wgHooks['ArticleSaveComplete'][] = 'SemanticTasksMailer::mailAssigneesUpdatedTask'; |
| 44 | +$wgHooks['ArticleSave'][] = 'SemanticTasksMailer::findOldValues'; |
Index: trunk/extensions/SemanticTasks/INSTALL |
— | — | @@ -1,9 +1,33 @@ |
2 | | -[[Semantic Tasks 1.2]] |
| 2 | +These is the install file for the Semantic Tasks extension. |
| 3 | + |
| 4 | +Extension page on mediawiki.org: https://www.mediawiki.org/wiki/Extension:Semantic_Tasks |
| 5 | +Latest version of the install file: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticTasks/INSTALL?view=co |
3 | 6 | |
| 7 | + |
| 8 | +== Requirements == |
| 9 | + |
| 10 | +Semantic Tasks requires: |
| 11 | + |
| 12 | +* MediaWiki 1.16 or above, 1.18 or above recommended |
| 13 | +* PHP 5.2 or above, 5.3 or above recommended |
| 14 | +* Semantic MediaWiki 1.5 or above, 1.7 or above recommended |
| 15 | + |
| 16 | +== Download == |
| 17 | + |
| 18 | +You can get the code directly from SVN. Tags can be obtained via |
| 19 | + |
| 20 | + svn checkout http://svn.wikimedia.org/svnroot/mediawiki/tags/extensions/SemanticTasks/REL_version |
| 21 | + |
| 22 | +Where 'version' is the version number of the tag, such as 0_1 (see the available tags at http://svn.wikimedia.org/svnroot/mediawiki/tags/extensions/SemanticTasks/). |
| 23 | +The latest code can be obtained from trunk: |
| 24 | + |
| 25 | + svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SemanticTasks/ |
| 26 | + |
4 | 27 | == Installation == |
5 | 28 | |
6 | | -(1) Extract the archive to obtain the directory "SemanticTasks" |
7 | | - that contains all relevant files. Copy this directory (or |
8 | | - extract/download it) to "[wikipath]/extensions/". |
9 | | -(2) Insert the following line into the file "[wikipath]/LocalSettings.php": |
10 | | - require_once( "$IP/extensions/SemanticTasks/SemanticTasks.php" ); |
| 29 | +Once you have downloaded the code, place the ''SemanticTasks'' directory within your MediaWiki |
| 30 | +'extensions' directory. Then add the following code to your [[Manual:LocalSettings.php|LocalSettings.php]] file: |
| 31 | + |
| 32 | +# Semantic Tasks |
| 33 | +require_once( "$IP/extensions/SemanticTasks/SemanticTasks.php" ); |
| 34 | + |
\ No newline at end of file |
Index: trunk/extensions/SemanticTasks/RELEASE-NOTES |
— | — | @@ -0,0 +1,17 @@ |
| 2 | +These are the release notes for the Semantic Tasks extension. |
| 3 | + |
| 4 | +Extension page on mediawiki.org: https://www.mediawiki.org/wiki/Extension:Semantic_Tasks |
| 5 | +Latest version of the release notes: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticTasks/RELEASE-NOTES?view=co |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +=== Version 0.4.1 === |
| 10 | +2011-12-06 |
| 11 | + |
| 12 | +* Added support for Semantic MediaWiki 1.7 and later. |
| 13 | +* Dropped support for MediaWiki 1.15.x and earlier. |
| 14 | + |
| 15 | +=== Version 0.4 === |
| 16 | +June 2010 |
| 17 | + |
| 18 | +* Fixed bug that caused notifications to fail in non-main namespaces. |
\ No newline at end of file |
Index: trunk/extensions/SemanticTasks/SemanticTasks.classes.php |
— | — | @@ -1,29 +1,30 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | if ( !defined( 'MEDIAWIKI' ) ) { |
5 | | - echo "Not a valid entry point"; |
| 5 | + echo 'Not a valid entry point'; |
6 | 6 | exit( 1 ); |
7 | 7 | } |
8 | 8 | |
9 | 9 | if ( !defined( 'SMW_VERSION' ) ) { |
10 | | - echo "This extension requires Semantic MediaWiki to be installed."; |
| 10 | + echo 'This extension requires Semantic MediaWiki to be installed.'; |
11 | 11 | exit( 1 ); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // constants for message type |
15 | | -define( "NEWTASK", 0 ); |
16 | | -define( "UPDATE", 1 ); |
17 | | -define( "ASSIGNED", 2 ); |
18 | | -define( "CLOSED", 3 ); |
| 15 | +define( 'NEWTASK', 0 ); |
| 16 | +define( 'UPDATE', 1 ); |
| 17 | +define( 'ASSIGNED', 2 ); |
| 18 | +define( 'CLOSED', 3 ); |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * This class handles the creation and sending of notification emails. |
22 | 22 | */ |
23 | 23 | class SemanticTasksMailer { |
| 24 | + |
24 | 25 | private static $task_assignees; |
25 | 26 | private static $task_status; |
26 | 27 | |
27 | | - function findOldValues( &$article, &$user, &$text, &$summary, $minor, $watch, $sectionanchor, &$flags ) { |
| 28 | + public static function findOldValues( &$article, &$user, &$text, &$summary, $minor, $watch, $sectionanchor, &$flags ) { |
28 | 29 | $title = $article->getTitle(); |
29 | 30 | $title_text = $title->getFullText(); |
30 | 31 | |
— | — | @@ -44,8 +45,7 @@ |
45 | 46 | return true; |
46 | 47 | } |
47 | 48 | |
48 | | - |
49 | | - function mailAssigneesUpdatedTask( $article, $current_user, $text, $summary, $minoredit, $watchthis, $sectionanchor, $flags, $revision ) { |
| 49 | + public static function mailAssigneesUpdatedTask( $article, $current_user, $text, $summary, $minoredit, $watchthis, $sectionanchor, $flags, $revision ) { |
50 | 50 | if ( !$minoredit ) { |
51 | 51 | // Get the revision count to determine if new article |
52 | 52 | $rev = $article->estimateRevisionCount(); |
— | — | @@ -259,9 +259,6 @@ |
260 | 260 | global $wgSitename; |
261 | 261 | |
262 | 262 | if ( !empty( $assignees ) ) { |
263 | | - // i18n |
264 | | - wfLoadExtensionMessages( 'SemanticTasks' ); |
265 | | - |
266 | 263 | $title_text = $title->getFullText(); |
267 | 264 | $from = new MailAddress( $user->getEmail(), $user->getName() ); |
268 | 265 | $link = $title->escapeFullURL(); |
— | — | @@ -327,9 +324,6 @@ |
328 | 325 | * @return TODO |
329 | 326 | */ |
330 | 327 | static function getQueryResults( $query_string, $properties_to_display, $display_title ) { |
331 | | - // i18n |
332 | | - wfLoadExtensionMessages( 'SemanticTasks' ); |
333 | | - |
334 | 328 | // We use the Semantic MediaWiki Processor |
335 | 329 | // $smwgIP is defined by Semantic MediaWiki, and we don't allow |
336 | 330 | // this file to be sourced unless Semantic MediaWiki is included. |
— | — | @@ -358,6 +352,11 @@ |
359 | 353 | array_push( $printouts, $to_push ); |
360 | 354 | } |
361 | 355 | |
| 356 | + if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) { |
| 357 | + SMWQueryProcessor::addThisPrintout( $printouts, $params ); |
| 358 | + $params = SMWQueryProcessor::getProcessedParams( $params, $printouts ); |
| 359 | + } |
| 360 | + |
362 | 361 | $query = SMWQueryProcessor::createQuery( $query_string, $params, $inline, $format, $printouts ); |
363 | 362 | $results = smwfGetStore()->getQueryResult( $query ); |
364 | 363 | |
— | — | @@ -429,11 +428,12 @@ |
430 | 429 | |
431 | 430 | if ( $wgSemanticTasksDebug ) { |
432 | 431 | if ( isset( $debugArr ) ) { |
433 | | - $text = $debugText . " " . implode( "::", $debugArr ); |
| 432 | + $text = $debugText . ' ' . implode( '::', $debugArr ); |
434 | 433 | wfDebugLog( 'semantic-tasks', $text, false ); |
435 | 434 | } else { |
436 | 435 | wfDebugLog( 'semantic-tasks', $debugText, false ); |
437 | 436 | } |
438 | 437 | } |
439 | 438 | } |
| 439 | + |
440 | 440 | } |