Merge pull request #22 from hcvcastro/master

Clear cache when saves admin settings
This commit is contained in:
Andras Timar 2016-03-17 15:27:20 +01:00
commit 21a5d3f2d9
2 changed files with 16 additions and 12 deletions

View File

@ -110,23 +110,24 @@ class DocumentController extends Controller{
try { try {
$wopiClient = \OC::$server->getHTTPClientService()->newClient(); $wopiClient = \OC::$server->getHTTPClientService()->newClient();
$xmlBody = $wopiClient->get($wopiDiscovery)->getBody(); $xmlBody = $wopiClient->get($wopiDiscovery)->getBody();
if (!$xmlBody) {
return $this->responseError('failure body content', $wopiRemote);
}
} }
catch (\Exception $e) { catch (\Exception $e) {
return $this->responseError($e->getMessage(), $wopiRemote); return $this->responseError($e->getMessage(), $wopiRemote);
} }
}
$loadEntities = libxml_disable_entity_loader(true); if (!$xmlBody) {
$data = simplexml_load_string($xmlBody); return $this->responseError('failure body content', $wopiRemote);
libxml_disable_entity_loader($loadEntities); }
if ($data !== false) {
$this->cache->set('discovery.xml', $xmlBody, 3600); $loadEntities = libxml_disable_entity_loader(true);
} $data = simplexml_load_string($xmlBody);
else { libxml_disable_entity_loader($loadEntities);
return $this->responseError('failure discovery.xml not well-formed XML string', $wopiRemote); if ($data !== false) {
$this->cache->set('discovery.xml', $xmlBody, 3600);
}
else {
return $this->responseError('failure discovery.xml not well-formed XML string', $wopiRemote);
}
} }
\OC::$server->getNavigationManager()->setActiveEntry( 'richdocuments_index' ); \OC::$server->getNavigationManager()->setActiveEntry( 'richdocuments_index' );

View File

@ -115,6 +115,9 @@ class SettingsController extends Controller{
$this->appConfig->setAppValue('wopi_url', $wopi_url); $this->appConfig->setAppValue('wopi_url', $wopi_url);
} }
$richMemCache = \OC::$server->getMemCacheFactory()->create('richdocuments');
$richMemCache->clear('discovery.xml');
$response = array( $response = array(
'status' => 'success', 'status' => 'success',
'data' => array('message' => (string) $this->l10n->t('Saved')) 'data' => array('message' => (string) $this->l10n->t('Saved'))