Skip to content

Commit 4dcf8f3

Browse files
committed
chore: Remove long deprecated methods from OCP
These have been deprecated from before 20 Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent 1219c8e commit 4dcf8f3

12 files changed

Lines changed: 3 additions & 384 deletions

File tree

lib/private/Collaboration/Resources/Manager.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,11 +457,6 @@ public function invalidateAccessCacheForProviderByUser(IProvider $provider, ?IUs
457457
$query->executeStatement();
458458
}
459459

460-
public function registerResourceProvider(string $provider): void {
461-
$this->logger->debug('\OC\Collaboration\Resources\Manager::registerResourceProvider is deprecated', ['provider' => $provider]);
462-
$this->providerManager->registerResourceProvider($provider);
463-
}
464-
465460
/**
466461
* Get the resource type of the provider
467462
*

lib/private/Security/CSP/ContentSecurityPolicy.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,6 @@ public function setInlineScriptAllowed(bool $inlineScriptAllowed): void {
2424
$this->inlineScriptAllowed = $inlineScriptAllowed;
2525
}
2626

27-
public function isEvalScriptAllowed(): bool {
28-
return $this->evalScriptAllowed;
29-
}
30-
31-
/**
32-
* @deprecated 17.0.0 Unsafe eval should not be used anymore.
33-
*/
34-
public function setEvalScriptAllowed(bool $evalScriptAllowed): void {
35-
$this->evalScriptAllowed = $evalScriptAllowed;
36-
}
37-
3827
public function isEvalWasmAllowed(): ?bool {
3928
return $this->evalWasmAllowed;
4029
}
@@ -115,21 +104,6 @@ public function setAllowedFontDomains($allowedFontDomains): void {
115104
$this->allowedFontDomains = $allowedFontDomains;
116105
}
117106

118-
/**
119-
* @deprecated 15.0.0 use FrameDomains and WorkerSrcDomains
120-
*/
121-
public function getAllowedChildSrcDomains(): array {
122-
return $this->allowedChildSrcDomains;
123-
}
124-
125-
/**
126-
* @param array $allowedChildSrcDomains
127-
* @deprecated 15.0.0 use FrameDomains and WorkerSrcDomains
128-
*/
129-
public function setAllowedChildSrcDomains($allowedChildSrcDomains): void {
130-
$this->allowedChildSrcDomains = $allowedChildSrcDomains;
131-
}
132-
133107
public function getAllowedFrameAncestors(): array {
134108
return $this->allowedFrameAncestors;
135109
}

lib/public/AppFramework/Http/ContentSecurityPolicy.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
class ContentSecurityPolicy extends EmptyContentSecurityPolicy {
2525
/** @var bool Whether inline JS snippets are allowed */
2626
protected $inlineScriptAllowed = false;
27-
/** @var bool Whether eval in JS scripts is allowed */
28-
protected $evalScriptAllowed = false;
2927
/** @var bool Whether WebAssembly compilation is allowed */
3028
protected ?bool $evalWasmAllowed = false;
3129
/** @var bool Whether strict-dynamic should be set */
@@ -69,8 +67,6 @@ class ContentSecurityPolicy extends EmptyContentSecurityPolicy {
6967
'\'self\'',
7068
'data:',
7169
];
72-
/** @var array Domains from which web-workers and nested browsing content can load elements */
73-
protected $allowedChildSrcDomains = [];
7470

7571
/** @var array Domains which can embed this Nextcloud instance */
7672
protected $allowedFrameAncestors = [

lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ class EmptyContentSecurityPolicy {
2424
protected $strictDynamicAllowed = null;
2525
/** @var bool Whether strict-dynamic should be used on script-src-elem */
2626
protected $strictDynamicAllowedOnScripts = null;
27-
/**
28-
* @var bool Whether eval in JS scripts is allowed
29-
* TODO: Disallow per default
30-
* @link https://github.com/owncloud/core/issues/11925
31-
*/
32-
protected $evalScriptAllowed = null;
3327
/** @var bool Whether WebAssembly compilation is allowed */
3428
protected ?bool $evalWasmAllowed = null;
3529
/** @var array Domains from which scripts can get loaded */
@@ -54,8 +48,6 @@ class EmptyContentSecurityPolicy {
5448
protected $allowedFrameDomains = null;
5549
/** @var array Domains from which fonts can be loaded */
5650
protected $allowedFontDomains = null;
57-
/** @var array Domains from which web-workers and nested browsing content can load elements */
58-
protected $allowedChildSrcDomains = null;
5951
/** @var array Domains which can embed this Nextcloud instance */
6052
protected $allowedFrameAncestors = null;
6153
/** @var array Domains from which web-workers can be loaded */
@@ -101,18 +93,6 @@ public function useJsNonce($nonce) {
10193
return $this;
10294
}
10395

104-
/**
105-
* Whether eval in JavaScript is allowed or forbidden
106-
* @param bool $state
107-
* @return $this
108-
* @since 8.1.0
109-
* @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.
110-
*/
111-
public function allowEvalScript($state = true) {
112-
$this->evalScriptAllowed = $state;
113-
return $this;
114-
}
115-
11696
/**
11797
* Whether WebAssembly compilation is allowed or forbidden
11898
* @param bool $state
@@ -323,31 +303,6 @@ public function disallowFrameDomain($domain) {
323303
return $this;
324304
}
325305

326-
/**
327-
* Domains from which web-workers and nested browsing content can load elements
328-
* @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized.
329-
* @return $this
330-
* @since 8.1.0
331-
* @deprecated 15.0.0 use addAllowedWorkerSrcDomains or addAllowedFrameDomain
332-
*/
333-
public function addAllowedChildSrcDomain($domain) {
334-
$this->allowedChildSrcDomains[] = $domain;
335-
return $this;
336-
}
337-
338-
/**
339-
* Remove the specified allowed child src domain from the allowed domains.
340-
*
341-
* @param string $domain
342-
* @return $this
343-
* @since 8.1.0
344-
* @deprecated 15.0.0 use the WorkerSrcDomains or FrameDomain
345-
*/
346-
public function disallowChildSrcDomain($domain) {
347-
$this->allowedChildSrcDomains = array_diff($this->allowedChildSrcDomains, [$domain]);
348-
return $this;
349-
}
350-
351306
/**
352307
* Domains which can embed an iFrame of the Nextcloud instance
353308
*
@@ -441,7 +396,7 @@ public function buildPolicy() {
441396
$policy .= "base-uri 'none';";
442397
$policy .= "manifest-src 'self';";
443398

444-
if (!empty($this->allowedScriptDomains) || $this->evalScriptAllowed || $this->evalWasmAllowed || is_string($this->jsNonce)) {
399+
if (!empty($this->allowedScriptDomains) || $this->evalWasmAllowed || is_string($this->jsNonce)) {
445400
$policy .= 'script-src ';
446401
$scriptSrc = '';
447402
if (is_string($this->jsNonce)) {
@@ -459,9 +414,6 @@ public function buildPolicy() {
459414
if (is_array($this->allowedScriptDomains)) {
460415
$scriptSrc .= implode(' ', $this->allowedScriptDomains);
461416
}
462-
if ($this->evalScriptAllowed) {
463-
$scriptSrc .= ' \'unsafe-eval\'';
464-
}
465417
if ($this->evalWasmAllowed) {
466418
$scriptSrc .= ' \'wasm-unsafe-eval\'';
467419
}
@@ -517,11 +469,6 @@ public function buildPolicy() {
517469
$policy .= ';';
518470
}
519471

520-
if (!empty($this->allowedChildSrcDomains)) {
521-
$policy .= 'child-src ' . implode(' ', $this->allowedChildSrcDomains);
522-
$policy .= ';';
523-
}
524-
525472
if (!empty($this->allowedFrameAncestors)) {
526473
$policy .= 'frame-ancestors ' . implode(' ', $this->allowedFrameAncestors);
527474
$policy .= ';';

lib/public/AppFramework/Http/StrictContentSecurityPolicy.php

Lines changed: 0 additions & 70 deletions
This file was deleted.

lib/public/AppFramework/Http/StrictEvalContentSecurityPolicy.php

Lines changed: 0 additions & 33 deletions
This file was deleted.

lib/public/Collaboration/Resources/IManager.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,4 @@ public function createResource(string $type, string $id): IResource;
9797
* @since 16.0.0
9898
*/
9999
public function getResourceForUser(string $type, string $id, ?IUser $user): IResource;
100-
101-
/**
102-
* @param string $provider
103-
* @since 16.0.0
104-
* @deprecated 18.0.0 Use IProviderManager::registerResourceProvider instead
105-
*/
106-
public function registerResourceProvider(string $provider): void;
107100
}

lib/public/Util.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -468,31 +468,6 @@ public static function mb_array_change_key_case($input, $case = MB_CASE_LOWER, $
468468
return $ret;
469469
}
470470

471-
/**
472-
* performs a search in a nested array
473-
*
474-
* @param array $haystack the array to be searched
475-
* @param string $needle the search string
476-
* @param mixed $index optional, only search this key name
477-
* @return mixed the key of the matching field, otherwise false
478-
* @since 4.5.0
479-
* @deprecated 15.0.0
480-
*/
481-
public static function recursiveArraySearch($haystack, $needle, $index = null) {
482-
$aIt = new \RecursiveArrayIterator($haystack);
483-
$it = new \RecursiveIteratorIterator($aIt);
484-
485-
while ($it->valid()) {
486-
if (((isset($index) && ($it->key() == $index)) || !isset($index)) && ($it->current() == $needle)) {
487-
return $aIt->key();
488-
}
489-
490-
$it->next();
491-
}
492-
493-
return false;
494-
}
495-
496471
/**
497472
* calculates the maximum upload size respecting system settings, free space and user quota
498473
*

0 commit comments

Comments
 (0)