r105270 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105269‎ | r105270 | r105271 >
Date:01:31, 6 December 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
0.4.1 rel
Modified paths:
  • /trunk/extensions/SemanticTasks/INSTALL (modified) (history)
  • /trunk/extensions/SemanticTasks/RELEASE-NOTES (added) (history)
  • /trunk/extensions/SemanticTasks/SemanticTasks.classes.php (modified) (history)
  • /trunk/extensions/SemanticTasks/SemanticTasks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticTasks/SemanticTasks.php
@@ -1,13 +1,13 @@
22 <?php
33
44 if ( !defined( 'MEDIAWIKI' ) ) {
5 - echo "Not a valid entry point";
 5+ echo 'Not a valid entry point';
66 exit( 1 );
77 }
88
99 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 );
1212 }
1313
1414 #
@@ -18,29 +18,26 @@
1919 $stScriptPath = $wgScriptPath . '/extensions/SemanticTasks';
2020 #
2121
22 -# Informations
 22+# Extension credits
2323 $wgExtensionCredits[defined( 'SEMANTIC_EXTENSION_TYPE' ) ? 'semantic' : 'parserhook'][] = array(
2424 'path' => __FILE__,
2525 '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',
2832 'url' => 'http://www.mediawiki.org/wiki/Extension:Semantic_Tasks',
2933 'descriptionmsg' => 'semantictasks-desc',
3034 );
3135
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 -
3636 // i18n
3737 $wgExtensionMessagesFiles['SemanticTasks'] = dirname( __FILE__ ) . '/SemanticTasks.i18n.php';
3838
39 -$dir = dirname( __FILE__ ) . '/';
40 -$wgAutoloadClasses['SemanticTasksMailer'] = $dir . 'SemanticTasks.classes.php';
 39+// Autoloading
 40+$wgAutoloadClasses['SemanticTasksMailer'] = dirname( __FILE__ ) . '/SemanticTasks.classes.php';
4141
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
36
 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+
427 == Installation ==
528
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 @@
22 <?php
33
44 if ( !defined( 'MEDIAWIKI' ) ) {
5 - echo "Not a valid entry point";
 5+ echo 'Not a valid entry point';
66 exit( 1 );
77 }
88
99 if ( !defined( 'SMW_VERSION' ) ) {
10 - echo "This extension requires Semantic MediaWiki to be installed.";
 10+ echo 'This extension requires Semantic MediaWiki to be installed.';
1111 exit( 1 );
1212 }
1313
1414 // 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 );
1919
2020 /**
2121 * This class handles the creation and sending of notification emails.
2222 */
2323 class SemanticTasksMailer {
 24+
2425 private static $task_assignees;
2526 private static $task_status;
2627
27 - function findOldValues( &$article, &$user, &$text, &$summary, $minor, $watch, $sectionanchor, &$flags ) {
 28+ public static function findOldValues( &$article, &$user, &$text, &$summary, $minor, $watch, $sectionanchor, &$flags ) {
2829 $title = $article->getTitle();
2930 $title_text = $title->getFullText();
3031
@@ -44,8 +45,7 @@
4546 return true;
4647 }
4748
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 ) {
5050 if ( !$minoredit ) {
5151 // Get the revision count to determine if new article
5252 $rev = $article->estimateRevisionCount();
@@ -259,9 +259,6 @@
260260 global $wgSitename;
261261
262262 if ( !empty( $assignees ) ) {
263 - // i18n
264 - wfLoadExtensionMessages( 'SemanticTasks' );
265 -
266263 $title_text = $title->getFullText();
267264 $from = new MailAddress( $user->getEmail(), $user->getName() );
268265 $link = $title->escapeFullURL();
@@ -327,9 +324,6 @@
328325 * @return TODO
329326 */
330327 static function getQueryResults( $query_string, $properties_to_display, $display_title ) {
331 - // i18n
332 - wfLoadExtensionMessages( 'SemanticTasks' );
333 -
334328 // We use the Semantic MediaWiki Processor
335329 // $smwgIP is defined by Semantic MediaWiki, and we don't allow
336330 // this file to be sourced unless Semantic MediaWiki is included.
@@ -358,6 +352,11 @@
359353 array_push( $printouts, $to_push );
360354 }
361355
 356+ if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) {
 357+ SMWQueryProcessor::addThisPrintout( $printouts, $params );
 358+ $params = SMWQueryProcessor::getProcessedParams( $params, $printouts );
 359+ }
 360+
362361 $query = SMWQueryProcessor::createQuery( $query_string, $params, $inline, $format, $printouts );
363362 $results = smwfGetStore()->getQueryResult( $query );
364363
@@ -429,11 +428,12 @@
430429
431430 if ( $wgSemanticTasksDebug ) {
432431 if ( isset( $debugArr ) ) {
433 - $text = $debugText . " " . implode( "::", $debugArr );
 432+ $text = $debugText . ' ' . implode( '::', $debugArr );
434433 wfDebugLog( 'semantic-tasks', $text, false );
435434 } else {
436435 wfDebugLog( 'semantic-tasks', $debugText, false );
437436 }
438437 }
439438 }
 439+
440440 }

Status & tagging log