Skip to content

Instantly share code, notes, and snippets.

@bartv2
Created September 16, 2013 20:30

Revisions

  1. bartv2 created this gist Sep 16, 2013.
    44 changes: 44 additions & 0 deletions info.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    <?php
    /**
    * Copyright (c) 2013 Bart Visscher <[email protected]>
    * This file is licensed under the Affero General Public License version 3 or
    * later.
    * See the COPYING-README file.
    */

    namespace OCP\App;

    /**
    * Provide a common interface to all Application functions
    */
    interface Info {
    /**
    * @brief Get the name of the app.
    *
    * @return string
    */
    public function getName();

    /**
    * @brief Get the last version of the app. Either from appinfo/version or from appinfo/info.xml
    *
    * @return string for example '1.2.45'
    */
    public function getVersion();

    /**
    * @brief Get the directory for the given app.
    * If the app is defined in multiple directories, the first one is taken. (false if not found)
    *
    * @return string
    */
    public function getDirectory();

    /**
    * @brief Get the web path of the app.
    * If the app is defined in multiple directories, the first one is taken. (false if not found)
    *
    * @return string
    */
    public function getWebPath();
    }
    34 changes: 34 additions & 0 deletions manager.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    <?php
    /**
    * Copyright (c) 2013 Bart Visscher <[email protected]>
    * This file is licensed under the Affero General Public License version 3 or
    * later.
    * See the COPYING-README file.
    */

    namespace OCP\App;

    /**
    * Provide a common interface to all Application functions
    */
    interface Manager {
    /**
    * @brief checks whether or not an app is enabled
    * @param $app string appid
    * @returns bool true when an app is enabled.
    */
    public function isEnabled( $app );

    /**
    * @brief load all enabled apps
    */
    public function loadAll();

    /**
    * @brief Get information about the app
    * @param $app string appid
    *
    * @return \OCP\App\Info
    */
    public function getInfo( $app );
    }