/** * 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(); } }
/** * The filename should be able to be settable afterwards too! */ public function testSetFilename(){ $file = new \Core\Filestore\Backends\FileRemote(); $file->setFilename($this->_testfile); $this->assertEquals($this->_testfile, $file->getFilename()); $this->assertTrue($file->exists()); }