Esempio n. 1
0
 /**
  * Read all app metadata from the info.xml file
  *
  * @param string $appId id of the app or the path of the info.xml file
  * @param boolean $path (optional)
  * @return array|null
  * @note all data is read from info.xml, not just pre-defined fields
  */
 public static function getAppInfo($appId, $path = false)
 {
     if ($path) {
         $file = $appId;
     } else {
         if (isset(self::$appInfo[$appId])) {
             return self::$appInfo[$appId];
         }
         $file = self::getAppPath($appId) . '/appinfo/info.xml';
     }
     $parser = new \OC\App\InfoParser(\OC::$server->getHTTPHelper(), \OC::$server->getURLGenerator());
     $data = $parser->parse($file);
     if (is_array($data)) {
         $data = OC_App::parseAppInfo($data);
     }
     self::$appInfo[$appId] = $data;
     return $data;
 }
Esempio n. 2
0
 /**
  * Read all app metadata from the info.xml file
  *
  * @param string $appId id of the app or the path of the info.xml file
  * @param boolean $path (optional)
  * @return array|null
  * @note all data is read from info.xml, not just pre-defined fields
  */
 public static function getAppInfo($appId, $path = false)
 {
     if ($path) {
         $file = $appId;
     } else {
         if (isset(self::$appInfo[$appId])) {
             return self::$appInfo[$appId];
         }
         $appPath = self::getAppPath($appId);
         if ($appPath === false) {
             return null;
         }
         $file = $appPath . '/appinfo/info.xml';
     }
     $parser = new \OC\App\InfoParser(\OC::$server->getHTTPHelper(), \OC::$server->getURLGenerator());
     $data = $parser->parse($file);
     if (is_array($data)) {
         $data = OC_App::parseAppInfo($data);
     }
     if (isset($data['ocsid'])) {
         $storedId = \OC::$server->getConfig()->getAppValue($appId, 'ocsid');
         if ($storedId !== '' && $storedId !== $data['ocsid']) {
             $data['ocsid'] = $storedId;
         }
     }
     self::$appInfo[$appId] = $data;
     return $data;
 }