ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilBMFWSDL_Cache Class Reference
+ Inheritance diagram for ilBMFWSDL_Cache:
+ Collaboration diagram for ilBMFWSDL_Cache:

Public Member Functions

 ilBMFWSDL_Cache ($cacheUse=WSDL_CACHE_USE, $cacheMaxAge=WSDL_CACHE_MAX_AGE)
 ilBMFWSDL_Cache constructor
 _cacheDir ()
 _cacheDir return the path to the cache, if it doesn't exist, make it
 get ($wsdl_fname, $proxy_params=array(), $cache=0)
 Retrieves a file from cache if it exists, otherwise retreive from net, add to cache, and return from cache.
- Public Member Functions inherited from ilBMFBase
 ilBMFBase ($faultcode= 'Client')
 Constructor.
 _resetNamespaces ()
 _setSchemaVersion ($schemaVersion)
 Sets the schema version used in the SOAP message.
 _getNamespacePrefix ($ns)
 _getNamespaceForPrefix ($prefix)
 _isSoapValue (&$value)
 _serializeValue (&$value, $name= '', $type=false, $elNamespace=NULL, $typeNamespace=NULL, $options=array(), $attributes=array(), $artype='', $OBJTypeNS=array())
 _getType (&$value)
 Converts a PHP type to a SOAP type.
 _multiArrayType (&$value, &$type, &$size, &$xml)
 _isBase64 (&$value)
 Returns whether a string is base64 encoded data.
 _isBase64Type ($type)
 Returns whether a type is a base64 type.
 _isHash (&$a)
 Returns whether an array is a hash.
 _un_htmlentities ($string)
_decode (&$soapval)
 _makeEnvelope (&$method, &$headers, $encoding=SOAP_DEFAULT_ENCODING, $options=array())
 Creates the SOAP envelope with the SOAP envelop data.
 _makeMimeMessage (&$xml, $encoding=SOAP_DEFAULT_ENCODING)
 _makeDIMEMessage ($xml)
 _decodeMimeMessage (&$data, &$headers, &$attachments)
 _decodeDIMEMessage (&$data, &$headers, &$attachments)
 __set_type_translation ($type, $class=null)
- Public Member Functions inherited from ilBMFBase_Object
 ilBMFBase_Object ($faultcode= 'Client')
 Constructor.
_raiseSoapFault ($str, $detail= '', $actorURI= '', $code=null, $mode=null, $options=null, $skipmsg=false)
 Raises a SOAP error.
 __isfault ()
__getfault ()
 _debug ($string)
 Adds a string to the debug data.
- Public Member Functions inherited from PEAR
 PEAR ($error_class=null)
 Constructor.
 _PEAR ()
 Destructor (the emulated type of...).
getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them.
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes.
 isError ($data, $code=null)
 Tell whether a value is a PEAR error.
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled.
 expectError ($code= '*')
 This method is used to tell which errors you expect to get.
 popExpect ()
 This method pops one element off the expected error codes stack.
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available.
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack.
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied.
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options.
 staticPushErrorHandling ($mode, $options=null)
 staticPopErrorHandling ()
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack.
 popErrorHandling ()
 Pop the last error handler used.
 loadExtension ($ext)
 OS independant PHP extension load.

Data Fields

 $_cacheUse = null
 $_cacheMaxAge = null
- Data Fields inherited from ilBMFBase
 $_XMLSchema
 $_XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 $_typemap
 $_defaultObjectClassname = 'stdClass'
 Default class name to use for decoded response objects.
 $_namespaces
 $_namespace
 $_xmlEntities
 $_doconversion = false
 $__attachments = array()
 $_wsdl = null
 $_section5 = true
 True if we use section 5 encoding, or false if this is literal.
 $_auto_translation = false
 $_type_translation = array()
- Data Fields inherited from ilBMFBase_Object
 $_debug_flag = false
 Store debugging information in $_debug_data?
 $_debug_data = ''
 String containing debugging information if $_debug_flag is true.
 $_encodings = array('ISO-8859-1', 'US-ASCII', 'UTF-8')
 Supported encodings, limited by XML extension.
 $_myfaultcode = ''
 Fault code.
 $fault = null
 Recent PEAR_Error object.
- Data Fields inherited from PEAR
 $_debug = false
 $_default_error_mode = null
 $_default_error_options = null
 $_default_error_handler = ''
 $_error_class = 'PEAR_Error'
 $_expected_errors = array()

Detailed Description

Definition at line 873 of file class.ilBMFWSDL.php.

Member Function Documentation

ilBMFWSDL_Cache::_cacheDir ( )

_cacheDir return the path to the cache, if it doesn't exist, make it

Definition at line 910 of file class.ilBMFWSDL.php.

References $dir.

Referenced by get().

{
$dir = getenv("WSDLCACHE");
if (!$dir) $dir = " ./wsdlcache";
@mkdir($dir, 0700);
return $dir;
}

+ Here is the caller graph for this function:

ilBMFWSDL_Cache::get (   $wsdl_fname,
  $proxy_params = array(),
  $cache = 0 
)

Retrieves a file from cache if it exists, otherwise retreive from net, add to cache, and return from cache.

Parameters
stringURL to WSDL
arrayproxy parameters
intexpected MD5 of WSDL URL public
Returns
string data

Definition at line 928 of file class.ilBMFWSDL.php.

References _cacheDir(), ilBMFBase_Object\_raiseSoapFault(), and PEAR\isError().

{
$cachename = $md5_wsdl = $file_data = '';
if ($this->_cacheUse) {
// Try to retrieve WSDL from cache
$cachename = ilBMFWSDL_Cache::_cacheDir() . '/' . md5($wsdl_fname). ' .wsdl';
if (file_exists($cachename)) {
$wf = fopen($cachename, 'rb');
if ($wf) {
// Reading cached file
$file_data = fread($wf, filesize($cachename));
$md5_wsdl = md5($file_data);
fclose($wf);
}
if ($cache) {
if ($cache != $md5_wsdl) {
return $this->_raiseSoapFault('WSDL Checksum error!', $wsdl_fname);
}
} else {
$fi = stat($cachename);
$cache_mtime = $fi[8];
//print cache_mtime, time()
if ($cache_mtime + $this->_cacheMaxAge < time()) {
// expired
$md5_wsdl = ''; // refetch
}
}
}
}
if (!$md5_wsdl) {
// Not cached or not using cache. Retrieve WSDL from URL
// is it a local file?
// this section should be replace by curl at some point
if (!preg_match('/^(https?|file):\/\//', $wsdl_fname)) {
if (!file_exists($wsdl_fname)) {
return $this->_raiseSoapFault("Unable to read local WSDL $wsdl_fname", $wsdl_fname);
}
if (function_exists('file_get_contents')) {
$file_data = file_get_contents($wsdl_fname);
} else {
$file_data = implode('',file($wsdl_fname));
}
} else {
$uri = explode('?', $wsdl_fname);
$rq =& new HTTP_Request($uri[0], $proxy_params);
// the user agent HTTP_Request uses fouls things up
if (isset($uri[1])) {
$rq->addRawQueryString($uri[1]);
}
if (isset($proxy_params['proxy_host']) &&
isset($proxy_params['proxy_port']) &&
isset($proxy_params['proxy_user']) &&
isset($proxy_params['proxy_pass'])) {
$rq->setProxy($proxy_params['proxy_host'], $proxy_params['proxy_port'],
$proxy_params['proxy_user'], $proxy_params['proxy_pass']);
} elseif (isset($proxy_params['proxy_host']) &&
isset($proxy_params['proxy_port'])) {
$rq->setProxy($proxy_params['proxy_host'], $proxy_params['proxy_port']);
}
$result = $rq->sendRequest();
if (PEAR::isError($result)) {
return $this->_raiseSoapFault("Unable to retrieve WSDL $wsdl_fname," . $rq->getResponseCode(), $wsdl_fname);
}
$file_data = $rq->getResponseBody();
if (!$file_data) {
return $this->_raiseSoapFault("Unable to retrieve WSDL $wsdl_fname, no http body", $wsdl_fname);
}
}
$md5_wsdl = md5($file_data);
if ($this->_cacheUse) {
$fp = fopen($cachename, "wb");
fwrite($fp, $file_data);
fclose($fp);
}
}
if ($this->_cacheUse && $cache && $cache != $md5_wsdl) {
return $this->_raiseSoapFault("WSDL Checksum error!", $wsdl_fname);
}
return $file_data;
}

+ Here is the call graph for this function:

ilBMFWSDL_Cache::ilBMFWSDL_Cache (   $cacheUse = WSDL_CACHE_USE,
  $cacheMaxAge = WSDL_CACHE_MAX_AGE 
)

ilBMFWSDL_Cache constructor

Parameters
booleanuse caching
intcache max lifetime (in seconds) public

Definition at line 898 of file class.ilBMFWSDL.php.

References ilBMFBase\ilBMFBase().

{
parent::ilBMFBase('WSDLCACHE');
$this->_cacheUse = $cacheUse;
$this->_cacheMaxAge = $cacheMaxAge;
}

+ Here is the call graph for this function:

Field Documentation

ilBMFWSDL_Cache::$_cacheMaxAge = null

Definition at line 889 of file class.ilBMFWSDL.php.

ilBMFWSDL_Cache::$_cacheUse = null

Definition at line 882 of file class.ilBMFWSDL.php.


The documentation for this class was generated from the following file: