Ejemplo n.º 1
0
 /**
  * Zend_XmlRpc_Server_Cache::delete() test
  */
 public function testDelete()
 {
     if (!is_writeable('./')) {
         throw new PHPUnit_Framework_IncompleteTestError('Directory not writeable');
     }
     $this->assertTrue(Zend_XmlRpc_Server_Cache::save($this->_file, $this->_server));
     $this->assertTrue(Zend_XmlRpc_Server_Cache::delete($this->_file));
 }
Ejemplo n.º 2
0
 public function testShouldReturnFalseWithInvalidCache()
 {
     if (!is_writeable('./')) {
         $this->markTestIncomplete('Directory no writable');
     }
     file_put_contents($this->_file, 'blahblahblah');
     $server = new Zend_XmlRpc_Server();
     $this->assertFalse(Zend_XmlRpc_Server_Cache::get($this->_file, $server));
 }
Ejemplo n.º 3
0
#!/usr/bin/env php
<?php 
chdir(dirname(__FILE__));
require_once '../php/setup.php';
// map errors to exceptions
function errorHandler($errno, $errstr, $errfile, $errline)
{
    if (error_reporting()) {
        throw new Exception($errstr);
        // internal error not to be mapped to fault
    }
    return true;
}
error_reporting(E_ALL & ~E_NOTICE);
set_error_handler('errorHandler', E_ALL & ~E_NOTICE);
// construct facade objects
$server = new Zend_XmlRpc_Server();
$server->setClass(new Wikidot_Facade_User(), 'user');
$server->setClass(new Wikidot_Facade_Site(), 'site');
$server->setClass(new Wikidot_Facade_Page(), 'page');
$server->setClass(new Wikidot_Facade_Forum(), 'forum');
Zend_XmlRpc_Server_Cache::save('/tmp/xmlrpcapi.cache', $server);
// map Wikidot_Facade_Exception to XML-RPC faults
Zend_XmlRpc_Server_Fault::attachFaultException('Wikidot_Facade_Exception');
Zend_XmlRpc_Server_Fault::attachFaultException('WDPermissionException');
// run XML-RPC server
echo $server->handle(new Zend_XmlRpc_Request_Stdin());
Ejemplo n.º 4
0
	/**
	 * XMLRPC server
	 */
	public function xmlrpcAction() 
	{
		$cacheFile = ROOT_PATH . '/var/cache/xmlrpc.cache';
		$server = new Zend_XmlRpc_Server();
		
		if( !Zend_XmlRpc_Server_Cache::get( $cacheFile, $server )){
			$server->setClass( 'User_Service_User', 'user' );
			Zend_XmlRpc_Server_Cache::save( $cacheFile, $server);
		}
		echo $server->handle();
	}