function arraytolower($arr) { foreach ($arr as &$val) { $val = is_array($val) ? arraytolower($val) : strtolower($val); } return $arr; }
/** * Create one page, push it * pull it on wiki2 and on wiki3 * modify the page on wiki2 and wiki3 * pull both on wiki1 * wiki1 must have the good page on local */ public function testSimple2() { $this->testSimple1(); // create pull on wiki2 $this->assertTrue($this->p2pBot2->createPull($this->pullName, $this->wiki1, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot2->bot->results . ')'); // pull $this->assertTrue($this->p2pBot2->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot2->bot->results . ')'); // assert page Ours exist on wiki2 assertPageExist($this->p2pBot2->bot->wikiServer, $this->pageName); // create pull on wiki3 $this->assertTrue($this->p2pBot3->createPull($this->pullName, $this->wiki1, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot3->bot->results . ')'); // pull $this->assertTrue($this->p2pBot3->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot3->bot->results . ')'); // assert page Ours exist on wiki3 assertPageExist($this->p2pBot3->bot->wikiServer, $this->pageName); $addContent2 = "Les caractéristiques communes des ours modernes\nsont un grand corps trapu et massif, un long museau,\nun pelage hirsutes, des pattes plantigrades à cinq griffes\nnon rétractiles, et une queue courte."; $this->assertTrue($this->p2pBot2->editPage($this->pageName, $addContent2), 'failed to edit page ' . $this->pageName); // create push on wiki2 $this->assertTrue($this->p2pBot2->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot2->bot->results . ')'); // push $this->assertTrue($this->p2pBot2->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')'); $addContent3 = "L'ours polaire est principalement carnivore\net le panda géant se nourrit presque exclusivement de bambou,\nles six autres espèces sont omnivores, leur alimentation variée\ncomprend essentiellement des plantes et des animaux."; $this->assertTrue($this->p2pBot3->editPage($this->pageName, $addContent3), 'failed to edit page ' . $this->pageName); // create push on wiki3 $this->assertTrue($this->p2pBot3->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot3->bot->results . ')'); // push $this->assertTrue($this->p2pBot3->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot3->bot->results . ')'); // create pull on wiki1 from wiki2 $this->assertTrue($this->p2pBot1->createPull($this->pullName . '2', $this->wiki2, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot1->bot->results . ')'); // pull $this->assertTrue($this->p2pBot1->Pull($this->pullFeed . '2'), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot1->bot->results . ')'); // create pull on wiki1 from wiki3 $this->assertTrue($this->p2pBot1->createPull($this->pullName . '3', $this->wiki3, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot1->bot->results . ')'); // pull $this->assertTrue($this->p2pBot1->Pull($this->pullFeed . '3'), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot1->bot->results . ')'); $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->pageName . ']]', '-3FpatchID'); $PatchonWiki1 = arraytolower($PatchonWiki1); $this->assertEquals(count($PatchonWiki1), 3); }
function cat($cat) { set_time_limit(60); $this->layout = 'bukget'; //get all plugins installed require APP . 'spacebukkitcall.php'; $args = array(); $installed = $api->call("getPlugins", $args, false); function arraytolower(array $array, $round = 0) { return unserialize(strtolower(serialize($array))); } $installed2 = arraytolower($installed); $output = ''; $installed3 = str_replace("", " ", $installed); $installed4 = str_replace("-", " ", $installed); //get all plugins in the cat $cat = str_replace("#", "", $cat); $plugins = json_decode(file_get_contents("http://api.bukget.org/api2/bukkit/category/" . $cat)); foreach ($plugins as $plugin) { if (in_array($plugin->name, $installed) || in_array($plugin->name, $installed2) || in_array($plugin->name, $installed3) || in_array($plugin->name, $installed4)) { $button = '<a href="#" class="nobutton approve">' . __('Installed!') . '</a>'; } else { $button = '<a href="./bukget2/installPlugin/' . $plugin->name . '" class="button icon favorite installer">' . __('Install') . '</a>'; } $output .= '<li class="plugin"><div class="first_row"><div class="col left col_2_3"><h4>' . $plugin->name . '</h4></div><div class="col right col_1_3" style="text-align: right; margin-top: 3px"> ' . $button . '</div></div></li>'; } $this->set('output', $output); $this->set('cat', $cat); }
/** * Create one page with tow attachment, push it * pull it on wiki2 * modify the attachment on wiki2 , push it * pull it on wiki1 * the tow wiki must have the same page and attachment */ public function testSimple1() { // create page $this->assertTrue($this->p2pBot1->createPage($this->pageName, $this->content), 'Failed to create page ' . $this->pageName . ' (' . $this->p2pBot1->bot->results . ')'); // assert page Ours exist on wiki1 assertPageExist($this->p2pBot1->bot->wikiServer, $this->pageName); // upload the file on wiki1 $this->assertTrue($this->p2pBot1->uploadFile($this->fileDir . $this->file11, $this->file, '0')); // test if the good file was upload on wiki1 $this->assertTrue($this->p2pBot1->getFileFeatures($this->file, $this->file_size1)); // edit File:Ours.jpg on wiki1 $this->assertTrue($this->p2pBot1->editPage($this->filePage, $this->pushRequest), 'failed to edit page ' . $this->filePage . ' ( ' . $this->p2pBot1->bot->results . ' )'); // upload the second file on wiki1 $this->assertTrue($this->p2pBot1->uploadFile($this->fileDir . $this->file21, $this->file2, '0')); // test if the good file was upload on wiki1 $this->assertTrue($this->p2pBot1->getFileFeatures($this->file2, $this->file_size3)); // edit File:Ours.pdf on wiki1 $this->assertTrue($this->p2pBot1->editPage($this->filePage2, $this->pushRequest), 'failed to edit page ' . $this->filePage . ' ( ' . $this->p2pBot1->bot->results . ' )'); // create push on wiki1 $this->assertTrue($this->p2pBot1->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot1->bot->results . ')'); // push $this->assertTrue($this->p2pBot1->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')'); // create pull on wiki2 $this->assertTrue($this->p2pBot2->createPull($this->pullName, $this->wiki1, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot2->bot->results . ')'); // pull $this->assertTrue($this->p2pBot2->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot2->bot->results . ')'); // change file on wiki2 $this->assertTrue($this->p2pBot2->uploadFile($this->fileDir . $this->file12, $this->file, '1')); // test if the good file was upload on wiki2 $this->assertTrue($this->p2pBot2->getFileFeatures($this->file, $this->file_size2)); // change second file on wiki2 $this->assertTrue($this->p2pBot2->uploadFile($this->fileDir . $this->file22, $this->file2, '1')); // test if the good file was upload on wiki2 $this->assertTrue($this->p2pBot2->getFileFeatures($this->file2, $this->file_size4)); // create push on wiki2 $this->assertTrue($this->p2pBot2->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot2->bot->results . ')'); // push $this->assertTrue($this->p2pBot2->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')'); // create pull on wiki1 $this->assertTrue($this->p2pBot1->createPull($this->pullName, $this->wiki2, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot1->bot->results . ')'); // pull $this->assertTrue($this->p2pBot1->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot1->bot->results . ')'); // test if the good file was upload on wiki1 $this->assertTrue($this->p2pBot1->getFileFeatures($this->file, $this->file_size2)); // test if the good file was upload on wiki1 $this->assertTrue($this->p2pBot1->getFileFeatures($this->file2, $this->file_size4)); $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID'); $PatchonWiki1 = arraytolower($PatchonWiki1); $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID'); $PatchonWiki2 = arraytolower($PatchonWiki2); $this->assertEquals(count($PatchonWiki1), count($PatchonWiki2)); $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage2 . ']]', '-3FpatchID'); $PatchonWiki1 = arraytolower($PatchonWiki1); $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage2 . ']]', '-3FpatchID'); $PatchonWiki2 = arraytolower($PatchonWiki2); $this->assertEquals(count($PatchonWiki1), count($PatchonWiki2)); // assert that wiki1/File:Ours == wiki2/File:Ours assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $this->filePage); // assert that wiki1/File:Ours == wiki2/File:Ours assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $this->filePage2); }
/** * Create one page with tow attachment, push it * pull it on wiki2 */ public function testSimple1() { // create page $this->assertTrue($this->p2pBot1->createPage($this->pageName, $this->content), 'Failed to create page ' . $this->pageName . ' (' . $this->p2pBot1->bot->results . ')'); // assert page Ours exist on wiki1 assertPageExist($this->p2pBot1->bot->wikiServer, $this->pageName); system("cp Import/Ours1.jpg cache/Ours1.jpg"); $file_size = filesize("cache/Ours1.jpg"); for ($i = 1; $i <= $this->nb; $i++) { $file = "cache/Ours" . $i . ".jpg"; // upload the file on wiki1 $this->assertTrue($this->p2pBot1->uploadFile($file, $this->file . $i . ".jpg", '0')); // test if the good file was upload on wiki1 $this->assertTrue($this->p2pBot1->getFileFeatures($this->file . $i . ".jpg", $file_size)); // edit File:Ours.jpg on wiki1 $this->assertTrue($this->p2pBot1->editPage($this->filePage . $i . ".jpg", $this->pushRequest), 'failed to edit page ' . $this->filePage . ' ( ' . $this->p2pBot1->bot->results . ' )'); // remove file system("mv cache/Ours" . $i . ".jpg cache/Ours" . ($i + 1) . ".jpg"); } system("rm cache/Ours*"); // create push on wiki1 $this->assertTrue($this->p2pBot1->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot1->bot->results . ')'); // push $this->assertTrue($this->p2pBot1->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')'); // create pull on wiki2 $this->assertTrue($this->p2pBot2->createPull($this->pullName, $this->wiki1, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot2->bot->results . ')'); // pull $this->assertTrue($this->p2pBot2->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot2->bot->results . ')'); $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]]', '-3FpatchID'); $PatchonWiki1 = arraytolower($PatchonWiki1); $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]]', '-3FpatchID'); $PatchonWiki2 = arraytolower($PatchonWiki2); $this->assertEquals(count($PatchonWiki1), count($PatchonWiki2)); }
public function test1() { // pages creation // Form:author $pageName = 'Form:Author'; $formauthor = '<noinclude> This is the "Author" form. To add a page with this form, enter the page name below; if a page with that name already exists, you will be sent to a form to edit that page. {{#forminput:Author}} </noinclude><includeonly> <div id="wikiPreview" style="display: none; border-bottom: 1px solid #AAAAAA;"></div> {{{for template|Author}}} {| class="formtable" ! Country: | {{{field|Country}}} |} {{{end template}}} \'\'\'Free text:\'\'\' {{{standard input|free text|rows=10}}} {{{standard input|summary}}} {{{standard input|minor edit}}} {{{standard input|watch}}} {{{standard input|save}}} {{{standard input|preview}}} {{{standard input|changes}}} {{{standard input|cancel}}} </includeonly> [[Category:package]]'; $this->assertTrue($this->p2pBot1->createPage($pageName, $formauthor), 'Failed to create page ' . $pageName . ' (' . $this->p2pBot1->bot->results . ')'); // Form:book $pageName1 = 'Form:Book'; $formbook = '<noinclude> This is the "Book" form. To add a page with this form, enter the page name below; if a page with that name already exists, you will be sent to a form to edit that page. {{#forminput:Book}} </noinclude><includeonly> <div id="wikiPreview" style="display: none; border-bottom: 1px solid #AAAAAA;"></div> {{{for template|Book}}} {| class="formtable" ! Authors: | {{{field|Authors}}} |- ! Genres: | {{{field|Genres}}} |- ! Year: | {{{field|Year}}} |- ! Number of pages: | {{{field|Number of pages}}} |} {{{end template}}} \'\'\'Free text:\'\'\' {{{standard input|free text|rows=10}}} {{{standard input|summary}}} {{{standard input|minor edit}}} {{{standard input|watch}}} {{{standard input|save}}} {{{standard input|preview}}} {{{standard input|changes}}} {{{standard input|cancel}}} </includeonly> [[Category:package]]'; $this->assertTrue($this->p2pBot1->createPage($pageName1, $formbook), 'Failed to create page ' . $pageName1 . ' (' . $this->p2pBot1->bot->results . ')'); // Property:Has genre $pageName2 = 'Property:Has_genre'; $hasgenre = 'This is a property of type [[Has type::String]]. The allowed values for this property are: * [[Allows value::Art]] * [[Allows value::Cookbook]] * [[Allows value::Fiction]] * [[Allows value::History]] * [[Allows value::Poetry]] * [[Allows value::Science]] [[Category:package]]'; $this->assertTrue($this->p2pBot1->createPage($pageName2, $hasgenre), 'Failed to create page ' . $pageName2 . ' (' . $this->p2pBot1->bot->results . ')'); // Property:Has number of pages $pageName3 = 'Property:Has_number_of_pages'; $nbpages = 'This is a property of type [[Has type::Number]]. [[Category:package]]'; $this->assertTrue($this->p2pBot1->createPage($pageName3, $nbpages), 'Failed to create page ' . $pageName3 . ' (' . $this->p2pBot1->bot->results . ')'); // Property:Is from country $pageName4 = 'Property:Is_from_country'; $isfromcountry = 'This is a property of type [[Has type::String]]. [[Category:package]]'; $this->assertTrue($this->p2pBot1->createPage($pageName4, $isfromcountry), 'Failed to create page ' . $pageName4 . ' (' . $this->p2pBot1->bot->results . ')'); // Property:Was published in year $pageName5 = 'Property:Was_published_in_year'; $pubyear = 'This is a property of type [[Has type::Number]]. [[Category:package]]'; $this->assertTrue($this->p2pBot1->createPage($pageName5, $pubyear), 'Failed to create page ' . $pageName5 . ' (' . $this->p2pBot1->bot->results . ')'); // Property:Was written by $pageName6 = 'Property:Was_written_by'; $written = 'This is a property of type [[Has type::Page]]. [[Category:package]] This property uses the form [[Has default form::Form:Author]].'; $this->assertTrue($this->p2pBot1->createPage($pageName6, $written), 'Failed to create page ' . $pageName6 . ' (' . $this->p2pBot1->bot->results . ')'); // Template:Book // $pageName7 = 'Template:Book'; // $tampBook = '<noinclude> // This is the "Book" template. // It should be called in the following format: // <pre> // {{Book // |Authors= // |Genres= // |Year= // |Number of pages= // }} // </pre> // Edit the page to see the template text. // </noinclude><includeonly> // {| class="wikitable" // ! Author(s) // | {{#arraymap:{{{Authors|}}}|,|x|[[Was written by::x]]}} // |- // ! Genre(s) // | {{#arraymap:{{{Genres|}}}|,|x|[[Has genre::x]]}} // |- // ! Year of publication // | [[Was published in year::{{{Year|}}}]] // |- // ! Number of pages // | [[Has number of pages::{{{Number of pages|}}}]] // |} // // [[Category:Books]] // </includeonly> // [[Category:package]] // '; // $this->assertTrue($this->p2pBot1->createPage($pageName7,$tampBook), // 'Failed to create page '.$pageName7.' ('.$this->p2pBot1->bot->results.')'); // // //Template:Author // $pageName8 = 'Template:Author'; // $tampAuthor = '<noinclude> // This is the "Author" template. // It should be called in the following format: // <pre> // {{Author // |Country= // }} // </pre> // Edit the page to see the template text. // </noinclude><includeonly> // {| class="wikitable" // ! Country of origin // | [[Is from country::{{{Country|}}}]] // |- // ! Books by this author // | {{#ask:[[Was written by::{{SUBJECTPAGENAME}}]]|format=list}} // |} // // [[Category:Authors]] // </includeonly> // [[Category:package]]'; // // $this->assertTrue($this->p2pBot1->createPage($pageName8,$tampAuthor), // 'Failed to create page '.$pageName8.' ('.$this->p2pBot1->bot->results.')'); // create push on wiki1 $pushName = 'PushPackage'; $pushRequest = '[[Category:package]]'; $this->assertTrue($this->p2pBot1->createPush($pushName, $pushRequest), 'Failed to create push : ' . $pushName . ' (' . $this->p2pBot1->bot->results . ')'); // push on wiki1 $this->assertTrue($this->p2pBot1->push('PushFeed:' . $pushName), 'failed to push ' . $pushName . ' (' . $this->p2pBot2->bot->results . ')'); // create pull on wiki2 $pullName = 'PullPackage'; $this->assertTrue($this->p2pBot2->createPull($pullName, $this->wiki1, $pushName), 'failed to create pull ' . $pullName . ' (' . $this->p2pBot2->bot->results . ')'); // pull $this->assertTrue($this->p2pBot2->Pull('PullFeed:' . $pullName), 'failed to pull ' . $pullName . ' (' . $this->p2pBot2->bot->results . ')'); // assert pages exist assertPageExist($this->p2pBot2->bot->wikiServer, $pageName); assertPageExist($this->p2pBot2->bot->wikiServer, $pageName1); assertPageExist($this->p2pBot2->bot->wikiServer, $pageName2); assertPageExist($this->p2pBot2->bot->wikiServer, $pageName3); assertPageExist($this->p2pBot2->bot->wikiServer, $pageName4); assertPageExist($this->p2pBot2->bot->wikiServer, $pageName5); assertPageExist($this->p2pBot2->bot->wikiServer, $pageName6); // assertPageExist($this->p2pBot2->bot->wikiServer, $pageName7); // assertPageExist($this->p2pBot2->bot->wikiServer, $pageName8); // assert that there is the same changeSet on the 2 wikis $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID'); $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID'); $this->assertEquals($CSonWiki1, $CSonWiki2, 'changeSet are not equals on the 2 wikis'); // assert that there is the same patch on the 2 wikis $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]]', '-3FpatchID'); $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]]', '-3FpatchID'); $PatchonWiki1 = arraytolower($PatchonWiki1); $PatchonWiki2 = arraytolower($PatchonWiki2); $this->assertEquals($PatchonWiki1, $PatchonWiki2, 'patch are not equals on the 2 wikis'); // assert that wiki1/page == wiki2/page assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName); assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName1); assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName2); assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName3); assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName4); assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName5); assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName6); }
public function testSimple2() { $text = "DSMW implements the Logoot algorithm (see [[Presentation_and_Papers|Papers and presentations]]).\nThis algorithm allows automatic resolution of edition conflicts.\n\nWhat we call \"conflict\" is when there is a concurrent editing on an article i.e. the same article has been modified by many users. For instance, this is the case when a user edits her local copy of a page and pulls remote modifications on this page.\n\n==Summary==\n\n\nIn the following table, we summarize the different cases of concurrent editing and the result produced by the merge algorithm.\nThe first column presents the content of the '''initial state''' of the page.\n'''DSMW server1''' and '''DSMW server2''' represent two concurrent modifications on the same initial state.\n'''Results''' is the convergent state i.e. the state that will reached on all servers after complete propagation of concurrent changes...\n\n\n{| border='1' cellpadding='5' cellspacing='0'\n| valign='top' | Scenario\n| valign='top' | Initial state\n| valign='top' | DSMW server1\n| valign='top' | DSMW server2\n| valign='top' | Results\n| valign='top' | Comments\n<div class='vspace'></div>\n|-\n| valign='top' | Insert/Insert at different lines\n| valign='top' | initial_line\n| valign='top' | <span style='color: red;'>inserted_line1 <br clear='all' /></span><span style='color: black;'>initial_line </span>\n| valign='top' | <span style='color: black;'>initial_line <br clear='all' /></span><span style='color: green;'>inserted_line2 </span>\n| valign='top' | <span style='color: red;'>inserted_line1 <br clear='all' /></span><span style='color: black;'>initial_line <br clear='all' /></span><span style='color: green;'>inserted_line2 </span>\n| valign='top' | <ul><li>DSMW server1 inserts a line before the initial line and DSMW server2 inserts a line after the initial line\n</li></ul><div class='vspace'></div>\n|-\n| valign='top' | Ins/ins the same line\n| valign='top' | initial_line1 <br clear='all' /> initial_line2\n| valign='top' | initial_line1 <br clear='all' /><span style='color: red;'>inserted_line1 <br clear='all' /></span><span style='color: black;'>initial_line2 </span>\n| valign='top' | initial_line1 <br clear='all' /><span style='color: green;'>inserted_line2 <br clear='all' /></span><span style='color: black;'>initial_line2 </span>\n| valign='top' | <ul><li>initial_line1 <br clear='all' /><span style='color: red;'>inserted_line1 <br clear='all' /></span><span style='color: green;'>inserted_line2 <br clear='all' /></span><span style='color: black;'>initial_line2 </span></li></ul><p>or\n</p><ul><li>initial_line1 <br clear='all' /><span style='color: green;'>inserted_line2 <br clear='all' /></span><span style='color: red;'>inserted_line1 <br clear='all' /></span><span style='color: black;'>initial_line2 </span></li></ul>\n| valign='top' | <ul><li>DSMW server1 and 2 insert a different line between the initial lines\n</li></ul><div class='vspace'></div>\n|-\n| valign='top' | update/update the same line\n| valign='top' | XXX\n| valign='top' | XX<span style='color: red;'>Y </span>\n| valign='top' | XX<span style='color: green;'>Z </span>\n| valign='top' | <ul><li>XX<span style='color: red;'>Y <br clear='all' /></span><span style='color: black;'>XX</span><span style='color: green;'>Z </span></li></ul><p>or\n</p><ul><li><span style='color: black;'>XX</span><span style='color: green;'>Z <br clear='all' /></span><span style='color: black;'>XX</span><span style='color: red;'>Y </span></li></ul>\n| valign='top' | <ul><li>DSMW server1 and 2 update the initial line with a different letter\n</li><li>There is no update operation in DSMW, update is equivalent to delete old line and insert a new one with the new content\n</li><li>The *or* does not means that we can have one value in one site and another in another site. Logoot will decide the convergent state by choosing one solution\n</li></ul><div class='vspace'></div>\n|-\n| valign='top' | update/delete same line\n| valign='top' | XXX\n| valign='top' | XX<span style='color: red;'>Y </span>\n| valign='top' | <span style='color: red;'><em><del>line deleted</del></em></span>\n| valign='top' | XX<span style='color: red;'>Y </span>\n| valign='top' | <ul><li>DSMW server1 updates the initial line and DSMW server2 deletes the initial line\n</li></ul><div class='vspace'></div>\n|-\n| valign='top' | Del/Del the same line\n| valign='top' | initial_line\n| valign='top' | <span style='color: red;'><em><del>line deleted</del></em></span>\n| valign='top' | <span style='color: red;'><em><del>line deleted</del></em></span>\n| valign='top' | <span style='color: red;'><em><del>line deleted</del></em></span>\n| valign='top' | <ul><li>DSMW server1 and server2 delete the “initial_line”\n</li></ul>\n|}\n\n[[Category:DSMWDocumentation]]\n"; $text1 = "* DSMW2 will subscribe to the DSMW1 push feed. Go to the and tp '''DSMW Admin functions''' on the '''special pages''' and click on '''[ADD]''' beside PULL. This leads to the following form:\n\n\n[[Image:2-1addpull1.png]]\n\n\n* Complete this form with the Server URL, the PushFeed name (informations received from DSMW1 user) and the PullFeed name. In this tutorial, the server URL is: \"http://localhost/wiki1\", the PushFeed Name is: \"PushTutorial\" and the PullFeedName is \"PullTutorial\" as showing below:\n\nNote that the PullFeed name is free, we use this one only for the example.\n\n\n[[Image:2-2addpull1.png]]\n----\n'''''Since DSMW-0.6, this page has been modified and has the layout represented by the image below'''''\n\n[[Image:pullpagecreation.png]]\n----\n\n\n'''Important:''' the PushFeed name is case sensitive, if you do not respect that (and you will not get the expected informations).\n\n* Click on the '''ADD''' button to create the PullFeed \"PullTutorial\".\n\n\n[[Image:pulltutorial2.png]]\n\n\nNote that we could \"pull\" the informations directly in this page, but we will use Administration page, so follow the link '''Special:ArticleAdminPage''' under the \"PULL\" button.\n\nRemark: We pull from the DSMW Administration page because we wanted to show you that you can see more informations on this page (and that you could pull more than one pullFeed, if they were more than one...).\n\n\n[[Image:2-4adminpage.png]]\n\n\nIf you want to see how many patches are available on remote server click on \"'''[Display]'''\" and the pullfeed table will appear like this:\n\n\n[[Image:2-4-1adminpage.png]]\n\n\n* Select the PullFeed you have just created by check the checkbox and click on the '''PULL''' button. A ChangeSet page that recapitulates the \"pulled\" informations (including the identifier of patches) is created.\n\n\n[[Image:changeset2.png]]\n\n\n* Now the \"pull\" procedure is completed on DSMW2, you should have the 2 articles \"Hello\" and \"World\" on DSMW2. Let's check it...\n\nWrite \"Hello\" in the search box and click on the button \"go\".\n\n\n[[Image:2-6hellopage.png]]\n\n\n...and...\n\n\n[[Image:2-8worldpage.png]]\n\n\n* Let us take a look to the Administration tab informations:\n\n\n[[Image:DSMWonHello2b.png]]\n\n\n...and...\n\n\n[[Image:DSMWonWorld2.png]]\n\n\n'''Remark: '''we have the right informations, a grey tinted patch means that a remote patch has been locally integrated.\n\nWe have the right informations because we made one modifications on Hello that are 2 insertions and one modification with 4 inserts.\n\n* Let us take a look to the \"DSMW Admin functions\" page informations:\n\n\n[[Image:2-10adminpage.png]]\n\n\nThe informations are updated! You can display remote patches:\n\n\n[[Image:2-10-1adminpage.png]]\n\n\n''Congratulations, you finished the first execution scenario with DSMW. Now you can enjoy playing with DSMW. If you want to learn more about the using of DSMW see the different [[DSMW User Manual|documentations]]''.\n\n[[Category:DSMWDocumentation]]\n"; $this->assertTrue($this->p2pBot1->createPage('Conflict_Management1', $text)); $this->p2pBot1->createPage('Subscription_Procedure1', $text1); $this->p2pBot1->createPush('PushDSMWDoc1', '[[Category:DSMWDocumentation]]'); $this->p2pBot1->push('PushFeed:PushDSMWDoc1'); $this->p2pBot2->createPull('PullDSMWDoc1', $this->p2pBot1->bot->wikiServer, 'PushDSMWDoc1'); $this->p2pBot2->pull('PullFeed:PullDSMWDoc1'); //assert that there is the same changeSet on the 2 wikis $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]][[inPushFeed::PushFeed:PushDSMWDoc1]]', '-3FchangeSetID'); $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]][[inPullFeed::PullFeed:PullDSMWDoc1]]', '-3FchangeSetID'); $this->assertEquals($CSonWiki1, $CSonWiki2, 'changeSet are not equals on the 2 wikis'); //assert that there is the same patch on the 2 wikis $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::Conflict_Management1]]', '-3FpatchID'); $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::Conflict_Management1]]', '-3FpatchID'); $PatchonWiki1 = arraytolower($PatchonWiki1); $PatchonWiki2 = arraytolower($PatchonWiki2); $this->assertEquals($PatchonWiki1, $PatchonWiki2, 'patch are not equals on the 2 wikis'); $PatchonWiki3 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::Subscription_Procedure1]]', '-3FpatchID'); $PatchonWiki4 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::Subscription_Procedure1]]', '-3FpatchID'); $PatchonWiki3 = arraytolower($PatchonWiki3); $PatchonWiki4 = arraytolower($PatchonWiki4); $this->assertEquals($PatchonWiki3, $PatchonWiki4, 'patch are not equals on the 2 wikis'); assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, 'Conflict_Management1'); assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, 'Subscription_Procedure1'); }
/** * execute criss cross merge W1|W2 1 2 - make change in 2 wiki |\/| |/\| 3==4 */ public function testSimple3() { // create page $this->assertTrue($this->p2pBot1->createPage($this->pageName, $this->content), 'Failed to create page ' . $this->pageName . ' (' . $this->p2pBot1->bot->results . ')'); // assert page Ours exist on wiki1 assertPageExist($this->p2pBot1->bot->wikiServer, $this->pageName); // create push on wiki1 $this->assertTrue($this->p2pBot1->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot1->bot->results . ')'); // push $this->assertTrue($this->p2pBot1->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')'); // create page $this->assertTrue($this->p2pBot2->createPage($this->pageName, $this->content), 'Failed to create page ' . $this->pageName . ' (' . $this->p2pBot2->bot->results . ')'); // assert page Ours exist on wiki2 assertPageExist($this->p2pBot2->bot->wikiServer, $this->pageName); // create push on wiki2 $this->assertTrue($this->p2pBot2->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot2->bot->results . ')'); // push $this->assertTrue($this->p2pBot2->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')'); // create pull on wiki2 $this->assertTrue($this->p2pBot2->createPull($this->pullName, $this->wiki1, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot2->bot->results . ')'); // pull $this->assertTrue($this->p2pBot2->pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot2->bot->results . ')'); // create pull on wiki1 $this->assertTrue($this->p2pBot1->createPull($this->pullName, $this->wiki2, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot1->bot->results . ')'); // pull $this->assertTrue($this->p2pBot1->pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot1->bot->results . ')'); // assert that there is the same changeSet on the 2 wikis $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]][[inPushFeed::' . $this->pushFeed . ']]', '-3FchangeSetID'); $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]][[inPullFeed::' . $this->pullFeed . ']]', '-3FchangeSetID'); $this->assertEquals($CSonWiki1, $CSonWiki2, 'changeSet are not equals on the 2 wikis'); // assert that there is the same patch on the 2 wikis $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->pageName . ']]', '-3FpatchID'); $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->pageName . ']]', '-3FpatchID'); $PatchonWiki1 = arraytolower($PatchonWiki1); $PatchonWiki2 = arraytolower($PatchonWiki2); $this->assertEquals($PatchonWiki1, $PatchonWiki2, 'patch are not equals on the 2 wikis'); // assert that wiki1/File:Ours == wiki2/File:Ours assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $this->pageName); }
function testSimple3() { $this->testSimple1(); $countCSonWiki1 = count(getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]]', '-3FpatchID')); //create push on wiki2 $pushName = 'PushCity10'; $pushRequest = '[[category:Lambach]]'; $this->assertTrue($this->p2pBot2->createPush($pushName, $pushRequest), 'Failed to create push : ' . $pushName . ' (' . $this->p2pBot2->bot->results . ')'); $this->assertTrue($this->p2pBot2->push('PushFeed:' . $pushName), 'failed to push ' . $pushName . ' (' . $this->p2pBot2->bot->results . ')'); // assert that wiki1/Category:Lambach == wiki2/Category:Lambach assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, 'Category:Lambach'); //create pull on wiki1 $pullName = 'pullCity'; $this->assertTrue($this->p2pBot1->createPull($pullName, $this->wiki2, $pushName), 'failed to create pull ' . $pullName . ' (' . $this->p2pBot1->bot->results . ')'); //pull $this->assertTrue($this->p2pBot1->Pull('PullFeed:' . $pullName), 'failed to pull ' . $pullName . ' (' . $this->p2pBot1->bot->results . ')'); $countCS = count(getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]]', '-3FpatchID')); //assert no patch created on wiki1 $this->assertTrue($countCSonWiki1 == $countCS); // assert that wiki1/Category:Lambach == wiki2/Category:Lambach $contentWiki1 = getContentPage($this->p2pBot1->bot->wikiServer, 'Category:Lambach'); $contentWiki2 = getContentPage($this->p2pBot2->bot->wikiServer, 'Category:Lambach'); assertPageExist($this->p2pBot2->bot->wikiServer, 'Category:Lambach'); $this->assertEquals($contentWiki1, $contentWiki2, 'Failed content page Lambach'); //assert that there is the same patch on the 2 wikis $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]]', '-3FpatchID'); $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]]', '-3FpatchID'); $PatchonWiki1 = arraytolower($PatchonWiki1); $PatchonWiki2 = arraytolower($PatchonWiki2); $this->assertEquals($PatchonWiki1, $PatchonWiki2); //assert that there is the same changeSet on the 2 wikis $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID'); $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID'); $this->assertEquals($CSonWiki1, $CSonWiki2); }
/** * Create one page with an attachment, push it * pull it on wiki2 * wiki2 change the file, pull the page * wiki1 push the page and must have the new attachment on local */ public function testSimple4() { $this->testSimple3(); // change file on wiki2 $this->assertTrue($this->p2pBot2->uploadFile($this->fileDir . $this->file2, $this->file, '1')); $PatchonWiki1 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID'); $PatchonWiki1 = arraytolower($PatchonWiki1); $this->assertEquals(count($PatchonWiki1), 3); // test si le fichier a été uploder sur le wiki2 $this->assertTrue($this->p2pBot2->getFileFeatures($this->file, $this->file_size2)); // create push on wiki2 $this->assertTrue($this->p2pBot2->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot1->bot->results . ')'); // push $this->assertTrue($this->p2pBot2->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')'); // create pull on wiki1 from wiki2 $this->assertTrue($this->p2pBot1->createPull($this->pullName, $this->wiki2, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot1->bot->results . ')'); // pull $this->assertTrue($this->p2pBot1->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot1->bot->results . ')'); // test if the good file was upload on wiki1 from wiki2 $this->assertTrue($this->p2pBot1->getFileFeatures($this->file, $this->file_size2)); assertPageExist($this->p2pBot1->bot->wikiServer, $this->filePage); // assert that there is the same changeSet on the 2 wikis $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]][[inPullFeed::' . $this->pullFeed . ']]', '-3FchangeSetID'); $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]][[inPushFeed::' . $this->pushFeed . ']]', '-3FchangeSetID'); $this->assertEquals($CSonWiki1, $CSonWiki2, 'changeSet are not equals on the 2 wikis'); // assert that there is the same patch on the 2 wikis $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID'); $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID'); $PatchonWiki1 = arraytolower($PatchonWiki1); $PatchonWiki2 = arraytolower($PatchonWiki2); $this->assertEquals($PatchonWiki1, $PatchonWiki2, 'patch are not equals on the 2 wikis'); // assert that wiki1/File:Ours == wiki2/File:Ours assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $this->filePage); }
} elseif ($request->code == 300 || $request->code == 301 || $request->code == 302) { $var_code = ANONNEWS_ERROR_SHORTENER_DETECTED; require "module.error.php"; } elseif ($request->code == 200) { $request = curl_get($_POST['url']); if (!preg_match("/<title>?(.*?)<\\/title>/i", $request->result, $matches)) { $title = ""; $title_desc = "No website title could be suggested. Please enter one yourself."; } else { $title = $matches[1]; $title_desc = "The below suggestion was made based on the full page title (<em>{$title}</em>). Make sure it's correct before submitting."; $title_suggestion = utf8_entities_if_needed(suggest_title($title)); $raw_suggestion = html_entity_decode($title_suggestion, ENT_QUOTES, "UTF-8"); // Load noise dictionary, for tag generation $noise = split_lines(file_get_contents_cached("english.dic")->data); $noise = arraytolower($noise); foreach (explode(" ", $raw_suggestion) as $tag) { $tag = trim(clean_tag($tag)); if (strlen(trim($tag)) > 1 && in_array(strtolower(trim($tag)), $noise) === false) { $tag_list[] = strtolower($tag); } } $tag_list = array_unique($tag_list); $tags_suggestion = utf8_entities_if_needed(implode(", ", $tag_list)); } if ($detect_language) { require_once "Text/LanguageDetect.php"; $detector = new Text_LanguageDetect(); $detected_language = $detector->detectSimple(strip_tags($request->result)); } else { $detected_language = "English";