本文整理汇总了PHP中OC_App::isShipped方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_App::isShipped方法的具体用法?PHP OC_App::isShipped怎么用?PHP OC_App::isShipped使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_App
的用法示例。
在下文中一共展示了OC_App::isShipped方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: call
/**
* handles an api call
* @param array $parameters
*/
public static function call($parameters)
{
$request = \OC::$server->getRequest();
$method = $request->getMethod();
// Prepare the request variables
if ($method === 'PUT') {
$parameters['_put'] = $request->getParams();
} else {
if ($method === 'DELETE') {
$parameters['_delete'] = $request->getParams();
}
}
$name = $parameters['_route'];
// Foreach registered action
$responses = array();
foreach (self::$actions[$name] as $action) {
// Check authentication and availability
if (!self::isAuthorised($action)) {
$responses[] = array('app' => $action['app'], 'response' => new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised'), 'shipped' => OC_App::isShipped($action['app']));
continue;
}
if (!is_callable($action['action'])) {
$responses[] = array('app' => $action['app'], 'response' => new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, 'Api method not found'), 'shipped' => OC_App::isShipped($action['app']));
continue;
}
// Run the action
$responses[] = array('app' => $action['app'], 'response' => call_user_func($action['action'], $parameters), 'shipped' => OC_App::isShipped($action['app']));
}
$response = self::mergeResponses($responses);
$format = self::requestedFormat();
if (self::$logoutRequired) {
OC_User::logout();
}
self::respond($response, $format);
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false') {
$shouldFilterShipped = true;
$shippedFilter = $input->getOption('shipped') === 'true';
} else {
$shouldFilterShipped = false;
}
$apps = \OC_App::getAllApps();
$enabledApps = $disabledApps = [];
$versions = \OC_App::getAppVersions();
//sort enabled apps above disabled apps
foreach ($apps as $app) {
if ($shouldFilterShipped && \OC_App::isShipped($app) !== $shippedFilter) {
continue;
}
if (\OC_App::isEnabled($app)) {
$enabledApps[] = $app;
} else {
$disabledApps[] = $app;
}
}
$apps = ['enabled' => [], 'disabled' => []];
sort($enabledApps);
foreach ($enabledApps as $app) {
$apps['enabled'][$app] = isset($versions[$app]) ? $versions[$app] : true;
}
sort($disabledApps);
foreach ($disabledApps as $app) {
$apps['disabled'][$app] = null;
}
$this->writeAppList($input, $output, $apps);
}
示例3: collect
public function collect($dryRun = false)
{
foreach (\OC_App::getAllApps() as $appId) {
if (\OC_App::isShipped($appId)) {
if ($dryRun || @file_exists($this->newBase . '/' . $appId)) {
$this->appsToUpdate[$appId] = $appId;
} else {
$this->appsToDisable[$appId] = $appId;
}
}
}
}
示例4: checkAppUpgrade
/**
* @param string $version the oc version to check app compatibility with
*/
protected function checkAppUpgrade($version)
{
$apps = \OC_App::getEnabledApps();
$this->emit('\\OC\\Updater', 'appUpgradeCheckBefore');
foreach ($apps as $appId) {
$info = \OC_App::getAppInfo($appId);
$compatible = \OC_App::isAppCompatible($version, $info);
$isShipped = \OC_App::isShipped($appId);
if ($compatible && $isShipped && \OC_App::shouldUpgrade($appId)) {
/**
* FIXME: The preupdate check is performed before the database migration, otherwise database changes
* are not possible anymore within it. - Consider this when touching the code.
* @link https://github.com/owncloud/core/issues/10980
* @see \OC_App::updateApp
*/
if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/preupdate.php')) {
$this->includePreUpdate($appId);
}
if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) {
$this->emit('\\OC\\Updater', 'appSimulateUpdate', array($appId));
\OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml');
}
}
}
$this->emit('\\OC\\Updater', 'appUpgradeCheck');
}
示例5: disable
/**
* @brief disables an app
* @param string $app app
* @return bool
*
* This function set an app as disabled in appconfig.
*/
public static function disable($app)
{
self::$enabledAppsCache = array();
// flush
// check if app is a shipped app or not. if not delete
\OC_Hook::emit('OC_App', 'pre_disable', array('app' => $app));
OC_Appconfig::setValue($app, 'enabled', 'no');
// check if app is a shipped app or not. if not delete
if (!OC_App::isShipped($app)) {
OC_Installer::removeApp($app);
}
}
示例6: array
/**
* Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OCP\JSON::checkAdminUser();
OCP\JSON::callCheck();
if (!array_key_exists('appid', $_POST)) {
OCP\JSON::error(array('message' => 'No AppId given!'));
exit;
}
$appId = $_POST['appid'];
if (!is_numeric($appId)) {
$appId = OC_Appconfig::getValue($appId, 'ocsid', null);
$isShipped = OC_App::isShipped($appId);
if ($appId === null) {
OCP\JSON::error(array('message' => 'No OCS-ID found for app!'));
exit;
}
} else {
$isShipped = false;
}
$appId = OC_App::cleanAppId($appId);
\OC_Config::setValue('maintenance', true);
$result = OC_Installer::updateAppByOCSId($appId, $isShipped);
\OC_Config::setValue('maintenance', false);
if ($result !== false) {
OC_JSON::success(array('data' => array('appid' => $appId)));
} else {
$l = OC_L10N::get('settings');
示例7: mergeResponses
/**
* merge the returned result objects into one response
* @param array $responses
*/
private static function mergeResponses($responses)
{
$response = array();
// Sort into shipped and thirdparty
$shipped = array('succeeded' => array(), 'failed' => array());
$thirdparty = array('succeeded' => array(), 'failed' => array());
foreach ($responses as $response) {
if (OC_App::isShipped($response['app']) || $response['app'] === 'core') {
if ($response['response']->succeeded()) {
$shipped['succeeded'][$response['app']] = $response['response'];
} else {
$shipped['failed'][$response['app']] = $response['response'];
}
} else {
if ($response['response']->succeeded()) {
$thirdparty['succeeded'][$response['app']] = $response['response'];
} else {
$thirdparty['failed'][$response['app']] = $response['response'];
}
}
}
// Remove any error responses if there is one shipped response that succeeded
if (!empty($shipped['succeeded'])) {
$responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']);
} else {
if (!empty($shipped['failed'])) {
// Which shipped response do we use if they all failed?
// They may have failed for different reasons (different status codes)
// Which reponse code should we return?
// Maybe any that are not OC_API::RESPOND_SERVER_ERROR
$response = reset($shipped['failed']);
return $response;
} elseif (!empty($thirdparty['failed'])) {
// Return the third party failure result
$response = reset($thirdparty['failed']);
return $response;
} else {
$responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']);
}
}
// Merge the successful responses
$meta = array();
$data = array();
foreach ($responses as $app => $response) {
if (OC_App::isShipped($app)) {
$data = array_merge_recursive($response->getData(), $data);
} else {
$data = array_merge_recursive($data, $response->getData());
}
}
$result = new OC_OCS_Result($data, 100);
return $result;
}
示例8: call
/**
* handles an api call
* @param array $parameters
*/
public static function call($parameters)
{
// Prepare the request variables
if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
parse_str(file_get_contents("php://input"), $parameters['_put']);
} else {
if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
parse_str(file_get_contents("php://input"), $parameters['_delete']);
}
}
$name = $parameters['_route'];
// Foreach registered action
$responses = array();
foreach (self::$actions[$name] as $action) {
// Check authentication and availability
if (!self::isAuthorised($action)) {
$responses[] = array('app' => $action['app'], 'response' => new OC_OCS_Result(null, OC_API::RESPOND_UNAUTHORISED, 'Unauthorised'), 'shipped' => OC_App::isShipped($action['app']));
continue;
}
if (!is_callable($action['action'])) {
$responses[] = array('app' => $action['app'], 'response' => new OC_OCS_Result(null, OC_API::RESPOND_NOT_FOUND, 'Api method not found'), 'shipped' => OC_App::isShipped($action['app']));
continue;
}
// Run the action
$responses[] = array('app' => $action['app'], 'response' => call_user_func($action['action'], $parameters), 'shipped' => OC_App::isShipped($action['app']));
}
$response = self::mergeResponses($responses);
$formats = array('json', 'xml');
$format = !empty($_GET['format']) && in_array($_GET['format'], $formats) ? $_GET['format'] : 'xml';
if (self::$logoutRequired) {
OC_User::logout();
}
self::respond($response, $format);
}