From: <var...@us...> - 2015-01-22 14:55:01
|
Revision: 9488 http://sourceforge.net/p/phpwiki/code/9488 Author: vargenau Date: 2015-01-22 14:54:52 +0000 (Thu, 22 Jan 2015) Log Message: ----------- Add soapscripts Added Paths: ----------- trunk/soapscripts/ trunk/soapscripts/README trunk/soapscripts/createpage trunk/soapscripts/createpagefromfile trunk/soapscripts/fulltextsearch trunk/soapscripts/getallpagenames trunk/soapscripts/getcurrentrevision trunk/soapscripts/getpage trunk/soapscripts/getpagemeta trunk/soapscripts/getpagerevision trunk/soapscripts/getpluginsynopsis trunk/soapscripts/listlinks trunk/soapscripts/listplugins trunk/soapscripts/listrelations trunk/soapscripts/recentchanges trunk/soapscripts/replacestring trunk/soapscripts/titlesearch Added: trunk/soapscripts/README =================================================================== --- trunk/soapscripts/README (rev 0) +++ trunk/soapscripts/README 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,16 @@ +The following scripts are available as examples of SOAP use: +* createpage +* createpagefromfile +* fulltextsearch +* getallpagenames +* getcurrentrevision +* getpage +* getpagemeta +* getpagerevision +* getpluginsynopsis +* listlinks +* listplugins +* listrelations +* recentchanges +* replacestring +* titlesearch Added: trunk/soapscripts/createpage =================================================================== --- trunk/soapscripts/createpage (rev 0) +++ trunk/soapscripts/createpage 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,33 @@ +#!/usr/bin/php +<?php +if (count($argv) != 3) { + echo "usage: $argv[0] pagename content\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + echo $client->doSavePage($argv[1], $argv[2], $credentials); + echo "\n"; +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/createpage ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/createpagefromfile =================================================================== --- trunk/soapscripts/createpagefromfile (rev 0) +++ trunk/soapscripts/createpagefromfile 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,43 @@ +#!/usr/bin/php +<?php +if (count($argv) != 3) { + echo "usage: $argv[0] pagename filename\n"; + exit; +} + +if (!file_exists($argv[2])) { + echo "error: file $argv[2] does not exist\n"; + exit; +} + +if (!is_readable($argv[2])) { + echo "error: file $argv[2] is not readable\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + echo $client->doSavePage($argv[1], file_get_contents($argv[2]), $credentials); + echo "\n"; +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/createpagefromfile ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/fulltextsearch =================================================================== --- trunk/soapscripts/fulltextsearch (rev 0) +++ trunk/soapscripts/fulltextsearch 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,35 @@ +#!/usr/bin/php +<?php +if (count($argv) != 2) { + echo "usage: $argv[0] term-to-search\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + $pages = $client->doFullTextSearch($argv[1], $credentials); + foreach ($pages as $page) { + echo $page['pagename']."\n"; + } +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/fulltextsearch ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/getallpagenames =================================================================== --- trunk/soapscripts/getallpagenames (rev 0) +++ trunk/soapscripts/getallpagenames 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,36 @@ +#!/usr/bin/php +<?php +if (count($argv) != 1) { + echo "usage: $argv[0]\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + $all_pages = $client->getAllPagenames($argv[1]); + for ($i = 0; $i < count($all_pages); $i++) { + echo $all_pages[$i]['pagename']; + echo "\n"; + } +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/getallpagenames ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/getcurrentrevision =================================================================== --- trunk/soapscripts/getcurrentrevision (rev 0) +++ trunk/soapscripts/getcurrentrevision 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,33 @@ +#!/usr/bin/php +<?php +if (count($argv) != 2) { + echo "usage: $argv[0] pagename\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + echo $client->getCurrentRevision($argv[1], $credentials); + echo "\n"; +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/getcurrentrevision ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/getpage =================================================================== --- trunk/soapscripts/getpage (rev 0) +++ trunk/soapscripts/getpage 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,33 @@ +#!/usr/bin/php +<?php +if (count($argv) != 2) { + echo "usage: $argv[0] pagename\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + echo $client->getPageContent($argv[1], $credentials); + echo "\n"; +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/getpage ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/getpagemeta =================================================================== --- trunk/soapscripts/getpagemeta (rev 0) +++ trunk/soapscripts/getpagemeta 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,35 @@ +#!/usr/bin/php +<?php +if (count($argv) != 2) { + echo "usage: $argv[0] pagename\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + $pagemeta = $client->getPageMeta($argv[1], $credentials); + foreach ($pagemeta as $key => $value) { + echo "$key: $value\n"; + } +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/getpagemeta ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/getpagerevision =================================================================== --- trunk/soapscripts/getpagerevision (rev 0) +++ trunk/soapscripts/getpagerevision 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,37 @@ +#!/usr/bin/php +<?php +if (count($argv) != 3) { + echo "usage: $argv[0] pagename revision\n"; + exit; +} +if (!is_numeric($argv[2])) { + echo "usage: revision must be an integer\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + echo $client->getPageRevision($argv[1], $argv[2], $credentials); + echo "\n"; +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/getpagerevision ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/getpluginsynopsis =================================================================== --- trunk/soapscripts/getpluginsynopsis (rev 0) +++ trunk/soapscripts/getpluginsynopsis 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,33 @@ +#!/usr/bin/php +<?php +if (count($argv) != 2) { + echo "usage: $argv[0] plugin-name\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + echo $client->getPluginSynopsis($argv[1], $credentials); + echo "\n"; +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/getpluginsynopsis ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/listlinks =================================================================== --- trunk/soapscripts/listlinks (rev 0) +++ trunk/soapscripts/listlinks 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,35 @@ +#!/usr/bin/php +<?php +if (count($argv) != 2) { + echo "usage: $argv[0] pagename\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + $links = $client->listLinks($argv[1], $credentials); + foreach ($links as $link) { + echo $link['pagename']."\n"; + } +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/listlinks ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/listplugins =================================================================== --- trunk/soapscripts/listplugins (rev 0) +++ trunk/soapscripts/listplugins 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,36 @@ +#!/usr/bin/php +<?php +if (count($argv) != 1) { + echo "usage: $argv[0]\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + $plugins = $client->listPlugins($credentials); + for ($i = 0; $i < count($plugins); $i++) { + echo $plugins[$i]; + echo "\n"; + } +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/listplugins ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/listrelations =================================================================== --- trunk/soapscripts/listrelations (rev 0) +++ trunk/soapscripts/listrelations 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,36 @@ +#!/usr/bin/php +<?php +if (count($argv) != 1) { + echo "usage: $argv[0]\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + $relations = $client->listRelations($credentials); + for ($i = 0; $i < count($relations); $i++) { + echo $relations[$i]; + echo "\n"; + } +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/listrelations ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/recentchanges =================================================================== --- trunk/soapscripts/recentchanges (rev 0) +++ trunk/soapscripts/recentchanges 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,45 @@ +#!/usr/bin/php +<?php +if (count($argv) == 1) { + $limit = 20; +} elseif (count($argv) == 2) { + $limit = $argv[0]; +} else { + echo "usage: $argv[0] [limit]\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + $changes = $client->getRecentChanges($limit, $credentials); + foreach ($changes as $change) { + echo "Pagename: ".$change['pagename']."\n"; + echo "Last modified: ".$change['lastModified']."\n"; + echo "Author: ".$change['author']."\n"; + echo "Summary: ".$change['summary']."\n"; + echo "Version: ".$change['version']."\n"; + echo "\n"; + } + +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/recentchanges ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/replacestring =================================================================== --- trunk/soapscripts/replacestring (rev 0) +++ trunk/soapscripts/replacestring 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,37 @@ +#!/usr/bin/php +<?php +if (count($argv) != 4) { + echo "usage: $argv[0] pagename search replace\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + $old_content = $client->getPageContent($argv[1], $credentials); + $new_content = str_replace($argv[2], $argv[3], $old_content); + if ($new_content != $old_content) { + echo $client->doSavePage($argv[1], $new_content, $credentials); + echo "\n"; + } +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/replacestring ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/soapscripts/titlesearch =================================================================== --- trunk/soapscripts/titlesearch (rev 0) +++ trunk/soapscripts/titlesearch 2015-01-22 14:54:52 UTC (rev 9488) @@ -0,0 +1,35 @@ +#!/usr/bin/php +<?php +if (count($argv) != 2) { + echo "usage: $argv[0] term-to-search\n"; + exit; +} + +try { + $client = new SoapClient("http://phpwiki.nmu.alcatel.fr/phpwiki/PhpWiki.wsdl"); +} catch (SoapFault $fault) { + die($fault->faultstring); +} + +$phpwiki = getenv("HOME")."/.phpwiki"; +if (!file_exists($phpwiki)) { + $login = readline("Login: "); + $password = readline("Password: "); + $credentials = base64_encode($login.':'.$password); + if ($fp = fopen($phpwiki, 'w')) { + fprintf($fp, "%s:%s\n", $login, $password); + fclose($fp); + chmod($phpwiki, 0600); + } +} else { + $credentials = base64_encode(file_get_contents($phpwiki)); +} + +try { + $pages = $client->doTitleSearch($argv[1], $credentials); + foreach ($pages as $page) { + echo $page['pagename']."\n"; + } +} catch (SoapFault $e) { + echo 'Error: ' . $e->getMessage() . "\n"; +} Property changes on: trunk/soapscripts/titlesearch ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |