Beispiel #1
0
<?
/**
 * HKFs Replicator
 *
 * 複製者、2重起動を禁止
 *
 * @author Kazuhito Hiraki <*****@*****.**>
 * @create 2011-08-24
 */
include_once("/data/hdev/app/bootstrap.php");
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// 複製数(自身を含まない)
$replicates = 1;

// 複製処理
$Fs = new HKFs();
$Fs->replicate($replicates);
exit;

?>
Beispiel #2
0
	/**
	 * DELETE処理
	 *
	 * SUCCESS: 200 OK, 204 No Content
	 * 404 Not Found (存在しないものを削除しようとしている)
	 * 204 No Content (リソースがあるコレクションを削除した)
	 *
	 * @param string $url 削除対象URL
	 * @return bool
	 */
	public function delete($url) {
		if ( $url == '' ) return false;
		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		$this->result = curl_exec($ch);
		$this->info = curl_getinfo($ch);
		$this->errno = curl_errno($ch);
		$this->error = curl_error($ch);
		
		if ( $this->getHttpCode() != 200 && $this->getHttpCode() != 204 && $this->getHttpCode() != 404 ) {
			HKFs::log("DELETE $url ".$this->getHttpCode()." NG");
			$this->setError("Delete Error HTTP CODE: ".$this->getHttpCode());
			return false;
		}
		if ( $this->errno != 0 ) {
			HKFs::log("DELETE $url ".$this->getHttpCode()." NG $this->error($this->errno)");
			return false;
		}
		curl_close($ch);
		HKFs::log("DELETE $url ".$this->getHttpCode()." OK");
		
		return true;
	}