Ejemplo n.º 1
0
	/**
	 * Sync all features from the licensing servers and keep the values cached locally.
	 */
	public static function Sync(){
		// This feature relies on a valid server id.
		if(!defined('SERVER_ID')){
			return null;
		}
		if(strlen(SERVER_ID) != 32){
			return null;
		}
		
		$urls     = [];
		$features = self::Singleton()->_features;
		
		foreach($features as $d){
			if(!in_array($d['url'], $urls)){
				$urls[] = $d['url'];
			}
		}
		
		// URLs now is an array of all update servers to pull licensed features from.
		foreach($urls as $u){
			$r = new \Core\Filestore\Backends\FileRemote();
			$r->setRequestHeader('X-Core-Server-ID', SERVER_ID);
			$r->setFilename($u . '/licenser.json');

			$contents = $r->getContents();
			var_dump($r, $contents); die();
		}
	}
Ejemplo n.º 2
0
	public function testGetContents() {
		$file1 = new \Core\Filestore\Backends\FileRemote($this->_testfile);

		$this->assertNotEmpty($file1->getContents());
	}