Skip to content

Commit

Permalink
Drop \OCP\User
Browse files Browse the repository at this point in the history
Inlines and remaining usages and drops the deprecated public API.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst authored and MorrisJobke committed May 21, 2021
1 parent 7ffee26 commit 6c0cf4c
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 111 deletions.
2 changes: 1 addition & 1 deletion apps/files/ajax/download.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/

// Check if we are a user
OCP\User::checkLoggedIn();
OC_Util::checkLoggedIn();
\OC::$server->getSession()->close();

$files = isset($_GET['files']) ? (string)$_GET['files'] : '';
Expand Down
2 changes: 1 addition & 1 deletion apps/files/recentlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
*/
// Check if we are a user
OCP\User::checkLoggedIn();
OC_Util::checkLoggedIn();
$config = \OC::$server->getConfig();
$userSession = \OC::$server->getUserSession();

Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
*/
// Check if we are a user
OCP\User::checkLoggedIn();
OC_Util::checkLoggedIn();
$config = \OC::$server->getConfig();
$userSession = \OC::$server->getUserSession();

Expand Down
6 changes: 3 additions & 3 deletions apps/files_sharing/lib/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ private static function moveShareToShare($path) {
* @param string $newPath new path relative to data/user/files
*/
private static function renameChildren($oldPath, $newPath) {
$absNewPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $newPath);
$absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $oldPath);
$absNewPath = \OC\Files\Filesystem::normalizePath('/' . \OC_User::getUser() . '/files/' . $newPath);
$absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OC_User::getUser() . '/files/' . $oldPath);

$mountManager = \OC\Files\Filesystem::getMountManager();
$mountedShares = $mountManager->findIn('/' . \OCP\User::getUser() . '/files/' . $oldPath);
$mountedShares = $mountManager->findIn('/' . \OC_User::getUser() . '/files/' . $oldPath);
foreach ($mountedShares as $mount) {
if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) {
$mountPoint = $mount->getMountPoint();
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
use OCP\EventDispatcher\GenericEvent;

// Check if we are a user
OCP\User::checkLoggedIn();
OC_Util::checkLoggedIn();
$config = \OC::$server->getConfig();
$userSession = \OC::$server->getUserSession();
$legacyEventDispatcher = \OC::$server->getEventDispatcher();
Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/lib/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static function deleteUser_hook($params) {
}

public static function post_write_hook($params) {
$user = \OCP\User::getUser();
$user = \OC_User::getUser();
if (!empty($user)) {
Trashbin::resizeTrash($user);
}
Expand Down
16 changes: 8 additions & 8 deletions apps/files_trashbin/lib/Trashbin.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

namespace OCA\Files_Trashbin;

use OC_User;
use OC\Files\Cache\Cache;
use OC\Files\Cache\CacheEntry;
use OC\Files\Cache\CacheQueryBuilder;
Expand All @@ -60,7 +61,6 @@
use OCP\Files\NotPermittedException;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
use OCP\User;

class Trashbin {

Expand Down Expand Up @@ -103,14 +103,14 @@ public static function getUidAndFilename($filename) {
// to a remote user with a federated cloud ID we use the current logged-in
// user. We need a valid local user to move the file to the right trash bin
if (!$userManager->userExists($uid)) {
$uid = User::getUser();
$uid = OC_User::getUser();
}
if (!$uid) {
// no owner, usually because of share link from ext storage
return [null, null];
}
Filesystem::initMountPoints($uid);
if ($uid !== User::getUser()) {
if ($uid !== OC_User::getUser()) {
$info = Filesystem::getFileInfo($filename);
$ownerView = new View('/' . $uid . '/files');
try {
Expand Down Expand Up @@ -390,7 +390,7 @@ public static function move2trash($file_path, $ownerOnly = false) {
*/
private static function retainVersions($filename, $owner, $ownerPath, $timestamp) {
if (\OCP\App::isEnabled('files_versions') && !empty($ownerPath)) {
$user = User::getUser();
$user = OC_User::getUser();
$rootView = new View('/');

if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) {
Expand Down Expand Up @@ -464,7 +464,7 @@ private static function copy(View $view, $source, $target) {
* @return bool true on success, false otherwise
*/
public static function restore($file, $filename, $timestamp) {
$user = User::getUser();
$user = OC_User::getUser();
$view = new View('/' . $user);

$location = '';
Expand Down Expand Up @@ -538,7 +538,7 @@ public static function restore($file, $filename, $timestamp) {
*/
private static function restoreVersions(View $view, $file, $filename, $uniqueFilename, $location, $timestamp) {
if (\OCP\App::isEnabled('files_versions')) {
$user = User::getUser();
$user = OC_User::getUser();
$rootView = new View('/');

$target = Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename);
Expand Down Expand Up @@ -574,7 +574,7 @@ private static function restoreVersions(View $view, $file, $filename, $uniqueFil
* delete all files from the trash
*/
public static function deleteAll() {
$user = User::getUser();
$user = OC_User::getUser();
$userRoot = \OC::$server->getUserFolder($user)->getParent();
$view = new View('/' . $user);
$fileInfos = $view->getDirectoryContent('files_trashbin/files');
Expand Down Expand Up @@ -725,7 +725,7 @@ private static function deleteVersions(View $view, $file, $filename, $timestamp,
* @return bool true if file exists, otherwise false
*/
public static function file_exists($filename, $timestamp = null) {
$user = User::getUser();
$user = OC_User::getUser();
$view = new View('/' . $user);

if ($timestamp) {
Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
*/
// Check if we are a user
OCP\User::checkLoggedIn();
OC_Util::checkLoggedIn();

$config = \OC::$server->getConfig();
$userSession = \OC::$server->getUserSession();
Expand Down
4 changes: 2 additions & 2 deletions apps/files_versions/lib/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ public static function copy_hook($params) {
public static function pre_renameOrCopy_hook($params) {
// if we rename a movable mount point, then the versions don't have
// to be renamed
$absOldPath = Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']);
$absOldPath = Filesystem::normalizePath('/' . \OC_User::getUser() . '/files' . $params['oldpath']);
$manager = Filesystem::getMountManager();
$mount = $manager->find($absOldPath);
$internalPath = $mount->getInternalPath($absOldPath);
if ($internalPath === '' and $mount instanceof MoveableMount) {
return;
}

$view = new View(\OCP\User::getUser() . '/files');
$view = new View(\OC_User::getUser() . '/files');
if ($view->file_exists($params['newpath'])) {
Storage::store($params['newpath']);
} else {
Expand Down
6 changes: 3 additions & 3 deletions apps/files_versions/lib/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

namespace OCA\Files_Versions;

use OC_User;
use OC\Files\Filesystem;
use OC\Files\View;
use OCA\Files_Versions\AppInfo\Application;
Expand All @@ -56,7 +57,6 @@
use OCP\Files\StorageNotAvailableException;
use OCP\IUser;
use OCP\Lock\ILockingProvider;
use OCP\User;

class Storage {
public const DEFAULTENABLED = true;
Expand Down Expand Up @@ -105,10 +105,10 @@ public static function getUidAndFilename($filename) {
// to a remote user with a federated cloud ID we use the current logged-in
// user. We need a valid local user to create the versions
if (!$userManager->userExists($uid)) {
$uid = User::getUser();
$uid = OC_User::getUser();
}
Filesystem::initMountPoints($uid);
if ($uid !== User::getUser()) {
if ($uid !== OC_User::getUser()) {
$info = Filesystem::getFileInfo($filename);
$ownerView = new View('/'.$uid.'/files');
try {
Expand Down
1 change: 0 additions & 1 deletion lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@
'OCP\\SystemTag\\TagAlreadyExistsException' => $baseDir . '/lib/public/SystemTag/TagAlreadyExistsException.php',
'OCP\\SystemTag\\TagNotFoundException' => $baseDir . '/lib/public/SystemTag/TagNotFoundException.php',
'OCP\\Template' => $baseDir . '/lib/public/Template.php',
'OCP\\User' => $baseDir . '/lib/public/User.php',
'OCP\\UserInterface' => $baseDir . '/lib/public/UserInterface.php',
'OCP\\UserStatus\\IManager' => $baseDir . '/lib/public/UserStatus/IManager.php',
'OCP\\UserStatus\\IProvider' => $baseDir . '/lib/public/UserStatus/IProvider.php',
Expand Down
1 change: 0 additions & 1 deletion lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\SystemTag\\TagAlreadyExistsException' => __DIR__ . '/../../..' . '/lib/public/SystemTag/TagAlreadyExistsException.php',
'OCP\\SystemTag\\TagNotFoundException' => __DIR__ . '/../../..' . '/lib/public/SystemTag/TagNotFoundException.php',
'OCP\\Template' => __DIR__ . '/../../..' . '/lib/public/Template.php',
'OCP\\User' => __DIR__ . '/../../..' . '/lib/public/User.php',
'OCP\\UserInterface' => __DIR__ . '/../../..' . '/lib/public/UserInterface.php',
'OCP\\UserStatus\\IManager' => __DIR__ . '/../../..' . '/lib/public/UserStatus/IManager.php',
'OCP\\UserStatus\\IProvider' => __DIR__ . '/../../..' . '/lib/public/UserStatus/IProvider.php',
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,7 @@ public function getUidAndFilename($filename) {
throw new NotFoundException($this->getAbsolutePath($filename) . ' not found');
}
$uid = $info->getOwner()->getUID();
if ($uid != \OCP\User::getUser()) {
if ($uid != \OC_User::getUser()) {
Filesystem::initMountPoints($uid);
$ownerView = new View('/' . $uid . '/files');
try {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Share/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ public static function getItems($itemType, $item = null, $shareType = null, $sha
}

// group items if we are looking for items shared with the current user
if (isset($shareWith) && $shareWith === \OCP\User::getUser()) {
if (isset($shareWith) && $shareWith === \OC_User::getUser()) {
$items = self::groupItems($items, $itemType);
}

Expand Down
85 changes: 0 additions & 85 deletions lib/public/User.php

This file was deleted.

0 comments on commit 6c0cf4c

Please sign in to comment.