public function test_getInformationsAboutSystem() { $config = Zend_Registry::get('config'); $informations = USVN_Update::getInformationsAboutSystem(); $xml = new SimpleXMLElement($informations); $this->assertEquals(phpversion(), (string) $xml->php->version); $this->assertEquals(PHP_OS, (string) $xml->host->os); $this->assertEquals(php_uname(), (string) $xml->host->uname); $this->assertEquals(implode(".", USVN_SVNUtils::getSvnVersion()), (string) $xml->subversion->version); $this->assertEquals("en_US", (string) $xml->usvn->translation); $this->assertEquals("mysql", (string) $xml->usvn->databaseadapter); $this->assertEquals("", (string) $xml->php->ini->register_globals); foreach ($xml->php->extension as $e) { if ($e == "pdo_sqlite") { return; } } $this->fail("pdo_sdqlite extension not found"); }
/** * Update file with USVN version number */ public static function updateUSVNAvailableVersionNumber() { if (USVN_Update::itsCheckForUpdateTime()) { $config = Zend_Registry::get('config'); $url = 'http://www.usvn.info'; $http_conf = USVN_Update::setProxyForUpdate(array('maxredirects' => 0, 'timeout' => 30)); // if (defined("PHPUnit_MAIN_METHOD")) // $url = 'http://iceage.usvn.info'; $client = new Zend_Http_Client($url . '/update/' . urlencode($config->version), $http_conf); $client->setParameterPost('sysinfo', USVN_Update::getInformationsAboutSystem()); try { $response = $client->request('POST'); } catch (Exception $e) { // Ugly but we don't want to display error if usvn.info is not available return; } if ($response->getStatus() == 200) { $config->update->availableversion = $response->getBody(); $config->save(); } $config->update->lastcheckforupdate = time(); $config->save(); } }