diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-08-02 17:47:38 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-08-02 17:47:38 +0200 |
commit | 7952c6a31c27718428fddbca71c587506eb071d8 (patch) | |
tree | dfbd8056b51578396f996c939701ff93b5bf7517 /lib | |
parent | 93daa9e247e9c423a6d4bb10af1106fdde37b800 (diff) | |
download | nextcloud-server-7952c6a31c27718428fddbca71c587506eb071d8.tar.gz nextcloud-server-7952c6a31c27718428fddbca71c587506eb071d8.zip |
Change access to router object to getter function
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api.php | 2 | ||||
-rw-r--r-- | lib/base.php | 18 |
2 files changed, 13 insertions, 7 deletions
diff --git a/lib/api.php b/lib/api.php index 6ee570d60e7..155082fa0d0 100644 --- a/lib/api.php +++ b/lib/api.php @@ -44,7 +44,7 @@ class OC_API { $name = strtolower($method).$url; $name = str_replace(array('/', '{', '}'), '_', $name); if(!isset(self::$actions[$name])){ - OC::$router->create($name, $url.'.{_format}') + OC::getRouter()->create($name, $url.'.{_format}') ->method($method) ->defaults(array('_format' => 'xml') + $defaults) ->requirements(array('_format' => 'xml|json') + $requirements) diff --git a/lib/base.php b/lib/base.php index 29a3502e352..43588944d04 100644 --- a/lib/base.php +++ b/lib/base.php @@ -62,14 +62,14 @@ class OC{ * requested file of app */ public static $REQUESTEDFILE = ''; - /* - * OC router - */ - public static $router = null; /** * check if owncloud runs in cli mode */ public static $CLI = false; + /* + * OC router + */ + protected static $router = null; /** * SPL autoload */ @@ -275,6 +275,14 @@ class OC{ } } + public static function getRouter() { + if (!isset(OC::$router)) { + OC::$router = new OC_Router(); + } + + return OC::$router; + } + public static function init(){ // register autoloader spl_autoload_register(array('OC','autoload')); @@ -358,8 +366,6 @@ class OC{ OC_User::useBackend(new OC_User_Database()); OC_Group::useBackend(new OC_Group_Database()); - OC::$router = new OC_Router(); - // Load Apps // This includes plugins for users and filesystems as well global $RUNTIME_NOAPPS; |