当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_App::getInternalAppIdByOcs方法代码示例

本文整理汇总了PHP中OC_App::getInternalAppIdByOcs方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_App::getInternalAppIdByOcs方法的具体用法?PHP OC_App::getInternalAppIdByOcs怎么用?PHP OC_App::getInternalAppIdByOcs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_App的用法示例。


在下文中一共展示了OC_App::getInternalAppIdByOcs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkAppsIntegrity

 /**
  * check an app's integrity
  * @param array $data
  * @param string $extractDir
  * @param string $path
  * @param bool $isShipped
  * @return array
  * @throws \Exception
  */
 public static function checkAppsIntegrity($data, $extractDir, $path, $isShipped = false)
 {
     $l = \OC::$server->getL10N('lib');
     //load the info.xml file of the app
     if (!is_file($extractDir . '/appinfo/info.xml')) {
         //try to find it in a subdir
         $dh = opendir($extractDir);
         if (is_resource($dh)) {
             while (($folder = readdir($dh)) !== false) {
                 if ($folder[0] != '.' and is_dir($extractDir . '/' . $folder)) {
                     if (is_file($extractDir . '/' . $folder . '/appinfo/info.xml')) {
                         $extractDir .= '/' . $folder;
                     }
                 }
             }
         }
     }
     if (!is_file($extractDir . '/appinfo/info.xml')) {
         OC_Helper::rmdirr($extractDir);
         if ($data['source'] === 'http') {
             unlink($path);
         }
         throw new \Exception($l->t("App does not provide an info.xml file"));
     }
     $info = OC_App::getAppInfo($extractDir . '/appinfo/info.xml', true);
     // We can't trust the parsed info.xml file as it may have been tampered
     // with by an attacker and thus we need to use the local data to check
     // whether the application needs to be signed.
     $appId = OC_App::cleanAppId($data['appdata']['id']);
     $appBelongingToId = OC_App::getInternalAppIdByOcs($appId);
     if (is_string($appBelongingToId)) {
         $previouslySigned = \OC::$server->getConfig()->getAppValue($appBelongingToId, 'signed', 'false');
     } else {
         $appBelongingToId = $info['id'];
         $previouslySigned = 'false';
     }
     if ($data['appdata']['level'] === OC_App::officialApp || $previouslySigned === 'true') {
         \OC::$server->getConfig()->setAppValue($appBelongingToId, 'signed', 'true');
         $integrityResult = \OC::$server->getIntegrityCodeChecker()->verifyAppSignature($appBelongingToId, $extractDir);
         if ($integrityResult !== []) {
             $e = new \Exception($l->t('Signature could not get checked. Please contact the app developer and check your admin screen.'));
             throw $e;
         }
     }
     // check the code for not allowed calls
     if (!$isShipped && !OC_Installer::checkCode($extractDir)) {
         OC_Helper::rmdirr($extractDir);
         throw new \Exception($l->t("App can't be installed because of not allowed code in the App"));
     }
     // check if the app is compatible with this version of ownCloud
     if (!OC_App::isAppCompatible(\OCP\Util::getVersion(), $info)) {
         OC_Helper::rmdirr($extractDir);
         throw new \Exception($l->t("App can't be installed because it is not compatible with this version of ownCloud"));
     }
     // check if shipped tag is set which is only allowed for apps that are shipped with ownCloud
     if (!$isShipped && isset($info['shipped']) && $info['shipped'] == 'true') {
         OC_Helper::rmdirr($extractDir);
         throw new \Exception($l->t("App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps"));
     }
     // check if the ocs version is the same as the version in info.xml/version
     $version = trim($info['version']);
     if (isset($data['appdata']['version']) && $version != trim($data['appdata']['version'])) {
         OC_Helper::rmdirr($extractDir);
         throw new \Exception($l->t("App can't be installed because the version in info.xml is not the same as the version reported from the app store"));
     }
     return $info;
 }
开发者ID:ZverAleksey,项目名称:core,代码行数:76,代码来源:installer.php


注:本文中的OC_App::getInternalAppIdByOcs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。