Index: trunk/extensions/DSMW/DSMW.hooks.php |
— | — | @@ -372,6 +372,7 @@ |
373 | 373 | $title = Title::newFromText( 'Special:ArticleAdminPage' ); |
374 | 374 | $article = new Article( $title ); |
375 | 375 | $article->doRedirect(); |
| 376 | + |
376 | 377 | return false; |
377 | 378 | } |
378 | 379 | |
— | — | @@ -381,12 +382,17 @@ |
382 | 383 | // wfDebugLog('p2p','Create pull '.$_POST['pullname'].' with pushName '.$_POST['pushname'].' on '.$_POST['url']); |
383 | 384 | // $url = rtrim($_POST['url'], "/"); //removes the final "/" if there is one |
384 | 385 | $urlTmp = $_POST['url']; |
385 | | - if ( utils::isValidURL( $urlTmp ) == false ) |
386 | | - throw new MWException( __METHOD__ . ': ' . $urlTmp . ' seems not to be an url' ); // throws an exception if $url is invalid |
387 | | - |
388 | | - $res = utils::parsePushURL( $urlTmp ); |
389 | | - if ( $res === false || empty( $res ) ) |
390 | | - throw new MWException( __METHOD__ . ': URL format problem' ); |
| 386 | + if ( utils::isValidURL( $urlTmp ) == false ) { |
| 387 | + // throws an exception if $url is invalid |
| 388 | + throw new MWException( __METHOD__ . ': ' . $urlTmp . ' seems not to be an url' ); |
| 389 | + } |
| 390 | + |
| 391 | + $res = utils::parsePushURL( $urlTmp ); |
| 392 | + |
| 393 | + if ( $res === false || empty( $res ) ) { |
| 394 | + throw new MWException( __METHOD__ . ': URL format problem' ); |
| 395 | + } |
| 396 | + |
391 | 397 | $pushname = $res[0]; |
392 | 398 | $url = $res[1]; |
393 | 399 | |
— | — | @@ -489,12 +495,15 @@ |
490 | 496 | if ( strpos( $cs, "<?xml version=\"1.0\"?>" ) === false ) { |
491 | 497 | $cs = utils::file_get_contents_curl( utils::lcfirst( $relatedPushServer ) . "/api.php5?action=query&meta=changeSet&cspushName=" . $nameWithoutNS . '&cschangeSet=' . $previousCSID . '&format=xml' ); |
492 | 498 | } |
| 499 | + |
493 | 500 | if ( strpos( $cs, "<?xml version=\"1.0\"?>" ) === false ) { |
494 | 501 | $cs = false; |
495 | 502 | } |
496 | 503 | |
497 | | - if ( $cs === false ) |
498 | | - throw new MWException( __METHOD__ . ': Cannot connect to Push Server (ChangeSet API)' ); |
| 504 | + if ( $cs === false ) { |
| 505 | + throw new MWException( __METHOD__ . ': Cannot connect to Push Server (ChangeSet API)' ); |
| 506 | + } |
| 507 | + |
499 | 508 | $cs = trim( $cs ); |
500 | 509 | $dom = new DOMDocument(); |
501 | 510 | $dom->loadXML( $cs ); |
— | — | @@ -627,7 +636,7 @@ |
628 | 637 | return true; |
629 | 638 | } |
630 | 639 | |
631 | | - $model = manager::loadModel( $rev_id ); |
| 640 | + $model = DSMWRevisionManager::loadModel( $rev_id ); |
632 | 641 | $logoot = new logootEngine( $model ); |
633 | 642 | |
634 | 643 | // get the revision with the edittime==>V0 |
— | — | @@ -641,10 +650,7 @@ |
642 | 651 | } |
643 | 652 | |
644 | 653 | if ( $conctext != $text ) {// if last revision is not V0, there is editing conflict |
645 | | - // wfDebugLog('testlog',' -> CONCURRENCE: '); |
646 | | - // wfDebugLog('testlog',' -> +'.$conctext.'+('.$rev_id.') ts '.$lastRevision->getTimestamp()); |
647 | | - // wfDebugLog('testlog',' -> +'.$text.'+('.$rev_id1.') ts '.$editpage->edittime.' '.$rev->getTimestamp()); |
648 | | - $model1 = manager::loadModel( $rev_id1 ); |
| 654 | + $model1 = DSMWRevisionManager::loadModel( $rev_id1 ); |
649 | 655 | $logoot1 = new logootEngine( $model1 ); |
650 | 656 | $listOp1 = $logoot1->generate( $text, $actualtext ); |
651 | 657 | // creation Patch P2 |
— | — | @@ -675,7 +681,7 @@ |
676 | 682 | |
677 | 683 | $revId = utils::getNewArticleRevId(); |
678 | 684 | wfDebugLog( 'p2p', ' -> store model rev : ' . $revId . ' session ' . session_id() . ' model ' . $modelAfterIntegrate->getText() ); |
679 | | - manager::storeModel( $revId + 1, $sessionId = session_id(), $modelAfterIntegrate, $blobCB = 0 ); |
| 685 | + DSMWRevisionManager::storeModel( $revId + 1, $sessionId = session_id(), $modelAfterIntegrate, $blobCB = 0 ); |
680 | 686 | |
681 | 687 | $patch->storePage( $title, $revId + 1 ); // stores the patch in a wikipage |
682 | 688 | $editpage->textbox1 = $modelAfterIntegrate->getText(); |
— | — | @@ -713,10 +719,10 @@ |
714 | 720 | } |
715 | 721 | |
716 | 722 | $revID = $lastRevision->getId(); |
717 | | - $model = manager::loadModel( $rev_id ); |
| 723 | + $model = DSMWRevisionManager::loadModel( $rev_id ); |
718 | 724 | $patch = new Patch( false, true, null, $urlServer, $rev_id, null, null, null, $localfile->mime, $localfile->size, urldecode( $localfile->url ), null ); |
719 | 725 | $patch->storePage( $localfile->getTitle(), $revID ); // stores the patch in a wikipage |
720 | | - manager::storeModel( $revID, $sessionId = session_id(), $model, $blobCB = 0 ); |
| 726 | + DSMWRevisionManager::storeModel( $revID, $sessionId = session_id(), $model, $blobCB = 0 ); |
721 | 727 | } |
722 | 728 | |
723 | 729 | return true; |
Index: trunk/extensions/DSMW/logootModel/manager.php |
— | — | @@ -1,53 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Used to seperated the data access layer |
6 | | - * |
7 | | - * @copyright INRIA-LORIA-ECOO project |
8 | | - * |
9 | | - * @author CUCUTEANU |
10 | | - */ |
11 | | -class manager { |
12 | | - |
13 | | - /** |
14 | | - * |
15 | | - * @param <String> $rev_id Revision id |
16 | | - * @return boModel |
17 | | - */ |
18 | | - static function loadModel( $rev_id ) { |
19 | | - try { |
20 | | - if ( $rev_id != 0 ) { |
21 | | - $dao = new dao(); |
22 | | - return $dao->loadModel( $rev_id ); |
23 | | - } |
24 | | - else { |
25 | | - return new boModel(); |
26 | | - } |
27 | | - } catch ( Exception $e ) { |
28 | | - die($e->getMessage()); |
29 | | - throw new MWException( __METHOD__ . ' db access problems, |
30 | | -if this page existed before the DSMW installation, |
31 | | -maybe it has not been processed by DSMW' ); |
32 | | - } |
33 | | - |
34 | | - } |
35 | | - |
36 | | - /** |
37 | | - * |
38 | | - * @param <String> $rev_id |
39 | | - * @param <String> $sessionId |
40 | | - * @param <Object> $model boModel |
41 | | - * @param <Object> $blobCB=0 (should have been a causal barrier object but |
42 | | - * not used yet) |
43 | | - */ |
44 | | - static function storeModel( $rev_id, $sessionId, $model, $blobCB ) { |
45 | | - wfDebugLog( 'p2p', ' -> store model into revid : ' . $rev_id . ' sessionid : ' . $sessionId . ' model : ' . $model->getText() ); |
46 | | - try { |
47 | | - $dao = new dao(); |
48 | | - $dao->storeModel( $rev_id, $sessionId, $model, $blobCB ); |
49 | | - } catch ( Exception $e ) { |
50 | | - throw new MWException( __METHOD__ . ' db access problems' ); |
51 | | - } |
52 | | - } |
53 | | - |
54 | | -} |
Index: trunk/extensions/DSMW/logootModel/boModel.php |
— | — | @@ -1,48 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Model of a wiki page. |
6 | | - * Represented by a list of page's lines and a list of the logootPositions |
7 | | - * associated to each line |
8 | | - * |
9 | | - * @copyright INRIA-LORIA-ECOO project |
10 | | - * @author Muller Jean-Philippe |
11 | | - */ |
12 | | -class boModel { |
13 | | - private $positionList = array(); |
14 | | - private $lineList = array(); |
15 | | - |
16 | | - public function setPositionlist( $positionList ) { |
17 | | - $this->positionList = $positionList; |
18 | | - } |
19 | | - |
20 | | - public function setLinelist( $lineList ) { |
21 | | - $this->lineList = $lineList; |
22 | | - } |
23 | | - |
24 | | - public function getPositionlist() { |
25 | | - return $this->positionList; |
26 | | - } |
27 | | - |
28 | | - public function getLinelist() { |
29 | | - return $this->lineList; |
30 | | - } |
31 | | - |
32 | | - /** |
33 | | - * transforms the text array into a string |
34 | | - * @return <String> |
35 | | - */ |
36 | | - public function getText() { |
37 | | - $textImage = ""; |
38 | | - $tmp = $this->lineList; |
39 | | - $nb = 0; |
40 | | - |
41 | | - $nb = sizeof( $tmp ); |
42 | | - for ( $i = 1; $i <= $nb; $i++ ) { |
43 | | - |
44 | | - if ( $i == 1 ) $textImage = $tmp[$i]; |
45 | | - else $textImage = $textImage . "\n" . $tmp[$i]; |
46 | | - } |
47 | | - return $textImage; |
48 | | - } |
49 | | -} |
Index: trunk/extensions/DSMW/logootModel/dao.php |
— | — | @@ -1,54 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * DAO used to load and store the boModel |
6 | | - * |
7 | | - * @copyright INRIA-LORIA-ECOO project |
8 | | - * @author Jean-Philippe Muller |
9 | | - */ |
10 | | -class dao { |
11 | | - |
12 | | - /** |
13 | | - * To get the model of the given revision |
14 | | - * --> A model is the logootPosition array corresponding to this revision |
15 | | - * @param <Integer> $rev_id |
16 | | - * @return <Object> model object |
17 | | - */ |
18 | | - function loadModel( $rev_id ) { |
19 | | - wfProfileIn( __METHOD__ ); |
20 | | - $dbr = wfGetDB( DB_SLAVE ); |
21 | | - $model1 = $dbr->selectField( 'model', 'blob_info', array( |
22 | | - 'rev_id' => $rev_id ), __METHOD__ ); |
23 | | - if ( $model1 === false ) |
24 | | - throw new MWException( __METHOD__ . ': This page has not been processed by DSMW' ); |
25 | | - wfProfileOut( __METHOD__ ); |
26 | | - $model = unserialize( $model1 ); |
27 | | - return $model; |
28 | | - } |
29 | | - |
30 | | -/** |
31 | | - * integrate model to DB |
32 | | - * @param <Integer> $rev_id |
33 | | - * @param <String> $sessionId |
34 | | - * @param <object> $model |
35 | | - * @param <Object> $blobCB (should have been a causal barrier object but |
36 | | - * not used yet) |
37 | | - */ |
38 | | - function storeModel( $rev_id, $sessionId, $model, $blobCB ) { |
39 | | - |
40 | | - $model1 = serialize( $model ); |
41 | | - |
42 | | - wfProfileIn( __METHOD__ ); |
43 | | - $dbw = wfGetDB( DB_MASTER ); |
44 | | - $dbw->insert( 'model', array( |
45 | | - 'rev_id' => $rev_id, |
46 | | - 'session_id' => $sessionId, |
47 | | - 'blob_info' => $model1, |
48 | | - 'causal_barrier' => $blobCB, |
49 | | - ), __METHOD__ ); |
50 | | - |
51 | | - |
52 | | - wfProfileOut( __METHOD__ ); |
53 | | - } |
54 | | - |
55 | | -} |
Index: trunk/extensions/DSMW/jobs/DSMWUpdateJob.php |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | $pageText = $lastRev->getText(); |
85 | 85 | |
86 | 86 | // load an empty model |
87 | | - $model = manager::loadModel( 0 ); |
| 87 | + $model = DSMWRevisionManager::loadModel( 0 ); |
88 | 88 | $logoot = new logootEngine( $model ); |
89 | 89 | |
90 | 90 | $listOp = $logoot->generate( "", $pageText ); |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | $patch->storePage( $lastRev->getTitle()->getText(), $lastRev->getId() ); |
113 | 113 | } |
114 | 114 | |
115 | | - manager::storeModel( $lastRev->getId(), $sessionId = session_id(), $modelAfterIntegrate, $blobCB = 0 ); |
| 115 | + DSMWRevisionManager::storeModel( $lastRev->getId(), $sessionId = session_id(), $modelAfterIntegrate, $blobCB = 0 ); |
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
Index: trunk/extensions/DSMW/DSMW.php |
— | — | @@ -72,9 +72,7 @@ |
73 | 73 | |
74 | 74 | $wgAutoloadClasses['LogootIns'] = "$wgDSMWIP/logootComponent/LogootIns.php"; |
75 | 75 | $wgAutoloadClasses['LogootDel'] = "$wgDSMWIP/logootComponent/LogootDel.php"; |
76 | | -$wgAutoloadClasses['boModel'] = "$wgDSMWIP/logootModel/boModel.php"; |
77 | | -$wgAutoloadClasses['dao'] = "$wgDSMWIP/logootModel/dao.php"; |
78 | | -$wgAutoloadClasses['manager'] = "$wgDSMWIP/logootModel/manager.php"; |
| 76 | +$wgAutoloadClasses['DSMWRevisionManager'] = dirname( __FILE__ ) . '/includes/DSMW_RevisionManager.php'; |
79 | 77 | |
80 | 78 | $wgAutoloadClasses['Patch'] = "$wgDSMWIP/patch/Patch.php"; |
81 | 79 | $wgAutoloadClasses['persistentClock'] = "$wgDSMWIP/clockEngine/persistentClock.php"; |
Index: trunk/extensions/DSMW/includes/IntegrationFunctions.php |
— | — | @@ -257,7 +257,7 @@ |
258 | 258 | } |
259 | 259 | $listOp = array(); |
260 | 260 | // $blobInfo = BlobInfo::loadBlobInfo($rev_id); |
261 | | - $model = manager::loadModel( $rev_id ); |
| 261 | + $model = DSMWRevisionManager::loadModel( $rev_id ); |
262 | 262 | if ( ( $model instanceof boModel ) == false ) |
263 | 263 | throw new MWException( __METHOD__ . ': model loading problem!' ); |
264 | 264 | $logoot = new logootEngine( $model ); |
— | — | @@ -282,7 +282,7 @@ |
283 | 283 | // $revId = utils::getNewArticleRevId(); |
284 | 284 | $status = $article->doEdit( $modelAfterIntegrate->getText(), $summary = "" ); |
285 | 285 | $revId = $status->value['revision']->getId(); |
286 | | - manager::storeModel( $revId, $sessionId = session_id(), $modelAfterIntegrate, $blobCB = 0 ); |
| 286 | + DSMWRevisionManager::storeModel( $revId, $sessionId = session_id(), $modelAfterIntegrate, $blobCB = 0 ); |
287 | 287 | return $revId; |
288 | 288 | // sleep(4); |
289 | 289 | if ( is_bool( $status ) ) return $status; |
— | — | @@ -299,15 +299,18 @@ |
300 | 300 | $dbr->immediateBegin(); |
301 | 301 | $title = Title::newFromText( $article ); |
302 | 302 | $lastRevision = Revision::loadFromTitle( $dbr, $title ); |
| 303 | + |
303 | 304 | if ( $lastRevision->getPrevious() == null ) { |
304 | 305 | $rev_id = 0; |
305 | 306 | } |
306 | 307 | else { |
307 | 308 | $rev_id = $lastRevision->getPrevious()->getId(); |
308 | 309 | } |
| 310 | + |
309 | 311 | $revID = $lastRevision->getId(); |
310 | | - $model = manager::loadModel( $rev_id ); |
311 | | - manager::storeModel( $revID, $sessionId = session_id(), $model, $blobCB = 0 ); |
| 312 | + $model = DSMWRevisionManager::loadModel( $rev_id ); |
| 313 | + DSMWRevisionManager::storeModel( $revID, $sessionId = session_id(), $model, $blobCB = 0 ); |
| 314 | + |
312 | 315 | if ( $edit ) { |
313 | 316 | $article = new Article( $title ); |
314 | 317 | $status = $article->doEdit( $model->getText(), $summary = "" ); |
— | — | @@ -326,11 +329,13 @@ |
327 | 330 | $dom = new DOMDocument(); |
328 | 331 | $dom->loadXML( $edittoken ); |
329 | 332 | $edittoken = $dom->getElementsByTagName( 'page' ); |
| 333 | + |
330 | 334 | foreach ( $edittoken as $p ) { |
331 | 335 | if ( $p->hasAttribute( "edittoken" ) ) { |
332 | 336 | $token = $p->getAttribute( 'edittoken' ); |
333 | 337 | } |
334 | 338 | } |
| 339 | + |
335 | 340 | $token = str_replace( "+", "%2B", $token ); |
336 | 341 | |
337 | 342 | // $url = $patch->getUrl(); |
— | — | @@ -347,6 +352,7 @@ |
348 | 353 | |
349 | 354 | function newRev( $article ) { |
350 | 355 | global $wgCanonicalNamespaceNames; |
| 356 | + |
351 | 357 | $indexNS = 0; |
352 | 358 | $dbr = wfGetDB( DB_SLAVE ); |
353 | 359 | |
— | — | @@ -354,13 +360,16 @@ |
355 | 361 | preg_match( "/^(.+?)_*:_*(.*)$/S", $article, $tmp ); |
356 | 362 | $articleWithoutNS = $tmp[2]; |
357 | 363 | $NS = $tmp[1]; |
| 364 | + |
358 | 365 | if ( in_array( $NS, $wgCanonicalNamespaceNames ) ) { |
359 | 366 | foreach ( $wgCanonicalNamespaceNames as $key => $value ) { |
360 | 367 | if ( $NS == $value ) |
361 | 368 | $indexNS = $key; |
362 | 369 | } |
363 | 370 | } |
| 371 | + |
364 | 372 | $title = Title::newFromText( $article ); |
| 373 | + |
365 | 374 | if ( !$title->exists() ) { |
366 | 375 | $article = new Article( $title ); |
367 | 376 | $article->doEdit( '', '' ); |
— | — | @@ -368,7 +377,7 @@ |
369 | 378 | $lastRevision = Revision::loadFromTitle( $dbr, $title ); |
370 | 379 | $rev_id = $lastRevision->getPrevious()->getId(); |
371 | 380 | $revID = $lastRevision->getId(); |
372 | | - $model = manager::loadModel( $rev_id ); |
| 381 | + $model = DSMWRevisionManager::loadModel( $rev_id ); |
373 | 382 | $article = new Article( $title ); |
374 | 383 | $article->quickEdit( $model->getText(), '' ); |
375 | 384 | } |
Index: trunk/extensions/DSMW/includes/DSMW_RevisionManager.php |
— | — | @@ -0,0 +1,161 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Used to seperated the data access layer |
| 6 | + * |
| 7 | + * @copyright INRIA-LORIA-ECOO project |
| 8 | + * |
| 9 | + * @author CUCUTEANU |
| 10 | + */ |
| 11 | +class DSMWRevisionManager { |
| 12 | + |
| 13 | + /** |
| 14 | + * |
| 15 | + * @param <String> $rev_id Revision id |
| 16 | + * @return boModel |
| 17 | + */ |
| 18 | + static function loadModel( $rev_id ) { |
| 19 | + try { |
| 20 | + if ( $rev_id != 0 ) { |
| 21 | + $dao = new dao(); |
| 22 | + return $dao->loadModel( $rev_id ); |
| 23 | + } |
| 24 | + else { |
| 25 | + return new boModel(); |
| 26 | + } |
| 27 | + } catch ( Exception $e ) { |
| 28 | + die($e->getMessage()); |
| 29 | + throw new MWException( __METHOD__ . ' db access problems, |
| 30 | +if this page existed before the DSMW installation, |
| 31 | +maybe it has not been processed by DSMW' ); |
| 32 | + } |
| 33 | + |
| 34 | + } |
| 35 | + |
| 36 | + /** |
| 37 | + * |
| 38 | + * @param <String> $rev_id |
| 39 | + * @param <String> $sessionId |
| 40 | + * @param <Object> $model boModel |
| 41 | + * @param <Object> $blobCB=0 (should have been a causal barrier object but |
| 42 | + * not used yet) |
| 43 | + */ |
| 44 | + static function storeModel( $rev_id, $sessionId, $model, $blobCB ) { |
| 45 | + wfDebugLog( 'p2p', ' -> store model into revid : ' . $rev_id . ' sessionid : ' . $sessionId . ' model : ' . $model->getText() ); |
| 46 | + try { |
| 47 | + $dao = new dao(); |
| 48 | + $dao->storeModel( $rev_id, $sessionId, $model, $blobCB ); |
| 49 | + } catch ( Exception $e ) { |
| 50 | + die($e->getMessage()); |
| 51 | + throw new MWException( __METHOD__ . ' db access problems' ); |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | +} |
| 56 | + |
| 57 | +/** |
| 58 | + * DAO used to load and store the boModel |
| 59 | + * |
| 60 | + * @copyright INRIA-LORIA-ECOO project |
| 61 | + * |
| 62 | + * @author Jean-Philippe Muller |
| 63 | + */ |
| 64 | +class dao { |
| 65 | + |
| 66 | + /** |
| 67 | + * To get the model of the given revision |
| 68 | + * --> A model is the logootPosition array corresponding to this revision |
| 69 | + * @param <Integer> $rev_id |
| 70 | + * @return <Object> model object |
| 71 | + */ |
| 72 | + function loadModel( $rev_id ) { |
| 73 | + wfProfileIn( __METHOD__ ); |
| 74 | + |
| 75 | + $dbr = wfGetDB( DB_SLAVE ); |
| 76 | + |
| 77 | + $model1 = $dbr->selectField( |
| 78 | + 'model', |
| 79 | + 'blob_info', |
| 80 | + array( |
| 81 | + 'rev_id' => $rev_id |
| 82 | + ), |
| 83 | + __METHOD__ |
| 84 | + ); |
| 85 | + |
| 86 | + if ( $model1 === false ) { |
| 87 | + throw new MWException( __METHOD__ . ': This page has not been processed by DSMW' ); |
| 88 | + } |
| 89 | + |
| 90 | + $model = unserialize( $model1 ); |
| 91 | + |
| 92 | + wfProfileOut( __METHOD__ ); |
| 93 | + |
| 94 | + return $model; |
| 95 | + } |
| 96 | + |
| 97 | + /** |
| 98 | + * integrate model to DB |
| 99 | + * @param <Integer> $rev_id |
| 100 | + * @param <String> $sessionId |
| 101 | + * @param <object> $model |
| 102 | + * @param <Object> $blobCB (should have been a causal barrier object but |
| 103 | + * not used yet) |
| 104 | + */ |
| 105 | + function storeModel( $rev_id, $sessionId, $model, $blobCB ) { |
| 106 | + wfProfileIn( __METHOD__ ); |
| 107 | + |
| 108 | + $model1 = serialize( $model ); |
| 109 | + |
| 110 | + $dbw = wfGetDB( DB_MASTER ); |
| 111 | + $dbw->insert( 'model', array( |
| 112 | + 'rev_id' => $rev_id, |
| 113 | + 'session_id' => $sessionId, |
| 114 | + 'blob_info' => $model1, |
| 115 | + 'causal_barrier' => $blobCB, |
| 116 | + ), __METHOD__ ); |
| 117 | + |
| 118 | + |
| 119 | + wfProfileOut( __METHOD__ ); |
| 120 | + } |
| 121 | + |
| 122 | +} |
| 123 | + |
| 124 | +/** |
| 125 | + * Model of a wiki page. |
| 126 | + * Represented by a list of page's lines and a list of the logootPositions |
| 127 | + * associated to each line |
| 128 | + * |
| 129 | + * @copyright INRIA-LORIA-ECOO project |
| 130 | + * @author Muller Jean-Philippe |
| 131 | + */ |
| 132 | +class boModel { |
| 133 | + |
| 134 | + private $positionList = array(); |
| 135 | + private $lineList = array(); |
| 136 | + |
| 137 | + public function setPositionlist( $positionList ) { |
| 138 | + $this->positionList = $positionList; |
| 139 | + } |
| 140 | + |
| 141 | + public function setLinelist( $lineList ) { |
| 142 | + $this->lineList = $lineList; |
| 143 | + } |
| 144 | + |
| 145 | + public function getPositionlist() { |
| 146 | + return $this->positionList; |
| 147 | + } |
| 148 | + |
| 149 | + public function getLinelist() { |
| 150 | + return $this->lineList; |
| 151 | + } |
| 152 | + |
| 153 | + /** |
| 154 | + * Transforms the text array into a string. |
| 155 | + * |
| 156 | + * @return string |
| 157 | + */ |
| 158 | + public function getText() { |
| 159 | + return implode( "\n", $this->lineList ); |
| 160 | + } |
| 161 | + |
| 162 | +} |
Property changes on: trunk/extensions/DSMW/includes/DSMW_RevisionManager.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 163 | + native |
Index: trunk/extensions/DSMW/specialPage/DSMWAdmin.php |
— | — | @@ -39,12 +39,14 @@ |
40 | 40 | /**** Get status of refresh job, if any ****/ |
41 | 41 | $dbr =& wfGetDB( DB_SLAVE ); |
42 | 42 | $row = $dbr->selectRow( 'job', '*', array( 'job_cmd' => 'DSMWUpdateJob' ), __METHOD__ ); |
| 43 | + |
43 | 44 | if ( $row !== false ) { // similar to Job::pop_type, but without deleting the job |
44 | 45 | $title = Title::makeTitleSafe( $row->job_namespace, $row->job_title ); |
45 | 46 | $updatejob = Job::factory( $row->job_cmd, $title, Job::extractBlob( $row->job_params ), $row->job_id ); |
46 | 47 | } else { |
47 | 48 | $updatejob = NULL; |
48 | 49 | } |
| 50 | + |
49 | 51 | $row1 = $dbr->selectRow( 'job', '*', array( 'job_cmd' => 'DSMWPropertyTypeJob' ), __METHOD__ ); |
50 | 52 | if ( $row1 !== false ) { // similar to Job::pop_type, but without deleting the job |
51 | 53 | $title = Title::makeTitleSafe( $row1->job_namespace, $row1->job_title ); |
— | — | @@ -57,8 +59,6 @@ |
58 | 60 | $action = $wgRequest->getText( 'action' ); |
59 | 61 | |
60 | 62 | if ( $action == 'logootize' ) { |
61 | | - |
62 | | - |
63 | 63 | if ( $updatejob === NULL ) { // careful, there might be race conditions here |
64 | 64 | $title = Title::makeTitle( NS_SPECIAL, 'DSMWAdmin' ); |
65 | 65 | $newjob = new DSMWUpdateJob( $title ); |
— | — | @@ -67,7 +67,6 @@ |
68 | 68 | } else { |
69 | 69 | $wgOut->addHTML( '<p><font color="red"><b>' . wfMsg( 'dsmw-special-admin-articleuprunning' ) . '</b></font></p>' ); |
70 | 70 | } |
71 | | - |
72 | 71 | } |
73 | 72 | |
74 | 73 | elseif ( $action == 'addProperties' ) { |