summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/AppFramework/App.php27
-rw-r--r--lib/public/Share/IManager.php12
-rw-r--r--lib/public/Share/IProviderFactory.php7
-rw-r--r--lib/public/Share/IShareProvider.php9
4 files changed, 46 insertions, 9 deletions
diff --git a/lib/public/AppFramework/App.php b/lib/public/AppFramework/App.php
index 06524e4bf02..3b42b28758d 100644
--- a/lib/public/AppFramework/App.php
+++ b/lib/public/AppFramework/App.php
@@ -34,6 +34,7 @@ declare(strict_types=1);
namespace OCP\AppFramework;
use OC\AppFramework\Routing\RouteConfig;
+use OC\ServerContainer;
use OCP\Route\IRouter;
@@ -51,8 +52,8 @@ class App {
private $container;
/**
- * Turns an app id into a namespace by convetion. The id is split at the
- * underscores, all parts are camelcased and reassembled. e.g.:
+ * Turns an app id into a namespace by convention. The id is split at the
+ * underscores, all parts are CamelCased and reassembled. e.g.:
* some_app_id -> OCA\SomeAppId
* @param string $appId the app id
* @param string $topNamespace the namespace which should be prepended to
@@ -71,6 +72,28 @@ class App {
* @since 6.0.0
*/
public function __construct(string $appName, array $urlParams = []) {
+ if (\OC::$server->getConfig()->getSystemValueBool('debug')) {
+ $applicationClassName = get_class($this);
+ $e = new \RuntimeException('App class ' . $applicationClassName . ' is not setup via query() but directly');
+ $setUpViaQuery = false;
+
+ foreach ($e->getTrace() as $step) {
+ if (isset($step['class'], $step['function'], $step['args'][0]) &&
+ $step['class'] === ServerContainer::class &&
+ $step['function'] === 'query' &&
+ $step['args'][0] === $applicationClassName) {
+ $setUpViaQuery = true;
+ break;
+ }
+ }
+
+ if (!$setUpViaQuery) {
+ \OC::$server->getLogger()->logException($e, [
+ 'app' => $appName,
+ ]);
+ }
+ }
+
try {
$this->container = \OC::$server->getRegisteredAppContainer($appName);
} catch (QueryException $e) {
diff --git a/lib/public/Share/IManager.php b/lib/public/Share/IManager.php
index 302be523327..8bb7291d6ba 100644
--- a/lib/public/Share/IManager.php
+++ b/lib/public/Share/IManager.php
@@ -385,4 +385,16 @@ interface IManager {
*/
public function shareProviderExists($shareType);
+ /**
+ * @Internal
+ *
+ * Get all the shares as iterable to reduce memory overhead
+ * Note, since this opens up database cursors the iterable should
+ * be fully itterated.
+ *
+ * @return iterable
+ * @since 18.0.0
+ */
+ public function getAllShares(): iterable;
+
}
diff --git a/lib/public/Share/IProviderFactory.php b/lib/public/Share/IProviderFactory.php
index ad43b64229d..8d14b78f462 100644
--- a/lib/public/Share/IProviderFactory.php
+++ b/lib/public/Share/IProviderFactory.php
@@ -35,13 +35,6 @@ use OCP\IServerContainer;
interface IProviderFactory {
/**
- * IProviderFactory constructor.
- * @param IServerContainer $serverContainer
- * @since 9.0.0
- */
- public function __construct(IServerContainer $serverContainer);
-
- /**
* @param string $id
* @return IShareProvider
* @throws ProviderException
diff --git a/lib/public/Share/IShareProvider.php b/lib/public/Share/IShareProvider.php
index 6731bf8882b..c8815928269 100644
--- a/lib/public/Share/IShareProvider.php
+++ b/lib/public/Share/IShareProvider.php
@@ -217,4 +217,13 @@ interface IShareProvider {
* @since 12
*/
public function getAccessList($nodes, $currentAccess);
+
+ /**
+ * Get all the shares in this provider returned as iterable to reduce memory
+ * overhead
+ *
+ * @return iterable
+ * @since 18.0.0
+ */
+ public function getAllShares(): iterable;
}