From fbad651ebd31d09406ef141e61ea396ad1eda710 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Tue, 21 Oct 2014 15:14:19 +0200 Subject: Make config.ini editable in the admin interface --- appinfo/app.json | 1 + appinfo/app.php | 5 ++--- appinfo/application.php | 17 +++++++++++++++-- appinfo/preupdate.php | 0 appinfo/routes.php | 3 +++ 5 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 appinfo/preupdate.php (limited to 'appinfo') diff --git a/appinfo/app.json b/appinfo/app.json index 5e110c8a9..6d8ed231d 100644 --- a/appinfo/app.json +++ b/appinfo/app.json @@ -34,6 +34,7 @@ "hooks": { "OC_User::pre_deleteUser": "OCA\\News\\Hooks\\User::deleteUser" }, + "admin": true, "categories": ["Multimedia"], "dependencies": { "databases": ["pgsql", "sqlite3", "mysql"], diff --git a/appinfo/app.php b/appinfo/app.php index a6de66ce2..8188d3eeb 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -26,6 +26,5 @@ set_error_handler(function ($code, $message) { $container = new Application(); $config = $container->getAppConfig(); -$config->registerNavigation(); -$config->registerBackgroundJobs(); -$config->registerHooks(); \ No newline at end of file +$config->registerAll(); +$config->testDependencies(); \ No newline at end of file diff --git a/appinfo/application.php b/appinfo/application.php index cdbaa82d6..e410ce701 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -21,6 +21,7 @@ use \OCP\User; use \OCA\News\Config\AppConfig; use \OCA\News\Config\Config; +use \OCA\News\Controller\AdminController; use \OCA\News\Controller\PageController; use \OCA\News\Controller\FolderController; use \OCA\News\Controller\FeedController; @@ -92,6 +93,15 @@ class Application extends App { ); }); + $container->registerService('AdminController', function($c) { + return new AdminController( + $c->query('AppName'), + $c->query('Request'), + $c->query('Config'), + $c->query('ConfigPath') + ); + }); + $container->registerService('FolderController', function($c) { return new FolderController( $c->query('AppName'), @@ -329,13 +339,17 @@ class Application extends App { return $view; }); + $container->registerService('ConfigPath', function() { + return 'config.ini'; + }); + $container->registerService('Config', function($c) { $config = new Config( $c->query('ConfigView'), $c->query('Logger'), $c->query('LoggerParameters') ); - $config->read('config.ini', true); + $config->read($c->query('ConfigPath'), true); return $config; }); @@ -470,6 +484,5 @@ class Application extends App { } - public function dispatchPart($controller, $) } diff --git a/appinfo/preupdate.php b/appinfo/preupdate.php new file mode 100644 index 000000000..e69de29bb diff --git a/appinfo/routes.php b/appinfo/routes.php index 7703de1c7..930fdb136 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -23,6 +23,9 @@ $application->registerRoutes($this, ['routes' => [ ['name' => 'page#update_settings', 'url' => '/settings', 'verb' => 'PUT'], ['name' => 'page#manifest', 'url' => '/manifest.webapp', 'verb' => 'GET'], + // admin + ['name' => 'admin#update', 'url' => '/admin', 'verb' => 'PUT'], + // folders ['name' => 'folder#index', 'url' => '/folders', 'verb' => 'GET'], ['name' => 'folder#create', 'url' => '/folders', 'verb' => 'POST'], -- cgit v1.2.3