Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ public function getContentType() {
* @return array|bool
*/
public function getDirectDownload() {
if (\OCP\App::isEnabled('encryption')) {
if (\OCP\Server::get(\OCP\App\IAppManager::class)->isEnabledForUser('encryption')) {
return [];
}
/** @var \OCP\Files\Storage $storage */
Expand Down
2 changes: 1 addition & 1 deletion apps/encryption/templates/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<table cellspacing="0" cellpadding="0" border="0" width="600px">
<tr>
<td colspan="2" bgcolor="<?php p($theme->getColorPrimary());?>">
<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/>
<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('core', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/>

Check notice

Code scanning / Psalm

DeprecatedMethod

The method OC\Server::getURLGenerator has been marked as deprecated
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCS\OCSForbiddenException;
use OCP\AppFramework\OCSController;
use OCP\App\IAppManager;
use OCP\Constants;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\Exceptions\ProviderCouldNotAddShareException;
Expand Down Expand Up @@ -366,7 +367,7 @@ public function revoke($id) {
* @return bool
*/
private function isS2SEnabled($incoming = false) {
$result = \OCP\App::isEnabled('files_sharing');
$result = \OCP\Server::get(IAppManager::class)->isEnabledForUser('files_sharing');

if ($incoming) {
$result = $result && $this->federatedShareProvider->isIncomingServer2serverShareEnabled();
Expand Down
7 changes: 4 additions & 3 deletions apps/files_trashbin/lib/Trashbin.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
use OCA\Files_Trashbin\AppInfo\Application;
use OCA\Files_Trashbin\Command\Expire;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\App\IAppManager;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\NotFoundException;
Expand Down Expand Up @@ -395,7 +396,7 @@ public static function move2trash($file_path, $ownerOnly = false) {
* @param integer $timestamp when the file was deleted
*/
private static function retainVersions($filename, $owner, $ownerPath, $timestamp) {
if (\OCP\App::isEnabled('files_versions') && !empty($ownerPath)) {
if (\OCP\Server::get(IAppManager::class)->isEnabledForUser('files_versions') && !empty($ownerPath)) {
$user = OC_User::getUser();
$rootView = new View('/');

Expand Down Expand Up @@ -543,7 +544,7 @@ public static function restore($file, $filename, $timestamp) {
* @return false|null
*/
private static function restoreVersions(View $view, $file, $filename, $uniqueFilename, $location, $timestamp) {
if (\OCP\App::isEnabled('files_versions')) {
if (\OCP\Server::get(IAppManager::class)->isEnabledForUser('files_versions')) {
$user = OC_User::getUser();
$rootView = new View('/');

Expand Down Expand Up @@ -704,7 +705,7 @@ public static function delete($filename, $user, $timestamp = null) {
*/
private static function deleteVersions(View $view, $file, $filename, $timestamp, $user) {
$size = 0;
if (\OCP\App::isEnabled('files_versions')) {
if (\OCP\Server::get(IAppManager::class)->isEnabledForUser('files_versions')) {
if ($view->is_dir('files_trashbin/versions/' . $file)) {
$size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file));
$view->unlink('files_trashbin/versions/' . $file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function setUp(): void {

public function testGetAppInfo() {
$result = $this->api->getAppInfo('provisioning_api');
$expected = \OC_App::getAppInfo('provisioning_api');
$expected = $this->appManager->getAppInfo('provisioning_api');
$this->assertEquals($expected, $result->getData());
}

Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/templates/part.settingcontrols.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</button>
<a href="<?php p(link_to_docs('admin-ldap')); ?>"
target="_blank" rel="noreferrer noopener">
<img src="<?php print_unescaped(image_path('', 'actions/info.svg')); ?>"
<img src="<?php print_unescaped(image_path('core', 'actions/info.svg')); ?>"
style="height:1.75ex" />
<?php p($l->t('Help'));?>
</a>
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/templates/part.wizardcontrols.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</button>
<a href="<?php p(link_to_docs('admin-ldap')); ?>"
target="_blank" rel="noreferrer noopener">
<img src="<?php print_unescaped(image_path('', 'actions/info.svg')); ?>"
<img src="<?php print_unescaped(image_path('core', 'actions/info.svg')); ?>"
style="height:1.75ex" />
<span class="ldap_grey"><?php p($l->t('Help'));?></span>
</a>
Expand Down
2 changes: 1 addition & 1 deletion core/Command/Maintenance/Repair.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if (!$this->appManager->isEnabledForUser($app)) {
continue;
}
$info = \OC_App::getAppInfo($app);
$info = $this->appManager->getAppInfo($app);
if (!is_array($info)) {
continue;
}
Expand Down
9 changes: 6 additions & 3 deletions core/Command/User/ResetPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
namespace OC\Core\Command\User;

use OC\Core\Command\Base;
use OCP\App\IAppManager;
use OCP\IUser;
use OCP\IUserManager;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
Expand All @@ -41,10 +42,12 @@

class ResetPassword extends Base {
protected IUserManager $userManager;
private IAppManager $appManager;

public function __construct(IUserManager $userManager) {
$this->userManager = $userManager;
public function __construct(IUserManager $userManager, IAppManager $appManager) {
parent::__construct();
$this->userManager = $userManager;
$this->appManager = $appManager;
}

protected function configure() {
Expand Down Expand Up @@ -84,7 +87,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');

if (\OCP\App::isEnabled('encryption')) {
if ($this->appManager->isEnabledForUser('encryption', $user)) {
$output->writeln(
'<error>Warning: Resetting the password when using encryption will result in data loss!</error>'
);
Expand Down
2 changes: 1 addition & 1 deletion core/register_command.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
$application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager()));
$application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager()));
$application->add(\OC::$server->get(\OC\Core\Command\User\Report::class));
$application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager()));
$application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager(), \OC::$server->getAppManager()));
$application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig()));
$application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
$application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
Expand Down
2 changes: 1 addition & 1 deletion core/templates/installation.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

<?php if (!$_['directoryIsSet'] or !$_['dbIsSet'] or count($_['errors']) > 0): ?>
<fieldset id="advancedHeader">
<legend><a id="showAdvanced" tabindex="0" href="#"><?php p($l->t('Storage & database')); ?><img src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a></legend>
<legend><a id="showAdvanced" tabindex="0" href="#"><?php p($l->t('Storage & database')); ?><img src="<?php print_unescaped(image_path('core', 'actions/caret.svg')); ?>" /></a></legend>
</fieldset>
<?php endif; ?>

Expand Down
6 changes: 3 additions & 3 deletions core/templates/layout.base.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>">
<link rel="icon" href="<?php print_unescaped(image_path('', 'favicon.ico')); /* IE11+ supports png */ ?>">
<link rel="apple-touch-icon" href="<?php print_unescaped(image_path('', 'favicon-touch.png')); ?>">
<link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path('', 'favicon-mask.svg')); ?>" color="<?php p($theme->getColorPrimary()); ?>">
<link rel="icon" href="<?php print_unescaped(image_path('core', 'favicon.ico')); /* IE11+ supports png */ ?>">
<link rel="apple-touch-icon" href="<?php print_unescaped(image_path('core', 'favicon-touch.png')); ?>">
<link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path('core', 'favicon-mask.svg')); ?>" color="<?php p($theme->getColorPrimary()); ?>">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
  "Exception": "RuntimeException",
  "Message": "image not found: image:favicon-mask.svg webroot: serverroot:\/drone\/src",
  "Code": 0,
  "Trace": [
    {
      "file": "\/drone\/src\/lib\/private\/legacy\/template\/functions.php",
      "line": 242,
      "function": "imagePath",
      "class": "OC\\URLGenerator",
      "type": "->"
    },
    {
      "file": "\/drone\/src\/core\/templates\/layout.user.php",
      "line": 37,
      "function": "image_path"
    },
    {
      "file": "\/drone\/src\/lib\/private\/Template\/Base.php",
      "line": 180,
      "args": [
        "\/drone\/src\/core\/templates\/layout.user.php"
      ],
      "function": "include"
    },
    {
      "file": "\/drone\/src\/lib\/private\/Template\/Base.php",
      "line": 150,
      "function": "load",
      "class": "OC\\Template\\Base",
      "type": "->"
    },
    {
      "file": "\/drone\/src\/lib\/private\/legacy\/OC_Template.php",
      "line": 181,
      "function": "fetchPage",
      "class": "OC\\Template\\Base",
      "type": "->"
    },
    {
      "file": "\/drone\/src\/lib\/private\/legacy\/OC_Template.php",
      "line": 212,
      "function": "fetchPage",
      "class": "OC_Template",
      "type": "->"
    },
    {
      "file": "\/drone\/src\/lib\/public\/AppFramework\/Http\/TemplateResponse.php",
      "line": 213,
      "function": "fetchPage",
      "class": "OC_Template",
      "type": "->"
    },
    {
      "file": "\/drone\/src\/lib\/private\/AppFramework\/Http\/Dispatcher.php",
      "line": 178,
      "function": "render",
      "class": "OCP\\AppFramework\\Http\\TemplateResponse",
      "type": "->"
    },
    {
      "file": "\/drone\/src\/lib\/private\/AppFramework\/App.php",
      "line": 172,
      "function": "dispatch",
      "class": "OC\\AppFramework\\Http\\Dispatcher",
      "type": "->"
    },
    {
      "file": "\/drone\/src\/lib\/private\/Route\/Router.php",
      "line": 298,
      "function": "main",
      "class": "OC\\AppFramework\\App",
      "type": "::"
    },
    {
      "file": "\/drone\/src\/lib\/base.php",
      "line": 1021,
      "function": "match",
      "class": "OC\\Route\\Router",
      "type": "->"
    },
    {
      "file": "\/drone\/src\/index.php",
      "line": 36,
      "function": "handleRequest",
      "class": "OC",
      "type": "::"
    }
  ],
  "File": "\/drone\/src\/lib\/private\/URLGenerator.php",
  "Line": 273,
  "CustomMessage": "--"
}

computer is still a bit unhappy. some of the integration tests are failing.

<?php emit_css_loading_tags($_); ?>
<?php emit_script_loading_tags($_); ?>
<?php print_unescaped($_['headers']); ?>
Expand Down
8 changes: 4 additions & 4 deletions core/templates/layout.guest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<meta name="apple-itunes-app" content="app-id=<?php p($theme->getiTunesAppId()); ?>">
<?php } ?>
<meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>">
<link rel="icon" href="<?php print_unescaped(image_path('', 'favicon.ico')); /* IE11+ supports png */ ?>">
<link rel="apple-touch-icon" href="<?php print_unescaped(image_path('', 'favicon-touch.png')); ?>">
<link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path('', 'favicon-mask.svg')); ?>" color="<?php p($theme->getColorPrimary()); ?>">
<link rel="manifest" href="<?php print_unescaped(image_path('', 'manifest.json')); ?>">
<link rel="icon" href="<?php print_unescaped(image_path('core', 'favicon.ico')); /* IE11+ supports png */ ?>">
<link rel="apple-touch-icon" href="<?php print_unescaped(image_path('core', 'favicon-touch.png')); ?>">
<link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path('core', 'favicon-mask.svg')); ?>" color="<?php p($theme->getColorPrimary()); ?>">
<link rel="manifest" href="<?php print_unescaped(image_path('core', 'manifest.json')); ?>">
<?php emit_css_loading_tags($_); ?>
<?php emit_script_loading_tags($_); ?>
<?php print_unescaped($_['headers']); ?>
Expand Down
2 changes: 0 additions & 2 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
'OCP\\Activity\\IManager' => $baseDir . '/lib/public/Activity/IManager.php',
'OCP\\Activity\\IProvider' => $baseDir . '/lib/public/Activity/IProvider.php',
'OCP\\Activity\\ISetting' => $baseDir . '/lib/public/Activity/ISetting.php',
'OCP\\App' => $baseDir . '/lib/public/App.php',
'OCP\\AppFramework\\ApiController' => $baseDir . '/lib/public/AppFramework/ApiController.php',
'OCP\\AppFramework\\App' => $baseDir . '/lib/public/AppFramework/App.php',
'OCP\\AppFramework\\AuthPublicShareController' => $baseDir . '/lib/public/AppFramework/AuthPublicShareController.php',
Expand Down Expand Up @@ -110,7 +109,6 @@
'OCP\\Authentication\\TwoFactorAuth\\TwoFactorProviderForUserDisabled' => $baseDir . '/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserDisabled.php',
'OCP\\Authentication\\TwoFactorAuth\\TwoFactorProviderForUserEnabled' => $baseDir . '/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserEnabled.php',
'OCP\\AutoloadNotAllowedException' => $baseDir . '/lib/public/AutoloadNotAllowedException.php',
'OCP\\BackgroundJob' => $baseDir . '/lib/public/BackgroundJob.php',
'OCP\\BackgroundJob\\IJob' => $baseDir . '/lib/public/BackgroundJob/IJob.php',
'OCP\\BackgroundJob\\IJobList' => $baseDir . '/lib/public/BackgroundJob/IJobList.php',
'OCP\\BackgroundJob\\Job' => $baseDir . '/lib/public/BackgroundJob/Job.php',
Expand Down
2 changes: 0 additions & 2 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\Activity\\IManager' => __DIR__ . '/../../..' . '/lib/public/Activity/IManager.php',
'OCP\\Activity\\IProvider' => __DIR__ . '/../../..' . '/lib/public/Activity/IProvider.php',
'OCP\\Activity\\ISetting' => __DIR__ . '/../../..' . '/lib/public/Activity/ISetting.php',
'OCP\\App' => __DIR__ . '/../../..' . '/lib/public/App.php',
'OCP\\AppFramework\\ApiController' => __DIR__ . '/../../..' . '/lib/public/AppFramework/ApiController.php',
'OCP\\AppFramework\\App' => __DIR__ . '/../../..' . '/lib/public/AppFramework/App.php',
'OCP\\AppFramework\\AuthPublicShareController' => __DIR__ . '/../../..' . '/lib/public/AppFramework/AuthPublicShareController.php',
Expand Down Expand Up @@ -143,7 +142,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\Authentication\\TwoFactorAuth\\TwoFactorProviderForUserDisabled' => __DIR__ . '/../../..' . '/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserDisabled.php',
'OCP\\Authentication\\TwoFactorAuth\\TwoFactorProviderForUserEnabled' => __DIR__ . '/../../..' . '/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserEnabled.php',
'OCP\\AutoloadNotAllowedException' => __DIR__ . '/../../..' . '/lib/public/AutoloadNotAllowedException.php',
'OCP\\BackgroundJob' => __DIR__ . '/../../..' . '/lib/public/BackgroundJob.php',
'OCP\\BackgroundJob\\IJob' => __DIR__ . '/../../..' . '/lib/public/BackgroundJob/IJob.php',
'OCP\\BackgroundJob\\IJobList' => __DIR__ . '/../../..' . '/lib/public/BackgroundJob/IJobList.php',
'OCP\\BackgroundJob\\Job' => __DIR__ . '/../../..' . '/lib/public/BackgroundJob/Job.php',
Expand Down
2 changes: 0 additions & 2 deletions lib/private/AppFramework/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,6 @@ public static function main(string $controllerName, string $methodName, DIContai
/**
* Shortcut for calling a controller method and printing the result.
* Similar to App:main except that no headers will be sent.
* This should be used for example when registering sections via
* \OC\AppFramework\Core\API::registerAdmin()
*
* @param string $controllerName the name of the controller under which it is
* stored in the DI container
Expand Down
6 changes: 4 additions & 2 deletions lib/private/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use OC\NeedsUpdateException;
use OC_App;
use OCP\AppFramework\QueryException;
use OCP\App\IAppManager;
use OCP\Console\ConsoleEvent;
use OCP\IConfig;
use OCP\IRequest;
Expand Down Expand Up @@ -117,13 +118,14 @@ public function loadCommands(
$this->writeMaintenanceModeInfo($input, $output);
} else {
OC_App::loadApps();
foreach (\OC::$server->getAppManager()->getInstalledApps() as $app) {
$appManager = \OCP\Server::get(IAppManager::class);
foreach ($appManager->getInstalledApps() as $app) {
$appPath = \OC_App::getAppPath($app);
if ($appPath === false) {
continue;
}
// load commands using info.xml
$info = \OC_App::getAppInfo($app);
$info = $appManager->getAppInfo($app);
if (isset($info['commands'])) {
$this->loadCommandsFromInfoXml($info['commands']);
}
Expand Down
27 changes: 15 additions & 12 deletions lib/private/Encryption/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,22 @@

use OCP\Cache\CappedMemoryCache;
use OCA\Files_External\Service\GlobalStoragesService;
use OCP\App\IAppManager;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Share\IManager;

class File implements \OCP\Encryption\IFile {

/** @var Util */
protected $util;

/** @var IRootFolder */
private $rootFolder;

/** @var IManager */
private $shareManager;
protected Util $util;
private IRootFolder $rootFolder;
private IManager $shareManager;

/**
* cache results of already checked folders
*
* Cache results of already checked folders
* @var CappedMemoryCache<array>
*/
protected CappedMemoryCache $cache;
private ?IAppManager $appManager = null;

public function __construct(Util $util,
IRootFolder $rootFolder,
Expand All @@ -60,6 +55,14 @@ public function __construct(Util $util,
$this->shareManager = $shareManager;
}

public function getAppManager(): IAppManager {
// Lazy evaluate app manager as it initialize the db too early otherwise
if ($this->appManager) {
return $this->appManager;
}
$this->appManager = \OCP\Server::get(IAppManager::class);
return $this->appManager;
}

/**
* Get list of users with access to the file
Expand Down Expand Up @@ -110,7 +113,7 @@ public function getAccessList($path) {
}

// check if it is a group mount
if (\OCP\App::isEnabled("files_external")) {
if ($this->getAppManager()->isEnabledForUser("files_external")) {
/** @var GlobalStoragesService $storageService */
$storageService = \OC::$server->get(GlobalStoragesService::class);
$storages = $storageService->getAllStorages();
Expand Down
Loading