コード例 #1
0
 public function testBad_string()
 {
     // <file> vs file>
     $data = "<extension key='test.foo' type='module'>file>foo</file></extension>";
     $exc = NULL;
     try {
         $info = CRM_Extension_Info::loadFromString($data);
     } catch (CRM_Extension_Exception $e) {
         $exc = $e;
     }
     $this->assertTrue(is_object($exc));
 }
コード例 #2
0
ファイル: Browser.php プロジェクト: kidaa30/yes
 /**
  * @return array
  * @throws CRM_Extension_Exception_ParseException
  */
 private function _discoverRemote()
 {
     $tsPath = $this->getTsPath();
     $timestamp = FALSE;
     if (file_exists($tsPath)) {
         $timestamp = file_get_contents($tsPath);
     }
     // 3 minutes ago for now
     $outdated = (int) $timestamp < time() - 180 ? TRUE : FALSE;
     if (!$timestamp || $outdated) {
         $remotes = json_decode($this->grabRemoteJson(), TRUE);
     } else {
         $remotes = json_decode($this->grabCachedJson(), TRUE);
     }
     $this->_remotesDiscovered = array();
     foreach ($remotes as $id => $xml) {
         $ext = CRM_Extension_Info::loadFromString($xml);
         $this->_remotesDiscovered[] = $ext;
     }
     if (file_exists(dirname($tsPath))) {
         file_put_contents($tsPath, (string) time());
     }
     return $this->_remotesDiscovered;
 }
コード例 #3
0
 /**
  * @return array
  * @throws CRM_Extension_Exception_ParseException
  */
 private function _discoverRemote()
 {
     $tsPath = $this->getTsPath();
     $timestamp = FALSE;
     if (file_exists($tsPath)) {
         $timestamp = file_get_contents($tsPath);
     }
     // 3 minutes ago for now
     $outdated = (int) $timestamp < time() - 180 ? TRUE : FALSE;
     if (!$timestamp || $outdated) {
         $remotes = $this->grabRemoteKeyList();
         $cached = FALSE;
     } else {
         $remotes = $this->grabCachedKeyList();
         $cached = TRUE;
     }
     $this->_remotesDiscovered = array();
     foreach ($remotes as $id => $rext) {
         $xml = $this->grabRemoteInfoFile($rext['key'], $cached);
         if ($xml != FALSE) {
             $ext = CRM_Extension_Info::loadFromString($xml);
             $this->_remotesDiscovered[] = $ext;
         }
     }
     if (file_exists(dirname($tsPath))) {
         file_put_contents($tsPath, (string) time());
     }
     return $this->_remotesDiscovered;
 }