Parcourir la source

Respect default settings

Support for default settings when there is none provided by user
was already in lib/appconfig.php

But we were using the CoreConfig object always which queries the
database; lets use the appConfig object so that if the value is
missing in the database, we still have the default value to take
care of the app.
tags/1.1.22
Pranav Kant il y a 3 ans
Parent
révision
c166c7b189
2 fichiers modifiés avec 8 ajouts et 5 suppressions
  1. 1
    0
      appinfo/application.php
  2. 7
    5
      controller/documentcontroller.php

+ 1
- 0
appinfo/application.php Voir le fichier

@@ -47,6 +47,7 @@ class Application extends App {
$c->query('AppName'),
$c->query('Request'),
$c->query('CoreConfig'),
$c->query('AppConfig'),
$c->query('L10N'),
$c->query('UserId'),
$c->query('ICacheFactory'),

+ 7
- 5
controller/documentcontroller.php Voir le fichier

@@ -48,15 +48,17 @@ class DocumentController extends Controller {
private $uid;
private $l10n;
private $settings;
private $appConfig;
private $cache;
private $logger;
const ODT_TEMPLATE_PATH = '/assets/odttemplate.odt';

public function __construct($appName, IRequest $request, IConfig $settings, IL10N $l10n, $uid, ICacheFactory $cache, ILogger $logger){
public function __construct($appName, IRequest $request, IConfig $settings, IConfig $appConfig, IL10N $l10n, $uid, ICacheFactory $cache, ILogger $logger){
parent::__construct($appName, $request);
$this->uid = $uid;
$this->l10n = $l10n;
$this->settings = $settings;
$this->appConfig = $appConfig;
$this->cache = $cache->create($appName);
$this->logger = $logger;
}
@@ -121,7 +123,7 @@ class DocumentController extends Controller {
private function getDiscovery(){
\OC::$server->getLogger()->debug('getDiscovery(): Getting discovery.xml from the cache.');

$wopiRemote = $this->settings->getAppValue('richdocuments', 'wopi_url');
$wopiRemote = $this->appConfig->getAppValue('wopi_url');

// Provides access to information about the capabilities of a WOPI client
// and the mechanisms for invoking those abilities through URIs.
@@ -183,7 +185,7 @@ class DocumentController extends Controller {

if ($discovery_parsed === false) {
$this->cache->remove('discovery.xml');
$wopiRemote = $this->settings->getAppValue('richdocuments', 'wopi_url');
$wopiRemote = $this->appConfig->getAppValue('wopi_url');

return array(
'status' => 'error',
@@ -239,7 +241,7 @@ class DocumentController extends Controller {
* @NoCSRFRequired
*/
public function index(){
$wopiRemote = $this->settings->getAppValue('richdocuments', 'wopi_url');
$wopiRemote = $this->appConfig->getAppValue('wopi_url');
if (($parts = parse_url($wopiRemote)) && isset($parts['scheme']) && isset($parts['host'])) {
$webSocketProtocol = "ws://";
if ($parts['scheme'] == "https") {
@@ -336,7 +338,7 @@ class DocumentController extends Controller {

if ($discovery_parsed === false) {
$this->cache->remove('discovery.xml');
$wopiRemote = $this->settings->getAppValue('richdocuments', 'wopi_url');
$wopiRemote = $this->appConfig->getAppValue('wopi_url');

return array(
'status' => 'error',

Chargement…
Annuler
Enregistrer