Merge branch 'master' into patch-2

This commit is contained in:
tflidd
2022-05-15 12:11:59 +02:00
committed by GitHub
11 changed files with 197 additions and 52 deletions

View File

@@ -159,6 +159,6 @@ changed remotely (files changed without going through Nextcloud), especially
when it's very deep in the folder hierarchy of the external storage.
You might need to setup a cron job that runs ``sudo -u www-data php occ files:scan --all``
(or replace "--all" with the user name, see also :doc:`../configuration_server/occ_command`)
(or replace ``--all`` with the user name, see also :doc:`../configuration_server/occ_command`)
to trigger a rescan of the user's files periodically (for example every 15 minutes), which includes
the mounted external storage.

View File

@@ -689,9 +689,9 @@ the scan::
Verbosity levels of ``-vv`` or ``-vvv`` are automatically reset to ``-v``
Note for option --unscanned:
Note for option ``--unscanned``:
In general there is a background job (through cron) that will do that scan periodically.
The --unscanned option makes it possible to trigger this from the CLI.
The ``--unscanned`` option makes it possible to trigger this from the CLI.
When using the ``--path`` option, the path must consist of following
components::
@@ -905,13 +905,7 @@ use the ``--force`` option to force it to check all active LDAP connections::
sudo -u www-data php occ ldap:check-user --force robert
``ldap:create-empty-config`` creates an empty LDAP configuration. The first
one you create has no ``configID``, like this example::
sudo -u www-data php occ ldap:create-empty-config
Created new configuration with configID ''
This is a holdover from the early days, when there was no option to create
additional configurations. The second, and all subsequent, configurations
one you create has ``configID`` ``s01``, and all subsequent configurations
that you create are automatically assigned IDs::
sudo -u www-data php occ ldap:create-empty-config

View File

@@ -66,9 +66,8 @@ This example shows what the table of users marked as ``deleted`` looks like::
Following flags can be specified additionally:
*--short-date*: formats the dates for ``Last login`` and ``Detected on`` in a short Y-m-d format (e.g. 2019-01-14)
*--json--*: instead of a table, the output is json-encoded. This makes it easy to process the data programmatically.
* ``--short-date``: formats the dates for ``Last login`` and ``Detected on`` in a short Y-m-d format (e.g. 2019-01-14)
* ``--json``: instead of a table, the output is json-encoded. This makes it easy to process the data programmatically.
Then you can run ``sudo -u www-data php occ user:delete aaliyah_brown`` to delete

View File

@@ -128,7 +128,7 @@ Previews
--------
It is possible to speed up preview generation using an
external microservice: `Imaginary <https://github.com/h2non/imaginary>`.
external microservice: `Imaginary <https://github.com/h2non/imaginary>`_.
To do so, you will need to deploy the service and make sure that it is
not accessible from outside of your servers. Then you can configure
@@ -150,4 +150,4 @@ Nextcloud to use Imaginary by editing your `config.php`:
.. note::
For large instance, you should follow `Imaginary's scalability recommandation <https://github.com/h2non/imaginary#scalability>`
For large instance, you should follow `Imaginary's scalability recommandation <https://github.com/h2non/imaginary#scalability>`.

View File

@@ -40,10 +40,10 @@ Required:
* PHP module filter (only on Mageia and FreeBSD)
* PHP module GD
* PHP module hash (only on FreeBSD)
* PHP module JSON
* PHP module JSON (included with PHP >= 8.0)
* PHP module libxml (Linux package libxml2 must be >=2.7.0)
* PHP module mbstring
* PHP module openssl
* PHP module openssl (included with PHP >= 8.0)
* PHP module posix
* PHP module session
* PHP module SimpleXML

View File

@@ -23,17 +23,15 @@ new dependencies in your constructor or methods but pass them in. So this:
.. code-block:: php
<?php
use OCP\IDBConnection;
// without dependency injection
class AuthorMapper {
/** @var IDBConnection */
private $db;
private IDBConnection $db;
public function __construct() {
$this->db = new Db();
}
}
would turn into this by using Dependency Injection:
@@ -46,14 +44,11 @@ would turn into this by using Dependency Injection:
// with dependency injection
class AuthorMapper {
/** @var IDBConnection */
private $db;
private IDBConnection $db;
public function __construct(IDBConnection $db) {
$this->db = $db;
}
}
@@ -90,15 +85,16 @@ use the **registerService** method on the container object:
use OCA\MyApp\Controller\AuthorController;
use OCA\MyApp\Service\AuthorService;
use OCA\MyApp\Db\AuthorMapper;
use OCP\IDBConnection;
use OCP\IServerContainer;
use Psr\Container\ContainerInterface;
class Application extends App {
/**
* Define your dependencies in here
*/
public function __construct(array $urlParams=array()){
public function __construct(array $urlParams = []){
parent::__construct('myapp', $urlParams);
$container = $this->getContainer();
@@ -106,29 +102,29 @@ use the **registerService** method on the container object:
/**
* Controllers
*/
$container->registerService('AuthorController', function(ContainerInterface $c){
$container->registerService(AuthorController::class, function(ContainerInterface $c): AuthorController {
return new AuthorController(
$c->get('AppName'),
$c->get('Request'),
$c->get('AuthorService')
$c->get(Request::class),
$c->get(AuthorService::class)
);
});
/**
* Services
*/
$container->registerService('AuthorService', function(ContainerInterface $c){
$container->registerService(AuthorService::class, function(ContainerInterface $c): AuthorService {
return new AuthorService(
$c->get('AuthorMapper')
$c->get(AuthorMapper::class)
);
});
/**
* Mappers
*/
$container->registerService('AuthorMapper', function(ContainerInterface $c){
$container->registerService(AuthorMapper::class, function(ContainerInterface $c): AuthorMapper {
return new AuthorMapper(
$c->get('ServerContainer')->getDatabaseConnection()
$c->get(IDBConnection::class)
);
});
}
@@ -144,25 +140,25 @@ The container works in the following way:
return new AuthorController(
$c->get('AppName'),
$c->get('Request'),
$c->get('AuthorService')
$c->get(Request::class),
$c->get(AuthorService::class)
);
* The **AppName** is queried and returned from the base class
* The **Request** is queried and returned from the server container
* **AuthorService** is queried::
$container->registerService('AuthorService', function(ContainerInterface $c){
$container->registerService(AuthorService::class, function(ContainerInterface $c): AuthorService {
return new AuthorService(
$c->get('AuthorMapper')
$c->get(AuthorMapper::class)
);
});
* **AuthorMapper** is queried::
$container->registerService('AuthorMappers', function(ContainerInterface $c){
$container->registerService(AuthorMappers::class, function(ContainerInterface $c): AuthorMapper {
return new AuthorService(
$c->get('ServerContainer')->getDatabaseConnection()
$c->get(IDBConnection::class)
);
});
@@ -184,7 +180,7 @@ How does auto-wiring work
Automatic assembly creates new instances of classes just by looking at the class name and its constructor parameters. For each constructor parameter the type or the argument name is used to query the container, e.g.:
* **SomeType $type** will use **$container->get('SomeType')**
* **SomeType $type** will use **$container->get(SomeType::class)**
* **$variable** will use **$container->get('variable')**
If all constructor parameters are resolved, the class will be created, saved as a service and returned.
@@ -199,10 +195,10 @@ So basically the following is now possible:
class MyTestClass {}
class MyTestClass2 {
public $class;
public $appName;
public MyTestClass $class;
public string $appName;
public function __construct(MyTestClass $class, $AppName) {
public function __construct(MyTestClass $class, string $AppName) {
$this->class = $class;
$this->appName = $AppName;
}
@@ -215,7 +211,7 @@ So basically the following is now possible:
$class2 instanceof MyTestClass2; // true
$class2->class instanceof MyTestClass; // true
$class2->appName === 'myname'; // true
$class2 === $app->getContainer()->get(MyTestClass2:class); // true
$class2 === $app->getContainer()->get(MyTestClass2::class); // true
.. note:: $AppName is resolved because the container registered a parameter under the key 'AppName' which will return the app id. The lookup is case sensitive so while $AppName will work correctly, using $appName as a constructor parameter will fail.
@@ -253,8 +249,10 @@ The only thing that needs to be done to add a route and a controller method is n
<?php
namespace OCA\MyApp\Controller;
use OCP\IRequest;
class PageController {
public function __construct($AppName, \OCP\IRequest $request) {
public function __construct($AppName, IRequest $request) {
parent::__construct($AppName, $request);
}
@@ -277,12 +275,15 @@ Interfaces and primitive types can not be instantiated, so the container can not
namespace OCA\MyApp\AppInfo;
use OCA\MyApp\Db\AuthorMapper;
use OCA\MyApp\Db\IAuthorMapper;
class Application extends \OCP\AppFramework\App {
/**
* Define your dependencies in here
*/
public function __construct(array $urlParams=array()){
public function __construct(array $urlParams = []){
parent::__construct('myapp', $urlParams);
$container = $this->getContainer();
@@ -291,9 +292,12 @@ Interfaces and primitive types can not be instantiated, so the container can not
$container->registerParameter('TableName', 'my_app_table');
// the interface is called IAuthorMapper and AuthorMapper implements it
$container->registerService('OCA\MyApp\Db\IAuthorMapper', function (ContainerInterface $c) {
return $c->get('OCA\MyApp\Db\AuthorMapper');
$container->registerService(IAuthorMapper::class, function (ContainerInterface $c): AuthorMapper {
return $c->get(AuthorMapper::class);
});
// Less verbose alternative
$container->registerAlias(IAuthorMapper::class, AuthorMapper::class);
}
}
@@ -389,3 +393,14 @@ What not to inject:
* It is a `pure function <https://en.wikipedia.org/wiki/Pure_function>`_
.. _`reflection`: https://www.php.net/manual/en/book.reflection.php
Accessing the container from anywhere
------------------------------------
Sometimes it can be hard to inject some service inside legacy code, in these case
you can use :code:`OCP\Server::get(MyService::class)`. This should only be used in
the last resort, as this makes your code more complicated to unit test and is
considered an anti-pattern.

View File

@@ -53,11 +53,12 @@ There is for the moment 4 views:
1. The general request and response view
2. The database queries view
3. The Event view
3. The event view
4. The LDAP queries view
4. The cache view
The general request and response view
The General Request and Response View
.....................................
.. image:: ../images/profiler-request.png
@@ -66,7 +67,7 @@ This view gives you general information about the request. For example,
which Controller and method was used, what where the response headers, the
request parameters, ...
The database queries view
The Database Queries View
.........................
This view gives you a list of all the database queries done for your request and
@@ -96,6 +97,13 @@ programe the more time is spent.
.. image:: ../images/profiler-event.png
The Cache View
..............
This view display all the access to the cache. It allows to detect cache hits and miss
as well as getting an idea of the time spent on Redis.
.. image:: ../images/profiler-cache.png
Contributing
------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

View File

@@ -0,0 +1,41 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022 Nextcloud GmbH
# This file is distributed under the same license as the Nextcloud latest User Manual package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Café Tango, 2022
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Nextcloud latest User Manual latest\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-07 14:47+0100\n"
"PO-Revision-Date: 2019-11-07 20:28+0000\n"
"Last-Translator: Café Tango, 2022\n"
"Language-Team: Chinese (Hong Kong) (https://www.transifex.com/nextcloud/teams/64236/zh_HK/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_HK\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../external_storage/external_storage.rst:3
msgid "Configuring external Storage"
msgstr "配置外部存儲"
#: ../../external_storage/external_storage.rst:5
msgid ""
"The External Storage application allows you to mount external storage "
"services, such as Amazon S3, SMB/CIFS fileservers and FTP servers… in "
"Nextcloud. Your Nextcloud server administrator controls which of these are "
"available to you. Please see `Configuring External Storage (GUI) "
"<https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/external_storage_configuration_gui.html>`_"
" in the Nextcloud Administrator's manual for configuration howtos and "
"examples."
msgstr ""
"External Storage 應用程式允許您在 Nextcloud 中掛載外部存儲服務,例如 Amazon S3、SMB/CIFS 檔案伺服器和 "
"FTP 伺服器等。您的 Nextcloud 伺服器管理員控制您可以使用哪些。有關配置方法和示例,請參閱 Nextcloud 管理員手冊中的“配置外部存儲"
" (GUI) "
"<https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/external_storage_configuration_gui.html>”。"

View File

@@ -0,0 +1,50 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022 Nextcloud GmbH
# This file is distributed under the same license as the Nextcloud latest User Manual package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Café Tango, 2022
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Nextcloud latest User Manual latest\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-07 14:47+0100\n"
"PO-Revision-Date: 2021-12-01 18:40+0000\n"
"Last-Translator: Café Tango, 2022\n"
"Language-Team: Chinese (Hong Kong) (https://www.transifex.com/nextcloud/teams/64236/zh_HK/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_HK\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../groupware/index.rst:3
msgid "Groupware"
msgstr "Groupware"
#: ../../groupware/index.rst:5
msgid ""
"Nextcloud Groupware is a bundle of apps which is consisting of an "
"**Mail**-client (IMAP/POP3) and a **Calendar** and **Contacts** server "
"(CalDAV/CardDAV) with the respective web interfaces."
msgstr ""
"Nextcloud Groupware 是一個應用程程式,它由一個**Mail** 客戶端IMAP/POP3和一個**Calendar** "
"和**Contacts** 伺服器CalDAV/CardDAV以及各自的 Web 介面組成。"
#: ../../groupware/index.rst:9
msgid ""
"We complete those productivity tools with **Deck**, a project management "
"tool which allows you to create Kanban-style task boards and share them with"
" your team."
msgstr "我們使用 **Deck** 完善了這些生產力工具,這是一種項目管理工具,可讓您創建看板式任務板並與您的團隊共享。"
#: ../../groupware/index.rst:12
msgid ""
"You can find out more about Nextcloud Groupware `on our website "
"<https://nextcloud.com/groupware/>`_."
msgstr ""
"您可以在`我們的網站 <https://nextcloud.com/groupware/>`_ 上找到有關 Nextcloud Groupware "
"的更多信息。"

View File

@@ -0,0 +1,38 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022 Nextcloud GmbH
# This file is distributed under the same license as the Nextcloud latest User Manual package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Café Tango, 2022
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Nextcloud latest User Manual latest\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-07 14:47+0100\n"
"PO-Revision-Date: 2021-10-11 16:50+0000\n"
"Last-Translator: Café Tango, 2022\n"
"Language-Team: Chinese (Hong Kong) (https://www.transifex.com/nextcloud/teams/64236/zh_HK/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_HK\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../talk/index.rst:3
msgid "Talk"
msgstr "Talk"
#: ../../talk/index.rst:5
msgid ""
"Nextcloud Talk offers audio/video and text chat integrated in Nextcloud. It "
"offers a web interface as well as mobile apps."
msgstr "Nextcloud Talk 提供集成到 Nextcloud 中的音頻、視頻和文本聊天。 它提供了一個網絡界面以及移動應用程序。"
#: ../../talk/index.rst:8
msgid ""
"You can find out more about Nextcloud Talk `on our website "
"<https://nextcloud.com/talk/>`_."
msgstr "您可以在我們的網站 <https://nextcloud.com/talk/> 上找到更多關於 Nextcloud Talk 的信息。"