Index: trunk/extensions/DSMW/CHANGELOG |
— | — | @@ -1,5 +1,9 @@ |
2 | 2 | For more documentation, see http://www.dsmw.org |
3 | 3 | |
| 4 | +== DSMW 1.1 == |
| 5 | + |
| 6 | +* Stylized all files using the stylize.php script. |
| 7 | + |
4 | 8 | == DSMW 1.0 == |
5 | 9 | * Tested with MW-1.16.0 |
6 | 10 | * better user interface with Ajax |
Index: trunk/extensions/DSMW/DSMW.php |
— | — | @@ -23,6 +23,7 @@ |
24 | 24 | } |
25 | 25 | |
26 | 26 | require_once "$IP/includes/GlobalFunctions.php"; |
| 27 | +require_once dirname( __FILE__ ) . '/includes/DSMW_GlobalFunctions.php'; |
27 | 28 | $wgDSMWIP = dirname( __FILE__ ); |
28 | 29 | |
29 | 30 | require_once( "$wgDSMWIP/includes/DSMWButton.php" ); |
— | — | @@ -135,6 +136,28 @@ |
136 | 137 | $wgAutoloadLocalClasses['UploadFromUrl'] = dirname( __FILE__ ) . '/api/upload/UploadFromUrl.php'; |
137 | 138 | } |
138 | 139 | |
| 140 | +function dsmwgSetupFunction() { |
| 141 | + global $smwgNamespacesWithSemanticLinks; |
139 | 142 | |
| 143 | + // This function has been deprecated in 1.16, but needed for earlier versions. |
| 144 | + // It's present in 1.16 as a stub, but lets check if it exists in case it gets removed at some point. |
| 145 | + if ( function_exists( 'wfLoadExtensionMessages' ) ) { |
| 146 | + wfLoadExtensionMessages( 'DSMW' ); |
| 147 | + } |
| 148 | + |
| 149 | + $smwgNamespacesWithSemanticLinks += array( |
| 150 | + PATCH => true, |
| 151 | + PUSHFEED => true, |
| 152 | + PULLFEED => true, |
| 153 | + CHANGESET => true |
| 154 | + ); |
140 | 155 | |
141 | | -require_once dirname( __FILE__ ) . 'DSMW_Settings.php'; |
| 156 | + if ( defined( 'SRF_VERSION' ) ) { |
| 157 | + global $wgDSMWExhibits; |
| 158 | + if ( !is_object( $wgDSMWExhibits ) ) { |
| 159 | + $wgDSMWExhibits = new DSMWExhibits(); |
| 160 | + } |
| 161 | + } |
| 162 | +} |
| 163 | + |
| 164 | +require_once dirname( __FILE__ ) . '/DSMW_Settings.php'; |
Index: trunk/extensions/DSMW/includes/DSMW_GlobalFunctions.php |
— | — | @@ -213,6 +213,7 @@ |
214 | 214 | wfDebugLog( 'p2p', 'push on ' ); |
215 | 215 | $patches = array(); |
216 | 216 | $tmpPatches = array(); |
| 217 | + |
217 | 218 | if ( isset( $_POST['name'] ) ) { |
218 | 219 | $name1 = $_POST['name']; |
219 | 220 | if ( !is_array( $name1 ) ) |
— | — | @@ -221,13 +222,17 @@ |
222 | 223 | wfDebugLog( 'p2p', ' - ' . $push ); |
223 | 224 | } |
224 | 225 | } |
225 | | - else |
226 | | - $name1 = ""; |
227 | | - if ( $name1 == "" ) { |
| 226 | + else { |
| 227 | + $name1 = ''; |
| 228 | + } |
| 229 | + |
| 230 | + if ( $name1 == '' ) { |
228 | 231 | utils::writeAndFlush( '<p><b>No pushfeed selected!</b></p>' ); |
| 232 | + |
229 | 233 | $title = Title::newFromText( 'Special:ArticleAdminPage' ); |
230 | 234 | $article = new Article( $title ); |
231 | 235 | $article->doRedirect(); |
| 236 | + |
232 | 237 | return false; |
233 | 238 | } |
234 | 239 | |
— | — | @@ -381,7 +386,6 @@ |
382 | 387 | $article->doEdit( $newtext, $summary = "" ); |
383 | 388 | $article->doRedirect(); |
384 | 389 | |
385 | | - |
386 | 390 | return false; |
387 | 391 | } |
388 | 392 | |
— | — | @@ -393,9 +397,11 @@ |
394 | 398 | if ( !is_array( $name1 ) ) |
395 | 399 | $name1 = array( $name1 ); |
396 | 400 | } |
397 | | - else |
398 | | - $name1 = ""; |
399 | | - if ( $name1 == "" ) { |
| 401 | + else { |
| 402 | + $name1 = ''; |
| 403 | + } |
| 404 | + |
| 405 | + if ( $name1 == '' ) { |
400 | 406 | utils::writeAndFlush( '<p><b>No pullfeed selected!</b></p> ' ); |
401 | 407 | $title = Title::newFromText( 'Special:ArticleAdminPage' ); |
402 | 408 | $article = new Article( $title ); |
— | — | @@ -418,23 +424,28 @@ |
419 | 425 | if ( $previousCSID == false ) { |
420 | 426 | $previousCSID = "none"; |
421 | 427 | } |
| 428 | + |
422 | 429 | wfDebugLog( 'p2p', ' -> pullHead : ' . $previousCSID ); |
| 430 | + |
423 | 431 | $relatedPushServer = getPushURL( $name ); |
424 | | - if ( is_null( $relatedPushServer ) |
425 | | - |
426 | | - )throw new MWException( __METHOD__ . ': no relatedPushServer url' ); |
| 432 | + if ( is_null( $relatedPushServer ) ) { |
| 433 | + throw new MWException( __METHOD__ . ': no relatedPushServer url' ); |
| 434 | + } |
| 435 | + |
427 | 436 | $namePush = getPushName( $name ); |
428 | 437 | $namePush = str_replace( ' ', '_', $namePush ); |
| 438 | + |
429 | 439 | wfDebugLog( 'p2p', ' -> pushServer : ' . $relatedPushServer ); |
430 | 440 | wfDebugLog( 'p2p', ' -> pushName : ' . $namePush ); |
431 | | - if ( is_null( $namePush ) |
432 | | - |
433 | | - )throw new MWException( __METHOD__ . ': no PushName' ); |
| 441 | + |
| 442 | + if ( is_null( $namePush ) ) { |
| 443 | + throw new MWException( __METHOD__ . ': no PushName' ); |
| 444 | + } |
| 445 | + |
434 | 446 | // split NS and name |
435 | 447 | preg_match( "/^(.+?)_*:_*(.*)$/S", $namePush, $m ); |
436 | 448 | $nameWithoutNS = $m[2]; |
437 | 449 | |
438 | | - |
439 | 450 | // $url = $relatedPushServer.'/api.php?action=query&meta=changeSet&cspushName='.$nameWithoutNS.'&cschangeSet='.$previousCSID.'&format=xml'; |
440 | 451 | // $url = $relatedPushServer."/api{$wgScriptExtension}?action=query&meta=changeSet&cspushName=".$nameWithoutNS.'&cschangeSet='.$previousCSID.'&format=xml'; |
441 | 452 | wfDebugLog( 'testlog', ' -> request ChangeSet : ' . $relatedPushServer . '/api.php?action=query&meta=changeSet&cspushName=' . $nameWithoutNS . '&cschangeSet=' . $previousCSID . '&format=xml' ); |
— | — | @@ -446,10 +457,10 @@ |
447 | 458 | if ( strpos( $cs, "<?xml version=\"1.0\"?>" ) === false ) { |
448 | 459 | $cs = utils::file_get_contents_curl( utils::lcfirst( $relatedPushServer ) . "/api.php5?action=query&meta=changeSet&cspushName=" . $nameWithoutNS . '&cschangeSet=' . $previousCSID . '&format=xml' ); |
449 | 460 | } |
450 | | - if ( strpos( $cs, "<?xml version=\"1.0\"?>" ) === false ) |
451 | | - $cs = false; |
| 461 | + if ( strpos( $cs, "<?xml version=\"1.0\"?>" ) === false ) { |
| 462 | + $cs = false; |
| 463 | + } |
452 | 464 | |
453 | | - |
454 | 465 | if ( $cs === false ) |
455 | 466 | throw new MWException( __METHOD__ . ': Cannot connect to Push Server (ChangeSet API)' ); |
456 | 467 | $cs = trim( $cs ); |
— | — | @@ -458,13 +469,16 @@ |
459 | 470 | |
460 | 471 | $changeSet = $dom->getElementsByTagName( 'changeSet' ); |
461 | 472 | $CSID = null; |
| 473 | + |
462 | 474 | foreach ( $changeSet as $cs ) { |
463 | 475 | if ( $cs->hasAttribute( "id" ) ) { |
464 | 476 | $CSID = $cs->getAttribute( 'id' ); |
465 | 477 | $csName = $CSID; |
466 | 478 | } |
467 | 479 | } |
| 480 | + |
468 | 481 | wfDebugLog( 'p2p', ' -> changeSet found ' . $CSID ); |
| 482 | + |
469 | 483 | while ( $CSID != null ) { |
470 | 484 | // if(!utils::pageExist($CSID)) { |
471 | 485 | $listPatch = null; |
— | — | @@ -518,10 +532,12 @@ |
519 | 533 | wfDebugLog( 'p2p', ' - redirect to ChangeSet:' . $csName ); |
520 | 534 | } |
521 | 535 | }// end foreach list pullfeed |
| 536 | + |
522 | 537 | utils::writeAndFlush( '<p><b>End pull</b></p>' ); |
523 | 538 | $title = Title::newFromText( 'Special:ArticleAdminPage' ); |
524 | 539 | $article = new Article( $title ); |
525 | 540 | $article->doRedirect(); |
| 541 | + |
526 | 542 | return false; |
527 | 543 | } else { |
528 | 544 | return true; |
— | — | @@ -572,14 +588,15 @@ |
573 | 589 | $urlServer = 'http://' . $wgServerName . $wgScriptPath; |
574 | 590 | |
575 | 591 | $ns = $editpage->mTitle->getNamespace(); |
576 | | - if ( ( $ns == PATCH ) || ( $ns == PUSHFEED ) || ( $ns == PULLFEED ) || ( $ns == CHANGESET ) |
| 592 | + if ( ( $ns == PATCH ) || ( $ns == PUSHFEED ) || ( $ns == PULLFEED ) || ( $ns == CHANGESET ) ) { |
| 593 | + return true; |
| 594 | + } |
577 | 595 | |
578 | | - )return true; |
579 | | - |
580 | 596 | $actualtext = $editpage->textbox1; // V2 |
581 | 597 | |
582 | 598 | $dbr = wfGetDB( DB_SLAVE ); |
583 | 599 | $lastRevision = Revision::loadFromTitle( $dbr, $editpage->mTitle ); |
| 600 | + |
584 | 601 | if ( is_null( $lastRevision ) ) { |
585 | 602 | $conctext = ""; |
586 | 603 | $rev_id = 0; |
— | — | @@ -592,8 +609,9 @@ |
593 | 610 | } |
594 | 611 | |
595 | 612 | // if there is no modification on the text |
596 | | - if ( $actualtext == $conctext ) |
597 | | - return true; |
| 613 | + if ( $actualtext == $conctext ) { |
| 614 | + return true; |
| 615 | + } |
598 | 616 | |
599 | 617 | $model = manager::loadModel( $rev_id ); |
600 | 618 | $logoot = new logootEngine( $model ); |
— | — | @@ -618,10 +636,14 @@ |
619 | 637 | // creation Patch P2 |
620 | 638 | $tmp = serialize( $listOp1 ); |
621 | 639 | $patch = new Patch( false, false, $listOp1, $urlServer, $rev_id1 ); |
622 | | - if ( $editpage->mTitle->getNamespace() == 0 ) |
623 | | - $title = $editpage->mTitle->getText(); |
624 | | - else |
625 | | - $title = $editpage->mTitle->getNsText() . ':' . $editpage->mTitle->getText(); |
| 640 | + |
| 641 | + if ( $editpage->mTitle->getNamespace() == 0 ) { |
| 642 | + $title = $editpage->mTitle->getText(); |
| 643 | + } |
| 644 | + else { |
| 645 | + $title = $editpage->mTitle->getNsText() . ':' . $editpage->mTitle->getText(); |
| 646 | + } |
| 647 | + |
626 | 648 | // integration: diffs between VO and V2 into V1 |
627 | 649 | |
628 | 650 | $modelAfterIntegrate = $logoot->integrate( $listOp1 ); |
— | — | @@ -630,6 +652,7 @@ |
631 | 653 | $modelAfterIntegrate = $logoot->getModel(); |
632 | 654 | $tmp = serialize( $listOp ); |
633 | 655 | $patch = new Patch( false, false, $listOp, $urlServer, $rev_id1 ); |
| 656 | + |
634 | 657 | if ( $editpage->mTitle->getNamespace() == 0 ) |
635 | 658 | $title = $editpage->mTitle->getText(); |
636 | 659 | else |
— | — | @@ -673,21 +696,3 @@ |
674 | 697 | } |
675 | 698 | return true; |
676 | 699 | } |
677 | | - |
678 | | -function dsmwgSetupFunction() { |
679 | | - global $smwgNamespacesWithSemanticLinks; |
680 | | - |
681 | | - $smwgNamespacesWithSemanticLinks += array( |
682 | | - PATCH => true, |
683 | | - PUSHFEED => true, |
684 | | - PULLFEED => true, |
685 | | - CHANGESET => true |
686 | | - ); |
687 | | - |
688 | | - if ( defined( 'SRF_VERSION' ) ) { |
689 | | - global $wgDSMWExhibits; |
690 | | - if ( !is_object( $wgDSMWExhibits ) ) { |
691 | | - $wgDSMWExhibits = new DSMWExhibits(); |
692 | | - } |
693 | | - } |
694 | | -} |
Index: trunk/extensions/DSMW/specialPage/ArticleAdminPage.php |
— | — | @@ -13,19 +13,20 @@ |
14 | 14 | $wgExtensionFunctions[] = "wfSetupAdminPage"; |
15 | 15 | |
16 | 16 | class ArticleAdminPage extends SpecialPage { |
17 | | -// Constructor |
18 | | - function ArticleAdminPage() { |
| 17 | + |
| 18 | + public function __construct() { |
19 | 19 | global $wgHooks, $wgSpecialPages, $wgWatchingMessages; |
| 20 | + |
20 | 21 | # Add all our needed hooks |
21 | 22 | $wgHooks["UnknownAction"][] = $this; |
22 | 23 | $wgHooks["SkinTemplateTabs"][] = $this; |
23 | 24 | $wgHooks['SkinTemplateNavigation'][] = $this; |
24 | | - SpecialPage::SpecialPage( 'ArticleAdminPage'/*, "block"*/ );// avec block => pasges speciales restreintes |
25 | | - wfLoadExtensionMessages( 'DSMW' ); |
| 25 | + |
| 26 | + parent::__construct( 'ArticleAdminPage' ); |
26 | 27 | } |
27 | 28 | |
28 | | - function getDescription() { |
29 | | - return "DSMW Admin functions"; |
| 29 | + public function getDescription() { |
| 30 | + return wfMsg( 'dsmw-special-admin' ); |
30 | 31 | } |
31 | 32 | |
32 | 33 | /** |
— | — | @@ -38,7 +39,7 @@ |
39 | 40 | * @global <String> $wgScriptPath |
40 | 41 | * @return <bool> |
41 | 42 | */ |
42 | | - function execute() { |
| 43 | + public function execute() { |
43 | 44 | global $wgOut, $wgServerName, $wgScriptPath, $wgScriptExtension; /*, $wgSitename, $wgCachePages, $wgUser, $wgTitle, $wgDenyAccessMessage, $wgAllowAnonUsers, $wgRequest, $wgMessageCache, $wgWatchingMessages, $wgDBtype, $namespace_titles;*/ |
44 | 45 | |
45 | 46 | $url = 'http://' . $wgServerName . $wgScriptPath . "/index{$wgScriptExtension}"; |
Index: trunk/extensions/DSMW/specialPage/DSMWAdmin.php |
— | — | @@ -1,4 +1,5 @@ |
2 | 2 | <?php |
| 3 | + |
3 | 4 | /** |
4 | 5 | * DSMW Special page |
5 | 6 | * |
— | — | @@ -9,23 +10,23 @@ |
10 | 11 | require_once "$IP/includes/SpecialPage.php"; |
11 | 12 | |
12 | 13 | /* Extension variables */ |
13 | | -$wgExtensionFunctions[] = "wfSetupDSMWAdmin"; |
| 14 | +$wgExtensionFunctions[] = 'wfSetupDSMWAdmin'; |
14 | 15 | |
15 | 16 | class DSMWAdmin extends SpecialPage { |
16 | | -// Constructor |
17 | | - function DSMWAdmin() { |
| 17 | + |
| 18 | + public function __construct() { |
18 | 19 | global $wgHooks, $wgSpecialPages, $wgWatchingMessages; |
| 20 | + |
19 | 21 | # Add all our needed hooks |
20 | | - $wgHooks["SkinTemplateTabs"][] = $this; |
21 | | - SpecialPage::SpecialPage( 'DSMWAdmin'/*, "block"*/ );// avec block => pages speciales restreintes |
22 | | - wfLoadExtensionMessages( 'DSMW' ); |
| 22 | + $wgHooks['SkinTemplateTabs'][] = $this; |
| 23 | + |
| 24 | + parent::__construct( 'DSMWAdmin' ); |
23 | 25 | } |
24 | 26 | |
25 | | - function getDescription() { |
26 | | - return "DSMW Settings"; |
| 27 | + public function getDescription() { |
| 28 | + return wfMsg( 'dsmw-special-settings' ); |
27 | 29 | } |
28 | 30 | |
29 | | - |
30 | 31 | /** |
31 | 32 | * Executed when the user opens the DSMW administration special page |
32 | 33 | * Calculates the PushFeed list and the pullfeed list (and everything that |
— | — | @@ -36,7 +37,7 @@ |
37 | 38 | * @global <String> $wgScriptPath |
38 | 39 | * @return <bool> |
39 | 40 | */ |
40 | | - function execute() { |
| 41 | + public function execute() { |
41 | 42 | global $wgOut, $wgRequest, $wgServerName, $wgScriptPath, $wgDSMWIP, $wgServerName, $wgScriptPath; /*, $wgSitename, $wgCachePages, $wgUser, $wgTitle, $wgDenyAccessMessage, $wgAllowAnonUsers, $wgRequest, $wgMessageCache, $wgWatchingMessages, $wgDBtype, $namespace_titles;*/ |
42 | 43 | $urlServer = 'http://' . $wgServerName . $wgScriptPath; |
43 | 44 | |
Index: trunk/extensions/DSMW/specialPage/DSMWGeneralExhibits.php |
— | — | @@ -1,7 +1,10 @@ |
2 | 2 | <?php |
| 3 | + |
3 | 4 | /** |
4 | 5 | * DSMW Special page |
5 | 6 | * |
| 7 | + * TODO: only load when SRF is available? |
| 8 | + * |
6 | 9 | * @copyright INRIA-LORIA-SCORE Team |
7 | 10 | * @author jean-Philippe Muller |
8 | 11 | */ |
— | — | @@ -9,19 +12,17 @@ |
10 | 13 | require_once "$IP/includes/SpecialPage.php"; |
11 | 14 | |
12 | 15 | /* Extension variables */ |
13 | | -$wgExtensionFunctions[] = "wfSetupDSMWGenExhibits"; |
| 16 | +// FIXME |
| 17 | +$wgExtensionFunctions[] = 'wfSetupDSMWGenExhibits'; |
14 | 18 | |
15 | 19 | class DSMWGeneralExhibits extends SpecialPage { |
16 | | -// Constructor |
17 | | - function DSMWGeneralExhibits() { |
18 | | - if ( defined( 'SRF_VERSION' ) ) { |
19 | | - SpecialPage::SpecialPage( 'DSMWGeneralExhibits' ); |
20 | | - } |
21 | | - wfLoadExtensionMessages( 'DSMW' ); |
| 20 | + |
| 21 | + public function __construct() { |
| 22 | + parent::__construct( 'DSMWGeneralExhibits' ); |
22 | 23 | } |
23 | 24 | |
24 | | - function getDescription() { |
25 | | - return "DSMW general exhibits"; |
| 25 | + public function getDescription() { |
| 26 | + return wfMsg( 'dsmw-special-exhibits' ); |
26 | 27 | } |
27 | 28 | |
28 | 29 | /** |
— | — | @@ -33,7 +34,7 @@ |
34 | 35 | * |
35 | 36 | * |
36 | 37 | */ |
37 | | - function execute() { |
| 38 | + public function execute() { |
38 | 39 | global $wgOut, $wgRequest, $wgServerName, $wgScriptPath, $wgDSMWIP, $wgServerName, $wgScriptPath; |
39 | 40 | |
40 | 41 | // If the Semantic Results Format isn't installed, a blank warning page appears |
Index: trunk/extensions/DSMW/DSMW.i18n.php |
— | — | @@ -15,5 +15,9 @@ |
16 | 16 | $messages['en'] = array( |
17 | 17 | 'dsmw-desc' => 'Allows to create a network of Semantic MediaWiki servers that share common semantic wiki pages. ([http://www.dsmw.org www.dsmw.org])', |
18 | 18 | |
19 | | - 'specialpages-group-dsmw_group' => 'Distributed Semantic MediaWiki' |
| 19 | + 'specialpages-group-dsmw_group' => 'Distributed Semantic MediaWiki', |
| 20 | + |
| 21 | + 'dsmw-special-admin' => 'DSMW Admin functions', |
| 22 | + 'dsmw-special-settings' => 'DSMW Settings', |
| 23 | + 'dsmw-special-exhibits' => 'DSMW general exhibits', |
20 | 24 | ); |
\ No newline at end of file |