Lines Matching refs:filename

82 		$filename = $this->createFilename($wsdl);
83 if ($this->obtainMutex($filename, "r")) {
86 if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) {
87 unlink($filename);
88 $this->debug("Expired $wsdl ($filename) from cache");
89 $this->releaseMutex($filename);
94 if (!file_exists($filename)) {
95 $this->debug("$wsdl ($filename) not in cache (1)");
96 $this->releaseMutex($filename);
99 $fp = @fopen($filename, "r");
101 $s = implode("", @file($filename));
103 $this->debug("Got $wsdl ($filename) from cache");
106 $this->debug("$wsdl ($filename) not in cache (2)");
108 $this->releaseMutex($filename);
111 $this->debug("Unable to obtain mutex for $filename in get");
119 * @param string $filename The Filename of the Cache to lock
124 function obtainMutex($filename, $mode) { argument
125 if (isset($this->fplock[md5($filename)])) {
126 $this->debug("Lock for $filename already exists");
129 $this->fplock[md5($filename)] = fopen($filename.".lock", "w");
131 return flock($this->fplock[md5($filename)], LOCK_SH);
133 return flock($this->fplock[md5($filename)], LOCK_EX);
145 $filename = $this->createFilename($wsdl_instance->wsdl);
147 if ($this->obtainMutex($filename, "w")) {
148 $fp = fopen($filename, "w");
150 $this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache");
151 $this->releaseMutex($filename);
156 $this->debug("Put $wsdl_instance->wsdl ($filename) in cache");
157 $this->releaseMutex($filename);
160 $this->debug("Unable to obtain mutex for $filename in put");
168 * @param string $filename The Filename of the Cache to lock
172 function releaseMutex($filename) { argument
173 $ret = flock($this->fplock[md5($filename)], LOCK_UN);
174 fclose($this->fplock[md5($filename)]);
175 unset($this->fplock[md5($filename)]);
177 $this->debug("Not able to release lock for $filename");
190 $filename = $this->createFilename($wsdl);
191 if (!file_exists($filename)) {
192 $this->debug("$wsdl ($filename) not in cache to be removed");
196 $this->obtainMutex($filename, "w");
197 $ret = unlink($filename);
198 $this->debug("Removed ($ret) $wsdl ($filename) from cache");
199 $this->releaseMutex($filename);