Skip to content

Commit

Permalink
Merge pull request #48196 from nextcloud/chore/add-deprecation-date
Browse files Browse the repository at this point in the history
chore: Add proper deprecation dates where missing
  • Loading branch information
susnux authored Sep 20, 2024
2 parents 436bd44 + e243cb8 commit 4ba3d4a
Show file tree
Hide file tree
Showing 24 changed files with 50 additions and 59 deletions.
5 changes: 2 additions & 3 deletions apps/files_sharing/lib/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ public static function registerHooks() {
* check if file name already exists and generate unique target
*
* @param string $path
* @param array $excludeList
* @param View $view
* @return string $path
*/
public static function generateUniqueTarget($path, $excludeList, $view) {
public static function generateUniqueTarget($path, $view) {
$pathinfo = pathinfo($path);
$ext = isset($pathinfo['extension']) ? '.' . $pathinfo['extension'] : '';
$name = $pathinfo['filename'];
$dir = $pathinfo['dirname'];
$i = 2;
while ($view->file_exists($path) || in_array($path, $excludeList)) {
while ($view->file_exists($path)) {
$path = Filesystem::normalizePath($dir . '/' . $name . ' (' . $i . ')' . $ext);
$i++;
}
Expand Down
12 changes: 2 additions & 10 deletions apps/files_sharing/lib/ShareBackend/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,12 @@ public function getFilePath($itemSource, $uidOwner) {
*
* @param string $itemSource
* @param string $shareWith
* @param array $exclude (optional)
* @return string
*/
public function generateTarget($itemSource, $shareWith, $exclude = null) {
public function generateTarget($itemSource, $shareWith) {
$shareFolder = \OCA\Files_Sharing\Helper::getShareFolder();
$target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($itemSource));

// for group shares we return the target right away
if ($shareWith === false) {
return $target;
}

\OC\Files\Filesystem::initMountPoints($shareWith);
$view = new \OC\Files\View('/' . $shareWith . '/files');

Expand All @@ -91,9 +85,7 @@ public function generateTarget($itemSource, $shareWith, $exclude = null) {
}
}

$excludeList = is_array($exclude) ? $exclude : [];

return \OCA\Files_Sharing\Helper::generateUniqueTarget($target, $excludeList, $view);
return \OCA\Files_Sharing\Helper::generateUniqueTarget($target, $view);
}

public function formatItems($items, $format, $parameters = null) {
Expand Down
2 changes: 1 addition & 1 deletion lib/composer/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public static function getRootPackage()
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @deprecated 23.0.0 Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
*/
Expand Down
8 changes: 4 additions & 4 deletions lib/private/AppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ private function setAsLoaded(?bool $lazy): void {
* @param string $default = null, default value if the key does not exist
*
* @return string the value or $default
* @deprecated - use getValue*()
* @deprecated 29.0.0 use getValue*()
*
* This function gets a value from the appconfig table. If the key does
* not exist the default value will be returned
Expand All @@ -1316,7 +1316,7 @@ public function getValue($app, $key, $default = null) {
* @return bool True if the value was inserted or updated, false if the value was the same
* @throws AppConfigTypeConflictException
* @throws AppConfigUnknownKeyException
* @deprecated
* @deprecated 29.0.0
*/
public function setValue($app, $key, $value) {
/**
Expand Down Expand Up @@ -1422,7 +1422,7 @@ private function convertTypedValue(string $value, int $type): string|int|float|b
* @param string $app
*
* @return string[]
* @deprecated data sensitivity should be set when calling setValue*()
* @deprecated 29.0.0 data sensitivity should be set when calling setValue*()
*/
private function getSensitiveKeys(string $app): array {
$sensitiveValues = [
Expand Down Expand Up @@ -1533,7 +1533,7 @@ private function getSensitiveKeys(string $app): array {
* Clear all the cached app config values
* New cache will be generated next time a config value is retrieved
*
* @deprecated use {@see clearCache()}
* @deprecated 29.0.0 use {@see clearCache()}
*/
public function clearCachedConfig(): void {
$this->clearCache();
Expand Down
10 changes: 5 additions & 5 deletions lib/private/AppFramework/DependencyInjection/DIContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ public function __construct(string $appName, array $urlParams = [], ?ServerConta
$this->server->registerAppContainer($appName, $this);

// aliases
/** @deprecated inject $appName */
/** @deprecated 26.0.0 inject $appName */
$this->registerAlias('AppName', 'appName');
/** @deprecated inject $webRoot*/
/** @deprecated 26.0.0 inject $webRoot*/
$this->registerAlias('WebRoot', 'webRoot');
/** @deprecated inject $userId */
/** @deprecated 26.0.0 inject $userId */
$this->registerAlias('UserId', 'userId');

/**
Expand Down Expand Up @@ -359,15 +359,15 @@ public function getAppName() {
}

/**
* @deprecated use IUserSession->isLoggedIn()
* @deprecated 12.0.0 use IUserSession->isLoggedIn()
* @return boolean
*/
public function isLoggedIn() {
return \OC::$server->getUserSession()->isLoggedIn();
}

/**
* @deprecated use IGroupManager->isAdmin($userId)
* @deprecated 12.0.0 use IGroupManager->isAdmin($userId)
* @return boolean
*/
public function isAdminUser() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ private function hashToken(string $token): string {
}

/**
* @deprecated Fallback for instances where the secret might not have been set by accident
* @deprecated 26.0.0 Fallback for instances where the secret might not have been set by accident
*/
private function hashTokenWithEmptySecret(string $token): string {
return hash('sha512', $token);
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Cache/CappedMemoryCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* Uses a simple FIFO expiry mechanism
* @template T
* @deprecated use OCP\Cache\CappedMemoryCache instead
* @deprecated 25.0.0 use OCP\Cache\CappedMemoryCache instead
*/
class CappedMemoryCache implements ICache, \ArrayAccess {
private $capacity;
Expand Down
4 changes: 2 additions & 2 deletions lib/private/DB/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public function getQueryBuilder(): IQueryBuilder {
* Gets the QueryBuilder for the connection.
*
* @return \Doctrine\DBAL\Query\QueryBuilder
* @deprecated please use $this->getQueryBuilder() instead
* @deprecated 8.0.0 please use $this->getQueryBuilder() instead
*/
public function createQueryBuilder() {
$backtrace = $this->getCallerBacktrace();
Expand All @@ -295,7 +295,7 @@ public function createQueryBuilder() {
* Gets the ExpressionBuilder for the connection.
*
* @return \Doctrine\DBAL\Query\Expression\ExpressionBuilder
* @deprecated please use $this->getQueryBuilder()->expr() instead
* @deprecated 8.0.0 please use $this->getQueryBuilder()->expr() instead
*/
public function getExpressionBuilder() {
$backtrace = $this->getCallerBacktrace();
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ public function getPathById($id) {
*
* @param int $id
* @return array first element holding the storage id, second the path
* @deprecated use getPathById() instead
* @deprecated 17.0.0 use getPathById() instead
*/
public static function getById($id) {
$query = \OC::$server->getDatabaseConnection()->getQueryBuilder();
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Share20/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ public function getToken() {
*
* @param int $parent
* @return IShare
* @deprecated The new shares do not have parents. This is just here for legacy reasons.
* @deprecated 12.0.0 The new shares do not have parents. This is just here for legacy reasons.
*/
public function setParent($parent) {
$this->parent = $parent;
Expand All @@ -541,7 +541,7 @@ public function setParent($parent) {
* Get the parent of this share.
*
* @return int
* @deprecated The new shares do not have parents. This is just here for legacy reasons.
* @deprecated 12.0.0 The new shares do not have parents. This is just here for legacy reasons.
*/
public function getParent() {
return $this->parent;
Expand Down
2 changes: 1 addition & 1 deletion lib/private/User/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public function checkPasswordNoLogging($loginName, $password) {
* @param int $limit
* @param int $offset
* @return IUser[]
* @deprecated since 27.0.0, use searchDisplayName instead
* @deprecated 27.0.0, use searchDisplayName instead
*/
public function search($pattern, $limit = null, $offset = null) {
$users = [];
Expand Down
4 changes: 2 additions & 2 deletions lib/private/legacy/OC_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,15 +417,15 @@ public static function uploadLimit() {
/**
* Checks if a function is available
*
* @deprecated Since 25.0.0 use \OCP\Util::isFunctionEnabled instead
* @deprecated 25.0.0 use \OCP\Util::isFunctionEnabled instead
*/
public static function is_function_enabled(string $function_name): bool {
return \OCP\Util::isFunctionEnabled($function_name);
}

/**
* Try to find a program
* @deprecated Since 25.0.0 Use \OC\BinaryFinder directly
* @deprecated 25.0.0 Use \OC\BinaryFinder directly
*/
public static function findBinaryPath(string $program): ?string {
$result = \OCP\Server::get(IBinaryFinder::class)->findBinaryPath($program);
Expand Down
14 changes: 7 additions & 7 deletions lib/private/legacy/OC_JSON.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class OC_JSON {
/**
* Check if the app is enabled, send json error msg if not
* @param string $app
* @deprecated Use the AppFramework instead. It will automatically check if the app is enabled.
* @deprecated 12.0.0 Use the AppFramework instead. It will automatically check if the app is enabled.
* @suppress PhanDeprecatedFunction
*/
public static function checkAppEnabled($app) {
Expand All @@ -25,7 +25,7 @@ public static function checkAppEnabled($app) {

/**
* Check if the user is logged in, send json error msg if not
* @deprecated Use annotation based ACLs from the AppFramework instead
* @deprecated 12.0.0 Use annotation based ACLs from the AppFramework instead
* @suppress PhanDeprecatedFunction
*/
public static function checkLoggedIn() {
Expand All @@ -41,7 +41,7 @@ public static function checkLoggedIn() {

/**
* Check an ajax get/post call if the request token is valid, send json error msg if not.
* @deprecated Use annotation based CSRF checks from the AppFramework instead
* @deprecated 12.0.0 Use annotation based CSRF checks from the AppFramework instead
* @suppress PhanDeprecatedFunction
*/
public static function callCheck() {
Expand All @@ -59,7 +59,7 @@ public static function callCheck() {

/**
* Check if the user is a admin, send json error msg if not.
* @deprecated Use annotation based ACLs from the AppFramework instead
* @deprecated 12.0.0 Use annotation based ACLs from the AppFramework instead
* @suppress PhanDeprecatedFunction
*/
public static function checkAdminUser() {
Expand All @@ -72,7 +72,7 @@ public static function checkAdminUser() {

/**
* Send json error msg
* @deprecated Use a AppFramework JSONResponse instead
* @deprecated 12.0.0 Use a AppFramework JSONResponse instead
* @suppress PhanDeprecatedFunction
* @psalm-taint-escape html
*/
Expand All @@ -84,7 +84,7 @@ public static function error($data = []) {

/**
* Send json success msg
* @deprecated Use a AppFramework JSONResponse instead
* @deprecated 12.0.0 Use a AppFramework JSONResponse instead
* @suppress PhanDeprecatedFunction
* @psalm-taint-escape html
*/
Expand All @@ -96,7 +96,7 @@ public static function success($data = []) {

/**
* Encode JSON
* @deprecated Use a AppFramework JSONResponse instead
* @deprecated 12.0.0 Use a AppFramework JSONResponse instead
*/
private static function encode($data) {
return json_encode($data, JSON_HEX_TAG);
Expand Down
6 changes: 3 additions & 3 deletions lib/private/legacy/OC_User.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public static function setUserId($uid) {
/**
* Check if the user is logged in, considers also the HTTP basic credentials
*
* @deprecated use \OC::$server->getUserSession()->isLoggedIn()
* @deprecated 12.0.0 use \OC::$server->getUserSession()->isLoggedIn()
* @return bool
*/
public static function isLoggedIn() {
Expand Down Expand Up @@ -353,7 +353,7 @@ public static function setPassword($uid, $password, $recoveryPassword = null) {
* @return string
*
* returns the path to the users home directory
* @deprecated Use \OC::$server->getUserManager->getHome()
* @deprecated 12.0.0 Use \OC::$server->getUserManager->getHome()
*/
public static function getHome($uid) {
$user = \OC::$server->getUserManager()->get($uid);
Expand All @@ -373,7 +373,7 @@ public static function getHome($uid) {
* @return array associative array with all display names (value) and corresponding uids (key)
*
* Get a list of all display names and user ids.
* @deprecated Use \OC::$server->getUserManager->searchDisplayName($search, $limit, $offset) instead.
* @deprecated 12.0.0 Use \OC::$server->getUserManager->searchDisplayName($search, $limit, $offset) instead.
*/
public static function getDisplayNames($search = '', $limit = null, $offset = null) {
$displayNames = [];
Expand Down
2 changes: 1 addition & 1 deletion lib/private/legacy/OC_Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public static function getVersionString() {
}

/**
* @deprecated the value is of no use anymore
* @deprecated 11.0.0 the value is of no use anymore
* @return string
*/
public static function getEditionString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function useJsNonce($nonce) {
* @param bool $state
* @return $this
* @since 8.1.0
* @deprecated Eval should not be used anymore. Please update your scripts. This function will stop functioning in a future version of Nextcloud.
* @deprecated 17.0.0 Eval should not be used anymore. Please update your scripts. This function will stop functioning in a future version of Nextcloud.
*/
public function allowEvalScript($state = true) {
$this->evalScriptAllowed = $state;
Expand Down
4 changes: 2 additions & 2 deletions lib/public/BackgroundJob/IJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use OCP\ILogger;

/**
* This interface represend a backgroud job run with cron
* This interface represents a background job run with cron
*
* To implement a background job, you must extend either \OCP\BackgroundJob\Job,
* \OCP\BackgroundJob\TimedJob or \OCP\BackgroundJob\QueuedJob
Expand All @@ -33,7 +33,7 @@ interface IJob {
* @param IJobList $jobList The job list that manages the state of this job
* @param ILogger|null $logger
* @since 7.0.0
* @deprecated since 25.0.0 Use start() instead. This method will be removed
* @deprecated 25.0.0 Use start() instead. This method will be removed
* with the ILogger interface
*/
public function execute(IJobList $jobList, ?ILogger $logger = null);
Expand Down
2 changes: 1 addition & 1 deletion lib/public/BackgroundJob/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(ITimeFactory $time) {
* @return void
*
* @since 15.0.0
* @deprecated since 25.0.0 Use start() instead. This method will be removed
* @deprecated 25.0.0 Use start() instead. This method will be removed
* with the ILogger interface
*/
public function execute(IJobList $jobList, ?ILogger $logger = null) {
Expand Down
2 changes: 1 addition & 1 deletion lib/public/BackgroundJob/QueuedJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class QueuedJob extends Job {
* @param ILogger|null $logger
*
* @since 15.0.0
* @deprecated since 25.0.0 Use start() instead. This method will be removed
* @deprecated 25.0.0 Use start() instead. This method will be removed
* with the ILogger interface
*/
final public function execute($jobList, ?ILogger $logger = null) {
Expand Down
2 changes: 1 addition & 1 deletion lib/public/BackgroundJob/TimedJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function setTimeSensitivity(int $sensitivity): void {
* @param ILogger|null $logger
*
* @since 15.0.0
* @deprecated since 25.0.0 Use start() instead
* @deprecated 25.0.0 Use start() instead
*/
final public function execute(IJobList $jobList, ?ILogger $logger = null) {
$this->start($jobList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/**
* @since 16.0.0
* @deprecated Use {@see AutoCompleteFilterEvent} instead
* @deprecated 28.0.0 Use {@see AutoCompleteFilterEvent} instead
*/
class AutoCompleteEvent extends GenericEvent {
/**
Expand Down
2 changes: 1 addition & 1 deletion lib/public/GroupInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface GroupInterface {

/**
* @since 12.0.0
* @deprecated 29.0.0
* @deprecated 29.0.0
*/
public const REMOVE_FROM_GOUP = 0x00001000; // oops

Expand Down
Loading

0 comments on commit 4ba3d4a

Please sign in to comment.