changxie work record

Posted by joe2 on Tue, 19 Oct 2021 04:50:12 +0200

Work plan for March

No. 3.8

Build and install nextcloud development environment through docker compose
Completed.

No. 3.9

There are two ways to develop new apps in apps. One is through the application skeleton generator app store , generate a skeleton app online. Another way is to download the framework on Github app-tutorial.

No. 3.10

Learn and use two generated app framework skeletons.

  • The application skeleton generator has finished creating a new app
  • Research on the separation mode of front and rear ends

Learning from the traditional template hello development method of app

Enable nextcloud debugging mode

/config/config.php

$CONFIG = array (
  'debug'=>true,
)

Comparison of error messages before and after opening the debugging mode.

//****Before opening
 Internal server error
 The server cannot complete your request.

If this happens again, please send the following technical details to the server administrator.

More details can be found in the server log.

Technical details
 Remote address: 172.19.0.1
 request ID: YAnpCKO1EG3aVu7Ccddf
//****After opening

The server cannot complete your request.

If this happens again, please send the following technical details to the server administrator.

More details can be found in the server log.

Technical details
 Remote address: 172.19.0.1
 request ID: GbRmEpEu3YQGXvxbGRIV
 Type: ReflectionException
 Code: 0
 Message: Method OCA\Hello\Controller\PageController::show() does not exist
 File:/var/www/html/lib/private/AppFramework/Utility/ControllerMethodReflector.php
 Line: 52

track
#0 /var/www/html/lib/private/AppFramework/Utility/ControllerMethodReflector.php(52): ReflectionMethod->__construct(Object(OCA\Hello\Controller\PageController), 'show')
#1 /var/www/html/lib/private/AppFramework/Http/Dispatcher.php(117): OC\AppFramework\Utility\ControllerMethodReflector->reflect(Object(OCA\Hello\Controller\PageController), 'show')
#2 /var/www/html/lib/private/AppFramework/App.php(157): OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\Hello\Controller\PageController), 'show')
#3 /var/www/html/lib/private/Route/Router.php(302): OC\AppFramework\App::main('OCA\\Hello\\Contr...', 'show', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
#4 /var/www/html/lib/base.php(993): OC\Route\Router->match('/apps/hello/zha...')
#5 /var/www/html/index.php(37): OC::handleRequest()
#6 {main}

PHP errors are logged to data/nextcloud.log

Writing method of routing

//***Conventional writing
<?php
return [
    'routes' => [
        ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
        ['name' => 'note#index', 'url' => '/notes', 'verb' => 'GET'],
        ['name' => 'note#show', 'url' => '/notes/{id}', 'verb' => 'GET'],
        ['name' => 'note#create', 'url' => '/notes', 'verb' => 'POST'],
        ['name' => 'note#update', 'url' => '/notes/{id}', 'verb' => 'PUT'],
        ['name' => 'note#destroy', 'url' => '/notes/{id}', 'verb' => 'DELETE']
    ]
];
//***Abbreviation
<?php
return [
    'resources' => [
        'note' => ['url' => '/notes']
    ],
    'routes' => [
        ['name' => 'page#index', 'url' => '/', 'verb' => 'GET']
    ]
];

Controller writing (Controller)

Study 3.11 why app failed to be enabled

trace hit

  • Turn on the routing address of the application
    http://localhost:6080/index.php/settings/apps/enable
    /apps/settings/appinfo/routes.php
['name' => 'AppSettings#enableApps', 'url' => '/settings/apps/enable', 'verb' => 'POST' , 'root' => ''],

  • Corresponding controller file

/apps/settings/lib/AppSettingsController.php

class AppSettingsController extends Controller {
    public function enableApps(){   
        $installer->installApp($appId);//This line of code will not be executed in the future
    }

}
  • Dependent file
    /lib/private/AppFramework/Installer.php
public function installApp(string $appId, bool $forceEnable = false): string {
    $coordinator = \OC::$server->get(Coordinator::class);
	$coordinator->runLazyRegistration($appId);
}

D:\docker_dev\nextcloud\src\lib\private\legacy\OC_App.php

/lib/private/AppFramework/Bootstrap/Coordinator.php

class Coordinator {
    public function runLazyRegistration(string $appId): void {
		$this->registerApps([$appId]);
	}
}

3.12 app front and back separate writing module vuezhaoqhu

Application of vue front-end technology to nextcloud

HTTP security middleware
D:\docker_dev\nextcloud\src\lib\private\AppFramework\Middleware\Security\SecurityMiddleware.php

@PublicPage Do you need to log in
@SubAdminRequired Do you need at least two levels of administrator privileges
@StrictCookieRequired Strict needs Cookie
@NoAdminRequired Administrator privileges are not required
@NoCSRFRequired unwanted
$this->l10n->t('Logged in user must be an admin or sub admin')

D:\docker_dev\nextcloud\src\lib\private\AppFramework\Http\Request.php

D:\docker_dev\nextcloud\src\lib\private\Security\CSRF\CsrfTokenManager.php
Check cross domain csrf token
$this->request->passesCSRFCheck()

Write RestApi interface for vue front end

vue front end calls RestApi interface

http://localhost:6080/apps/photos/api/v1/albums/Photos
http://localhost:6080/apps/photos/api/v1/albums/Photos

Front end technology vue

VueZhaoqhu test

http://192.168.100.226:6080/index.php/apps/vuezhaoqhu/

nextcloud npm moudles

https://docs.nextcloud.com/server/latest/developer_manual/digging_deeper/javascript-apis.html

3.15 separation of front and rear ends of apps / files

php side to design an API to get folders

D:\docker_dev\nextcloud\src\apps\dav\lib\Connector\Sabre\Auth.php

requiresCSRFCheck(){
//Check csrfcheck
}

Readme
app-content-files
filestable


---------------
RedirectResponse() //Jump to page header('Location: ')
D:\docker_dev\nextcloud\src\lib\private\legacy\OC_App.php

$appPath = \OC_App::getAppPath($appName);
Util::addScript(Application::APP_ID, 'app.c7da1d22');
Util::addScript(Application::APP_ID, 'chunk-vendors.bd2bce2e');
Util::addStyle(Application::APP_ID, 'app.fb0c6e1c');

filelist.js
_createRow
_renderRow
tagplugin.js
_extendFileList
add
_nextPage //
setFiles //

use OCP\AppFramework\Http\TemplateResponse;

## Namespace rules

namespace OCA /apps Below app such as file,Namespace is
 example: namespace OCA\Files\Controller;/Apps/Files/Controller

namespace OCP /lib/public/Interface file under directory
 example: namespace OCP\Files;/lib/public/Files/

namespace OC /lib/private/Namespace under directory
 example: namespace OC\Files;/lib/private/Files/
OCA.Files;
OC
http://localhost:6080/remote.php/dav/files/admin / / / call the API to get the list of all folders in the current directory.
//-----------------------------------------------------------

https://docs.nextcloud.com/server/latest/developer_manual/app_publishing_maintenance/upgrade-guide.html#upgrading-to-nextcloud-21


filelist.js init 445
getUserFolder
namespace 
public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false) {
		if ($fileid !== null) {
			try {
				return $this->redirectToFile($fileid);
			} catch (NotFoundException $e) {
				return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
			}
		}

		$nav = new \OCP\Template('files', 'appnavigation', ''); //zqh * * * left navigation menu, all files, recent, favorite, share, tag

		// Load the files we need
		\OCP\Util::addStyle('files', 'merged'); //zqh * * * import merged.scss file
		\OCP\Util::addScript('files', 'merged-index');//zqh * * * import all js files in the merged-index.json file
		\OCP\Util::addScript('files', 'dist/templates');//zqh * * * import dis/templates.js file
        //zqh***start
        OC\User\UseravatarManager: null
OC\User\Userbackend: {}
OC\User\Userconfig: {}
OC\User\Userdispatcher: {}
OC\User\UserdisplayName: "admin"
OC\User\Useremitter: {}
OC\User\Userenabled: true
OC\User\Userhome: "/var/www/html/data/admin"
OC\User\UserlastLogin: "1615857733"
OC\User\UserlegacyDispatcher: {}
OC\User\Useruid: "admin"
OC\User\UserurlGenerator: {}
//zqh***end
		// mostly for the home storage's free space
		// FIXME: Make non static
		$storageInfo = $this->getStorageInfo();

		$user = $this->userSession->getUser()->getUID();

		// Get all the user favorites to create a submenu
		try {
			$favElements = $this->activityHelper->getFavoriteFilePaths($this->userSession->getUser()->getUID());
		} catch (\RuntimeException $e) {
			$favElements['folders'] = [];
		}

		$collapseClasses = '';
		if (count($favElements['folders']) > 0) {
			$collapseClasses = 'collapsible';
		}

		$favoritesSublistArray = [];

		$navBarPositionPosition = 6;
		$currentCount = 0;
		foreach ($favElements['folders'] as $dir) {
			$link = $this->urlGenerator->linkToRoute('files.view.index', ['dir' => $dir, 'view' => 'files']);
			$sortingValue = ++$currentCount;
			$element = [
				'id' => str_replace('/', '-', $dir),
				'view' => 'files',
				'href' => $link,
				'dir' => $dir,
				'order' => $navBarPositionPosition,
				'folderPosition' => $sortingValue,
				'name' => basename($dir),
				'icon' => 'files',
				'quickaccesselement' => 'true'
			];

			array_push($favoritesSublistArray, $element);
			$navBarPositionPosition++;
		}

		$navItems = \OCA\Files\App::getNavigationManager()->getAll(); 
        //zqh * * * get the left navigation menu: 1. All files 2. Recent 3. Favorites 4. Share, 4-1. Files you shared 4-2. Files you shared 4-3. Share through connection 4-4. Deleted shares 4-5. To be shared. 5. Tab 6. Deleted files

		// add the favorites entry in menu
		$navItems['favorites']['sublist'] = $favoritesSublistArray;
		$navItems['favorites']['classes'] = $collapseClasses;

        
		// parse every menu and add the expandedState user value
		foreach ($navItems as $key => $item) {
			if (isset($item['expandedState'])) {
				$navItems[$key]['defaultExpandedState'] = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', $item['expandedState'], '0') === '1';
			}
		}

		$nav->assign('navigationItems', $navItems);

		$nav->assign('usage', \OC_Helper::humanFileSize($storageInfo['used']));
		if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
			$totalSpace = $this->l10n->t('Unlimited');
		} else {
			$totalSpace = \OC_Helper::humanFileSize($storageInfo['total']);
		}
		$nav->assign('total_space', $totalSpace);
		$nav->assign('quota', $storageInfo['quota']);
        //zqh***\OCP\Files\FileInfo::SPACE_ The value of unlimited is - 3, which means there is no space limit. The template only displays the used space and does not display the remaining space

		$nav->assign('usage_relative', $storageInfo['relative']);

		$nav->assign('webdav_url', \OCP\Util::linkToRemote('dav/files/' . $user));

		$contentItems = [];

		// render the container content for every navigation item
		foreach ($navItems as $item) {
			$content = '';
			if (isset($item['script'])) {
				$content = $this->renderScript($item['appname'], $item['script']);
                //zqh * * * import template file in left navigation menu
                1,appname:files
                1-1,appname:files,id:files,script:list.php,name:All files,type:link
                1-2,appname:files,id:recent,script:recentlist.php,name:lately,type:link
                1-3,appname:files,id:favorites,script:simplelist.php,name:Collection,type:link
                2,appname:files_sharing
                2-1,appname:files_sharing,id:shareoverview,script:list.php,name:share
                2-1-1,appname:files_sharing,id:sharingout,script:list.php,name:Files you shared
                2-1-2,appname:files_sharing,id:sharingin,script:list.php,name:Shared with you
                2-1-3,appname: files_sharing,id:sharinglinks,script:list.php,name:Share via link
                2-1-4,appname: files_sharing,id: deletedshares,script:list.php,name:Deleted share
                2-1-5,appname: files_sharing,id: pendingshares,script:list.php,name:Pending share
                3,appname:systemtags
                3-1,appname: systemtags,id:systemtagsfilter,script:list.php,name:share type:link
                4,appname:files_trashbin,id:trashbin,script:list.php,type:link

			}
			// parse submenus
			if (isset($item['sublist'])) {
				foreach ($item['sublist'] as $subitem) {
					$subcontent = '';
					if (isset($subitem['script'])) {
						$subcontent = $this->renderScript($subitem['appname'], $subitem['script']);
					}
					$contentItems[$subitem['id']] = [
						'id' => $subitem['id'],
						'content' => $subcontent
					];
				}
			}
			$contentItems[$item['id']] = [
				'id' => $item['id'],
				'content' => $content
			];
		}

		$event = new LoadAdditionalScriptsEvent();
		$this->eventDispatcher->dispatchTyped($event);
		$this->eventDispatcher->dispatchTyped(new LoadSidebar());
		// Load Viewer scripts
		if (class_exists(LoadViewer::class)) {
			$this->eventDispatcher->dispatchTyped(new LoadViewer());
		}
		$this->initialState->provideInitialState('templates_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : null);
		$this->initialState->provideInitialState('templates', $this->templateManager->listCreators());

		$params = [];
		$params['usedSpacePercent'] = (int) $storageInfo['relative'];
		$params['owner'] = $storageInfo['owner'] ?? '';
		$params['ownerDisplayName'] = $storageInfo['ownerDisplayName'] ?? '';
		$params['isPublic'] = false;
		$params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
		$params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
		$params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc');
		$params['showgridview'] = $this->config->getUserValue($user, 'files', 'show_grid', false);
		$params['isIE'] = \OCP\Util::isIE();
		$showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
		$params['showHiddenFiles'] = $showHidden ? 1 : 0;
		$cropImagePreviews = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'crop_image_previews', true);
		$params['cropImagePreviews'] = $cropImagePreviews ? 1 : 0;
		$params['fileNotFound'] = $fileNotFound ? 1 : 0;
		$params['appNavigation'] = $nav;
		$params['appContents'] = $contentItems;
		$params['hiddenFields'] = $event->getHiddenFields();

		$response = new TemplateResponse(
			$this->appName,
			'index',
			$params
		);
		$policy = new ContentSecurityPolicy();
		$policy->addAllowedFrameDomain('\'self\'');
		$response->setContentSecurityPolicy($policy);

		return $response;
	}

The vue front end invokes this excuse

getOwner
http://localhost:6080/index.php/apps/recommendations/api/recommendations

GRANT ALL PRIVILEGES ON . TO 'root'@'%'
flush privileges

No. 3.17

Notification API
http://localhost:6080/ocs/v2.php/apps/notifications/api/v2/notifications

File list API
http://localhost:6080/remote.php/dav/files/admin/

https://www.51jianxie.com/remote.php/webdav/

remote.php

http://localhost:6080/remote.php/dav/files/admin/

D:\docker_dev\nextcloud\src\3rdparty\sabre\dav\lib\DAV\Server.php

table

oc_vcategory_to_object
oc_filecache D:\docker_dev\nextcloud\src\lib\private\Files\Cache\Cache.php

use OCP\IDBConnection; Database object
ConnectionAdapter
executeQuery ;sql execution statement

\OC::$server->getDatabaseConnection();
KaTeX parse error: Undefined control sequence: \OC at position 8: conn = \̲O̲C̲::server->getDatabaseConnection();
$sql = "SELECT * FROM oc_vcategory_to_object";
D:\docker_dev\nextcloud\src\lib\private\DB\Connection.php
$res = c o n n − > e x e c u t e Q u e r y ( conn->executeQuery( conn−>executeQuery(sql)->fetchAll();
var_dump(1111, $res);die;

private DB

D:\docker_dev\nextcloud\src\lib\private\Files\Cache\Cache.php*

getFolderContentsById()**
D:\docker_dev\nextcloud\src\lib\private\Files\Cache\CacheQueryBuilder.php*
D:\docker_dev\nextcloud\src\lib\private\Files\Cache\HomeCache.php*
src\lib\private\Files\Cache\HomeCache.php:

/var/www/html/apps/dav/appinfo/v2/remote.php

/dav/files/admin/
DummyGetResponsePlugin
This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.

318

Sabre\DAV\Exception\NotAuthenticated

src\3rdparty\sabre\dav\lib\DAV\Auth\Backend\AbstractBasic.php
src\3rdparty\sabre\dav\lib\DAV\Server.php

<?xml version="1.0" encoding="utf-8"?>

<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
<s:message>No public access to this resource., No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured</s:message>
</d:error>

3.19

Get token

http://localhost:6080/index.php/csrftoken

webdav API

https://docs.nextcloud.com/server/21/developer_manual/client_apis/WebDAV/index.html#webdav
Native apps/file, the API called in the file control panel interface

View all files

URL 1

http://localhost:6080/remote.php/dav/files/admin/

  • PROPFIND METHOD

Upload file

URL 1

http://localhost:6080/remote.php/webdav/error_2222.html

  • PUT METHOD

create folder

API URL 1

http://localhost:6080/remote.php/dav/files/admin/FolderCreateTest

  • MKCOL METHOD
  • PROPFIND METHOD
  • PROPFIND METHOD

API URL 2

http://localhost:6080/remote.php/dav/systemtags-relations/files/524

  • PROPFIND METHOD
  • PROPFIND METHOD

API URL 3

http://localhost:6080/remote.php/dav/comments/files/524

  • REPORT METHOD

API URL 4

http://localhost:6080/ocs/v2.php/collaboration/resources/file/524?format=json

  • GET METHOD

API URL 5

http://localhost:6080/ocs/v1.php/apps/files_sharing/api/v1/sharees_recommended?format=json&itemType=dir

  • GET METHOD

Modify folder name

API URL 1

http://localhost:6080/remote.php/dav/files/admin/folder%20create%20test

  • MOVE MEHOD

API URL 2

http://localhost:6080/remote.php/dav/files/admin/FolderCreate1Test

  • PROFIND METHOD

API URL 3

http://localhost:6080/remote.php/dav/files/admin/FolderCreate1Test

  • PROFIND METHOD

API URL 4

http://localhost:6080/ocs/v2.php/apps/activity/api/v2/activity/filter?format=json&object_type=files&object_id=522

  • GET

API URL 5

http://localhost:6080/ocs/v2.php/apps/files_sharing/api/v1/shares?format=json&path=%2FFolderCreate1Test&reshares=true

  • GET

URL 6

http://localhost:6080/ocs/v2.php/apps/files_sharing/api/v1/shares?format=json&path=%2FFolderCreate1Test&shared_with_me=true

  • GET

URL 7

http://localhost:6080/ocs/v1.php/apps/files_sharing/api/v1/sharees_recommended?format=json&itemType=dir

  • GET

Tracking debugging

zqhAuthLogin

If the header contains X-Requested-With: XMLHttpRequest, go to
var_dump('zqhAuthLogin auth() ');die;
Otherwise go to
var_dump('zqhAuthLogin challenge ');die;

1.3rdparty/sabre/dab/lib/DAV/Server.php
start();
invokeMethod();

3.22

remote.php
KaTeX parse error: Undefined control sequence: \OCA at position 14: server = new \̲O̲C̲A̲\DAV\Server(request, $baseuri);
$server->exec(); // implement

$root = new RootCollection();

\OC::KaTeX parse error: Undefined control sequence: \OC at position 14: server = new \̲O̲C̲\Server(\OC::WEBROOT, self::$config);
Root set
attribute
use OCA\DAV\Connector\Sabre\CachingTree;

/src/lib/private/User/Session.php

getSession()

getUser();

3.23

\OC::$server

New cachengtree ($root) is \ Sabre\DAV\Tree
KaTeX parse error: Undefined control sequence: \Sabre at position 20: ...->server = new \̲S̲a̲b̲r̲e̲\Server(new Cac...root));

$this->httpRequest = $this->sapi->getRequest();

\Sabre\HTTP\Sapi()

Based on php native variables and methods, S E R V E R , _SERVER, S​ERVER,_POST,$_FILES,php://input echo(),header(),php://output

\Sabre\HTTP\Request

function invokeMethod();

src\3rdparty\sabre\dav\lib\DAV\Browser\Plugin.php

new \Sabre\DAV\Browser\Plugin()

src\apps\dav\lib\Files\RootCollection.php

class RootCollection extends AbstractPrincipalCollection {
public function getChildForPrincipal(){
KaTeX parse error: Undefined control sequence: \OC at position 8: user = \̲O̲C̲::server->getUserSession->getUser();
}

$userFolder = \OC::$server->getUserFolder();

}
function getUserFolder(){
if ($userId === null) {
$user = t h i s − > g e t ( I U s e r S e s s i o n : : c l a s s ) − > g e t U s e r ( ) ; i f ( ! this->get(IUserSession::class)->getUser(); if (! this−>get(IUserSession::class)−>getUser();if(!user) {
return null;
}
$userId = $user->getUID();
}
$root = $this->get(IRootFolder::class);
return r o o t − > g e t U s e r F o l d e r ( root->getUserFolder( root−>getUserFolder(userId);
}
IRootFolder
src\lib\private\Files\Node\Root.php
public function getUserFolder($userId) {
$userObject = t h i s − > u s e r M a n a g e r − > g e t ( this->userManager->get( this−>userManager−>get(userId);

	if (is_null($userObject)) {
		$this->logger->error(
			sprintf(
				'Backends provided no user object for %s',
				$userId
			),
			[
				'app' => 'files',
			]
		);
		throw new NoUserException('Backends provided no user object');
	}

	$userId = $userObject->getUID();

	if (!$this->userFolderCache->hasKey($userId)) {
		\OC\Files\Filesystem::initMountPoints($userId);

		try {
			$folder = $this->get('/' . $userId . '/files');
		} catch (NotFoundException $e) {
			if (!$this->nodeExists('/' . $userId)) {
				$this->newFolder('/' . $userId);
			}
			$folder = $this->newFolder('/' . $userId . '/files');
		}

		$this->userFolderCache->set($userId, $folder);
	}

	return $this->userFolderCache->get($userId);
}

Root directory collection

getNodeForPath

$this - > server used in browser\Plugin.php is \ sabre\dab\lib\Dav\Server.php

$this->server->getPropertiesForChildren();

3.24

3rd party software

sabre Sabre
dav/lib/dav/auth/Backend
AbstractBasic.php
AbstractBearer.php
AbstractDigest.php

Sign in

Login home page

src\core\Controller\LoginController.php
showLoginForm
user session
\src\lib\private\Session\Internal.php
Internal.php
\src\lib\private\Session\CryptoSessionData.php
cryptoSessionData.php

user_id
OC\User\Session # search
src\core\Controller\LoginController.php login controller

3.25

webdav header authorization basic

apidoc

https://apidocjs.com/example/

https://zhuanlan.zhihu.com/p/83487114

ocs api

src\apps\provisioning_api\appinfo\routes.php
src\apps\files_sharing\appinfo\routes.php

csrftoken

Pass csrftoken

src\lib\private\AppFramework\Http\Request.php #line 491

  • requesttoken
    requesttoken can be passed through http GET, POST and adding to http header header.
if (isset($this->items['get']['requesttoken'])) {
	$token = $this->items['get']['requesttoken'];
} elseif (isset($this->items['post']['requesttoken'])) {
	$token = $this->items['post']['requesttoken'];
} elseif (isset($this->items['server']['HTTP_REQUESTTOKEN'])) {
	$token = $this->items['server']['HTTP_REQUESTTOKEN'];
} else {
	//no token found.
	return false;
}
$token = new CsrfToken($token);

return $this->csrfTokenManager->isTokenValid($token);

Validate csrftoken

Check whether the user has a requesttoken key in the server

src\lib\private\Security\CSRF\TokenStorage\SessionStorage.php #line 91

/**
	 * Whether the storage has a storage.
	 *
	 * @return bool
	 */
	public function hasToken(): bool {
		return $this->session->exists('requesttoken');
	}

src\lib\private\Session\Internal.php #line 91

/**
	 * @param string $key
	 * @return bool
	 */
	public function exists(string $key): bool {
		return isset($_SESSION[$key]);
	}

Check whether the requesttoken value passed by the user is consistent with the session value whose key is requesttoken in the server.

src\lib\private\Security\CSRF\CsrfTokenManager.php #line 102

/**
	 * Verifies whether the provided token is valid.
	 *
	 * @param CsrfToken $token
	 * @return bool
	 */
	public function isTokenValid(CsrfToken $token): bool {
		if (!$this->sessionStorage->hasToken()) {
			return false;
		}

		return hash_equals(
			$this->sessionStorage->getToken(),
			$token->getDecryptedValue()
		);
	}

http authorization basic

// Backends
src\apps\dav\lib\Connector\Sabre\Auth.php
src\3rdparty\sabre\dav\lib\DAV\Auth\Backend\AbstractBasic.php
class Auth extends AbstractBasic{
	
}
$authBackend = new Auth(
	\OC::$server->getSession(),
	\OC::$server->getUserSession(),
	\OC::$server->getRequest(),
	\OC::$server->getTwoFactorAuthManager(),
	\OC::$server->getBruteForceThrottler()
);
$authPlugin = new Plugin();//zqhAuthLogin***  Sabre\DAV\Auth\Plugin
$authPlugin->addBackend(new PublicAuth());//zqhAuthLogin*** 
$this->server->addPlugin($authPlugin);//zqhAuthLogin***  src\apps\dav\lib\Connector\Sabre\Server.php
// allow setup of additional auth backends
$event = new SabrePluginEvent($this->server);
$dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event);
$newAuthEvent = new SabrePluginAuthInitEvent($this->server);
$newDispatcher->dispatchTyped($newAuthEvent);

$bearerAuthBackend = new BearerAuth(
	\OC::$server->getUserSession(),
	\OC::$server->getSession(),
	\OC::$server->getRequest()
);
$authPlugin->addBackend($bearerAuthBackend);//zqhAuthLogin***
// because we are throwing exceptions this plugin has to be the last one
$authPlugin->addBackend($authBackend);//zqhAuthLogin***

src\3rdparty\sabre\dav\lib\DAV\Auth\Plugin.php #line 71
/**
* Adds an authentication backend to the plugin.
*/
public function addBackend(Backend\BackendInterface $authBackend)
{
	$this->backends[] = $authBackend;
}
src\3rdparty\sabre\dav\lib\DAV\Server.php #line 404
/**
	* Adds a plugin to the server.
	*
	* For more information, console the documentation of Sabre\DAV\ServerPlugin
	*/
public function addPlugin(ServerPlugin $plugin)
{
	$this->plugins[$plugin->getPluginName()] = $plugin;
	$plugin->initialize($this);#Plugin is plugin
}

3.29

src\lib\base.php

class OC {
	public static function init(){
		OC::$SERVERROOT = str_replace("\\", '/', substr(__DIR__, 0, -4));//root directory
	}
}

ocs/apis

src\ocs\v1.php

require_once __DIR__ . '/../lib/base.php';//Introducing src/lib/base.php
try {
	OC_App::loadApps(['session']);
	OC_App::loadApps(['authentication']);

	// load all apps to get all api routes properly setup
	// FIXME: this should ideally appear after handleLogin but will cause
	// side effects in existing apps
	OC_App::loadApps();

	if (!\OC::$server->getUserSession()->isLoggedIn()) {
		OC::handleLogin(\OC::$server->getRequest());//Process user login
	}

	OC::$server->get(\OC\Route\Router::class)->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo());
}

src\apps\provisioning_api\appinfo\routes.php
src\apps\files_sharing\appinfo\routes.php
D:\docker_dev\nextcloud\src\apps\federatedfilesharing\appinfo\routes.php

No. 3.30

Custom AuthToken controller file

src\core\Controller\AuthTokenController.php

Custom AuthToken router

['name' => 'authToken#basic', 'url' => '/accesstoken', 'verb' => 'POST'],
['name' => 'authToken#getEncryptedStr', 'url' => '/encryptstr', 'verb' => 'POST'],

No. 3.31

API doc writing API

Verification APIs

Get encrypted string

access token

Webdav

View resources under folder

New folder

Move folder or file

Jquery Fileupload

https://github.com/blueimp/jQuery-File-Upload/wiki

No. 4.1

File

src\lib\private\legacy\OC_App.php

OC\Route\Router" string(12) "/apps/files/
src\lib\private\AppFramework\DependencyInjection\DIContainer.php

server

src\lib\private\Server.php
src\lib\private\ServerContainer.php
src\lib\private\AppFramework\Middleware\MiddlewareDispatcher.php
class MiddlewareDispatcher(){
public beforeController(){
m i d d l e w a w r e − > b e f o r e C o n t r o l l e r ( middlewawre->beforeController( middlewawre−>beforeController(controller,$methodName);
}
public afterException(){

}

}
src\lib\private\AppFramework\Middleware\Security\SecurityMiddleware.php
class SecurityMiddleWare{
public beforeController(){

}
public afterException(){

}

}

src\apps\dav\lib\Connector\Sabre\Auth.php

if ($this->userSession->logClientIn($username, $password, $this->request, $this->throttler)) {
					\OC_Util::setupFS($this->userSession->getUser()->getUID());
					$this->session->set(self::DAV_AUTHENTICATED, $this->userSession->getUser()->getUID());
					$this->session->close();
					return true;
				} else {
					$this->session->close();
					return false;
				}

src\lib\private\User\Session.php

No. 4.2

iframe cross domain introduction
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors
Content-Security-Policy
frame-src
src\apps\files\lib\Controller\ViewController.php
class ViewController {
public function index() {
$policy = new ContentSecurityPolicy();
$policy->addAllowedFrameDomain('http://192.168.100.226:2000');
$policy->addAllowedFrameAncestorDomain('http://192.168.100.226:2000');
r e s p o n s e − > s e t C o n t e n t S e c u r i t y P o l i c y ( response->setContentSecurityPolicy( response−>setContentSecurityPolicy(policy);
}
}
addAllowedFrameDomain(''self'')
$policy->addAllowedFrameDomain('http://192.168.100.226:2000');
$policy->addAllowedFrameAncestorDomain('http://192.168.100.226:2000');

apidoc adds a url to the file management interface

Production environment address

apidoc -i src -o doc

2021.04.06

onlyoffice integration

  • Nextcloud
  • ownCloud
  • Confluence
  • Alfresco

Investigate the API called by 192.168.100.23 collaboration space interface

base.php

class OC {
protected static function handleAuthHeaders() {

}
public static function init(){
	self::handleAuthHeaders();//Processing Authorization
}
public static function handleRequest(){
	self::handleLogin($request);
}

}

D:\docker_dev\nextcloud\src\lib\private\AppFramework\Http\Dispatcher.php

https://www.51jianxie.com/apps/registration/

No. 4.7

Collection

http://192.168.100.23/remote.php/webdav/
http://192.168.100.226:6080/remote.php/dav/files/admin/

recycle bin

http method get
http://192.168.100.23/index.php/apps/files_trashbin/ajax/list.php?dir=%2F&sort=mtime&sortdirection=desc
http method propfind
http://192.168.100.226:6080/remote.php/dav/trashbin/admin/trash

Document list center Pagination

src\lib\private\Files\Cache\Cache.php

public function getFolderContentsById($fileId) {
		if ($fileId > -1) {
			$query = $this->getQueryBuilder();
			$page = intval(\OC::$server->getRequest()->getParam('page'));
			if($page != NULL && $page > 0){
				$queryB = $this->getQueryBuilder();
				$queryB->selectAlias($queryB->createFunction('COUNT(fileid)'),'counts')
				->from('filecache')->whereParent($fileId);
				$result = $queryB->execute();
				$resCounts = $result->fetch();
				$result->closeCursor();
				$perPageNum = 10;
				$pageCount = ceil($resCounts['counts']/$perPageNum);
				if ($page > $pageCount){
					return [];
				}
				$offsetNum = ($page - 1) * $perPageNum;
				$query->selectFileCache()
				->whereParent($fileId)->setFirstResult($offsetNum)->setMaxResults($perPageNum)
				->orderBy('name', 'ASC');
			}else{
				$query->selectFileCache()
				->whereParent($fileId)
				->orderBy('name', 'ASC');
			}
			
			$result = $query->execute();
			$files = $result->fetchAll();
			$result->closeCursor();
			return array_map(function (array $data) {
				return self::cacheEntryFromData($data, $this->mimetypeLoader);
			}, $files);
		}
		return [];
	}

Study 4.8 cross domain

CORS error

CSP

header('Access-Control-Allow-Origin:');
header('Access-Control-Allow-Headers:');
header('Access-Control-Allow-Methods:');
var_dump("zqhAuth*cors");die;
// $httpHeaders['Access-Control-Allow-Headers'] = 'http://192.168.100.226:8080';
// $httpHeaders['Access-Control-Allow-Origin'] = '';
// h t t p H e a d e r s [ ′ A c c e s s − C o n t r o l − A l l o w − M e t h o d s ′ ] = ′ ∗ ′ ; / / httpHeaders['Access-Control-Allow-Methods'] = '*'; // httpHeaders[′Access−Control−Allow−Methods′]=′∗′;//this->httpResponse->addHeaders( h t t p H e a d e r s ) ; / / httpHeaders); // httpHeaders);//this->httpResponse->addHeaders($httpHeaders);

src\3rdparty\sabre\dav\lib\DAV\Auth\Plugin.php

if ($this->autoRequireLogin) {
           $this->challenge($request, $response); //zqhAuth***
          //var_dump(implode(', ', $authResult[1]));
           throw new NotAuthenticated(implode(', ', $authResult[1])); //zqhAuth***
        }

OCA\DAV\Connector\Sabre\Auth
OCA\Federation\DAV\FedAuth

Study 4.9 cross domain and http basic authentication

src\lib\base.php

class OC {
	public static function init() {
		header('Access-Control-Allow-Origin:*');
		header('Access-Control-Allow-Methods:*');
		header('Access-Control-Allow-Headers:*');
		if($_SERVER['REQUEST_METHOD'] == 'OPTIONS'){
			exit;
		 }
	}
}
 _ajaxConnectionLostHandler: f,
        _processAjaxError: function(e) {
            (0 !== e.status || "abort" !== e.statusText && "timeout" !== e.statusText && !le._reloadCalled) && (d.default.contains([302, 303, 307, 401], e.status) && le.currentUser ? setTimeout((function() {
                if (!le._userIsNavigatingAway && !le._reloadCalled) {
                    var e = 0
                      , t = setInterval((function() {
                        p.showUpdate(n("core", "Problem loading page, reloading in %n second", "Problem loading page, reloading in %n seconds", 5 - e)),
                        e >= 5 && (clearInterval(t),
                        le.reload()),
                        e++
                    }
                    ), 1e3);
                    le._reloadCalled = !0
                }
            }
            ), 100) : 0 === e.status && setTimeout((function() {
                le._userIsNavigatingAway || le._reloadCalled || le._ajaxConnectionLostHandler()
            }
            ), 100))
        },

No. 4.12

http://192.168.100.226:6080/apps/files?code=T%2F1H8jmU4tTBRdx1ZdqB7Oi%2F2ohLkicq3Z9Dem971nlH0z1wrZtfc5jBOqvBAF4Tei5BGW3J8x9M7bvAkdvA8g%3D%3D

Research routing

src\ocs\v1.php

OC::$server->get(\OC\Route\Router::class)->v('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo());

src\lib\base.php

OC::$server->get(\OC\Route\Router::class)->match($request->getRawPathInfo());
				return;

src\lib\private\Route\Router.php

public function match($url) {
		$parameters = $this->findMatchingRoute($url);
		var_dump($parameters);die;
		\OC::$server->getEventLogger()->start('run_route', 'Run route');
		if (isset($parameters['caller'])) {
			$caller = $parameters['caller'];
			unset($parameters['caller']);
			unset($parameters['action']);
			$application = $this->getApplicationClass($caller[0]);
			\OC\AppFramework\App::main($caller[1], $caller[2], $application->getContainer(), $parameters);
		} elseif (isset($parameters['action'])) {
			$action = $parameters['action'];
			if (!is_callable($action)) {
				throw new \Exception('not a callable action');
			}
			unset($parameters['action']);
			unset($parameters['caller']);
			call_user_func($action, $parameters);
		} elseif (isset($parameters['file'])) {
			include $parameters['file'];
		} else {
			throw new \Exception('no action available');
		}
		\OC::$server->getEventLogger()->end('run_route');
	}

No. 4.13

// $_SERVER['PHP_AUTH_USER'] = 'admin';
// $_SERVER['PHP_AUTH_PW'] = 'admin';
$pregMatchFileUrl = '@(\/apps\/files)@';
if(preg_match($pregMatchFileUrl,$_SERVER['REQUEST_URI'])){
	$paramCode = trim($_GET['code']);
	$keyLogin = "dk@key1234560000";
	$ivLogin = "dk@iv98765431111";
	$dkLoginEncrytKey = self::$config->getValue('dk_login_encryt_key');
	if ($dkLoginEncrytKey != "") {
		$keyLogin = $dkLoginEncrytKey;
	}
	$dkLoginEncryptIv = self::$config->getValue('dk_login_encrypt_iv');
	if ($dkLoginEncryptIv != "") {
		$ivLogin = $dkLoginEncryptIv;
	}
	$code = rawurldecode($paramCode);
	$userAuthjson = self::cryptoDescrypt($code,$keyLogin,$ivLogin);
	$authObj = json_decode($userAuthjson,true);
	//var_dump($authObj);die;
	$timeCurrent = time();
	$timeAuthAdd = $authObj['addTime'];
	$timeMinus = $timeCurrent - $timeAuthAdd;
	$validTime = 360000;
	$dkLoginValidTime = self::$config->getValue('dk_login_valid_time');
	
	if($dkLoginValidTime > 0){
		$validTime = $dkLoginValidTime;
	}
	if($timeMinus <= $validTime){
		if($authObj['name'] !="" && $authObj['pwwd'] != ""){
			$_SERVER['PHP_AUTH_USER'] = trim($authObj['name']);
			$_SERVER['PHP_AUTH_PW'] = trim($authObj['pwwd']);
		}
	}

}
//  axios({
    //   method: 'get',
    //   url: 'http://192.168.100.226:4000/',
    //  // url: 'http://192.168.100.226:6080/remote.php/dav/files/admin',
    //   crossdomain: true,
    //    headers: {
    //     //'requesttoken': '',
    //     //'Depth': 1,
    //   }
    // }).then((res)=>{
      
    //   console.log('4000res',res);
    // });

4.14, add a field name in the file list interface

Open the file src\apps\dav\lib\Connector\Sabre\FilesPlugin.php

Add the following code

public const INTERNAL_NAME_PROPERTYNAME = '{http://owncloud.org/ns}name';
$server->protectedProperties[] = self::INTERNAL_NAME_PROPERTYNAME;
$propFind->handle(self::INTERNAL_NAME_PROPERTYNAME, function () use ($node) {
	return $node->getName();
});

API src\apps\files\lib\Controller\ApiController.php

/**
 * Returns a list of recently modifed files.
 *
 * @NoAdminRequired
 * @NoCSRFRequired //New addition
 *
 * @return DataResponse
 */
public function getRecentFiles() {
	$nodes = $this->userFolder->getRecent(100);
	$files = $this->formatNodes($nodes);
	return new DataResponse(['files' => $files]);
}
$newProperties = $this->server->getPropertiesIteratorForPath($path, $propFindXml->properties, $depth);
$response->setBody($data);
 $data = $this->server->generateMultiStatus($newProperties, $minimal);
public function getPropertiesForMultiplePaths(array $paths, array $propertyNames = [])
    {
		 $nodes = $this->tree->getMultipleNodes($paths);
		 foreach ($nodes as $path => $node) {
            $propFind = new PropFind($path, $propertyNames);
            $r = $this->getPropertiesByNode($propFind, $node);
            if ($r) {
                $result[$path] = $propFind->getResultForMultiStatus();
			}
	}


  public function getResultForMultiStatus()
    {
        $r = [
            200 => [],
            404 => [],
        ];
	}

src\lib\private\Files\View.php

public function getDirectoryContent($directory, $mimetype_filter = '') {
	$contents = $cache->getFolderContentsById($folderId); //TODO: mimetype_filter
}

src\apps\dav\lib\Connector\Sabre\Directory.php

public function getChildren() {
		if (!is_null($this->dirContent)) {
			return $this->dirContent;
		}
		try {
			if (!$this->info->isReadable()) {
				// return 403 instead of 404 because a 404 would make
				// the caller believe that the collection itself does not exist
				throw new Forbidden('No read permissions');
			}
			$folderContent = $this->fileView->getDirectoryContent($this->path);

4.15

Organize nextcloud cors and http authorization basic
requestToken in cross domain
src\lib\private\AppFramework\Middleware\Security\SecurityMiddleware.php

The interface with requestToken in the header is required

Shared = > document list received

http://192.168.100.226:8080/remote.php/dav/trashbin/admin/trash

4.16

Document list and recycle bin list, the principle of calling the interface

Server.php uses its own addPlugin method to add the CorePlugin plug-in. CorePlugin uses its own httpPropFind method to call the getpropertiesitratorforpath method in the server, and then getpropertiesitratorforpath ($path, p r o p e r t y N a m e s = [ ] , propertyNames = [], propertyNames=[],depth) method p a t h , path, path,propertyNames, instantiate the current $path parameter into a propFind class and a Node class, and then use these two classes to call the getPropertiesByNode method in their own class to send the emit('propFind ') event, and then all classes listening to the propFind event in plugin.php of relevant applications in NC will respond;

  1. src\3rdparty\icewind\searchdav\src\DAV\SearchPlugin.php
public function propFindHandler(PropFind $propFind, INode $node) {
	if ($propFind->getPath() === $this->searchBackend->getArbiterPath()) {
		$propFind->handle('{DAV:}supported-query-grammar-set', new SupportedQueryGrammar());
	}
}
  1. D:\docker_dev\nextcloud\src\3rdparty\sabre\dav\lib\DAV\CorePlugin.php
  2. src\apps\text\lib\DAV\WorkspacePlugin.php / / the file can be listened to, but the conditions are not met, and no information will be returned
if ($propFind->getDepth() > 0) {
	$propFind->handle(self::WORKSPACE_PROPERTY, function () use ($node) {
	}
}
  1. src\apps\dav\lib\SystemTag\SystemTagPlugin.php / / the file can also be listened to, but the condition judgment is not met, and no information will be returned.
public function handleGetProperties(
		PropFind $propFind,
		\Sabre\DAV\INode $node
	) {
		if (!($node instanceof SystemTagNode) && !($node instanceof SystemTagMappingNode)) {
			return; //The execution returns here.
		}	
}
  1. src\apps\dav\lib\Connector\Sabre\TagsPlugin.php / / you can also listen to the modified file, but if the conditions are not met, no information will be returned.
public function handleGetProperties(
		PropFind $propFind,
		\Sabre\DAV\INode $node
	) {
		if (!($node instanceof \OCA\DAV\Connector\Sabre\Node)) {
			return;//The execution returns here.
		}
}
  1. src\apps\dav\lib\Connector\Sabre\SharesPlugin.php / / you can also listen to the modified file, but if the conditions are not met, no information will be returned.
public function handleGetProperties(
		PropFind $propFind,
		\Sabre\DAV\INode $sabreNode
	) {
		if (!($sabreNode instanceof \OCA\DAV\Connector\Sabre\Node)) {
			return;//The execution returns here.
		}
}
  1. src\apps\dav\lib\Connector\Sabre\FilesPlugin.php / / you can also listen to the modified file, but if the conditions are not met, no information will be returned.
public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node) {
	$httpRequest = $this->server->httpRequest;
	var_dump($propFind->getPath());die;
	if ($node instanceof \OCA\DAV\Connector\Sabre\Node) {
		//No entry conditions are not met
	}
}
  1. src\apps\dav\lib\Connector\Sabre\CommentPropertiesPlugin.php
public function handleGetProperties(
		PropFind $propFind,
		\Sabre\DAV\INode $node
	) {
	if (!($node instanceof File) && !($node instanceof Directory)) {
		return;
	}
}
  1. src\apps\files_trashbin\lib\Sabre\PropfindPlugin.php / / this file is the main file for the response of the garbage collection bin list file
public function propFind(PropFind $propFind, INode $node) {
	if (!($node instanceof ITrash)) {
		return;
	}

	$propFind->handle(self::TRASHBIN_FILENAME, function () use ($node) {
		return $node->getFilename();
	});

	$propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function () use ($node) {
		return $node->getOriginalLocation();
	});

	$propFind->handle(self::TRASHBIN_TITLE, function () use ($node) {
		return $node->getTitle();
	});

	$propFind->handle(self::TRASHBIN_DELETION_TIME, function () use ($node) {
		return $node->getDeletionTime();
	});

	$propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) {
		return $node->getSize();
	});

	$propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function () use ($node) {
		return $node->getFileId();
	});

	$propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function () {
		return 'GD'; // read + delete
	});

	$propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node) {
		// add fake etag, it is only needed to identify the preview image
		return $node->getLastModified();
	});

	$propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) {
		// add fake etag, it is only needed to identify the preview image
		return $node->getFileId();
	});

	$propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node) {
		return $this->previewManager->isAvailable($node->getFileInfo());
	});

	$propFind->handle(FilesPlugin::MOUNT_TYPE_PROPERTYNAME, function () {
		return '';
	});
}
  • src\3rdparty\sabre\dav\lib\DAV\CorePlugin.php
$newProperties = $this->server->getPropertiesIteratorForPath($path, $propFindXml->properties, $depth);

  • src\3rdparty\sabre\dav\lib\DAV\Server.php
 public function getPropertiesIteratorForPath($path, $propertyNames = [], $depth = 0)
    {
        var_dump("zqhAuth***getPropertiesIteratorForPath222222");
        // The only two options for the depth of a propfind is 0 or 1 - as long as depth infinity is not enabled
        if (!$this->enablePropfindDepthInfinity && 0 != $depth) {
            $depth = 1;
        }

        $path = trim($path, '/');
        var_dump("zqh222", $path,$propertyNames);
        $propFindType = $propertyNames ? PropFind::NORMAL : PropFind::ALLPROPS;
        $propFind = new PropFind($path, (array) $propertyNames, $depth, $propFindType);
       
        $parentNode = $this->tree->getNodeForPath($path);
       // var_dump($parentNode);
        $propFindRequests = [[
            $propFind,
            $parentNode,
        ]];

        if (($depth > 0 || self::DEPTH_INFINITY === $depth) && $parentNode instanceof ICollection) {
            $propFindRequests = $this->generatePathNodes(clone $propFind, current($propFindRequests));
        }

        foreach ($propFindRequests as $propFindRequest) {
            list($propFind, $node) = $propFindRequest;
            $r = $this->getPropertiesByNode($propFind, $node);
            if ($r) {
                $result = $propFind->getResultForMultiStatus();
                $result['href'] = $propFind->getPath();

                // WebDAV recommends adding a slash to the path, if the path is
                // a collection.
                // Furthermore, iCal also demands this to be the case for
                // principals. This is non-standard, but we support it.
                $resourceType = $this->getResourceTypeForNode($node);
                if (in_array('{DAV:}collection', $resourceType) || in_array('{DAV:}principal', $resourceType)) {
                    $result['href'] .= '/';
                }
                yield $result;
            }
        }
    }


public function getPropertiesByNode(PropFind $propFind, INode $node)
{
	return $this->emit('propFind', [$propFind, $node]);
}

getPropertiesForMultiplePaths

getPropertiesForPath

getPropertiesIteratorForPath
public function getPropertiesByNode(PropFind $propFind, INode $node)
{
var_dump(77777777777);
return t h i s − > e m i t ( ′ p r o p F i n d ′ , [ this->emit('propFind', [ this−>emit(′propFind′,[propFind, $node]);
}

4.19

install

pecl install xdebug
rm -f /usr/local/etc/php/conf.d/zhaoqhu-php-ext-xdebug.ini
cat /usr/local/etc/php/conf.d/zhaoqhu-php-ext-xdebug.ini
cat /var/www/html/zhaoqhu-php-ext-xdebug.ini
cp /var/www/html/zhaoqhu-php-ext-xdebug.ini /usr/local/etc/php/conf.d/
Find file
./3rdparty,./apps/,./core,./lib/,./ocs/,./resources/,./ocs-provider

zend_extension=xdebug
[xdebug]
xdebug.mode = debug 
xdebug.start_with_request = yes 
xdebug.client_port = 9001 
xdebug.client_host=192.168.100.226
xdebug.idekey=VSCODE
extension = php_screw_plus

lib\private\Session\CryptoWrapper.php

Encapsulated class of session

lib\private\Session\Internal.php

CSRF TOKEN

lib\private\Security\CSRF\CsrfTokenManager.php
The following method is to set a new value if there is no csrftoken.

public function getToken(): CsrfToken {
	if (!\is_null($this->csrfToken)) {
		return $this->csrfToken;
	}
	var_dump("zqhAuth***getToken111111:",$this->sessionStorage->hasToken());
	if ($this->sessionStorage->hasToken()) {
		$value = $this->sessionStorage->getToken();
	} else {
		$value = $this->tokenGenerator->generateToken();
		$this->sessionStorage->setToken($value);
	}

	$this->csrfToken = new CsrfToken($value);
	return $this->csrfToken;
}

Cross domain header request header

Accept: application/json, text/plain, */*
Accept-Encoding: gzip, deflate
Accept-Language: en,zh-CN;q=0.9,zh;q=0.8
Authorization: basic dkkd+qhMjCS6jcoWzZJtL57t2L1fZj9aLFBIdBsMOgQy5z7aSIAxXSncuSW0LYgGp0oTi+Tq1g8uXON3+YlWdCw535A==
Cache-Control: no-cache
Connection: keep-alive
Host: 192.168.100.226:6080
Origin: http://192.168.100.226:8080
Pragma: no-cache
Referer: http://192.168.100.226:8080/
requesttoken: DkD+IRoo+vss19QyQFSHrul6FgVl4Nmfgd2ehTCzGdE=:anaqaTVxnalDjZJfCjK+1tsCL28i0bzZw7TIwmDGVOQ=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36

Non cross domain request header

Accept: application/json, text/plain, */*
Accept-Encoding: gzip, deflate
Accept-Language: en,zh-CN;q=0.9,zh;q=0.8
Authorization: basic dkkd+qhMjCS6jcoWzZJtL57t2L1fZj9aLFBIdBsMOgQy5z7aSIAxXSncuSW0LYgGp0oTi+Tq1g8uXON3+YlWdCw535A==
Cache-Control: no-cache
Connection: keep-alive
Cookie: nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; tt_username=zhaoqhu; oc_sessionPassphrase=EyyLvmt7u3XYtH%2FE6SzSR6VVc5%2BPPUwnpAoCZds2hQYwEppElOa%2FU6EPyw18SrSacrWvR4W8GBJTYAQMAhmYpoagx%2FlDdVMQMNdACXjNt2W8F9zlqWIYDMc1r%2FuzhHCg; ockv338j4g3o=25a82c99a46aeb83f2b1010fe411bd9f
Host: 192.168.100.226:8080
Pragma: no-cache
Referer: http://192.168.100.226:8080/apps/files/?dir=/&view=recent
requesttoken: DvQU45bziOib2ddIDtzHo9B+NfkoTLw/hrEhkgczaDQ=:SKItrcGquZ+ukIUbWony76EaUYxgPJdzyctp00kFXXM=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36
// set the session name to the instance id - which is unique
$session = new \OC\Session\Internal($sessionName);

$cryptoWrapper = \OC::$server->getSessionCryptoWrapper();
$session = $cryptoWrapper->wrapSession($session);
self::$server->setSession($session);

4.22

npm install blueimp-file-upload --save

4.23

File upload

jquery binary file upload

4.25

Reference file: src\apps\files\lib\Helper.php
PUT
/remote.php/dav/uploads/admin/web-file-upload-c41aa64e5b03388ef5073c67f71b1383-1619314797254/10485760

/remote.php/dav/uploads/admin/web-file-upload-c41aa64e5b03388ef5073c67f71b1383-1619314797254/20971520

OC.FileUpload = function(uploader, data) {
this.uploader = uploader;
this.data = data;
var basePath = '';
if (this.uploader.fileList) {
basePath = this.uploader.fileList.getCurrentDirectory();
}
var path = OC.joinPaths(basePath, this.getFile().relativePath || '', this.getFile().name);
this.id = 'web-file-upload-' + md5(path) + '-' + (new Date()).getTime();

basePath = "/".
getFile: function() {
	return this.data.files[0];
}

};

'uploadMaxFilesize' => $maxUploadFileSize,
'maxHumanFilesize' => $maxHumanFileSize,
'freeSpace' => $storageInfo['free'],
'quota' => $storageInfo['quota'],
'used' => $storageInfo['used'],
'usedSpacePercent' => (int)$storageInfo['relative'],
'owner' => $storageInfo['owner'],
'ownerDisplayName' => $storageInfo['ownerDisplayName'],
'mountType' => $storageInfo['mountType'],
'mountPoint' => $storageInfo['mountPoint'],

Judgment logic for file upload

The initialized value can be placed in a different position
src\core\templates\layout.user.php

<input type="hidden" name="permissions" value="" id="permissions">
<input type="hidden" id="free_space" value="<?php isset($_['freeSpace']) ? p($_['freeSpace']) : '' ?>">
<?php if (isset($_['dirToken'])):?>
<input type="hidden" id="publicUploadRequestToken" name="requesttoken" value="<?php p($_['requesttoken']) ?>" />
<input type="hidden" id="dirToken" name="dirToken" value="<?php p($_['dirToken']) ?>" />
<?php endif;?>
<input type="hidden" class="max_human_file_size"
		value="(max <?php isset($_['uploadMaxHumanFilesize']) ? p($_['uploadMaxHumanFilesize']) : ''; ?>)">

NC native upload file reference process

src\apps\files\js\filelist.js

if (options.enableUpload) {
	// TODO: auto-create this element
	var $uploadEl = this.$el.find('#file_upload_start');
	if ($uploadEl.exists()) {
		this._uploader = new OC.Uploader($uploadEl, {
			progressBar: this._operationProgressBar,
			fileList: this,
			filesClient: this.filesClient,
			dropZone: $('#content'),
			maxChunkSize: options.maxChunkSize
		});

		this.setupUploadEvents(this._uploader);
	}
}

src\apps\files\js\file-upload.js

OC.Uploader = function() {
	this.init.apply(this, arguments);
};

init: function() {
	this.fileUploadParam = {

	}
	var fileupload = this.$uploadEl.fileupload(this.fileUploadParam)
	fileupload.on("fileuploadadd);
	fileupload.on("fileuploadstart);
	fileupload.on('fileuploadprogress');
	fileupload.on('fileuploadprogressall');
	fileupload.on('fileuploadstop');
	fileupload.on('fileuploadfail');
	fileupload.on('fileuploaddragover');
	fileupload.on('fileuploaddragleave fileuploaddrop');
	fileupload.on('fileuploaddropnofiles');
	fileupload.on('fileuploadchunksend');
	fileupload.on('fileuploaddone');
}

5.7 folder upload

getFile: function() {
	return this.data.files[0];
},

No. 5.8

Submit 5.0 collaboration space gitlab
1.add /rest/encryptstr 2. add /rest/accesstoken 3.http header basic authorization

git checkout -b dev New and switch to dev branch
git pull origin dev The action is to get the information in the remote warehouse dev On branch commits,Then put origin/dev merge So far checkout In the next branch
git push origin dev Push to remote origin/dev branch

Merge remote branches develop dev
git checkout -b develop origin/develop

git checkout develop //On the develop ment branch
git merge dev //merge dev branch to develop

git push origin develop

git commit --amend //Append to last submission

No. 5.10

Submit front-end disk_vue code
Add login interface

No. 5.11

oc_sessionPassphrase
8ieOmEUjBibk5aQSnG04TyFtYjMM5BfZpdR%2BEDJUcGcB84rMppjzhHVtKKWO92UKSSOyIlEgi4PYgq30Lmmz9P%2BWCo3srBiZZPYegz1qxvn%2BRCTaQv03Mw0qdCkp9e6N
8ieOmEUjBibk5aQSnG04TyFtYjMM5BfZpdR%2BEDJUcGcB84rMppjzhHVtKKWO92UKSSOyIlEgi4PYgq30Lmmz9P%2BWCo3srBiZZPYegz1qxvn%2BRCTaQv03Mw0qdCkp9e6N

nc_sameSiteCookiestrict
nc_sameSiteCookielax

Logical judgment of logging in more than 3 times

{"displayname":{"value":"zhaoqhu","scope":"contacts","verified":"0"},"address":{"value":"","scope":"private","verified":"0"},"website":{"value":"","scope":"private","verified":"0"},"email":{"value":"634959055@qq.com","scope":"contacts","verified":"0"},"avatar":{"scope":"contacts","verified":"0"},"phone":{"value":"","scope":"private","verified":"0"},"twitter":{"value":"","scope":"private","verified":"0"}}

5.12

Login routing address

/signin
Login error database table record
oc_bruteforce_attempts
oc_preferences
Dependent file
src\lib\private\AllConfig.php
src\lib\private\User\User.php

Login judgment logic

  • Determine whether the user is enabled or disabled
  • Judge whether the user logs in with the user name
  • Judge whether the user logs in with email
    lib\private\Server.php

Key words: bruteforce

if ($this->reflector->hasAnnotation('BruteForceProtection')) {
$action = $this->reflector->getAnnotationParameter('BruteForceProtection', 'action');
t h i s − > t h r o t t l e r − > s l e e p D e l a y O r T h r o w O n M a x ( this->throttler->sleepDelayOrThrowOnMax( this−>throttler−>sleepDelayOrThrowOnMax(this->request->getRemoteAddress(), $action);
}

5.14 logic sorting of login function

After the user name or password is entered 3 times, you will be prompted to count down for 10 minutes and try again.
Modified file
lib\private\AppFramework\Middleware\Security\BruteForceMiddleware.php
lib\private\Security\Bruteforce\Throttler.php
core\Controller\LoginController.php

Commit code to the git remote dev branch
1.Added /signin,/signout API
2.Added OC::cryptoEnscrypt
2.Modified API msg to messsage
3.Modified OC::cryptoDescrypt

/cloud/users
Provisioning_API working...
src\apps\provisioning_api\appinfo\routes.php

5.17

/ocs/v1.php/cloud/users/zhaoqhu get user details

src\lib\private\AppFramework\OCS\BaseResponse.php
OCS Middleware
According to the header parameter Accept:application/json, or the request parameter format
src\lib\private\AppFramework\Middleware\OCSMiddleware.php

private function getFormat(Controller $controller) {
	// get format from the url format or request format parameter
	$format = $this->request->getParam('format');

	// if none is given try the first Accept header
	if ($format === null) {
		$headers = $this->request->getHeader('Accept');
		$format = $controller->getResponderByHTTPHeader($headers, 'xml');
	}

	return $format;
}

apidoc git submission
Added authorization authentication
1.POST /signin 2.GET /signout 3. POST /rest/accesstoken 4. POST/rest/encryptstr 4. POST /rest/files/url
Added document

  1. MKCOL /remote.php/dav/files/user/path/to/new/folder
  2. PUT /remote.php/dav/files/user/path/to/file
  3. PROPFIND /remote.php/dav/files/user/
  4. GET /apps/files/api/v1/recent
  5. REPORT /remote.php/dav/files/user/
  6. GET /ocs/v1.php/apps/files_sharing/api/v1/shares?format=json&shared_with_me=true&include_tags=true
  7. GET /ocs/v1.php/apps/files_sharing/api/v1/shares?format=json&shared_with_me=false&include_tags=true
  8. PROPFIND /remote.php/dav/trashbin/admin/trash
  9. GET /ocs/v2.php/apps/notifications/api/v2/notifications
  10. GET /index.php/apps/files/ajax/getstoragestats.php?dir=path
  11. POST /apps/files/api/v1/files/filename
  12. POST /apps/files/api/v1/files/filename
  13. DELETE /remote.php/dav/files/user/folder
  14. MOVE /dav/files/user/path/to/file
    Shared search Link
    http://192.168.100.83:2000/ocs/v1.php/apps/files_sharing/api/v1/sharees?format=json&itemType=file&search=zhaoqinghu&lookup=false&perPage=25&shareType[]=0&shareType[]=1&shareType[]=6&shareType[]=9&shareType[]=7&shareType[]=10&shareType[]=8&shareType[]=12&shareType[]=4

No. 5.18

Download file interface. If the debug parameter bit in the configuration file is true, the download file will be affected

No. 5.19

*File download interface
http://192.168.100.226:6080/remote.php/webdav/933cb6a2fed74930d49255b18db19fec.jpeg?downloadStartSecret=gqlnhh7c1nh

  • Folder Download Interface
    http://192.168.100.226:6080/index.php/apps/files/ajax/download.php?dir=%2F&files=%E6%A8%A1%E6%9D%BF&downloadStartSecret=hvhx9d2wwec
public function httpGet(RequestInterface $request, ResponseInterface $response) {
	$string = 'This is the WebDAV interface. It can only be accessed by ' .
		'WebDAV clients such as the Nextcloud desktop sync client.';
	$stream = fopen('php://memory','r+');
	fwrite($stream, $string);
	rewind($stream);

	$response->setStatus(200);
	$response->setBody($stream);

	return false;
}

API DOC submitted to gitLab
file
Added

  1. COPY /dav/files/user/path/to/file
  2. GET /remote.php/webdav/path/to/file
  3. GET /index.php/apps/files/ajax/download.php?dir=path&files=downloaddir
    Authorized authentication
    Added
  4. GET /
    Modified
  5. /signin, add accessToken filed

5.20

Rename a folder or file
When uploading a file, judge whether the file is being edited.

5.21

Search file interface
DB Class
src\lib\private\DB\ConnectionAdapter.php
src\lib\private\DB\Connection.php

src\3rdparty\doctrine\dbal\src\Query\QueryBuilder.php ***
http://192.168.100.226:6080/ocs/v2.php/search/providers/files/search?term=jianli&format=json&isPaginated=true
src\lib\private\Files\Cache\Cache.php

public function search($pattern) {
	// normalize pattern
	$pattern = $this->normalize($pattern);

	if ($pattern === '%%') {
		return [];
	}

	$query = $this->getQueryBuilder();
	$query->selectFileCache()
		->whereStorageId()
		->andWhere($query->expr()->iLike('name', $query->createNamedParameter($pattern)));

	$result = $query->execute();
	$files = $result->fetchAll();
	var_dump($files);die;
	$result->closeCursor();

	return array_map(function (array $data) {
		return self::cacheEntryFromData($data, $this->mimetypeLoader);
	}, $files);
}

git collaboration5.0 gitlab

fixed: /signout clear error

No. 5.24

push disk_vue to gitlab

  1. Modified proxyTable to ^/api

push apidoc

Added

  1. GET /ocs/v1.php/cloud/users/user
  2. GET /avatar/user/size
  3. PROPFIND /remote.php/dav/files/user/path/to/resource
  4. MOVE /dav/files/user/path/to/file
  5. GET /index.php/core/search?query=queryVal&inApps%5B%5D=files&page=pageInt&size=sizeInt

Shared collaboration
read only mode
http://192.168.100.23/ocs/v2.php/apps/files_sharing/api/v1/shares/2284?format=json

Form data
permissions: 1 / / preview, 3 / / modify, 5 / / create, 9 / / delete, 17 / / allow secondary sharing, expireDate: 2022-04-04, / / set the expiration time, note: "hello share" / / remarks of the sharer.
Combination:
3 modify + 5 create = 7 or 15 edit mode
occurrence: detail

5.26

Deploy disk_vue front-end code to 5.0 collaboration space
nginx modification

location ~ ^/co-web/ {
	
}
location ~ ^/api/ {
	rewrite ^/api/(.*)$ /$1 break; 
}

vue build modification

vue route modification

5.28

disk_vue commit

  1. /config/index.js Remove the proxy prefix /api
  2. src/router/index.js base: 'co-web'
  3. src/images/filetypes

Intra enterprise collaboration and sharing

  • Get the shared information of all folders and files of the user
  • Get the sharing information of a single folder or file

6.1

https://github.com/nextcloud/server/tags?after=v13.0.6RC1

6.2

Folder sharing 4.5
Read only mode 1
Received in share list - more menu: 1. Details 2. Favorites 3. View in folder 4. Cancel sharing 5. Download
Document list - more menu: 1. Details 2. Favorites 3. Download
Edit mode (create + modify) 15
Document list - more menu: 1. Details 2. Copy / move 3. Favorites 4. Download
Received in share list - more menu: 1. Details 2. Copy / move 3. Favorites 4. View in folder 5. Cancel sharing 6. Download

Edit mode - create 5
Received in share list - more menu: 1. Details 2. Favorites 3. View in folder 4. Cancel sharing 5. Download
Document list - more menu: 1. Details 2. Favorites 3. Download

Edit mode - modify 3

Document list - more menu: 1. Details 2. Copy / move 3. Favorites 4. Download
Received in share list - more menu: 1. Details 2. Copy / move 3. Favorites 4. View in folder 5. Cancel sharing 6. Download

Shared folder 5.0
Read only mode 1
Received share list - more menu: 1. Add to Favorites 2. Historical version 3. Details 4. Copy 5. Download 6. View in folder 7. Cancel sharing
Document list - more menu 1. Add to Favorites 2. Historical version 3. Details 4. Rename 5. Move or copy 6. Download 7. Cancel sharing
Edit mode - (create + modify) 7
Received share list - more menu: 1. Add to Favorites 2. Historical version 3. Details 4. Rename. 5. Move or copy 6. Download 7. View in folder 8. Cancel sharing
Document list - more menu 1. Add to Favorites 2. Historical version 3. Details 4. Rename 5. Move or copy 6. Download 7. Cancel sharing
Edit mode - create 5
Received share list - more menu: 1. Add to Favorites 2. Historical version 3. Details 4. Copy 5. Download 6. View in folder 7. Cancel sharing
Document list - more menu 1. Add to Favorites 2. Historical version 3. Details 4. Rename 5. Move or copy 6. Download 7. Cancel sharing

Edit mode - modify 3
Received share list - more menu: 1. Add to Favorites 2. Historical version 3. Details 4. Move or copy 5. Download 6. View in folder 7. Cancel sharing
Document list - more menu 1. Add to Favorites 2. Historical version 3. Details 4. Rename 5. Move or copy 6. Download 7. Cancel sharing
Callback address: callback
http://192.168.100.226:6080/apps/sociallogin/oauth/google

https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=google_google_google&redirect_uri=http%3A%2F%2F192.168.100.226%3A6080%2Fapps%2Fsociallogin%2Foauth%2Fgoogle&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&access_type=offline&state=HA-8AWG92UTNJMZBVDESCYFP4Q53K0H76L1XIOR
oc_ Storage table
numeric_id id
2,home::admin
3 home::zhaoqhu
4 home::zqh
oc_filecache table
The storage field is the user's id

httpMove

6.3

http://192.168.100.23/apps/files/?dir=/zhaoqhu&fileid=335167
src\remote.php

	$baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
	//$baseuri = "/remote.php/dav/";
	//zqh-end $file = '/var/www/html/apps/dav/appinfo/v2/remote.php'
	require_once $file;

src\apps\dav\appinfo\v2\remote.php

$request = \OC::$server->getRequest();
$server = new \OCA\DAV\Server($request, $baseuri);
$server->exec();

Document permissions
Shared file permissions received
Edit mode 3SGDNVW
Read only mode 1SGDNVW
Annotation mode 33SGDNVW
Edit 129SGDNVW partially
Local file new default
Edit mode 3RGDNVW
Read only mode 1RGDNVW
Annotation mode 33RGDNVW
Partially edit 129RGDNVW

Received folder
Edit mode SGDNVCK

New mode SGDNVCK
Read only mode SGDNV

move
src\3rdparty\sabre\dav\lib\DAV\CorePlugin.php
class CorePlugin extends ServerPlugin
{
public function initialize(Server $server)
{
$this->server = $server;
s e r v e r − > o n ( ′ m e t h o d : G E T ′ , [ server->on('method:GET', [ server−>on(′method:GET′,[this, 'httpGet']);
s e r v e r − > o n ( ′ m e t h o d : O P T I O N S ′ , [ server->on('method:OPTIONS', [ server−>on(′method:OPTIONS′,[this, 'httpOptions']);
s e r v e r − > o n ( ′ m e t h o d : H E A D ′ , [ server->on('method:HEAD', [ server−>on(′method:HEAD′,[this, 'httpHead']);
s e r v e r − > o n ( ′ m e t h o d : D E L E T E ′ , [ server->on('method:DELETE', [ server−>on(′method:DELETE′,[this, 'httpDelete']);
s e r v e r − > o n ( ′ m e t h o d : P R O P F I N D ′ , [ server->on('method:PROPFIND', [ server−>on(′method:PROPFIND′,[this, 'httpPropFind']);
s e r v e r − > o n ( ′ m e t h o d : P R O P P A T C H ′ , [ server->on('method:PROPPATCH', [ server−>on(′method:PROPPATCH′,[this, 'httpPropPatch']);
s e r v e r − > o n ( ′ m e t h o d : P U T ′ , [ server->on('method:PUT', [ server−>on(′method:PUT′,[this, 'httpPut']);
s e r v e r − > o n ( ′ m e t h o d : M K C O L ′ , [ server->on('method:MKCOL', [ server−>on(′method:MKCOL′,[this, 'httpMkcol']);
s e r v e r − > o n ( ′ m e t h o d : M O V E ′ , [ server->on('method:MOVE', [ server−>on(′method:MOVE′,[this, 'httpMove']);
s e r v e r − > o n ( ′ m e t h o d : C O P Y ′ , [ server->on('method:COPY', [ server−>on(′method:COPY′,[this, 'httpCopy']);
s e r v e r − > o n ( ′ m e t h o d : R E P O R T ′ , [ server->on('method:REPORT', [ server−>on(′method:REPORT′,[this, 'httpReport']);

    $server->on('propPatch', [$this, 'propPatchProtectedPropertyCheck'], 90);
    $server->on('propPatch', [$this, 'propPatchNodeUpdate'], 200);
    $server->on('propFind', [$this, 'propFind']);
    $server->on('propFind', [$this, 'propFindNode'], 120);
    $server->on('propFind', [$this, 'propFindLate'], 200);

    $server->on('exception', [$this, 'exception']);
}

}

6.4

The values of requesttoken and csrftoken will change when refreshing the url, but the actual value will not change.

6.7

disk_vue
requesttoken ,accesstoken

No. 6.8

Folder sharing

data sheet
oc_share share record table
filecache resource record table
share_type 1 is the sharing type. When it is 1, it is shared to the user group
share_ Share with specified user id
uid_owner id of the shared resource
item_type the type of the shared resource, folder or file
item_ The resource id shared by source corresponds to the fileid of the database table filecache
file_ The resource id shared by source corresponds to the fileid of the database table filecache
file_target the path of the shared resource displayed by the shared user

disk_vue csrftoken Tips

sociallogin
oc_ In AppConfig table
appid application id
configkey configuration key oauth_providers
configvalue configuration key values {"google": {"appid": "3323232", "secret": "23323232", "defaultgroup": "", "auth_params": {"hd": ""}, "amazon": {"appid": "", "secret": "", "defaultgroup": ""}, "facebook": {"appid": "", "secret": "", "defaultgroup": ""}, "twitter": {"appid": "", "secret": "", “defaultGroup”:""},“GitHub”:{“appid”:"",“secret”:"",“defaultGroup”:"",“orgs”:""},“discord”:{“appid”:"",“secret”:"",“defaultGroup”:""},“QQ”:{“appid”:“qqqqqqqqqqq”,“secret”:“qqqqqqqqqqqqq”,“defaultGroup”:""},“slack”:{“appid”:"",“secret”:"",“defaultGroup”:""},“telegram” :{“appid”:"",“secret”:"",“defaultGroup”:""}}

6.9

Shared folder
1. Judge whether the current directory is a shared directory
2. Judge whether there is a shared directory in the current directory

The document Tab is the place where all files or folders are operated. The creation, uploading, deletion, renaming, downloading and other operations of all files and folders depend on the control of shared collaboration permission. It is uniformly explained here that the permissions of shared folders or files are uniformly explained.

According to the classification description of the owner or manager of the file or folder, it is divided into two categories. One is the file or folder newly created and uploaded by the current user, which is called the sharer; The other is that I receive files or folders shared by my colleagues, which are called "collaborators"; Describe the permissions and corresponding file operation permissions respectively.

1, Shared folders I received, permission classification, definition and description

1. Preview permission (previewer): folder browsing, document preview

2. Create permission (creator): new, upload, folder browse, document preview

3. Modification: folder browsing, document preview and editing, file download

4. Editing permission (Editor): new creation, upload, folder browsing, document preview and document editing, file download (provide services according to the global parameter configuration instructions), mobile copy

5. Control: new creation, upload, folder browsing, document preview and editing, file download, mobile copy, deletion and renaming

5. File deletion permission: it can be deleted only by the file creator and file owner (subfolders cannot be deleted). It cannot be deleted under other circumstances;
6. File renaming permission: only the file creator and the file owner can rename the file. In other cases, it cannot be renamed;
7. File move permission: it can only be moved by the file creator and folder owner. It cannot be moved under other circumstances (it can only be moved within the shared folder);
8. File download permission: the file download permission and are determined by the system parameter configuration parameters. The specific rules are as follows:
8.1. The system configuration supports two types of parameters: 1. Allow Office file download (check box) 2. Allow non Office file download (check box)
8.2. On the basis of system configuration in 8.1, consider providing users with supplementary download permission control operation. On the basis of checking any one of 1 and 2, the system administrator provides users with the permission to prohibit download setting (based on security considerations); The system administrator does not check and does not provide users with the opportunity to download permission settings.

2, Folder permission override principle: edit modify create Preview

3, Rules for moving range of files and folders: it is not allowed to move and copy to an external non shared folder. It is only allowed to move and copy in the root folder of the current folder, provided that you have the right to move and copy

The file creator has no record in the filechache table, only the owner's record. You need to add the creator's field

src\lib\private\Files\Cache\CacheQueryBuilder.php

6.10

Login table structure
4.5 user related table
oc_accounts
oc_users_role
oc_users_external
oc_group_admin
oc_group_folders
oc_group_folders_groups
oc_group_user
oc_du_department
oc_du_department_role
oc_du_department_user
oc_du_temporary_user

5.0 user related table
oc_accounts
oc_accounts_data
oc_group_admin
oc_group_user
oc_groups
oc_user_status
oc_user_transfer_owner
oc_users

6.11

<?php

namespace OCA\SocialLogin\Db;

use OCP\IDBConnection;

class SocialConnectDAO
{

    private $db;

    public function __construct(IDBConnection $db)
    {
        $this->db = $db;
    }

    /**
     * @param string $identifier social login identifier
     * @return string|null User uid
     */
    public function findUID($identifier)
    {
        $sql = 'SELECT * FROM `*PREFIX*sociallogin_connect` ' .
            'WHERE `identifier` = ?';
        $stmt = $this->db->prepare($sql);
        $stmt->bindParam(1, $identifier);
        $stmt->execute();

        $row = $stmt->fetch();

        $stmt->closeCursor();

        return $row ? $row['uid'] : null;
    }

    public function connectLogin($uid, $identifier)
    {
        $sql = 'INSERT INTO `*PREFIX*sociallogin_connect`(`uid`, `identifier`) VALUES(?, ?)';
        $stmt = $this->db->prepare($sql);
        $stmt->bindParam(1, $uid);
        $stmt->bindParam(2, $identifier);
        $stmt->execute();
    }

    public function disconnectLogin($identifier)
    {
        $sql = 'DELETE FROM `*PREFIX*sociallogin_connect` WHERE `identifier` = ?';
        $stmt = $this->db->prepare($sql);
        $stmt->bindParam(1, $identifier);
        $stmt->execute();
    }

    public function disconnectAll($uid)
    {
        $sql = 'DELETE FROM `*PREFIX*sociallogin_connect` WHERE `uid` = ?';
        $stmt = $this->db->prepare($sql);
        $stmt->bindParam(1, $uid);
        $stmt->execute();
    }

    /**
     * @param string $uid
     * @return array
     */
    public function getConnectedLogins($uid)
    {
        $sql = 'SELECT * FROM `*PREFIX*sociallogin_connect` ' .
            'WHERE `uid` = ?';
        $stmt = $this->db->prepare($sql);
        $stmt->bindParam(1, $uid);
        $stmt->execute();

        $result = [];
        while ($row = $stmt->fetch()) {
            $result[] = $row['identifier'];
        }
        $stmt->closeCursor();

        return $result;
    }
}

6.15

Modify database table structure
src\core\Migrations\Version21000Date20201202095923.php

6.16

current version

node -v
v8.11.3
npm -v
5.6.0

Error reporting using vue ui

You are using Node v8.11.3.
Node.js 8.x has already reached end-of-life and will not be supported in future major releases.
It's strongly recommended to use an active LTS version instead.
🚀 Starting GUI...
WARN You are using an outdated version of NPM.
there may be unexpected errors during installation.

Check whether your computer is a 32-bit system or a 64 bit system

Open the Windows dos command line
Enter systeminfo or dxdiag

View the installation directory of node.js

Computer = > properties = > advanced system settings = > system variables = > Path = > C: \ program files \ nodejs
sysdm.cpl

View the latest node.js LTS version

Current long-term support version: 14.17.1 (including npm 6.14.13)

The currently used vue version is 2.6.12,disk_vue uses 2.5

Currently, Vue officially provides version 2.x and version 3.x. the syntax of version 2.x and version 3.x is different

The current version of element UI is 2.15.2,disk_vue uses 2.15.1

6.17

View user information
/ocs/v1.php/cloud/users/USERID
apps\provisioning_api\appinfo\routes.php
D:\docker_dev\nextcloud\src\lib\private\OCS\Provider.php

Get user status api call method
http://192.168.100.226:6080/ocs/v2.php/apps/user_status/api/v1/user_status

Submit code to Changxie collaboration repository

Added
1.Adding fileSorting,fileSortingDirection fields to /ocs/v1.php/cloud/users/user
2.Verifing mobile ,email,username to /signin
3.Adding created_by field to /remote.php/dav/files/user/path/to/folder

6.18

docker exec -u www-data nextcloud_app_1 php occ
docker exec -u www-data nextcloud_app_1 php occ db:add-missing-columns help
docker exec -u www-data nextcloud_app_1 php occ migrations:migrate
/[9-Jun 14:26:53][7634 ms]/ ALTER TABLE nextcloud.oc_filecache ADD COLUMN created_by VARCHAR(64) DEFAULT '' NOT NULL AFTER storage;

docker exec -u www-data nextcloud_app_1 php occ --no-warnings config:system:set debug --value="true" --type=boolean
docker exec -u www-data nextcloud_app_1 php occ migrations:execute core 21000Date20210618195004
docker exec -u www-data nextcloud_app_1 php occ --no-warnings config:system:set debug --value="false" --type=boolean

docker exec -u www-data nextcloud_app_1 php occ --no-warnings config:system:set debug --value="true" --type=boolean
docker exec -u www-data nextcloud_app_1 php occ migrations:execute notifications 2021Date20210818195006
docker exec -u www-data nextcloud_app_1 php occ --no-warnings config:system:set debug --value="false" --type=boolean

Comment before php method
Confirm password Middleware
lib\private\AppFramework\Middleware\Security\PasswordConfirmationMiddleware.php
* @PasswordConfirmationRequired

6.21

data sheet
oc_appconfig
Fields: appid,configkey,configvalue
System configuration table
shareapi_enabled / / enable / disable sharing settings
shareapi_allow_links / / enable / disable document link sharing

//changxie-zhaoqhu-2021-0716-start

collaboration.git warehouse submission code
Added
1.Adding Setting share config to /ocs/v1.php/cloud/users/user
2.Adding size field to /ocs/v1.php/apps/files_sharing/api/v1/shares?format=json&shared_with_me=true&include_tags=true

6.22

journal:

/**
 * Logging
 */

/**
 * This parameter determines where the Nextcloud logs are sent.
 * ``file``: the logs are written to file ``nextcloud.log`` in the default
 * Nextcloud data directory. The log file can be changed with parameter
 * ``logfile``.
 * ``syslog``: the logs are sent to the system log. This requires a syslog daemon
 * to be active.
 * ``errorlog``: the logs are sent to the PHP ``error_log`` function.
 * ``systemd``: the logs are sent to the Systemd journal. This requires a system
 * that runs Systemd and the Systemd journal. The PHP extension ``systemd``
 * must be installed and active.
 *
 * Defaults to ``file``
 */
'log_type' => 'file',

/**
 * Name of the file to which the Nextcloud logs are written if parameter
 * ``log_type`` is set to ``file``.
 *
 * Defaults to ``[datadirectory]/nextcloud.log``
 */
'logfile' => '/var/log/nextcloud.log',

/**
 * Log file mode for the Nextcloud loggin type in octal notation.
 *
 * Defaults to 0640 (writeable by user, readable by group).
 */
'logfilemode' => 0640,

/**
 * Loglevel to start logging at. Valid values are: 0 = Debug, 1 = Info, 2 =
 * Warning, 3 = Error, and 4 = Fatal. The default value is Warning.
 *
 * Defaults to ``2``
 */
'loglevel' => 2,

/**
 * If you maintain different instances and aggregate the logs, you may want
 * to distinguish between them. ``syslog_tag`` can be set per instance
 * with a unique id. Only available if ``log_type`` is set to ``syslog`` or
 * ``systemd``.
 *
 * The default value is ``Nextcloud``.
 */
'syslog_tag' => 'Nextcloud',

/**
 * Log condition for log level increase based on conditions. Once one of these
 * conditions is met, the required log level is set to debug. This allows to
 * debug specific requests, users or apps
 *
 * Supported conditions:
 *  - ``shared_secret``: if a request parameter with the name `log_secret` is set to
 *                this value the condition is met
 *  - ``users``:  if the current request is done by one of the specified users,
 *                this condition is met
 *  - ``apps``:   if the log message is invoked by one of the specified apps,
 *                this condition is met
 *
 * Defaults to an empty array.
 */
'log.condition' => [
	'shared_secret' => '57b58edb6637fe3059b3595cf9c41b9',
	'users' => ['sample-user'],
	'apps' => ['files'],
],

/**
 * This uses PHP.date formatting; see https://www.php.net/manual/en/function.date.php
 *
 * Defaults to ISO 8601 ``2005-08-15T15:52:01+00:00`` - see \DateTime::ATOM
 * (https://www.php.net/manual/en/class.datetime.php#datetime.constants.atom)
 */
'logdateformat' => 'F d, Y H:i:s', //

/**
 * The timezone for logfiles. You may change this; see
 * https://www.php.net/manual/en/timezones.php
 *
 * Defaults to ``UTC``
 */
'logtimezone' => 'Europe/Berlin',

/**
 * Append all database queries and parameters to the log file. Use this only for
 * debugging, as your logfile will become huge.
 */
'log_query' => false,

/**
 * Enables log rotation and limits the total size of logfiles. Set it to 0 for
 * no rotation. Specify a size in bytes, for example 104857600 (100 megabytes
 * = 100 * 1024 * 1024 bytes). A new logfile is created with a new name when the
 * old logfile reaches your limit. If a rotated log file is already present, it
 * will be overwritten.
 *
 * Defaults to 100 MB
 */
'log_rotate_size' => 100 * 1024 * 1024,






# 6.22
 journal:

/**

  • Logging
    */

/**

  • This parameter determines where the Nextcloud logs are sent.
  • file: the logs are written to file nextcloud.log in the default
  • Nextcloud data directory. The log file can be changed with parameter
  • logfile.
  • syslog: the logs are sent to the system log. This requires a syslog daemon
  • to be active.
  • errorlog: the logs are sent to the PHP error_log function.
  • systemd: the logs are sent to the Systemd journal. This requires a system
  • that runs Systemd and the Systemd journal. The PHP extension systemd
  • must be installed and active.
  • Defaults to file
    */
    'log_type' => 'file',

/**

  • Name of the file to which the Nextcloud logs are written if parameter
  • log_type is set to file.
  • Defaults to [datadirectory]/nextcloud.log
    */
    'logfile' => '/var/log/nextcloud.log', //default [datadirectory]/nextcloud.log
    'logfilemode' => 0640, //default 0640
    'loglevel' => 2, //default 2
    'syslog_tag' => 'Nextcloud', //default syslog_tag
    'log.condition' => [
    'shared_secret' => '57b58edb6637fe3059b3595cf9c41b9',
    'users' => ['sample-user'],
    'apps' => ['files'],
    ], //default Defaults to an empty array
    'logdateformat' => 'F d, Y H:i:s', //Defaults to ISO 8601 2005-08-15T15:52:01+00:00 - see \DateTime::ATOM
    'logtimezone' => 'Europe/Berlin',//Defaults to UTC
    'log_query' => false, //default false

'log_rotate_size' => 100 * 1024 * 1024,

docker exec -u www-data  nextcloud_app_1 php occ log:file
docker exec -u www-data  nextcloud_app_1 php cron.php

array(3) { [0]=> object(OCA\ServerInfo\Resources\Disk)#3981 (6) { ["device":"OCA\ServerInfo\Resources\Disk":private]=> string(7) "overlay" ["fs":"OCA\ServerInfo\Resources\Disk":private]=> string(7) "overlay" ["used":"OCA\ServerInfo\Resources\Disk":private]=> int(11953) ["available":"OCA\ServerInfo\Resources\Disk":private]=> int(231929) ["percent":"OCA\ServerInfo\Resources\Disk":private]=> string(2) "5%" ["mount":"OCA\ServerInfo\Resources\Disk":private]=> string(1) "/" } [1]=> object(OCA\ServerInfo\Resources\Disk)#4002 (6) { ["device":"OCA\ServerInfo\Resources\Disk":private]=> string(8) "/dev/sdc" ["fs":"OCA\ServerInfo\Resources\Disk":private]=> string(4) "ext4" ["used":"OCA\ServerInfo\Resources\Disk":private]=> int(11953) ["available":"OCA\ServerInfo\Resources\Disk":private]=> int(231929) ["percent":"OCA\ServerInfo\Resources\Disk":private]=> string(2) "5%" ["mount":"OCA\ServerInfo\Resources\Disk":private]=> string(10) "/etc/hosts" } [2]=> object(OCA\ServerInfo\Resources\Disk)#4025 (6) { ["device":"OCA\ServerInfo\Resources\Disk":private]=> string(3) "D:\" ["fs":"OCA\ServerInfo\Resources\Disk":private]=> string(2) "9p" ["used":"OCA\ServerInfo\Resources\Disk":private]=> int(63168) ["available":"OCA\ServerInfo\Resources\Disk":private]=> int(294600) ["percent":"OCA\ServerInfo\Resources\Disk":private]=> string(3) "18%" ["mount":"OCA\ServerInfo\Resources\Disk":private]=> string(13) "/var/www/html" } }
# 6.23

Added

8 Submit front and rear end test on June 20

# 6.24
 View remaining disk space
free_space(){
	disk_free_space()
}
lib\private\Files\Storage\Local.php

# 6.25
apps/settings/lib/Controller Add the controller file below
 Enterprise basic information
CompaniesController.php
apps\settings\composer\composer\autoload_classmap.php
'OCA\\Settings\\Controller\\CompaniesController' => $baseDir . '/../lib/Controller/CompaniesController.php',
apps\settings\composer\composer\autoload_static.php
    'OCA\\Settings\\Controller\\CompaniesController' => __DIR__ . '/..' . '/../lib/Controller/CompaniesController.php',
data sheet
oc_du_enterprise
id 
uid
name
website
email
phone
address

if (!$schema->hasTable('du_enterprise')) {
$table = $schema->createTable('du_enterprise');
$table->addColumn('id', Types::BIGINT, [
'autoincrement' => true,
'notnull' => true,
'length' => 20,
]);
$table->addColumn('uid', 'string', [
'notnull' => false,
'length' => 64,
]);
$table->addColumn('name', 'string', [
'notnull' => false,
'length' => 150,
]);
$table->addColumn('website', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('email', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('phone', 'string', [
'notnull' => false,
'length' => 30,
]);
$table->addColumn('address', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['uid',], 'enterprise_uid');
$table->addIndex(['name',], 'enterprise_name');
$table->addIndex(['email',], 'enterprise_email');
$table->addIndex(['phone',], 'enterprise_phone');
}

Working enterpriseDao
# 6.26

$stmt
e PDO::prepare() 
mysqli:
v1Response
Added:
1./ocs/v2.php/apps/settings/api/v1/enterprise
2./ocs/v2.php/apps/settings/api/v1/enterprise
3./ocs/v2.php/apps/serverinfo/api/v1/usagedata
4./apps/serverinfo/update
# System settings
 Minimum password length setting
## The data sheet is oc_appconfig
appid: password_policy
configkey: minLength
configvalue: 4
# Password enforcement rules
## Force case
*The data sheet is oc_appconfig
appid: password_policy
configkey: enforceUpperLowerCase
configvalue: 1
# 6.28
## Document watermark settings
appid: file
configkey: watermarkEnabled
configvalue: 1,On, 0 off
## Document security control settings
### Document download control
#### Allow users to download configurations using Office files
appid: file
configkey: downloadFileOffice
configvalue: 1 On, 0 off
#### Allow users to download configurations using non Office type files
appid: file
configkey: downloadFileOther
configvalue: 1 On, 0 off
#### Prohibit downloading all files
appid: file
configkey: downloadFileForbid
configvalue: 1 On, 0 off
### Document printing control
#### Print settings: allows users to use online print permission configuration
appid: file
configkey: printFileOffice
configvalue: 1
#### Global print settings: prohibit online printing of documents
appid: file
configkey: printFileOffice
configvalue: 0
### Content control
 Content anti copy settings
#### Allow users to copy the controlled content to the system permission configuration
appid: file
configkey: copyFileOffice
configvalue: 1
#### It is forbidden to copy the contents of the file out of the system
appid: file
configkey: copyFileOffice
configvalue: 0

# 7.6
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/settings/lib/Controller/EnterprisesController.php -d
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/settings/lib/Db -d



# 7.8
*Research collaboration space 5.0 Feasibility of front and rear end separation
 Scheme 1: use NC Routing mode in NC Create a new one in app,Front end VUE Deploy the compiled code to app In the corresponding directory.
Scheme 2: use VUE To deploy the front-end compiled code to NC In the secondary directory of the server.
Practice: build on the machine NC Development environment and VUE In the development environment, write tests for scheme 1 and scheme 2 respectively DEMO. Deploy the front-end compiled code according to scheme 1 and scheme 2 to verify the feasibility of the scheme, and finally adopt scheme 2 as the development mode of the collaborative system.
*Organize and write collaborative spaces 5.0API file
*The test of scheme II will be prepared DEMO Share it with the front end. You can refer to it when making some functional modules
 With the help and guidance of leaders and colleagues, I can quickly get familiar with the working environment, understand and integrate into the team.
During the internship, I am serious and hardworking, open-minded and eager to learn. I am sincere, can correctly deal with the difficulties encountered in my work, apply my learned knowledge to my work, and strive to complete the work tasks with quality and quantity. At the same time, I strictly abide by the company's rules and regulations. During my internship, I have not been absent from work for no reason, late and leave early. I work hard and try my best.




21 March 8, 2011 to June 1, 21
1.Research collaboration space 5.0 Feasibility of front and rear end separation
 Scheme 1: use NC Routing mode in NC Create a new one in app,Front end VUE Deploy the compiled code to app In the corresponding directory.
Scheme 2: use VUE To deploy the front-end compiled code to NC In the secondary directory of the server.
Practice: build on the machine NC Development environment and VUE In the development environment, write tests for scheme 1 and scheme 2 respectively DEMO. Deploy the front-end compiled code according to scheme 1 and scheme 2 to verify the feasibility of the scheme, and finally adopt scheme 2 as the development mode of the collaborative system.
2.Organize and write collaboration space 5.0API file
3.Scheme 2 call will be written NC Interface test DEMO Submit to gitlab
4.Integrate the first beta code of collaborative space into 192.168.100.83:2000 The server.
21 June 2, 2021 to June 15, 2021
 Collaborative space front desk API Organize, write, test and develop.
21 June 15, 2011 to July 8, 21
 Collaborative space background API Organize, write, test and develop.



In my work, I am serious and hardworking, open-minded, studious and sincere. When I encounter problems at work, I take the initiative to communicate with leaders and colleagues in a timely and effective manner and solve the problems encountered at work. Apply the knowledge you have learned to your work, and strive to complete the work tasks with quality and quantity. At the same time, I strictly abide by the company's rules and regulations, and have not been absent for no reason, late and leave early. I work hard and try my best.

# 7.9
//auth_token table 
min:1155
max:1191

vim /sys/class/dmi/id/product_uuid

# 7.12

```
//Query user active list
SELECT t_a.`file_num` + t_b.`share_with_num` + t_c.`share_owner_num` AS all_num, t_a.*,t_b.`share_with_num`,t_c.`share_owner_num` FROM (SELECT COUNT(*)AS file_num,created_by FROM oc_filecache WHERE `created_by` != '' GROUP BY `created_by` ) AS t_a, (SELECT COUNT(*)AS share_with_num,share_with FROM oc_share WHERE share_with != '' GROUP BY share_with 
) AS t_b,  (SELECT COUNT(*)AS share_owner_num,uid_owner FROM oc_share WHERE uid_owner != '' GROUP BY uid_owner 
) AS t_c WHERE t_a.created_by = t_b.share_with AND t_a.created_by = t_c.uid_owner ORDER BY all_num DESC LIMIT 10


//Query the active list of users in a certain period of time
SELECT t_a.`file_num` + t_b.`share_with_num` + t_c.`share_owner_num` AS all_num, t_a.*,t_b.`share_with_num`,t_c.`share_owner_num` FROM (SELECT COUNT(*)AS file_num,created_by FROM oc_filecache WHERE `created_by` != '' AND `storage_mtime` >= 1614556800 AND `storage_mtime` <= 1625702400 GROUP BY `created_by` ) AS t_a, (SELECT COUNT(*)AS share_with_num,share_with FROM oc_share WHERE share_with != '' AND `stime` >= 1614556800 AND `stime` <= 1625702400 GROUP BY share_with 
) AS t_b,  (SELECT COUNT(*)AS share_owner_num,uid_owner FROM oc_share WHERE uid_owner != '' AND `stime` >= 1614556800 AND `stime` <= 1625702400 GROUP BY uid_owner 
) AS t_c WHERE t_a.created_by = t_b.share_with AND t_a.created_by = t_c.uid_owner ORDER BY all_num DESC LIMIT 10
```





# 7.14
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/serverinfo/lib/Controller/AbiController.php

83:2000 Machine code
```
"ocs": {
	"meta": {
		"status": "ok",
		"statuscode": 200,
		"message": "OK"
	},
	"data": {
		"product_uuid": "",
		"board_serial": "",
		"board_name": "06WXJT\n",
		"product_name": "PowerEdge R740\n",
		"mac_address": "02:42:ac:17:00:05\n",
		"php_screw": "yes"
hostName: 1150562f4475
 Machine code: 51363 d6ce90e16c7324523245896efb2

51363d6ce90e16c7324523245896efb2

```


6080: Machine code


1c72609e85f3d1da1cd360dcb2914854

# 7.16
83:2000
```
"product_uuid": "",
"board_serial": "",
"board_name": "06WXJT\n",
"product_name": "PowerEdge R740\n",
"cpuModelName": "model name\t: intel(r) xeon(r) silver 4216 cpu @ 2.10ghz\n",
"cpuStepping": "stepping\t: 7\n",
"cpuMicrocode": "microcode\t: 0x5003003\n",
"cpumhz": "cpu mhz\t\t: 2039.446\n",
"cpuCachesize": "cache size\t: 22528 kb\n"
```


# 7.21
 File dynamic
# 7.22
 File dynamics,File sharing
## 1 D:\docker_dev\nextcloud\src\apps\provisioning_api\appinfo\routes.php

```
['name' => 'AppConfig#fileActivityOpen', 'url' => '/api/v1/files/activity/open', 'verb' => 'POST'], //changxie-zhaoqhu-activity-open-2021-0719-start
```
## 2 D:\docker_dev\nextcloud\src\apps\provisioning_api\lib\Controller\AppConfigController.php
```
	public function fileActivityOpen($path){
	
		$userFolder = \OC::$server->getUserFolder();
		
		if($userFolder == null){
			throw new OCSBadRequestException('User is invalid');
		}
		try {
			$userFolder->get($path);
		} catch (\Throwable $th) {
			throw new OCSBadRequestException('Path is invalid');
		}
	
		$view = \OC\Files\Filesystem::getView();
		$view->viewOpened($path);
		return new DataResponse([]);
	}
```
## 3 D:\docker_dev\nextcloud\src\lib\private\Files\View.php
```
public function viewOpened($path) {
		$path = $path;
		\OC_Hook::emit(
			Filesystem::CLASSNAME, Filesystem::signal_post_opened,
			[
				Filesystem::signal_param_path => $this->getHookPath($path)
			]
		);
	}
```

## 4 D:\docker_dev\nextcloud\src\lib\private\Files\Filesystem.php
```
public const signal_post_opened = 'post_opened';
```

## D:\docker_dev\nextcloud\src\lib\private\Files\Node\HookConnector.php

```
Util::connectHook('OC_Filesystem', 'post_opened', $this, 'postOpened');//changxie-zhaoqhu-activity-open-2021-0719-end
/**
	* //changxie-zhaoqhu-activity-open-2021-0716-start
	*/
public function postOpened($arguments){
	$arguments = $arguments;
	$this->root->emit('\OC\Files', 'postOpened', [$arguments['path']]);
}

```
## D:\docker_dev\nextcloud\src\apps\activity\lib\AppInfo\Application.php
```
private function registerFilesActivity() {
	// All other events from other apps have to be send via the Consumer
	Util::connectHook('OC_Filesystem', 'post_create', FilesHooksStatic::class, 'fileCreate');
	Util::connectHook('OC_Filesystem', 'post_update', FilesHooksStatic::class, 'fileUpdate');
	Util::connectHook('OC_Filesystem', 'delete', FilesHooksStatic::class, 'fileDelete');
	Util::connectHook('OC_Filesystem', 'rename', FilesHooksStatic::class, 'fileMove');
	Util::connectHook('OC_Filesystem', 'post_rename', FilesHooksStatic::class, 'fileMovePost');
	Util::connectHook('OC_Filesystem', 'get_download', FilesHooksStatic::class, 'fileDownload');//changxie-zhaoqhu-activity-download-2021-0716-start
	Util::connectHook('OC_Filesystem', 'post_opened', FilesHooksStatic::class, 'fileOpened');//changxie-zhaoqhu-activity-open-2021-0719-start
	Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', FilesHooksStatic::class, 'fileRestore');
	Util::connectHook('OCP\Share', 'post_shared', FilesHooksStatic::class, 'share');//Add share
	Util::connectHook('OCP\Share', 'post_shared', FilesHooksStatic::class, 'share');//Add share

	$eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher();
	$eventDispatcher->addListener('OCP\Share::preUnshare', [FilesHooksStatic::class, 'unShare']);//Delete share
	$eventDispatcher->addListener('OCP\Share::postUnshareFromSelf', [FilesHooksStatic::class, 'unShareSelf']);
}
```

##  D:\docker_dev\nextcloud\src\apps\activity\lib\FilesHooksStatic.php
```
/**
	* //changxie-zhaoqhu-activity-open-2021-0719-start
	*/
public static function fileOpened($params){
	self::getHooks()->fileOpened($params['path']);
}
```
## D:\docker_dev\nextcloud\src\apps\activity\lib\FilesHooks.php
```
public function fileOpened($path){
		$this->addNotificationsForFileAction($path, Files::TYPE_FILE_OPENED, 'opened_self', 'opened_by');
	}
```


## Delete share
* apps\files_sharing\lib\Controller\ShareAPIController.php

```
public function deleteShare(){
	$this->shareManager->deleteShare($share);
}
```
* lib\private\Share20\Manager.php

```
public function deleteShare(IShare $share) {
$this->legacyDispatcher->dispatch('OCP\Share::postUnshare', $event);
}
```
lib\private\Share20\LegacyHooks.php
```
/**
	* @param GenericEvent $e
	*/
public function postUnshare(GenericEvent $e) {
	/** @var IShare $share */
	$share = $e->getSubject();

	$formatted = $this->formatHookParams($share);

	/** @var IShare[] $deletedShares */
	$deletedShares = $e->getArgument('deletedShares');

	$formattedDeletedShares = array_map(function ($share) {
		return $this->formatHookParams($share);
	}, $deletedShares);

	$formatted['deletedShares'] = $formattedDeletedShares;

	\OC_Hook::emit(Share::class, 'post_unshare', $formatted);
}
```
lib\private\legacy\OC_Hook.php
```
public static function emit($signalClass, $signalName, $params = []) {

		// Return false if no hook handlers are listening to this
		// emitting class
		if (!array_key_exists($signalClass, self::$registered)) {
			return false;
		}

		// Return false if no hook handlers are listening to this
		// emitting method
		if (!array_key_exists($signalName, self::$registered[$signalClass])) {
			return false;
		}

		// Call all slots
		foreach (self::$registered[$signalClass][$signalName] as $i) {//$signalClass = "OCP\Share",$signalName = "post_shared"
			try {
				call_user_func([ $i["class"], $i["name"] ], $params);//$i["class"] = ""
			} catch (Exception $e) {
				self::$thrownExceptions[] = $e;
				\OC::$server->getLogger()->logException($e);
				if ($e instanceof \OC\HintException) {
					throw $e;
				}
				if ($e instanceof \OC\ServerNotAvailableException) {
					throw $e;
				}
			}
		}

		return true;
	}

```





OCC Command

https://docs.nextcloud.com/server/21/admin_manual/configuration_server/occ_command.html

# 7.23
 Jump to default page
lib\private\legacy\OC_Util.php
```
public static function redirectToDefaultPage() {
		$location = self::getDefaultPageUrl();
		header('Location: ' . $location);
		exit();
	}
```
# 7.23
Seven days of experience are over . . . . 


# 7.26
83:2000 Machine code
* 1: 7c20e2cbbdf59942957cd29a85c2433d
* 2: 7c20e2cbbdf59942957cd29a85c2433d
* 3: 7c20e2cbbdf59942957cd29a85c2433d
* 4: 7c20e2cbbdf59942957cd29a85c2433d

QQ: smpt password
epzznkyhrabzbdae




# 7.27
 How to schedule the background operation of mail sending
apps\activity\lib\BackgroundJob\EmailNotification.php

run
 Mail notification workflow

Folder or file operation dynamic=>Insert into data table activity_mq in=>implement cron.php File execution activity_mq Queue in=>Send mail



# 7.28
83:2000 5000 Number of users
```
Xueaedq4bTWn+n5s6RkS4y8I8ACGqxIk/6JSbYvoGuWwki6bmt70LrZbJy5H51ncUaE/7xMZVuypn4pC9CtURiAhNhQkN+pMTxvfJ2oMf3DUwbwQoYwzhBpx9GjcmTgJEpjvdjtbuYfMODWk61NfX2rrOZ4FPvIBLRZ8oQ9JvYQUomLkFq+qftZm29wwKFwQDXIVUhFMtm+yXb4eVN9bzA5g9gUZJWObBqAeHN07bbX3b1UUNEQLWHif5WK+rI9hx0JPBxiDQTmOtvoWjX6V6Z0qbH/0+QCpp6Byga8/30Av1afGpbj0gNPO5RA3N6dw6NXRyZq7yrEUtl1DdQbA3DobrE4UrsmN75qpbd0+JTtMHANuqlMipcXGxSQ25+QVInh5xikk7JVgwuxbAllkcnn6w+rZk7a1wwS1Limu6cvtFOvzsuadD9vMIh1Y3zuxtV28dg8FIPeHNsmtvfFK8Xc0eVcnvw+H2ZiXu9IWhkW/c59qJslQBphn/jvUuRx2PmZpoBdLF5XAHMk/cNmg7JhOAyQ95C7Eu5Soe+AMs6MqJ3pXO2llg6i4j9Fv5+5URtGbCtTb4qDzms4s1SspdFUn2M4ipcMAq0wjpXVamk1Y8BF5HU2E5arDrplqujydpu0MQrOCcVvKWbcLnMa5BpOppCY2r/F9xrpafsgv23J34QxilUrsEDDUqO1TcAI1rWzZRrlmR4ujGEOnBBRXt+o5TI5lROaQy9+i2xgl0tZ8jwVgnePvK8eUt3GN9381x8yLc1Lw+isWnbICpKi+WAbZfdGeCWefdwxykdiwVbL75nB3qsSN6hRhAvW6/+EHJoRvf4HKGejrPHLXT2fMNDC49S0MiWPuRHenkf1iEjBayh3hjWgWdGkt2bf5iWRFtkMucfLr8fiyAphPcITGh9w0SSJ+XbuMvGC9DvOlRzEYudSl0fXfFI1nWNGmbJmN0gkVOPi6WNWNL45hdah9l/rZIB0U9kTixYWl21o9wNdfg1cgB9IYhEfgHcFmW8XnDZJdB7Ujy+Kry6VxA/1DgYoiX+tkUfcZXCXsr6klM9zBm42kscG4uhryCQWbTfslmgJu8HnFvhW7mGoo4mKiuGyxbiID+rqXMaYsa8ncHx1/pZnAw3zlUr/KHp3PdXudMBSLHn076dpwXVR75kQbUygP50x1Lt80dL1txCqOlec6KDKr1ucHG602DuXqZNyxRO2QQqI7W8MRkKCQzsOTwZwRyvX3fCElh6fRN2OESExV+qUpAY44OmLFGJh2C066wqpUlERPAVvT4j7RIOo4DCzDjKvB5Ss+K2RT3/+NnW6fOR5WQ39HXTsS4DNt72/lKg2WmizUJLPTS1I6e7zEY4ZB8ATJ9z7GQWuFnPA9yySpYqMmuZ5bx8XmaoJGtFsSEUYIm9iYt9Rc3H64Rogv0LcymwN7XMyf2hUvpCdOoSIrhVsH2fqExCzDXtVMgPJLza9TmPfbX+lq19+9Yuy3CVH0jnxJI+SW5i8TzcEdLPLMgsT0nQ/wfcd1JKPqUk98vG+NBzLWWPVz3/R18SpPwcgSKJZNo1gj3dlkbIePPSJkjyG/Y76HiwpPTVkGquwKgBuHzAaacOPngjAeMaKebuKZcQH2EtZ24aq3gVn8RbCrxqUPbLWXhZxh8Z0TNSZ4ScCg9xFLasZ9/1BUMlXJ+gKgu7D8N0yFiPsbE44xHuTWfn1MJk4xO1rNK+2Kv7pwTmSZENdLLq4Ki+YQlgDZsCAEisPaYVvH4fjsUEIAyWpv5mGCpIy1WyrX6StOamaDNB9ZN9meAMBUV6MV7ATK5BAQONtZVZRG8PKwqADrm6hCzKfHr7rwKE2ORv6WY4KZztRzTXeSVctuNxF1mGMzrAikOm3G7jZB3g4UmGui32pr4XehPA1mox7Rc60hXBnNciek7NFRRsRMUg3u1EVEKogIddmt9bDe3or3kRaUllTxxf95v06RrhtBT5npsrfd7Bj6kfEuAefOslOhTP5Eb94SLMl0v/7rlkun37ftq8VWjNOHmNZ9VD2hG/0R5m/1zUk3qyaSSzdlMYXEu/CwAhNwgTheHjQS6rZwlM6IO7JQOg1MrmlpFGMLacar+euyCuAoozk7DfT3zS4mSFKtDEBQW9WZLY3/xFXb6ThyJnzShpV0Vwu3DZu+NtsGNf5RKO89s9/dust+7J5iG7WqUg==
```
83:2000 20 Number of users
```
JFaWhaOigSxWbIplNhoFMt+GiMhxe8nqgoR+8VbE52ZPOX6kbQP4ylCAz6iXzYgvCKok5L38S6JczQ1OpN/6+nTiIXygwsnXW8Vr/rFiqYGNBeNan+ahTcXwBFQtXE2/q0LOZDjHePpYz53bJYIPaWdVZZyylrEPYq+I4PcORnBbBfGmxQQSd7fAUOsxead6YPtkL0El0Ifq2gpDNgHxPJZYmXLiQtE0N8Nh5PweK6SkTVc4ati6r/HIdJHBwGYoHaZUqk7Rcw/c10FkczxJ+VsuqB28MbqQYeOJPtxDJIaZqk6v9lKNTKXcEiTZAsOHjfgCty6feOg65egqxgshiZIMd7dq0Fpgl54hYykb+muzUo3/Lg0rjeWB6zHQrCVbsY3WK5p6b2a3oGt1wGGbhOhaAcHTM+7okuKlt+JRykf8PxVSFRZEWIVY8caphYfUNC1bSBY6d34nGwu6+IYmdBFkKFj/5wXQSMTtnMaLM1LRr/V6rceJPIBrM67InKfjctVnZ7KUpU46gy+AegdALQvpGpV9IpbaH8PlHE4LNw6tuUGzFHJwMWj3qNvlig0QnuuKstGo1XeP9OYQBgmoLinCXIasi+4zZgO4r+JFpXad/4peMSHGJipKQi1WbZPrqxIvHfqWMLOQn/KYmV0Y5WzCvoGM3xP3zyGr0I6+ijNWEeH4l1N1CmpNLAlwtpImOpY9QlZ5PTsJNM2d5LRdeafPOxvxlCwSJveSigXBNQfoGN20U1WFp4ZoqvO0GZGDHzT7ZYh9oGzqTZ8m3O8EHhGxmFETiEay4Sp6/GgWCQCNy9oPj9iA8FYETtREko73OcqDxPyTKxlVrSntnN4nBPGXm1+KNFqyKsexnP8Optk/yTcgdot+DLjzNAlo5eJP9e9EwgZUodWiFPGMPGMR/4swzR2UFoRlNbwcupnpY8xvF15RxfWBE0gVXoZcq2FcInoYaJJqsMlsUYSqReONF5hYpZEaD1K+4mjgnXJVJxoDPo5PTVJFUMAimQrmvod67WnNMsdWRx6LuWz8mVeXvhJkcan6ax0uVF+2Ow5R2CnXK0ercJkRV6InUJYML3LjXTdWhwZ9C6E5sjAcnJwcg40hWe2Eg904rd1PiKzSLMwJhVja/D+nrGYXq5IydRVKQnmW5WapHb5RRuNzL021BLTt1Fcpr/JoHKBvilUuLS/hVwOjPbvPb22lRdx4zmLIrrruVJT6gn1BKHD6kir6gou2kbTWHlgf+hjkXZsTgkmRTgBY4NlT5fN7xVJ2n5HwaogxC5IDX7eFS17BnlEl1Tm1ejOBvB9wTUigueHH3ClS/DOIBWV7lCdaXxZMQySN3KbkFGJ0ukNQf0n6YCcj7EeCRsl/e7I5vCsvVoP0XmYnyfnAHGnmdwa48TC5cFD3rPdnCNgZZHd2ur6BR2q+9ITSYGv4/OMggCAg1eAMaaSIwUyGetBx9uCL5ZSq931M7wao3ZF56qx2WA3ufvv8lvkVVIWnx2zZ4Ti2aQ3lyx8+F7xD2KPG5f1Ij5SSBh0jc7UgdkHSC3p93fjMYUuF6q+7s++3+n9OMbgIRjCxkqBl9FHhzzR9BrYe/j6/PdRZG1W5i5nJYWGEAswmxfFrb3SbxVv6HLCEZI724qpziLrb2ExUm7U8NHNxQ0gRIgTJ0Ss8NMXzsgpaXYaJQuaA5L2HMX1mbDgvv/aAOyXDq50ZHYLHXqn8DxfDgnQD2RRvuxlHKNMSxQmAiDFjvKBzBsYAo5cAsnOlfTQvnrQVqmDCLDA5E1JCLOzZGGkN/CI/L+w60wDRQMINvQWjHOvwBBjU8uplVQn2CsPs/3p3FnYQ6lo3zVQbxV7UrzOyf7LI0mHvPRMys8ul9FqaBqBL3NNkHpJ8AzIXFm9HV1CoMONBiSi+l+MwcSvFeMctwo0XO1/TNpQqq6h58Fldc0dh5NIwpxG2F51dHxRO/hvge10rhmlcI6Ig64IVUFbx5QSmTDXTodjLvzP/UnEQ5o9wAyYT/rWvaGjovWJgsLBNBUYgkqC59UneXqCr3gg7wWtdsviFqKTlmrKHZKpccMicvs03s4hp94Ptg5I6yESbDcXj4Sx6IgvW197Z43+W6IG+jtDXalSP7bkUMBS7MLADL54VorW16EQDsEiTgWPBPv2RKFOIROWpPbpmWQmYPQlD
```

getShareLinkFiles working...


# 7.29

in Subqueries, shared links
```
// $sql = "SELECT * FROM `*PREFIX*share` WHERE `share_type` = :share_type ";
	// if($since > 0 ){
	// 	$sql .= " AND `id` < :share_id";
	// }
	// if($userID != ''){
	// 	$sql .= " AND `uid_owner` = :uid_owner";
	// }
	// $departmentID = 4;
	// if($departmentID != ''){
	// 	$sql .= " AND `uid_owner` in (SELECT `user_id` FROM `*PREFIX*du_department_user` WHERE `department_id` = :department_id)";
	// }
	// if($startTime != ''){
	// 	$sql .= " AND `stime` > :start_time";
	// }
	// if($endTime != ''){
	// 	$sql .= " AND `stime` <= :end_time";
	// }
	// if($fileName != ''){
	// 	$sql .= " AND `file_target` = :file_target";
	// }
	// $sql .= " ORDER BY `id` DESC LIMIT ".$limit;
	// $stmt = $this->db->prepare($sql);
	// $shareType = 3;
	// $stmt->bindParam(':share_type', $shareType);
	// if($since > 0 ){
	// 	$stmt->bindParam(':share_id', $since);
	// }
	// if($userID != ''){
	// 	$stmt->bindParam(':uid_owner', $userID);
	// }
	// if($departmentID != ''){
	// 	$stmt->bindParam(':department_id', $departmentID);
	// }
	// if($startTime != "" ){
	// 	$stmt->bindParam(':start_time', $startTime);
	// }
	// if($endTime != "" ){
	// 	$stmt->bindParam(':end_time', $endTime);
	// }
	// if($fileName != "" ){
	// 	$stmt->bindParam(':file_target', $fileName);
	// }
```
# 7.30
 Disable account routing
http://192.168.100.83:2000/ocs/v2.php/cloud/users/zqh1/disable


	Linux 4.15.0-112-generic x86_64
CPU:	Intel(R) Xeon(R) Silver 4216 CPU @ 2.10GHz (32 cores)
Memory:	62.42 GB
 Server time:	Fri Jul 30 17:13:48 CST 2021
 Run time:	50 days, 4 hours, 41 minutes, 29 seconds




# No. 8.2
 Message notification

[{"5277":"\/activityFoderTest"},"admin",{"permissions":31}]


activity
notify_notification_shared
notify_email_shared

# notification appconfig settings
notify_email_favorite
notify_email_file_changed
notify_email_file_favorite_changed
notify_email_public_links
notify_email_remote_share
notify_email_shared
notify_email_systemtags


notify_notification_favorite
notify_notification_file_changed
notify_notification_file_favorite_changed
notify_notification_public_links
notify_notification_remote_share
notify_notification_group_settings
notify_notification_personal_settings
notify_setting_selfemail
notify_setting_self
notify_notification_systemtags


D:
cd vue_dev/apidoc/doc
php -S 192.168.100.226:3000


D:
cd vue_dev/apidoc_manager/doc
php -S 192.168.100.226:1000




D:\docker_dev\nextcloud\src\apps\files_sharing\lib\Db\LinkSharesDbo.php

# 8.3
{"defFormats[csv]": true
,"defFormats[doc]": true
,"defFormats[docm]": true
,"defFormats[docx]": true
,"defFormats[dotx]": true
,"defFormats[epub]": true
,"defFormats[html]": true
,"defFormats[odp]": true
,"defFormats[ods]": true
,"defFormats[odt]": true
,"defFormats[otp]": true
,"defFormats[ots]": true
,"defFormats[ott]": true
,"defFormats[pdf]": true
,"defFormats[potm]": true
,"defFormats[potx]": true
,"defFormats[ppsm]": true
,"defFormats[ppsx]": true
,"defFormats[ppt]": true
,"defFormats[pptm]": false
,"defFormats[pptx]": true
,"defFormats[rtf]": true
,"defFormats[txt]": true
,"defFormats[xls]": true
,"defFormats[xlsm]": true
,"defFormats[xlsx]": true
,"defFormats[xltm]": true
,"defFormats[xltx]": true
,"editFormats[csv]": true
,"editFormats[odp]": true
,"editFormats[ods]": true
,"editFormats[odt]": true
,"editFormats[rtf]": true
,"editFormats[txt]": true
,"sameTab": false
,"preview": false
,"versionHistory": false
,"chat": true
,"compactHeader": true
,"feedback": true
,"forcesave": false
,"help": true
,"toolbarNoTabs": false
,"reviewDisplay": "markup"}


{"defFormats": {
"csv":"true",
"doc":"true",
"docm":"true",
"docx":"true",
"dotx":"true",
"epub":"true",
"html":"true",
"odp":"true",
"ods":"true",
"odt":"true",
"otp":"true",
"ots":"true",
"ott":"true",
"pdf":"true",
"potm":"true",
"potx":"true",
"ppsm":"true",
"ppsx":"true",
"ppt":"true",
"pptm":"true",
"pptx":"true",
"rtf":"true",
"txt":"true",
"xls":"true",
"xlsm":"true",
"xlsx":"true",
"xltm":"true",
"xltx":"true"
}
,"editFormats": {
"csv":"true",
"odp":"true",
"ods":"true",
"odt":"true",
"rtf":"true",
"txt":"true"
}
,"editFormats[odp]": true
,"editFormats[ods]": true
,"sameTab": false
,"preview": false
,"versionHistory": false
,"chat": true
,"compactHeader": true
,"feedback": true
,"forcesave": false
,"help": true
,"toolbarNoTabs": false
,"reviewDisplay": "markup"}

# 8.4
 Individual quota
 data sheet:oc_preference
app: files
configkey: quota
configvalue: 10G

# 8.5
cron

```
#!/bin/bash
php -q cron.php
```
php_sapi_name(),System function, if from cli(command line interface),Command line interface php return cli
posix_getuid()System function

## backgroundjobs_mode
value: ajax Web page execution cron.php
 Execution of the previous entry on the web page cron of id25
SELECT * FROM oc_appconfig WHERE appid = 'backgroundjob'

mailbox
createEMailTemplate

lib\private\Share20\Manager.php

sendMailNotification()

apps\activity\lib\MailQueueHandler.php

sendEmails()


D:\docker_dev\nextcloud\src\apps\activity\lib\BackgroundJob\EmailNotification.php
 The interval between the two is 15 minutes.
Data table fields:
last_run
last_checked
execution_duration
interval
lastRun

900 Seconds 15 minutes

# 8.6
 Last login time, confirm password
 Authorization file decryption
last-password-confirm
```
object(stdClass)#3561 (34) {
["uuid"]=>
string(32) "1c72609e85f3d1da1cd360dcb2914854"
["bindMode"]=>
string(1) "1"
["exchangeFormat"]=>
array(14) {
[0]=>
string(3) "bmp"
[1]=>
string(4) "docx"
[2]=>
string(3) "gif"
[3]=>
string(3) "jpg"
[4]=>
string(3) "odt"
[5]=>
string(3) "pdf"
[6]=>
string(3) "rtf"
[7]=>
string(3) "png"
[8]=>
string(3) "txt"
[9]=>
string(3) "csv"
[10]=>
string(3) "ods"
[11]=>
string(4) "xlsx"
[12]=>
string(3) "odp"
[13]=>
string(4) "pptx"
}
["wordDeskRadio"]=>
string(1) "2"
["wordDeskFileFormatList"]=>
array(18) {
[0]=>
string(3) "doc"
[1]=>
string(4) "docm"
[2]=>
string(4) "docx"
[3]=>
string(3) "dot"
[4]=>
string(4) "dotm"
[5]=>
string(4) "dotx"
[6]=>
string(4) "epub"
[7]=>
string(4) "fodt"
[8]=>
string(3) "htm"
[9]=>
string(4) "html"
[10]=>
string(3) "mht"
[11]=>
string(3) "odt"
[12]=>
string(3) "ott"
[13]=>
string(3) "pdf"
[14]=>
string(3) "rtf"
[15]=>
string(3) "txt"
[16]=>
string(3) "xps"
[17]=>
string(3) "wps"
}
["wordDeskAdvancedFunction"]=>
array(0) {
}
["wordMobileFileFormatList"]=>
array(18) {
[0]=>
string(3) "doc"
[1]=>
string(4) "docm"
[2]=>
string(4) "docx"
[3]=>
string(3) "dot"
[4]=>
string(4) "dotm"
[5]=>
string(4) "dotx"
[6]=>
string(4) "epub"
[7]=>
string(4) "fodt"
[8]=>
string(3) "htm"
[9]=>
string(4) "html"
[10]=>
string(3) "mht"
[11]=>
string(3) "odt"
[12]=>
string(3) "ott"
[13]=>
string(3) "pdf"
[14]=>
string(3) "rtf"
[15]=>
string(3) "txt"
[16]=>
string(3) "xps"
[17]=>
string(3) "wps"
}
["wordMobileRadio"]=>
string(1) "2"
["excelDeskRadio"]=>
string(1) "1"
["excelDeskFileFormatList"]=>
array(12) {
[0]=>
string(3) "csv"
[1]=>
string(2) "et"
[2]=>
string(4) "crtx"
[3]=>
string(4) "fods"
[4]=>
string(3) "ods"
[5]=>
string(3) "ost"
[6]=>
string(3) "xls"
[7]=>
string(4) "xlsm"
[8]=>
string(4) "xlsx"
[9]=>
string(3) "xlt"
[10]=>
string(4) "xltm"
[11]=>
string(4) "xltx"
}
["excelDeskAdvancedFunction"]=>
array(0) {
}
["excelMobileRadio"]=>
string(1) "2"
["excelMobileFileFormatList"]=>
array(12) {
[0]=>
string(3) "csv"
[1]=>
string(2) "et"
[2]=>
string(4) "crtx"
[3]=>
string(4) "fods"
[4]=>
string(3) "ods"
[5]=>
string(3) "ost"
[6]=>
string(3) "xls"
[7]=>
string(4) "xlsm"
[8]=>
string(4) "xlsx"
[9]=>
string(3) "xlt"
[10]=>
string(4) "xltm"
[11]=>
string(4) "xltx"
}
["pptDeskRadio"]=>
string(1) "1"
["pptDeskFileFormatList"]=>
array(13) {
[0]=>
string(4) "fodp"
[1]=>
string(3) "dps"
[2]=>
string(3) "odp"
[3]=>
string(3) "otp"
[4]=>
string(3) "pot"
[5]=>
string(4) "potm"
[6]=>
string(4) "potx"
[7]=>
string(3) "pps"
[8]=>
string(4) "ppsm"
[9]=>
string(4) "ppsx"
[10]=>
string(3) "ppt"
[11]=>
string(4) "pptm"
[12]=>
string(4) "pptx"
}
["pptMobileRadio"]=>
string(1) "2"
["pptMobileFileFormatList"]=>
array(13) {
[0]=>
string(4) "fodp"
[1]=>
string(3) "dps"
[2]=>
string(3) "odp"
[3]=>
string(3) "otp"
[4]=>
string(3) "pot"
[5]=>
string(4) "potm"
[6]=>
string(4) "potx"
[7]=>
string(3) "pps"
[8]=>
string(4) "ppsm"
[9]=>
string(4) "ppsx"
[10]=>
string(3) "ppt"
[11]=>
string(4) "pptm"
[12]=>
string(4) "pptx"
}
["process"]=>
string(4) "5000"
["connections"]=>
string(4) "5000"
["users_count"]=>
string(4) "5000"
["nodes"]=>
string(4) "5000"
["count"]=>
string(4) "5000"
["commonAdvanceFunction"]=>
array(0) {
}
["end_date"]=>
string(9) "2022-08-6"
["users_expire"]=>
int(2)
["mode"]=>
int(0)
["light"]=>
bool(false)
["version"]=>
string(5) "5.0.0"
["coCharaCode"]=>
string(16) "editor-author-co"
["coRegUserMax"]=>
string(4) "5000"
["authorizationLevel"]=>
string(3) "700"
["cosysCode"]=>
string(0) ""
["sequenceNo"]=>
string(32) "0b1c5556ea27038ebb2461bd99b085d7"
["signature"]=>
string(256)
"84ec89df6288835ec79fffa3c784a68a5e2fef8e4652152f24174f4c4ad56d48d2b236d390a924676293e90fac5029153718571721b51ffc65499e7b8491ebead26c362af91a90b8eadada7c279fcb612cc18d19b8974c66854c7e78f53ee8e887bcce0c3368e38be30a7a003b0a749aaee898d64c756809e567ea3e972de918"
}
```



# 8.9

There are two cases,
One is the unauthorized status interface display of the collaboration space,
One is the display of the authorized status interface of the collaboration space






# 8.10
# ubuntu 20.04.2.0 LTS
https://cn.ubuntu.com/download/desktop

win 10 Home Edition
##gpedit.msc not found
 establish gpedit.bat,Then run as administrator

```
@echo off

pushd "%~dp0"

dir /b C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >List.txt

dir /b C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>List.txt

for /f %%i in ('findstr /i . List.txt 2^>nul') do dism /online /norestart /add-package:"C:\Windows\servicing\Packages\%%i"

pause
```
## Hyper-V cannot find
 establish hyper-v.cmd,Then run as administrator
```
pushd "%~dp0"

dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt

for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"

del hyper-v.txt

Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
```

```
bcdedit /set hypervisorlaunchtype off
```

## Installing VMWare Workstation 15 Pro for win 10 home edition
VMWare Version No.: 15.5.1 build-15018445
 Download address
http://www.ddooo.com/softdown/160399.htm
## Download and install Ubuntu 20.04 LTS
 Download address
https://cn.ubuntu.com/download/desktop
 
## win10 home VMWare 15.5.1, problems encountered when installing Ubuntu 20.04
## Question 1: blue screen

Remove the printer for device management, and the blue screen problem is solved.

## Problem 2: win10 home VMware, disable Device/Credential Guard incompatibility

* Solution I
 environment vmware 15pro,windows10 Home edition.
Cause: Trial win10 Does the stable version support wsl2,stay powershell Running commands in administrator mode
```
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
```
Opened the virtual platform, resulting in vmware Conflict.
Similarly, in powershell Run in administrator mode:
```
Disable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
```
The problem of virtual machine conflict caused by other reasons needs to be analyzed and solved in detail, and this method is not necessarily applicable.
## Problem 3: conflict resolution between win10 docker and VMware operating environment
  Due to consistency win10 What's running down there VMware,It has always been normal. I was on a whim today VS2019 Here's an attempt based on DotNet-Core-3.1 of Web Application experience, while opening the Docker The installation is completed according to the prompts Docker For Window ,At this time Window Below Docker They are also running normally; However, I found that VMware I can't start. It's a little embarrassing.

  In order to solve the conflict, after some operation and consulting data, the solution shall be recorded to avoid embarrassment again in the future.

  When used Docker For Window,And not used VMware Run as administrator when PowerShell,And enter the command: bcdedit /set hypervisorlaunchtype auto Enter and restart the computer; here Docker For Window function Ok. 

  When needed WMware Instead of using Docker For WIndow Run as administrator when PowerShell,And enter the command: bcdedit /set hypervisorlaunchtype off Enter and restart the computer; here WMware function Ok. 

  To sum up,The reason for this problem is Device Guard or Credential Guard And Workstation If it is incompatible, you can use it in different scenarios through the above switching configuration.
## Problem summary:
Even if the operating system is win10 In the home version, everyone may have different problems. Don't give up. Trying step by step will certainly solve the problem.



Configuring Single-Sign-On
Using the SSO & SAML app of your Nextcloud you can make it easily possible to integrate your existing Single-Sign-On solution with Nextcloud. In addition, you can use the Nextcloud LDAP user provider to keep the convenience for users. (e.g. when sharing)

The following providers are supported and tested at the moment:

SAML 2.0
OneLogin
Shibboleth
Active Directory Federation Services (ADFS)
Authentication via Environment Variable
Kerberos (mod_auth_kerb)
CAS (see below)
Any other provider that authenticates using the environment variable
While theoretically any other authentication provider implementing either one of those standards is compatible, we like to note that they are not part of any internal test matrix.

Enabling the SSO & SAML app
Warning

Make sure to configure an administrative user that can access the instance via SSO. Logging-in with your regular Nextcloud account won't be possible anymore, unless you go directly to the URL https://cloud.example.com/log



https://portal.nextcloud.com/category/authentication/single-sign-on-x28%3bsso-x29%3b/5/


# nextcloud apps
https://apps.nextcloud.com/

SSO & SAML authenticationFeatured

```
docker-compose build
docker-compose down
docker volume prune -f
```
# 8.11

Enter running docker container
docker exec -it app-server-dev /bin/bash

docker exec -it mariadb-dev /bin/bash


Error while trying to initialise the database: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
## 
ubuntu
192.168.179.129
 I git checkout -f dev
 II git pull
 III docker-compose build
 IV docker-compose down
 V docker volume prune -f Force deletion of data volume

Start docker-compose up -d


docker exec -u root  app-server-dev chown -R www-data:www-data *
docker exec -u www-data  app-server-dev php occ maintenance:install --database "mysql" --database-name "jianxiecloud"  --database-user "jianxiecloud" --database-pass "qwe123" --admin-user "admin" --admin-pass "qwe123" --database-host "db-dev" --data-dir "/var/www/html/data"

sudo docker exec -u www-data app-server-dev php occ user:add --group="admin" zhaoqhu















php occ maintenance:install
Error while trying to initialise the database: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.



lib\private\User\Database.php
createUser
# maintenance:install
accounts No data in table
D:\docker_dev\nextcloud\src\lib\private\Accounts\AccountManager.php

pubic updateUser()
private updateExistingUser
private insertNewUser


	public function postCreateUser($params) {
		$user = $this->userManager->get($params['uid']);
		if ($user instanceof IUser) {
			$this->syncService->updateUser($user);
		}
	}

# 8.12
"pathMappings": {
                "/var/www/html":"/home/zhaoqhu/www"
            }


```
{
    // Use IntelliSense to understand related properties. 
    // Hover to view the description of an existing property.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "pathMappings": {
                "/var/www/html":"/home/zhaoqhu/www"
            }
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9003,
            "runtimeArgs": [
                "-dxdebug.start_with_request=yes"
            ],
            "env": {
                "XDEBUG_MODE": "debug,develop",
                "XDEBUG_CONFIG": "client_port=${port}"
            }
        },
        {
            "name": "Launch Built-in web server",
            "type": "php",
            "request": "launch",
            "runtimeArgs": [
                "-dxdebug.mode=debug",
                "-dxdebug.start_with_request=yes",
                "-S",
                "localhost:0"
            ],
            "program": "",
            "cwd": "${workspaceRoot}",
            "port": 9003,
            "serverReadyAction": {
                "pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
                "uriFormat": "http://localhost:%s",
                "action": "openExternally"
            }
        }
    ]
}
```
apps/departmentuser
self::$loader->addValidRoot(OC::$SERVERROOT . '/apps/departmentuser');
error 
lib/private/AppFramework/Utility/SimpleContainer.php 
#115

Could not resolve

sudo chmod -R 777 ./www/

lib/private/Share20/ProviderFactory.php

```
protected function defaultShareProvider() {
		if ($this->defaultProvider === null) {
			$this->defaultProvider = new DefaultShareProvider(
				$this->serverContainer->getDatabaseConnection(),
				$this->serverContainer->getUserManager(),
				$this->serverContainer->getGroupManager(),
				$this->serverContainer->getLazyRootFolder(),
				$this->serverContainer->getMailer(),
				$this->serverContainer->query(Defaults::class),
				$this->serverContainer->getL10NFactory(),
				$this->serverContainer->getURLGenerator(),
				$this->serverContainer->getConfig(),
				$this->serverContainer->getDepartmentService()
			);
		}

		return $this->defaultProvider;
	}
```

sudo cp /home/zhaoqhu/Downloads/nextcloud-21.0.0/nextcloud/* /home/zhaoqhu/www


```
{"displayname":{"value":"wd_144","scope":"contacts","verified":"0"},"address":{"value":"","scope":"private","verified":"0"},"website":{"value":"","scope":"private","verified":"0"},"email":{"value":"0621@qq.com","scope":"contacts","verified":"0"},"avatar":{"scope":"contacts","verified":"0"},"phone":{"value":"","scope":"private","verified":"0"},"twitter":{"value":"","scope":"private","verified":"0"}}
```

		$machineCode['dkBase'] = 'dkbcde@#22222';
		$machineCode['product_uuid'] = $osMachine["product_uuid"];
		$machineCode['board_serial'] = $osMachine["board_serial"];
		$machineCode['board_name'] = $osMachine["board_name"];
		$machineCode['product_name'] = $osMachine["product_name"];
		$machineCode['cpuMicrocode'] = $osMachine["cpuMicrocode"];
		$machineCode['serverPort'] = $_SERVER["SERVER_PORT"];


# 8.13
```
SELECT * FROM oc_du_department AS d,oc_du_department_user AS du WHERE d.id = du.department_id ORDER BY d.id

SELECT * FROM oc_du_department AS d LEFT JOIN (SELECT COUNT(*) AS user_num,department_id FROM oc_du_department_user GROUP BY department_id) AS du ON d.id = du.department_id

```
File list

In addition to their own files, there are files for obtaining other mount points
OC\Files\Config\MountProviderCollection->OC\Files\Config\{closure:/var/www/html/lib/private/Files/Config/MountProviderCollection.php:102-104} (d:\docker_dev\nextcloud\src\lib\private\Files\Config\MountProviderCollection.php:103)
array_filter (d:\docker_dev\nextcloud\src\lib\private\Files\Config\MountProviderCollection.php:104)
OC\Files\Config\MountProviderCollection->addMountForUser (d:\docker_dev\nextcloud\src\lib\private\Files\Config\MountProviderCollection.php:104)
OC\Files\Filesystem::initMountPoints (d:\docker_dev\nextcloud\src\lib\private\Files\Filesystem.php:471)
OC\Files\Filesystem::init (d:\docker_dev\nextcloud\src\lib\private\Files\Filesystem.php:396)
OC_Util::setupFS (d:\docker_dev\nextcloud\src\lib\private\legacy\OC_Util.php:324)
OCA\DAV\Connector\Sabre\Auth->auth (d:\docker_dev\nextcloud\src\apps\dav\lib\Connector\Sabre\Auth.php:241)
OCA\DAV\Connector\Sabre\Auth->check (d:\docker_dev\nextcloud\src\apps\dav\lib\Connector\Sabre\Auth.php:156)
Sabre\DAV\Auth\Plugin->check (d:\docker_dev\nextcloud\src\3rdparty\sabre\dav\lib\DAV\Auth\Plugin.php:182)
Sabre\DAV\Auth\Plugin->beforeMethod (d:\docker_dev\nextcloud\src\3rdparty\sabre\dav\lib\DAV\Auth\Plugin.php:137)
OCA\DAV\Connector\Sabre\Server->emit (d:\docker_dev\nextcloud\src\3rdparty\sabre\event\lib\WildcardEmitterTrait.php:89)
OCA\DAV\Connector\Sabre\Server->invokeMethod (d:\docker_dev\nextcloud\src\3rdparty\sabre\dav\lib\DAV\Server.php:456)
OCA\DAV\Connector\Sabre\Server->start (d:\docker_dev\nextcloud\src\3rdparty\sabre\dav\lib\DAV\Server.php:253)
OCA\DAV\Connector\Sabre\Server->exec (d:\docker_dev\nextcloud\src\3rdparty\sabre\dav\lib\DAV\Server.php:321)
OCA\DAV\Server->exec (d:\docker_dev\nextcloud\src\apps\dav\lib\Server.php:332)
require_once (d:\docker_dev\nextcloud\src\apps\dav\appinfo\v2\remote.php:35)
{main} (d:\docker_dev\nextcloud\src\remote.php:167)
httpPropFind

lib\private\Files\Config\MountProviderCollection.php
```
addMountForUser(){
	OC\Files\Mount\CacheMountProvider
	OCA\Files_Sharing\MountProvider //Shared mount point
	OCA\Files_Sharing\External\MountProvider
}
```
lib\private\Files\View.php
//add a folder for any mountpoint in this directory and add the sizes of other mountpoints to the folders

# 8.19
 Change Password
http://192.168.100.83:2000/settings/users/changepassword

//changxie-zhaoqhu-enforceChangePasswordFirstLogin-2021-0819-start
```
SELECT t_a.`file_num` + t_b.`share_with_num` + t_c.`share_owner_num` AS all_num,t_u.displayname, t_a.*,t_b.`share_with_num`,t_c.`share_owner_num` FROM 
(SELECT COUNT(*) AS file_num,created_by FROM oc_filecache WHERE `created_by` != '' GROUP BY `created_by` ) AS t_a, 
(SELECT COUNT(*) AS share_with_num,share_with FROM oc_share WHERE share_with != '' GROUP BY share_with 
) AS t_b,  (SELECT COUNT(*) AS share_owner_num,uid_owner FROM oc_share WHERE uid_owner != '' GROUP BY uid_owner 
) AS t_c, oc_users AS t_u  WHERE t_a.created_by = t_b.share_with AND t_a.created_by = t_c.uid_owner AND t_a.created_by = t_u.uid ORDER BY all_num DESC LIMIT 10


SELECT COUNT(*) AS file_num,created_by FROM oc_filecache WHERE `created_by` != '' GROUP BY `created_by` 

SELECT COUNT(*) AS share_with_num,share_with FROM oc_share WHERE share_with != '' GROUP BY share_with 

SELECT COUNT(*) AS share_owner_num,uid_owner FROM oc_share WHERE uid_owner != '' GROUP BY uid_owner 



SELECT t_u.uid,t_a.`file_num` + t_b.`share_with_num` + t_c.`share_owner_num` AS all_num,t_u.displayname, t_a.*,t_b.`share_with_num`,t_c.`share_owner_num` FROM oc_users AS t_u LEFT JOIN (SELECT COUNT(*) AS file_num,created_by FROM oc_filecache WHERE `created_by` != '' GROUP BY `created_by`) AS t_a ON t_u.uid = t_a.created_by

LEFT JOIN (SELECT COUNT(*) AS share_with_num,share_with FROM oc_share WHERE share_with != '' GROUP BY share_with 
) AS t_b ON t_u.uid = t_b.share_with LEFT JOIN (SELECT COUNT(*) AS share_owner_num,uid_owner FROM oc_share WHERE uid_owner != '' GROUP BY uid_owner 
) AS t_c ON t_u.uid = t_c.uid_owner




SELECT t_u.uid,t_u.displayname, IF(t_a.file_num IS NULL,0, t_a.file_num) AS file_num, IFNULL(t_b.`share_with_num`,0) AS share_with_num_b,
IFNULL(t_c.`share_owner_num`,0) AS share_owner_num_b FROM oc_users AS t_u LEFT JOIN (SELECT COUNT(*) AS file_num,created_by FROM oc_filecache WHERE `created_by` != '' GROUP BY `created_by`) AS t_a ON t_u.uid = t_a.created_by

LEFT JOIN (SELECT COUNT(*) AS share_with_num,share_with FROM oc_share WHERE share_with != '' GROUP BY share_with 
) AS t_b ON t_u.uid = t_b.share_with LEFT JOIN (SELECT COUNT(*) AS share_owner_num,uid_owner FROM oc_share WHERE uid_owner != '' GROUP BY uid_owner 
) AS t_c ON t_u.uid = t_c.uid_owner



SELECT * ,`file_num` + `share_with_num` + `share_owner_num` AS all_num FROM (SELECT t_u.uid,t_u.displayname, IF(t_a.file_num IS NULL,0, t_a.file_num) AS file_num, IFNULL(t_b.`share_with_num`,0) AS share_with_num,
IFNULL(t_c.`share_owner_num`,0) AS share_owner_num FROM oc_users AS t_u LEFT JOIN (SELECT COUNT(*) AS file_num,created_by FROM oc_filecache WHERE `created_by` != '' GROUP BY `created_by`) AS t_a ON t_u.uid = t_a.created_by

LEFT JOIN (SELECT COUNT(*) AS share_with_num,share_with FROM oc_share WHERE share_with != '' GROUP BY share_with 
) AS t_b ON t_u.uid = t_b.share_with LEFT JOIN (SELECT COUNT(*) AS share_owner_num,uid_owner FROM oc_share WHERE uid_owner != '' GROUP BY uid_owner 
) AS t_c ON t_u.uid = t_c.uid_owner) AS t_temp ORDER BY all_num DESC LIMIT 0,10


SELECT * FROM oc_activity WHERE `type` LIKE "%open%"


SELECT * FROM `oc_filecache` WHERE 1 = 1 AND created_by != '' AND `name` REGEXP '(doc|docx|xls|xlsx|ppt|pptx)$'


SELECT * FROM oc_share WHERE stime >= '' GROUP BY file_source 






	SELECT t_a.`object_id`, t_a.active_num, t_f.name,t_f.created_by FROM (SELECT COUNT(*) AS active_num, `object_id` FROM oc_activity WHERE app = 'files' 
	AND (`subject` = 'downloaded_self' OR `subject` = 'opened_self')
	 GROUP BY `object_id`)
	 AS t_a, oc_filecache AS t_f WHERE t_a.`object_id` = t_f.`fileid` AND t_f.`name` REGEXP '(doc|docx|xls|xlsx|ppt|pptx)$'  ORDER BY t_a.active_num DESC LIMIT 10




SELECT t_a.`file_num` + t_b.`share_with_num` + t_c.`share_owner_num` AS all_num,t_u.displayname, t_a.*,t_b.`share_with_num`,t_c.`share_owner_num` FROM 
(SELECT COUNT(*) AS file_num,created_by FROM oc_filecache WHERE `created_by` != '' GROUP BY `created_by` ) AS t_a, 
(SELECT COUNT(*) AS share_with_num,share_with FROM oc_share WHERE share_with != '' GROUP BY share_with 
) AS t_b,  (SELECT COUNT(*) AS share_owner_num,uid_owner FROM oc_share WHERE uid_owner != '' GROUP BY uid_owner 
) AS t_c, oc_users AS t_u  WHERE t_a.created_by = t_b.share_with AND t_a.created_by = t_c.uid_owner AND t_a.created_by = t_u.uid ORDER BY all_num DESC LIMIT 10


SELECT COUNT(*) AS file_num,created_by FROM oc_filecache WHERE `created_by` != '' GROUP BY `created_by` 

SELECT COUNT(*) AS share_with_num,share_with FROM oc_share WHERE share_with != '' GROUP BY share_with 

SELECT COUNT(*) AS share_owner_num,uid_owner FROM oc_share WHERE uid_owner != '' GROUP BY uid_owner 



SELECT t_u.uid,t_a.`file_num` + t_b.`share_with_num` + t_c.`share_owner_num` AS all_num,t_u.displayname, t_a.*,t_b.`share_with_num`,t_c.`share_owner_num` FROM oc_users AS t_u LEFT JOIN (SELECT COUNT(*) AS file_num,created_by FROM oc_filecache WHERE `created_by` != '' GROUP BY `created_by`) AS t_a ON t_u.uid = t_a.created_by

LEFT JOIN (SELECT COUNT(*) AS share_with_num,share_with FROM oc_share WHERE share_with != '' GROUP BY share_with 
) AS t_b ON t_u.uid = t_b.share_with LEFT JOIN (SELECT COUNT(*) AS share_owner_num,uid_owner FROM oc_share WHERE uid_owner != '' GROUP BY uid_owner 
) AS t_c ON t_u.uid = t_c.uid_owner




SELECT t_u.uid,t_u.displayname, IF(t_a.file_num IS NULL,0, t_a.file_num) AS file_num, IFNULL(t_b.`share_with_num`,0) AS share_with_num_b,
IFNULL(t_c.`share_owner_num`,0) AS share_owner_num_b FROM oc_users AS t_u LEFT JOIN (SELECT COUNT(*) AS file_num,created_by FROM oc_filecache WHERE `created_by` != '' GROUP BY `created_by`) AS t_a ON t_u.uid = t_a.created_by

LEFT JOIN (SELECT COUNT(*) AS share_with_num,share_with FROM oc_share WHERE share_with != '' GROUP BY share_with 
) AS t_b ON t_u.uid = t_b.share_with LEFT JOIN (SELECT COUNT(*) AS share_owner_num,uid_owner FROM oc_share WHERE uid_owner != '' GROUP BY uid_owner 
) AS t_c ON t_u.uid = t_c.uid_owner



SELECT * ,`file_num` + `share_with_num` + `share_owner_num` AS all_num FROM (SELECT t_u.uid,t_u.displayname, IF(t_a.file_num IS NULL,0, t_a.file_num) AS file_num, IFNULL(t_b.`share_with_num`,0) AS share_with_num,
IFNULL(t_c.`share_owner_num`,0) AS share_owner_num FROM oc_users AS t_u LEFT JOIN (SELECT COUNT(*) AS file_num,created_by FROM oc_filecache WHERE `created_by` != '' GROUP BY `created_by`) AS t_a ON t_u.uid = t_a.created_by

LEFT JOIN (SELECT COUNT(*) AS share_with_num,share_with FROM oc_share WHERE share_with != '' GROUP BY share_with 
) AS t_b ON t_u.uid = t_b.share_with LEFT JOIN (SELECT COUNT(*) AS share_owner_num,uid_owner FROM oc_share WHERE uid_owner != '' GROUP BY uid_owner 
) AS t_c ON t_u.uid = t_c.uid_owner) AS t_temp ORDER BY all_num DESC LIMIT 0,10


SELECT * FROM oc_activity WHERE `type` LIKE "%open%"


SELECT * FROM `oc_filecache` WHERE 1 = 1 AND created_by != '' AND `name` REGEXP '(doc|docx|xls|xlsx|ppt|pptx)$'


SELECT * FROM oc_share WHERE stime >= '' GROUP BY file_source 






SELECT  t_f.fileid, t_a.active_num, t_f.name,t_f.created_by, t_u.displayname FROM oc_filecache AS t_f LEFT JOIN 
(SELECT COUNT(*) AS active_num, `object_id` FROM oc_activity WHERE app = 'files' 
AND (`subject` = 'downloaded_self' OR `subject` = 'opened_self')
 GROUP BY `object_id`)
 AS t_a ON t_a.`object_id` = t_f.`fileid` LEFT JOIN oc_users AS t_u ON t_f.created_by = t_u.uid WHERE t_f.`name` REGEXP '(doc|docx|xls|xlsx|ppt|pptx)$'  ORDER BY t_a.active_num DESC LIMIT 10

SELECT * FROM oc_activity WHERE `type` = 'file_opened'


SELECT * FROM oc_appconfig WHERE configkey = 'shareapi_default_permissions'


SELECT * FROM oc_appconfig WHERE appid = 'user_status'


SELECT * FROM oc_preferences WHERE configkey = 'lastLogin' ORDER BY userid ASC


SELECT * FROM oc_preferences WHERE userid = 'zqh' AND configkey = 'lastLogin'


SELECT * FROM oc_preferences WHERE userid = 'zhaoqhu' AND configkey = 'lastLogin'  

 DELETE FROM oc_preferences WHERE  userid = 'zhaoqhu' AND configkey = 'lastLogin'  
```
# 8.20

loginWithCookie
 Single device login

cookie:
nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; oc_sessionPassphrase=MiIVIuhYskxoHR7NZMj8shPP4opSWrwSfpIL25LH3n%2FrcvDytmH%2FLjkKKCxw5ckBVGvbnw9sXV48H73rQFbWZt4YWgNgKLV%2BYWbg9BrgOmJSBiubrgwczIrmpqpDzUSt; jenkins-timestamper-offset=-28800000; nc_username=admin; JSESSIONID.13785da4=node0yfu5pt1vmp0h1l9ui38gecbln1266.node0; screenResolution=1920x1080; ocgrna7xwyio=84ed0a0d4bd124cea021e37c99dd5b07; nc_token=a0Gz%2FvyEhpyl2KgwoycQVNCxjgV%2F5w3K; nc_session_id=84ed0a0d4bd124cea021e37c99dd5b07


6080: cookie
nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; nc_username=admin; oc_sessionPassphrase=9abFng04dzoR11+OQcnAd8atOk2u69J6PzF/VZBeiMLQv0HKzUYrExz6EIKEPK9IWKKC4+288YdHUJEfu1SRJYilIqnWY/rd8aSeJrxgJ8Xh0e4ED6GgS2s/waqcKlA0; nc_token=sJ6XW1S2f3wdBVXfEr2wpajnh2+Amd9w; nc_session_id=bfac5cdaa498dbc22d748c5e5c732eef; ockv338j4g3o=7b3077a5328f33e8f443bcc9727a6e62

nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; nc_username=admin; oc_sessionPassphrase=Z3B5BmhGA5R9kRPjtgy79cNbMVZtCnjbPd5HqHQCeQId/4/zExJf1mLvavKQ0P195P1AJkrHopDVXs3fo7VkYT18JnHXkVRAUzNe+AYo3FiqNb6ReHbc55xnNuiMtJAP; ockv338j4g3o=d1e9e653cfa9f295e09ec472e62a4389; nc_token=aFh2gz3MkAwNHV0DkVqBRmKGJOT3NJhd; nc_session_id=d1e9e653cfa9f295e09ec472e62a4389



# Login mode: cookie login
 When there is NC in the browser's cookie_ username,nc_ token,nc_ session_ When ID, a cookie login is triggered.
```
	if (isset($_COOKIE['nc_username'])
			&& isset($_COOKIE['nc_token'])
			&& isset($_COOKIE['nc_session_id'])
			&& $userSession->loginWithCookie($_COOKIE['nc_username'], $_COOKIE['nc_token'], $_COOKIE['nc_session_id'])) {
			return true;
		}
```
lib\private\User\Session.php

```
public function setMagicInCookie($username, $token) {
	$secureCookie = OC::$server->getRequest()->getServerProtocol() === 'https';
	$webRoot = \OC::$WEBROOT;
	if ($webRoot === '') {
		$webRoot = '/';
	}

	$maxAge = $this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15);
	\OC\Http\CookieHelper::setCookie(
		'nc_username',
		$username,
		$maxAge,
		$webRoot,
		'',
		$secureCookie,
		true,
		\OC\Http\CookieHelper::SAMESITE_LAX
	);
	\OC\Http\CookieHelper::setCookie(
		'nc_token',
		$token,
		$maxAge,
		$webRoot,
		'',
		$secureCookie,
		true,
		\OC\Http\CookieHelper::SAMESITE_LAX
	);
```
lib\private\Authentication\Login\FinishRememberedLoginCommand.php
```
public function process(LoginData $loginData): LoginResult {
	if ($loginData->isRememberLogin() && $this->config->getSystemValue('auto_logout', false) === false) {
		$this->userSession->createRememberMeToken($loginData->getUser());
	}

	return $this->processNextOrFinishSuccessfully($loginData);
}
```

"303de498c8520b58c8c98bcfad65166f"
# 8.23
 Set user oc_preferences configuration table
$this->config->setUserValue($user->getUID(), 'login_token', $token, $this->timeFactory->getTime()); 
validSessionID
$this->config->setUserValue($user->getUID(), 'login', 'currentSessionID', $this->session->getId()); 
Set cookie s
try {
	\OC\Http\CookieHelper::setCookie(
		'nc_session_id',
		$this->session->getId(),
		$maxAge,
		$webRoot,
		'',
		$secureCookie,
		true,
		\OC\Http\CookieHelper::SAMESITE_LAX
	);
} catch (SessionNotAvailableException $ex) {
	// ignore
}

Set the session when the user logs in_ id

//lib\private\User\Session.php
completeLogin(

// When creating a user, you need to check the authorization information

department/user/create


# 8.24
SSO It is to solve the problem that a user can log in to any application unimpeded after logging in to the authentication server once. One login and multi system access. The operating user is the actual official user of the application. The user's authority and domain are subject to the storage of the authentication server.

OAuth2.0 The solution is to obtain the operation authority of a system through a token. Because there is the identification of clientId, one login can only be effective for the system. The operation user of the third-party application is not the official user of the authentication system, and the authorization authority authentication center can restrict it.
--------

# 8.25
 Disable the user and clear bruteforce when the user is enabled_ attamp action signin
http://192.168.100.83:2000/index.php/apps/departmentuser/department/user/setenabled

http://192.168.100.226:6080/ocs/v2.php/cloud/users/zqh/enable

docker exec -u www-data nextcloud_app_1 php occ --no-warnings app:enable departmentuser


mysqldump --single-transaction -unextcloud -pnextcloud --databases nextcloud > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak

https://apps.nextcloud.com/apps/nextbackup


https://github.com/pbek/nextbackup/releases

# 8.26
mysql group by 1055

  ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

[mysqld]
sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"

SET sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"


# 8.27
http://192.168.100.83:2000/ocs/v2.php/apps/files_sharing/api/v1/shares

{shareType: 0, path: "/Word processing (332). Docx ", permissions: 1, sharewith:" Yuda "}
path: "/Word processing (332).docx“
permissions: 1
shareType: 0
shareWith: "yuda"

# 8.28

Check user concurrency status
 User manual exit is set to offline
 If the user exits abnormally, the background task cron executes the task offline

# 8.30
 Check the number of users online at the same time in the authorization file

# 9.1
 Modify and check the number of simultaneous online in the authorization file
 Modify print file dynamics

## Add custom_param
 Share type is user
 Share type is Department
 The sharing type is public connection






# 9.3
```
$enterpriseObj = \OC::$server->getEnterprisesController()
SELECT * FROM oc_preferences WHERE configkey LIKE '%currentSessionID%';






edd74d679491402f8cc8a1fa863fc52a

e33d4ece51f2497d7f37173e1717a024



SELECT * FROM oc_activity WHERE `subject` LIKE "%favorite%"



SELECT * FROM oc_du_department



SELECT * FROM oc_filecache WHERE fileid = 37761

SELECT * FROM oc_activity ORDER BY activity_id ASC LIMIT 80000,40000


SELECT * FROM oc_appconfig WHERE configkey LIKE '%share%'



SELECT GROUP_CONCAT( `department_id` SEPARATOR ',' ) AS `department_id` FROM oc_du_department_user WHERE user_id = 'zhaoqhu'


SELECT * FROM oc_share WHERE `share_type` = 999 AND `file_source` = 32638 AND `share_with` IN (13,2,3)


SELECT `department_id` FROM oc_du_department_user WHERE user_id = 'zhaoqhu'




"SELECT permissions FROM oc_share WHERE `share_type` = :share_type AND `file_source` = :file_source AND `share_with` IN (SELECT `department_id` FROM oc_du_department_user WHERE user_id = :user_id)"



SELECT permissions,custom_param AS customParam,uid_owner AS shareOwner,updated_at AS updatedAt FROM `oc_share` WHERE `share_type` = 999 AND `file_source` = 29850 AND `share_with` IN (2,3,7) ORDER BY updated_at DESC LIMIT 1



SELECT * FROM oc_share WHERE uid_owner != uid_initiator

SELECT * FROM oc_filecache WHERE fileid = 11626


SELECT * FROM oc_appconfig WHERE configkey LIKE "%password%"


SELECT * FROM oc_appconfig WHERE appid = 'files'
UPDATE oc_appconfig SET configvalue = 0 WHERE appid = 'files' AND configkey = 'printFileOffice'



SELECT * FROM oc_activity WHERE `subject` LIKE "%move%" 


```

# 9.4
/OC/Notification/Manager

# 9.6


Login: OC\Session\CryptoSessionData
"EHMHeBVPmWx4keOsMRS/g6Jef3LCuA7PayxIs8jfSl2tVJoW0vkxgHoeeo4johdvIFHt6ATu4Bp6PRWPChXQJR0MvZa+AsbF/mawXir1pOs8MexAtdB2a2EM64SLzvRm"




-------------------------------------------
ChangePassword: OC\Session\CryptoSessionData
"EHMHeBVPmWx4keOsMRS/g6Jef3LCuA7PayxIs8jfSl2tVJoW0vkxgHoeeo4johdvIFHt6ATu4Bp6PRWPChXQJR0MvZa+AsbF/mawXir1pOs8MexAtdB2a2EM64SLzvRm"


"encrypted_session_data"

"b715d01c31048c931a6bfca6be0899b65d3a9394a2d0c8f4863ff7e577b6baf87deb2a8b637a6516f958b6980c1856a85ee37a4f94aa29eb83b2a3391874e45633a2a5d602a19ce41a1b30b4d2b4d57fb4d37344fee46b12ead73a8afed2b70218107db46e3bd50c6b8ff6d68a19affc96048b7d2330decfd89d6f2359bea8978e3b4b865941e54fdda3fd5af328fd0f5ffbe0702430b823ea51235fd1acfe0fbbc4e7cb0fadc96adc3c28b5baf58e06313c20ed5449b25567d70faad1bdfe24cff0956dbd2cdb9611f362f5e2e57c7a0a4e9ca93bb1cbead197411e674b26097991c94b1590b0fb8adb4776571cda536dc3d4e513e0f7c1345652b100ac16dde76d3bce2b268968ba126abc00df6214f26dedc84a409b3cce09fbb9986815d1e98ed815e1e07349e0eb7db28021e507d8a620d7716d329b5b2185d6a4e83af11ad9e740efc64246969e6dde3a37f9b3ade0164ae2b0d2106925583536cc743e1d4df1bf80a31f72b62e4b6edb3aa95080e1a631c13a43e087296ab01a3413bf|b6fefbca51488af128c90abb16e536fb|9c36040e7a16beb9d34608df1c14bd3b73a57ea5528c076927d817f9c72629856311bed89db1b950c6f0297d8242f7b2f021f35d82f56e32f22988bb533c88a4|3"



"b715d01c31048c931a6bfca6be0899b65d3a9394a2d0c8f4863ff7e577b6baf87deb2a8b637a6516f958b6980c1856a85ee37a4f94aa29eb83b2a3391874e45633a2a5d602a19ce41a1b30b4d2b4d57fb4d37344fee46b12ead73a8afed2b70218107db46e3bd50c6b8ff6d68a19affc96048b7d2330decfd89d6f2359bea8978e3b4b865941e54fdda3fd5af328fd0f5ffbe0702430b823ea51235fd1acfe0fbbc4e7cb0fadc96adc3c28b5baf58e06313c20ed5449b25567d70faad1bdfe24cff0956dbd2cdb9611f362f5e2e57c7a0a4e9ca93bb1cbead197411e674b26097991c94b1590b0fb8adb4776571cda536dc3d4e513e0f7c1345652b100ac16dde76d3bce2b268968ba126abc00df6214f26dedc84a409b3cce09fbb9986815d1e98ed815e1e07349e0eb7db28021e507d8a620d7716d329b5b2185d6a4e83af11ad9e740efc64246969e6dde3a37f9b3ade0164ae2b0d2106925583536cc743e1d4df1bf80a31f72b62e4b6edb3aa95080e1a631c13a43e087296ab01a3413bf|b6fefbca51488af128c90abb16e536fb|9c36040e7a16beb9d34608df1c14bd3b73a57ea5528c076927d817f9c72629856311bed89db1b950c6f0297d8242f7b2f021f35d82f56e32f22988bb533c88a4|3"

OC\Session\CryptoSessionData

session id
"933fff0a4aacad695bafdd1761357a94"


"0fb891024b80b2481ab99d9ee63b39b8"


# 9.6

Link sharing
http://192.168.100.83:2000/s/PJBtdoXksEKnk4A






```
# 9.7
"cUnm0gPtc9Q6AYqR+3iQ3GwsrfAsK0DvGpY7uGq8enELjuSbCVyYC0EWinCnONpUjjVtby9A1NXkDJ4j0FOZ7/syUupZAkwK90FD+8IKnjsRKM9Y7bjx+vzBV36titLmdaz5VvQD3D5vkM5pC1ACjMoDgjrXuT8ioTHZZEl3LgfXSgtkA7p+MA7uTPDX6+ymHw/MV7qfkGpiK3S3QrSawuvSqWh9mSctuHNKpk7Cncsf8JWmjtFFXKBGPPHF+3i9CsnNFAPTDpVYJUnRSRTTmea47ylaAyrN1Pzt8gkopDBHQJK/DeIJjR2lPPkX3t1jjJsunU0fOLoM2j+SoSL0dy2S5YEVJN59fJG7m4bHspY+DGif7ZxT5PmnReVZTEqWDpUYfmC8tq2yC1YZekNCZkYw3zsNc5mi7KNLWqrKSU7TXslF2qYc9ONbSOmxeK61CbcJkak7u/0m3DVjbNby+t5M1Rk7crCX5lpteYZ1iAVVAmUxkrEOqYlvPG93ezPIIJ2UGQG4FFIA2pI6VWVkKo57OuUO8+hOEdxRUyqberACMh50m5ylXM/XNAJA7Qg1KR8EWFw3Y8yr28MjRwHTgS1SYVsksk6O2v/Hkn0DUiF3kd0r8j+aSo3HdBI52dy3CcRF4WFQi+2BXItIGFXek/m8esJPjBflYZd5wmy//QPzpbq7OrDt7UMLJAwUH1tYR+LT70wQ0JDs1klPAu1RG0CM+NhXFTQdScvQfw/Q7fgAuvWPHyVoid5C2mPwvrdsA52PvriSyoQcClUUX4zu24Q8Cf/3k+fvlQgl42mGXmlhiMSaxGu4cJVAKEaQ4qoYAJ2zQQIHtDXrgl6xtA5Xv4roj95CnLutg942KMv/Tivk+qNKdJEd8KkSX/5OOE1yskb2SbViXcgUMYmWoUvoDqeZBMBOOOJUS7FkhNQvgfrVNA/JdyJSEtAR0hDS6iecL447saFD3tbp3kg8gN+tAQ8HX6pd4feC95U7jSnCh+8E0mjDUH/lpGRf8aQ1hZqu"
```

1.
sudo passwd root



# 9.8
```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCcPcGt1mlk3WBnuE2zRNcduFjwS9tj9ql2nKKoXkqrLCkg5pRlYzo+3tEZuwUSBFtdpj6GVb40G2fM5ov0SofTa3T1qKctt1gi5dYIsyAvEjI9uAzBpmdAh1ht3YRtwYf6c1pM3D27dZuFVH8QWJCijr4WFt+Ljp+l7BrK7pm1g1mlCvwdvpk48Wa800nFUUJ51RSnyb5KvtlZIWBvLrVYSJGJpYydmtcB1Q7W5k6cXMKa36sdbqP75ZG2cA4a9oHCs4/n2MsSxfn1qDCWm9XGxNhL331+V4DpzP0oHSpAN9y8twD4e4dZk4ZM/TTltVrV8lDv+8FZVhPN2L0VOfWQik8ft1xgixUkpRq8pnD8/lwDaYsTfMx9uIRxHioI/PGTfLn9qPTFdwTe1W1oGHTJUEZ65oIrWEtHQG0TI69WWNPhR5xb8PUpsAm1V1j+Yzqw786iZQRzOo5YuxajlYCS4Dex7BztS7xzx3kqwKbfo3nKbuPmONHS+Ov2htDojqc= changxie@DESKTOP-QINDEP1

```
```
    $enterprise = \OC::$server->getEnterprisesController();
    $tokenCoCharaCode = $enterprise->getTokenCoCharaCode();

```

# 9.9 Folder or file open modification time

```
$inSubjectStr = "'".implode("','",$inSubjectArr)."'";
		
		if($filter == 'folder') {
			$sql = 'SELECT `path` FROM `*PREFIX*filecache` WHERE `fileid` = :fileid';
			$stmt = $this->connection->prepare($sql);
			$stmt->bindParam(':fileid',$objectId);
			$stmt->execute();
			$row = $stmt->fetch();
			if($row == false){
				return $retData;
			}
			$folderName = strstr($row['path'],'/');
			$regFolder = "^(".$folderName.".*)$";
			
			$sql = "SELECT t_u.`displayname`,`activity_id`,`timestamp`,`type`,`user`,`subject`,`file`,`subjectparams`,`object_id`,`affecteduser` FROM `*PREFIX*activity` AS t_a LEFT JOIN `oc_users` AS t_u ON t_a.affecteduser = t_u.uid  WHERE `affecteduser` = :user_id AND `subject` IN (".$inSubjectStr.") AND `object_type` = :object_type AND `file` REGEXP :regfolder";

```



subscription_info//Share by department for the first time
updateShare//Modify collaboration mode
deleteShare//Cancel collaboration mode





insert  into `oc_notifications`(`app`,`user`,`timestamp`,`object_type`,`object_id`,`subject`,`subject_parameters`,`message`,`message_parameters`,`link`,`icon`,`actions`,`is_read`) values 
('support','admin',1630374013,'subscription','large','subscription_info','[]','','[]','/settings/admin/support','','[]',0),
('files_sharing','admin',1630375300,'share','ocinternal:563','deleteShare','{\"currentPermission\":\"\",\"oldPermission\":\"\",\"setPermissionShow\":false,\"fileOwner\":\"baoxiao10\",\"nodeType\":\"\",\"folderId\":\"\"}','37570','[]','','','[]',0),
('files_sharing','admin',1630408439,'share','ocinternal:674','updateShare','{\"currentPermission\":1,\"oldPermission\":3,\"setPermissionShow\":false,\"fileOwner\":\"\",\"nodeType\":\"\",\"folderId\":\"\"}','37991','[]','','','[]',0)

# 9.11
```
$this->cache->update(
					$fileId, [
						'mtime' => null, // this magic tells it to not overwrite mtime
						'storage_mtime' => $mtime
					]
				);
```

```
	//zhaoqhu-test-start
			$enterprise = OC::$server->getEnterprisesController();
			$aaa = $enterprise->updateEnterpriseName('bbbbbbbbbbbbc');
			$appCtrl = \OC::$server->getAppConfigController();
			$sysConfig = $appCtrl->getSystemArr();
			
			//zhaoqhu-test-end
```



# 9.13
\OC_Util::redirectToDefaultPage();
public static function redirectToDefaultPage() {
		$location = self::getDefaultPageUrl();
		header('Location: ' . $location);
		exit();
	}
## Integrated routing
### All files
### lately
### Collection
### share
#### Files you shared
#### Shared with you
#### Share via connection
#### Deleted share
#### Pending share
### Deleted files


//changxie-zhaoqhu-redirectDefault-2021-0913-start


//changxie-zhaoqhu-redirectDefault-2021-0913-end



apps/files
```
[
	'name' => 'view#index',
	'url' => '/',
	'verb' => 'GET',
],
```
apps\files\lib\Controller\ViewController.php

public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false) {

### Photo
/apps/photos/


# Recent and shared lists are missing custom_param

# 9.14
$this->config->getSystemValue('instanceid','')



Modify the password directly in the database.
zhaoqhu The password of the account is qwr123. The password encrypted by the database is directly copied to the user's password
3|$argon2id$v=19$m=65536,t=4,p=1$V3gwMDhBVHEwT3E4Y3NIOQ$TsU0+tkORtigec0NamXHh91FHTfYVS4WcipLKXU+AdI
 If you forget the account password of wd01, use the encrypted password above to directly overwrite the current encryption string

# 9.15
```
SELECT * FROM oc_preferences WHERE configkey LIKE '%currentSessionID%';






edd74d679491402f8cc8a1fa863fc52a

e33d4ece51f2497d7f37173e1717a024



SELECT * FROM oc_activity WHERE `subject` LIKE "%favorite%"



SELECT * FROM oc_du_department'

SELECT VERSION();



DELETE FROM oc_preferences WHERE userid = 'zqh7' AND configkey = 'lastLogin'


SELECT VERSION();


DELETE FROM oc_preferences WHERE userid = 'zqh6' AND configkey = 'lastLogin'


SELECT * FROM oc_share WHERE item_source = 8219


SELECT * FROM oc_appconfig WHERE appid = 'files'


SELECT * FROM oc_filecache WHERE fileid = 37761

SELECT * FROM oc_activity ORDER BY activity_id ASC LIMIT 80000,40000


SELECT * FROM oc_appconfig WHERE configkey LIKE '%share%'



SELECT GROUP_CONCAT( `department_id` SEPARATOR ',' ) AS `department_id` FROM oc_du_department_user WHERE user_id = 'zhaoqhu'


SELECT * FROM oc_share WHERE `share_type` = 999 AND `file_source` = 32638 AND `share_with` IN (13,2,3)


SELECT `department_id` FROM oc_du_department_user WHERE user_id = 'zhaoqhu'




"SELECT permissions FROM oc_share WHERE `share_type` = :share_type AND `file_source` = :file_source AND `share_with` IN (SELECT `department_id` FROM oc_du_department_user WHERE user_id = :user_id)"



SELECT permissions,custom_param AS customParam,uid_owner AS shareOwner,updated_at AS updatedAt FROM `oc_share` WHERE `share_type` = 999 AND `file_source` = 29850 AND `share_with` IN (2,3,7) ORDER BY updated_at DESC LIMIT 1



SELECT * FROM oc_share WHERE uid_owner != uid_initiator

SELECT * FROM oc_filecache WHERE fileid = 11626


SELECT * FROM oc_appconfig WHERE configkey LIKE "%password%"


SELECT * FROM oc_appconfig WHERE appid = 'files'
UPDATE oc_appconfig SET configvalue = 0 WHERE appid = 'files' AND configkey = 'printFileOffice'



SELECT * FROM oc_activity WHERE `subject` LIKE "%move%" 


SELECT * FROM oc_notifications WHERE `user` = 'admin' AND app = 'files_sharing' ORDER BY notification_id DESC



SELECT * FROM oc_appconfig WHERE configkey = 'shareapi_allow_links'


SELECT * FROM oc_appconfig WHERE configvalue = 'ocgrna7xwyio'



SELECT * FROM oc_activity WHERE app = 'files_sharing' OR app = 'files'
 GROUP BY `subject` ORDER BY activity_id DESC 
 
 
 
 SELECT * FROM oc_appconfig WHERE configkey = 'downloadFileForbid'
 
 
 
 
 SELECT * FROM oc_notifications WHERE  app = 'files_sharing' GROUP BY `subject` ORDER BY notification_id DESC
 
 
 SELECT * FROM oc_activity WHERE activity_id = 4290
 
 incoming_user_share,updateShare,reshared_user_by,incoming_group_share,expired,expired_user



SELECT * FROM oc_preferences WHERE configkey = 'lastLogin'




unshared_by
update_shared_by
shared_with_by




SELECT * FROM oc_notifications WHERE `notification_id` < 14930 AND `user` = 'admin' AND `app` IN ('files_sharing','support') AND `subject` IN ('unshared_by','update_shared_by','shared_with_by') ORDER BY notification_id DESC LIMIT 30


SELECT * FROM oc_notifications WHERE `app` IN ('files_sharing','support') GROUP BY `subject` ORDER BY notification_id DESC

notification_id : 16781


subscription_info//Share by department for the first time
updateShare//Modify collaboration mode
deleteShare//Cancel collaboration mode

SELECT * FROM oc_activity WHERE activity_id = 14633


SELECT * FROM oc_activity GROUP BY `subject`

SELECT * FROM oc_filecache WHERE fileid = 35343

SELECT * FROM oc_du_department_user WHERE id = 741

SELECT * FROM oc_share WHERE id = 743

SELECT * FROM oc_accounts_data WHERE `name` = 'email' AND `value` != ''


SELECT * FROM oc_preferences WHERE appid = 'settings' AND configkey = 'email'

//1631271115

SELECT mtime,storage_mtime FROM oc_filecache WHERE fileid = 37895


SELECT * FROM oc_share WHERE file_source = 35343

 SELECT * FROM oc_appconfig WHERE appid = 'settings'
 
  SELECT * FROM oc_preferences WHERE userid = 'zqh'




SELECT COUNT(*) AS user_num FROM `oc_users` WHERE `create_at` IS NULL OR `create_at` <= :create_at


SELECT COUNT(*) useage_num FROM `oc_users`


  DELETE FROM oc_preferences WHERE  userid = 'zqh5' AND configkey = 'lastLogin'  
  
 SELECT * FROM oc_users WHERE uid = 'zqh'

//wd02
3|$argon2id$v=19$m=65536,t=4,p=1$YWExREgzS0JQeEFiRHZBUQ$M1NGGQb9izvIbxAGLS8XvU/9sE6v6+fi/v7zu0/ITW8
//

//zhaoqhu
3|$argon2id$v=19$m=65536,t=4,p=1$V3gwMDhBVHEwT3E4Y3NIOQ$TsU0+tkORtigec0NamXHh91FHTfYVS4WcipLKXU+AdI


3|$argon2id$v=19$m=65536,t=4,p=1$VWlvWmp5MDZzaEZwbkhSdQ$FZTmIXFpy+Y6SFiY2cBDnIf56HyO9uCMb9Ijj8EYnpw


SELECT * FROM oc_fileca


SELECT * FROM oc_activity WHERE 


SELECT t_u.`displayname`,`activity_id`,`timestamp`,`type`,`user`,`subject`,`file`,`subjectparams`,`object_id`,`affecteduser` 
FROM `oc_activity` AS t_a LEFT JOIN `oc_users` AS t_u ON t_a.affecteduser = t_u.uid WHERE `subject` IN
 ('changed_self','changed_by','copied_self','copied_by','created_self','created_by','deleted_self','deleted_by','downloaded_self','downloaded_by','moved_self',
 'moved_by','opened_self','opened_by','','','','','added_favorite','','removed_favorite','','renamed_self','renamed_by','uploaded_self','uploaded_by','update_shared_by',
 'update_shared_user_self','shared_with_by','shared_user_self','unshared_by','unshared_user_self','shared_link_self','unshared_link_self','update_shared_link_self') AND 
 (`object_id` = 138684 AND `object_type` = 'files') AND `affecteduser` = 'shaoxl' ORDER BY `timestamp` DESC, `activity_id` DESC LIMIT 50
 
 
 SELECT * FROM oc_accounts_data WHERE uid = 'shaoxl' AND `name` = 'displayname'
 
 
 
 SELECT * FROM oc_users WHERE uid = 'shaoxl'
 
 
 SELECT * FROM oc_activity WHERE object_id = 138684 ORDER BY `timestamp` DESC




```

# 9.16

## Recent list page
```
  SELECT t_f.*, t_c.category FROM oc_filecache AS t_f LEFT JOIN oc_vcategory_to_object AS t_cto 
 ON t_f.fileid = t_cto.objid
 LEFT JOIN oc_vcategory AS t_c ON t_cto.categoryid = t_c.id
  WHERE 
  (`path` NOT REGEXP '^(appdata_|files_trashbin|files_versions|versions).*$' AND `path` != '' ) AND 
  (`storage` = 3 OR created_by = 'zhaoqhu' OR fileid IN 
 
 ( SELECT file_source FROM oc_share WHERE share_with = 'zhaoqhu') )

 GROUP BY fileid ORDER BY mtime DESC LIMIT 0, 100
```


```
mysqlbinlog /var/lib/mysql/binlog.000132

mysqlbinlog /var/lib/mysql/binlog.000125


mysqlbinlog --stop-position="3051904" /var/lib/mysql/binlog.000132 > BackupZQh_1.sql

```
# 9.17 number
## There are still two messages to download
## A message sent to other collaborators after a shared file is moved

## Copy and move, missing destination folder

## When collecting, it was not sent to the sharing collaborator, which has been solved.

```
SELECT t_f.*, t_c.category FROM oc_filecache AS t_f LEFT JOIN oc_vcategory_to_object AS t_cto 
 ON t_f.fileid = t_cto.objid
 LEFT JOIN oc_vcategory AS t_c ON t_cto.categoryid = t_c.id
  WHERE 
  (`path` NOT REGEXP '^(appdata_|files_trashbin|files_versions|versions).*$' AND `path` != '' ) AND 
  (`storage` = 3 OR created_by = 'zhaoqhu' OR fileid IN 
 
 ( SELECT file_source FROM oc_share WHERE share_with = 'zhaoqhu') )

 GROUP BY fileid ORDER BY mtime DESC LIMIT 0, 100
 
 
 
 
 SELECT * FROM oc_appconfig WHERE appid = 'core'
 
 
 
 SELECT VERSION();
 
 
 
SELECT * FROM oc_activity WHERE app = 'files_sharing' ORDER BY activity_id DESC
 
```
# 9.18
```
getRootFolder
$node = $this->rootFolder->getUserFolder($uidOwner)->get($path);
$accessList = $this->shareHelper->getPathsForAccessList($node);

getShareManager
```

## The shared collaboration file rename operation was not sent to collaborators.



# 9.26
## dynamic

### File download duplicate record

Reason: the front end requested twice.
bug:3951 Not for the time being.
### File dynamic backup
```
// $sql = 'SELECT `path` FROM `*PREFIX*filecache` WHERE `fileid` = :fileid';
// $stmt = $this->connection->prepare($sql);
// $stmt->bindParam(':fileid',$objectId);
// $stmt->execute();
// $row = $stmt->fetch();
// $accessList = [];
// $connDb = \OC::$server->getDatabaseConnection();
// $sql = "SELECT t_f.`path`,t_s.id FROM `*PREFIX*filecache` AS t_f LEFT JOIN `*PREFIX*storages` AS t_s ON t_f.`storage` = t_s.`numeric_id` WHERE fileid = :fileid";
// $stmt = $connDb->prepare($sql);
// $stmt->bindParam(':fileid',$objectId);
// $stmt->execute();
// $row = $stmt->fetch();
// if($row == false){
// 	return $retData;
// }
// $fileOwner = substr($row['id'],6);
// $filePath = substr($row['path'],5);
// $rootFolder = \OC::$server->getRootFolder();
// $node = $rootFolder->getUserFolder($fileOwner)->get($filePath);
// $shareManager = \OC::$server->getShareManager();
// $shareHelper = new ShareHelper($shareManager);
// $accessList = $shareHelper->getPathsForAccessList($node);
// if(!empty($accessList['users'])){
// 	$folderName = $accessList['users'][$user];
// }
// if($folderName == ''){
// 	return $retData;
// }
// $folderName = strstr($row['path'],'/');
//$regFolder = "^(".$folderName.".*)$";
// $sql = "SELECT t_u.`displayname`,`activity_id`,`timestamp`,`type`,`user`,`subject`,`file`,`subjectparams`,`object_id`,`affecteduser` FROM `*PREFIX*activity` AS t_a LEFT JOIN `oc_users` AS t_u ON t_a.affecteduser = t_u.uid  WHERE `affecteduser` = :user_id AND `subject` IN (".$inSubjectStr.") AND `object_type` = :object_type AND `file` REGEXP :regfolder";
```

```
	/**
	 * //changxie-zhaoqhu-2021-0926-start
	 * //changxie-zhaoqhu-2021-0926-end
	 * 
	 * @param string $uid
	 */
	protected function getUserDisplaynameByUid($uid){
		$sql = "SELECT `displayname` from `*PREFIX*users` where `uid` = :uid";
		$dbConn = \OC::$server->getDatabaseConnection();
		$stmt = $dbConn->prepare($sql);
		$stmt->bindParam(':uid',$uid);
		$stmt->execute();
		$row = $stmt->fetch();
		$displayname = trim($row['displayname']) != '' ? trim($row['displayname']) : $uid;
		return $displayname;
	}
```
### Folder dynamics
```
// $sql = "SELECT tp_a.*,tp_u.displayname AS affectedusername FROM (SELECT t_u.`displayname`,`activity_id`,`timestamp`,`type`,`user`,`affecteduser`,`subject`,`file`,`subjectparams`,`object_id` FROM `*PREFIX*activity` AS t_a LEFT JOIN `*PREFIX*users` AS t_u ON t_a.user = t_u.uid LEFT JOIN `*PREFIX*filecache` AS t_f ON t_a.`object_id` = t_f.`fileid` WHERE `affecteduser` = :user_id AND `subject` IN (".$inSubjectStr.") AND `object_type` = :object_type AND (t_f.`fileid` = :fileid OR t_f.`parent` = :parent)";

// if($since > 0){
// 	$sql .= ' AND (`activity_id` < :since)';
// }
// $sql .=  ' ORDER BY `timestamp` DESC, `activity_id` DESC LIMIT '.$limit;
// $sql .= ") AS tp_a LEFT JOIN `*PREFIX*users` AS tp_u ON tp_a.affecteduser = tp_u.uid";
// $stmt = $this->connection->prepare($sql);
// $stmt->bindParam(':user_id', $user);
// $stmt->bindParam(':object_type', $objectType);
// //$stmt->bindParam(':regfolder', $regFolder);
// $stmt->bindParam(':fileid', $objectId);
// $stmt->bindParam(':parent', $objectId);
// if($since > 0){
// 	$stmt->bindParam(':since', $since);
// }
$sql = "SELECT tp_a.*,tp_u.displayname AS affectedusername FROM (SELECT t_u.`displayname`,`activity_id`,`timestamp`,`type`,`user`,`subject`,`file`,`subjectparams`,`object_id`,`affecteduser` FROM `*PREFIX*activity` AS t_a LEFT JOIN `oc_users` AS t_u ON t_a.affecteduser = t_u.uid WHERE `subject` IN (".$inSubjectStr.") AND (`object_id` = :object_id AND `object_type` = :object_type) AND `affecteduser` = :user_id";
			if($since > 0){
				$sql .= ' AND (`activity_id` < :activity_id)';
			}
			$sql .= ' ORDER BY `timestamp` DESC, `activity_id` DESC LIMIT '.$limit;
			$sql .= ") AS tp_a LEFT JOIN `*PREFIX*users` AS tp_u ON tp_a.affecteduser = tp_u.uid";
```

# 9.27
```
SELECT * FROM oc_appconfig WHERE configkey = 'printFileOffice'


SELECT * FROM oc_appconfig WHERE configkey = 'copyFileOffice'




SELECT * FROM 



SELECT * FROM oc_activity WHERE `subject` LIKE "%print%"


SELECT * FROM oc_activity WHERE `subject` LIKE "%copied%"



SELECT tp_a.*,tp_u.displayname AS affectedusername FROM (SELECT t_u.`displayname`,`activity_id`,`timestamp`,`type`,`user`,`affecteduser` ,`subject`,`file`,`subjectparams`,`object_id`
FROM `oc_activity` AS t_a LEFT JOIN `oc_users` AS t_u ON t_a.user = t_u.uid LEFT JOIN oc_filecache AS t_f ON t_f.`fileid` = t_a.`object_id`  WHERE `affecteduser` = 'zhaoqhu' AND `subject` 
IN ('changed_self','changed_by','copied_self','copied_by','created_self','created_by','deleted_self','deleted_by','downloaded_self','downloaded_by',
'moved_self','moved_by','opened_self','opened_by','printed_self','printed_by','','','added_favorite','added_favorite_by','removed_favorite',
'removed_favorite_by','renamed_self','renamed_by','uploaded_self','uploaded_by','update_shared_by','update_shared_user_self','shared_with_by',
'shared_user_self','unshared_by','unshared_user_self','shared_link_self','unshared_link_self','update_shared_link_self') 
AND `object_type` = 'files' AND (t_f.fileid = 2518 OR t_f.parent = 2518) ORDER BY `timestamp` DESC, `activity_id` DESC LIMIT 50) AS tp_a LEFT JOIN `oc_users` AS 
tp_u ON tp_a.affecteduser = tp_u.uid


SELECT tp_a.*,tp_u.displayname AS affectedusername FROM (SELECT t_u.`displayname`,`activity_id`,`timestamp`,`type`,`user`,`affecteduser` ,`subject`,`file`,`subjectparams`,`object_id`
FROM `oc_activity` AS t_a LEFT JOIN `oc_users` AS t_u ON t_a.user = t_u.uid LEFT JOIN oc_filecache AS t_f ON t_f.`fileid` = t_a.`object_id`  WHERE `affecteduser` = 'shaoxl' AND `subject` 
IN ('changed_self','changed_by','copied_self','copied_by','created_self','created_by','deleted_self','deleted_by','downloaded_self','downloaded_by',
'moved_self','moved_by','opened_self','opened_by','printed_self','printed_by','','','added_favorite','added_favorite_by','removed_favorite',
'removed_favorite_by','renamed_self','renamed_by','uploaded_self','uploaded_by','update_shared_by','update_shared_user_self','shared_with_by',
'shared_user_self','unshared_by','unshared_user_self','shared_link_self','unshared_link_self','update_shared_link_self') 
AND `object_type` = 'files' AND (t_f.fileid = 2518 OR t_f.parent = 2518) ORDER BY `timestamp` DESC, `activity_id` DESC LIMIT 50) AS tp_a LEFT JOIN `oc_users` AS 
tp_u ON tp_a.affecteduser = tp_u.uid



SELECT * FROM oc_filecache WHERE fileid = 2518 OR parent = 2518
```


## //changxie-zhaoqhu-notificationDepart-2021-0927-start



```
 "notification_id": 631,
                "app": "files_sharing",
                "user": "admin",
                "datetime": "2021-09-18T08:54:47+00:00",
                "object_type": "activity_notification",
                "object_id": "6800",
                "subject": "Zhao zhaoqhu Shared 111 with you ShareFolder ",
                "message": "",
                "link": "",
                "subjectOriginal": "shared_with_by",
                "subjectParameters": [
                    {
                        "permissions": 13
                    }
                ],
                "isRead": "0",
                "subjectRich": "{actor} Shared with you {file} ",
                "subjectRichParameters": {
                    "file": {
                        "type": "file",
                        "id": "6800",
                        "name": "111ShareFolder",
                        "path": "111ShareFolder",
                        "mimetype": "httpd/unix-directory",
                        "link": "http://192.168.100.226:6080/f/6800"
                    },
                    "actor": {
                        "type": "user",
                        "id": "zhaoqhu",
                        "name": "Zhao zhaoqhu",
                        "departmentName": "root_1_1,Bao Xiao creates a new sub department",
                        "email": "634959055@qq.com"
                    }
                },
                "messageRich": "",
                "messageRichParameters": [],
                "icon": "",
                "actions": []
            },
```

# 9.27
```
$sql = "SELECT t_u.`displayname`,`activity_id`,`timestamp`,`type`,`user`,`affecteduser`,`subject`,`file`,`subjectparams`,`object_id` FROM `*PREFIX*activity` AS t_a LEFT JOIN `*PREFIX*users` AS t_u ON t_a.user = t_u.uid LEFT JOIN `*PREFIX*filecache` AS t_f ON t_a.`object_id` = t_f.`fileid` WHERE `affecteduser` = :user_id AND `subject` IN (".$inSubjectStr.") AND `object_type` = :object_type AND (t_f.`fileid` = :fileid OR t_f.`parent` = :parent)";
```
# 9.29
```
SELECT * FROM oc_share WHERE item_source = '4594'



SELECT t_f.`path`,t_s.id FROM oc_filecache AS t_f LEFT JOIN oc_storages AS t_s ON t_f.`storage` = t_s.`numeric_id` WHERE fileid = 4594




SELECT t_u.`displayname`,`activity_id`,`timestamp`,`type`,`user`,`affecteduser` ,`subject`,`file`,`subjectparams`,`object_id`
FROM `oc_activity` AS t_a LEFT JOIN `oc_users` AS t_u ON t_a.affecteduser = t_u.uid  WHERE `affecteduser` = 'admin' AND `subject` 
IN ('changed_self','changed_by','copied_self','copied_by','created_self','created_by','deleted_self','deleted_by','downloaded_self','downloaded_by',
'moved_self','moved_by','opened_self','opened_by','printed_self','printed_by','','','added_favorite','added_favorite_by','removed_favorite',
'removed_favorite_by','renamed_self','renamed_by','uploaded_self','uploaded_by','update_shared_by','update_shared_user_self','shared_with_by',
'shared_user_self','unshared_by','unshared_user_self','shared_link_self','unshared_link_self','update_shared_link_self') 
AND `object_type` = 'files' AND `file` REGEXP "^(/111 Documents received/111ShareFolder.*)$" ORDER BY `timestamp` DESC, `activity_id` DESC LIMIT 50



SELECT tp_a.*,tp_u.displayname AS affectedusername FROM (SELECT t_u.`displayname`,`activity_id`,`timestamp`,`type`,`user`,`affecteduser` ,`subject`,`file`,`subjectparams`,`object_id`
FROM `oc_activity` AS t_a LEFT JOIN `oc_users` AS t_u ON t_a.user = t_u.uid LEFT JOIN oc_filecache AS t_f ON t_f.`fileid` = t_a.`object_id`  WHERE `affecteduser` = 'admin' AND `subject` 
IN ('changed_self','changed_by','copied_self','copied_by','created_self','created_by','deleted_self','deleted_by','downloaded_self','downloaded_by',
'moved_self','moved_by','opened_self','opened_by','printed_self','printed_by','','','added_favorite','added_favorite_by','removed_favorite',
'removed_favorite_by','renamed_self','renamed_by','uploaded_self','uploaded_by','update_shared_by','update_shared_user_self','shared_with_by',
'shared_user_self','unshared_by','unshared_user_self','shared_link_self','unshared_link_self','update_shared_link_self') 
AND `object_type` = 'files' AND (t_f.fileid = 6800 OR t_f.parent = 6800) ORDER BY `timestamp` DESC, `activity_id` DESC LIMIT 50) AS tp_a LEFT JOIN `oc_users` AS 
tp_u ON tp_a.affecteduser = tp_u.uid




SELECT t_u.`displayname`,`activity_id`,`timestamp`,`type`,`user`,`affecteduser` ,`subject`,`file`,`subjectparams`,`object_id`
FROM `oc_activity` AS t_a LEFT JOIN `oc_users` AS t_u ON t_a.user = t_u.uid LEFT JOIN oc_filecache AS t_f ON t_f.`fileid` = t_a.`object_id`  WHERE `affecteduser` = 'admin' AND `subject` 
IN ('changed_self','changed_by','copied_self','copied_by','created_self','created_by','deleted_self','deleted_by','downloaded_self','downloaded_by',
'moved_self','moved_by','opened_self','opened_by','printed_self','printed_by','','','added_favorite','added_favorite_by','removed_favorite',
'removed_favorite_by','renamed_self','renamed_by','uploaded_self','uploaded_by','update_shared_by','update_shared_user_self','shared_with_by',
'shared_user_self','unshared_by','unshared_user_self','shared_link_self','unshared_link_self','update_shared_link_self') 
AND `object_type` = 'files' AND t_a.`object_id` IN (6800,6801,6802,6803,6804,6805,6806,6807,6808,6809,6811,6812,6813) ORDER BY `timestamp` DESC, `activity_id` DESC LIMIT 50


SELECT * FROM oc_filecache WHERE path LIKE '%/shareFileTest/README.md%'

(6800,6801,6802,6803,6804,6805,6806,6807,6808,6809,6811,6812,6813)



SELECT `displayname` FROM oc_users WHERE uid = 'admin'



SELECT * FROM oc_du_department_user AS t_du LEFT JOIN  WHERE user_id = 'admin'





INSERT INTO `oc_notifications` ( `app`, `user`, `timestamp`, `object_type`, `object_id`, `subject`, `subject_parameters`, `message`, `message_parameters`, `link`, `icon`, `actions`, `is_read`) VALUES('files_sharing','13','1632392935','activity_notification','3152','shared_with_by','[{\"permissions\":1},{\"shareType\":999},{\"expirationDate\":1633602535}]','','[]','','','[]','0');
INSERT INTO `oc_notifications` (`app`, `user`, `timestamp`, `object_type`, `object_id`, `subject`, `subject_parameters`, `message`, `message_parameters`, `link`, `icon`, `actions`, `is_read`) VALUES('files_sharing','13','1632392959','activity_notification','3153','update_shared_by','[{\"permissions\":33,\"permissionsOld\":1},{\"expirationDate\":\"\"},{\"shareType\":999}]','','[]','','','[]','0');
INSERT INTO `oc_notifications` (`app`, `user`, `timestamp`, `object_type`, `object_id`, `subject`, `subject_parameters`, `message`, `message_parameters`, `link`, `icon`, `actions`, `is_read`) VALUES('files_sharing','13','1632392972','activity_notification','3155','unshared_depart_by','[{\"expirationDate\":1633602572}]','','[]','','','[]','0');
INSERT INTO `oc_notifications` (`app`, `user`, `timestamp`, `object_type`, `object_id`, `subject`, `subject_parameters`, `message`, `message_parameters`, `link`, `icon`, `actions`, `is_read`) VALUES('files_sharing','13','1632396149','activity_notification','3243','unshared_depart_by','[{\"expirationDate\":1633605749}]','','[]','','','[]','0');

INSERT INTO `oc_activity` (`activity_id`, `timestamp`, `priority`, `type`, `user`, `affecteduser`, `app`, `subject`, `subjectparams`, `message`, `messageparams`, `file`, `link`, `object_type`, `object_id`) VALUES('2799','1632392935','30','shared','test_admin','17','files_sharing','shared_with_by','[{\"1606\":\"\\/\\u6587\\u5b57\\u5904\\u7406 (3).docx\"},\"test_admin\",{\"permissions\":1},{\"shareType\":999}]','','[]','/word processing (3).docx','http://192.168.100.83:2000/apps/files/?dir=/','files','1606');
INSERT INTO `oc_activity` (`activity_id`, `timestamp`, `priority`, `type`, `user`, `affecteduser`, `app`, `subject`, `subjectparams`, `message`, `messageparams`, `file`, `link`, `object_type`, `object_id`) VALUES('2800','1632392959','30','shared','test_admin','17','files_sharing','update_shared_by','[{\"1606\":\"\\/\\u6587\\u5b57\\u5904\\u7406 (3).docx\"},\"test_admin\",{\"permissions\":33,\"permissionsOld\":1},{\"expirationDate\":\"\"},{\"shareType\":999}]','','[]','/word processing (3).docx','http://192.168.100.83:2000/apps/files/?dir=/','files','1606');
INSERT INTO `oc_activity` (`activity_id`, `timestamp`, `priority`, `type`, `user`, `affecteduser`, `app`, `subject`, `subjectparams`, `message`, `messageparams`, `file`, `link`, `object_type`, `object_id`) VALUES('2801','1632392972','30','shared','test_admin','17','files_sharing','unshared_depart_by','[{\"1606\":\"\\/\\u6587\\u5b57\\u5904\\u7406 (3).docx\"},\"test_admin\"]','','[]','/word processing (3).docx','http://192.168.100.83:2000/apps/files/?dir=/','files','1606');



SELECT * FROM oc_filecache AS t_f LEFT JOIN oc_mimetypes AS t_m ON t_f.mimepart = t_m.id WHERE fileid = 1606


INSERT INTO `oc_filecache` (`fileid`, `storage`, `created_by`, `path`, `path_hash`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `unencrypted_size`, `etag`, `permissions`, `checksum`) VALUES('1606','2','admin','files/word processing (3).docx','8a31403eb9086908e0eab71663104e2f','62','word processing (3).docx','7','5','12718','1632393118','1632393118','0','0','b2736b24abe3d9cca3381df722d9a564','27','');

SELECT * FROM oc_notifications WHERE `user` IN (13,'admin') AND app = 'files_sharing' ORDER BY notification_id DESC




SELECT t_du.`department_id`,t_d.department_name FROM `oc_du_department_user` AS t_du LEFT JOIN oc_du_department AS t_d ON t_du.department_id = t_d.id WHERE `user_id` = 'admin' 
AND t_du.`is_del` = 0


SELECT `value` AS email FROM oc_accounts_data WHERE uid = 'admin' AND `name` = 'email'



SELECT * FROM oc_filecache WHERE fileid = "6895";

SELECT * FROM oc_share WHERE item_source = '6895'


SELECT * FROM oc_activity GROUP BY `subject`

SELECT t_n.* FROM `oc_notifications` AS t_n LEFT JOIN `oc_activity` AS t_a ON t_n.`object_id` = t_a.`activity_id` WHERE 1 = 1 AND
 t_a.`user` != 'admin'  AND t_n.`user` IN('4','13','admin') AND t_n.`app` IN ('files_sharing') 
AND t_n.`subject` IN ('unshared_by','update_shared_by','shared_with_by','downloadFileLog','unshared_depart_by') ORDER BY notification_id DESC LIMIT 100


SELECT * FROM oc_activity WHERE activity_id = 255


SELECT * FROM oc_notifications WHERE `subject` = 'downloadFileLog' AND `user` = 'admin'


```

Dynamic problem summary:

Rename: renamed_self
 Copy: copied_self
```
$view = Filesystem::getView();
try {
	$owner = $view->getOwner($path);
	$owner = !is_string($owner) || $owner === '' ? null : $owner;
} catch (NotFoundException $e) {
	$owner = null;
}
```
redirect URL
http://192.168.100.83:2000/index.php/apps/files/ajax/download.php?dir=/&files=shareFolderTest&format=json
http://192.168.100.83:2000/login?redirect_url=/index.php/apps/files/ajax/download.php?dir%3D/%26files%3D8888%26format%3Djson
shareFolderTest
http://192.168.100.83:2000/remote.php/webdav/test_download.docx




# Check disk space
http://192.168.100.83:2000/index.php/apps/files/ajax/getstoragestats.php

```
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'smtp.qq.com',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => '634959055',
  'mail_domain' => 'qq.com',
  'mail_smtpport' => '465',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'zhaoqhu@qq.com',
  'mail_smtppassword' => 'epzznkyhrabzbdae',
```




# 9.30
oc_jobs
17 OCA\Files_Trashbin\BackgroundJob\ExpireTrash

## View file directory space size:
SELECT * FROM oc_filecache WHERE `storage` = 5 AND path = 'files'
28017956 = 26.7MB
## View recycle bin space size:

SELECT * FROM oc_filecache WHERE `storage` = 5 AND path LIKE 'files_trash%'
9916367 = 9.45MB
13879403 = 13.23MB
# 10.8

tomcat page load failed with error: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection


# 10.9
```
public static function resizeTrash($user) {
		$size = self::getTrashbinSize($user);

		$freeSpace = self::calculateFreeSpace($size, $user);

		if ($freeSpace < 0) {
			self::scheduleExpire($user);
		}
	}
```

## Departmental collaboration mode message notification solution:
* When the message type is department collaboration message, it is triggered by the message sender when polling the top message to send a message notification to everyone in the current department,
* New entrants to the Department will not be notified,
* New entrants to the Department can see the department collaboration file.

## Download the file. Move the collaboration file that cannot be downloaded to the file that can be downloaded. The download is successful.

## The data you inserted cannot be seen by others before mysql transaction commit.

## 
public function setMailSettings(
 @PasswordConfirmationRequired

# 10.11

## Department sharing notification message type
## Download folder
 The shared file does not have download permission, but it can be downloaded after being moved to its own folder.

# 10.14
```
    ab -n 2000 -c 500 http://*:8000/recommend?companyCode=param
    ./ab -n 2000 -c 500 http://192.168.100.83:2000/status.php

     -n :Number of requests

    -c:   Concurrent number

     param: post Parameters you need to pass

    *: yes IP address
```

Author: Wang Xiaowang
 Link: https://www.zhihu.com/question/39608108/answer/82173112
 Source: Zhihu
 The copyright belongs to the author. For commercial reprint, please contact the author for authorization, and for non-commercial reprint, please indicate the source.

This article solves the problem of many users, that is, how to determine the maximum number of users of the system through the maximum number of concurrent users, because if this problem is not solved, it is difficult for users to select the server most suitable for their own system. Let's take a look at this article. The following is the author's original text.
This article is mainly about performance.
The maximum number of concurrent users of a system is 1100. How can we calculate the maximum number of users supported by the system.
The user performance requirements are as follows: support 1 million registered users
 Performance requirements analysis:
1,According to the requirements of users, the system should support 1 million users. What is the performance machine configuration? What is the peak value? Bandwidth? etc.
2,If the company's test environment is adopted, what performance should be done this time? Performance evaluation, load test, strength test?
3,How to calculate the number of concurrent users? Response time?
Determination of performance index:
Because the performance requirements of users are too wide, no specific value is set. So how do I carry out the follow-up work?
1,It is determined to adopt the company's test environment without considering environmental issues. In other words, the client, server and bandwidth systems can not be considered, which is fixed.
2,Considering the system performance previously developed by the project team, can it be used as a reference value. Solution: find out that the project team has two concurrent projects, and its performance indicators are weighted.
Browsing function: the number of concurrency is 1100, and the average response time is 363 seconds; The average response time per user is 0.33 Seconds. 3 concurrent users per second. One system has 5 million users and the other has 3.2 million users. And the two systems have been running normally, but the current servers of the two systems are three respectively. It can be concluded that a server can carry 1.66 million or more. (because there are claims in the server)
3,100 Million users, so how to calculate his peak active users per hour?
Solution: 80•20 In principle, the peak number of active users per hour is calculated as 6.667 ten thousand/Hours; Then the number of concurrent clicks on the same function point per second should be 18.5. 
4,How to get the concurrency number?
Solution: how many function points does the system have? 153 function points; In other words, the system will click a function 1258 times at peak value, with 0 click per second.35 Times. (regardless of interval time) consider the previous values of this project group. The number of concurrency is preliminarily set to 1100, mainly focusing on browsing, followed by query and addition.
5,Which performance type should be tested? After careful consideration, all three properties should be tested.
Execution performance:
According to the third point in the performance index determination, the concurrency of users is set to 300-350,It depends. Load test, with 1100 as the starting point, the strength test is subject to 15 hours and 24 hours
 Performance test results:
It is found that the maximum user support of the system is 1100.The maximum number of failed users is 209 and the response time is 315. It can be judged that the maximum concurrent number of this system is about 1100. In other words, the system can support 1.5 million users on one server.
Based on the above, it can be concluded that:
1100 When users are concurrent, the total response time of users is 315 seconds (i.e. the average response time per user is 0.005 Seconds), of which 209 failed users are generated at most, but successful users can basically complete subsequent operations, which meets the maximum number of stable users required by the current system. It can be concluded that the maximum number of concurrent users supported by the system in the new function points is 1100. According to 1*100 The peak number of active users per hour is 110000/Hours; Use 80•20 According to the principle calculation, the number of registered users supported by the system is about 1.65 million. The performance requirements of the system support 1 million registered users on a large scale. Based on the above data, our system has met the performance requirements of the system


# No. 10.18

```
lib\private\Share20\DefaultShareProvider.php
getSharedWith()
createShare
```

```

```






--------------------------------------
The encrypted file is
/var/www/html/php-screw-plus/tools/screw /var/www/html/lib/base.php
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/serverinfo/lib/Controller/AbiController.php
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/settings/lib/Controller/EnterprisesController.php
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/settings/lib/Db/EnterprisesDbo.php
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/serverinfo/lib/OperatingSystems/DefaultOs.php
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/serverinfo/lib/OperatingSystems/FreeBSD.php
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/files_sharing/lib/Db/LinkSharesDbo.php
 Decrypt file
/var/www/html/php-screw-plus/tools/screw /var/www/html/lib/base.php -d
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/serverinfo/lib/Controller/AbiController.php -d
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/settings/lib/Controller/EnterprisesController.php -d
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/settings/lib/Db/EnterprisesDbo.php -d
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/serverinfo/lib/OperatingSystems/DefaultOs.php -d
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/serverinfo/lib/OperatingSystems/FreeBSD.php -d
/var/www/html/php-screw-plus/tools/screw /var/www/html/apps/files_sharing/lib/Db/LinkSharesDbo.php -d

git Common commands-start------------------------------------------------------

git config --global user.name "ZhaoQingHu"

git config --global user.email "zhaoqinghu@51jianxie.com"


------------------------------
When there are new files in the warehouse, the status of these files is untracked(Untracked files),At this time git add <file>Command is to track new files.
When the existing files in the warehouse are modified, the status of these files is modified(Modified),If you are sure to submit a file, you need to add the file to the staging area first git add <file>command
git restore --staged <file>The function of is to withdraw the files in the staging area from the staging area
git restore <file> Undo changes to documents discard

git add -A  Submit all changes
git add -u  Submit modified(modified)And deleted(deleted)Files, excluding new files(new)
git add .  Submit new documents(new)And modified(modified)File, excluding deleted(deleted)file



git restore --staged The function of is to withdraw the files in the staging area from the staging area

------------------------------
git checkout -b dev New and switch to dev branch
git pull origin dev The action is to get the information in the remote warehouse dev On branch commits,Then put origin/dev merge So far checkout In the next branch
git push origin dev Push to remote origin/dev branch

Merge remote branches develop dev
git checkout -b develop origin/develop

git checkout develop //On the develop ment branch
git merge dev //merge dev branch to develop

git push origin develop

git commit --amend //Append to last submission


66cfe2db1767198a2c07c436c8189da23e8fda4d
bca5f2d27d37f6f3cc837a310e4dc72edebcf629 

git reset --hard bca5f2d27d37f6f3cc837a310e4dc72edebcf629
git reset --hard 66cfe2db1767198a2c07c436c8189da23e8fda4d

git reflog View all commit of id

git Common commands-end------------------------------------------------------







## Development environment address
* home page http://192.168.100.22/apps/files/navigate
* [Collaborative space][http://192.168.100.22/apps/files/?dir=/&fileid=7]


## Development document address
https://docs.nextcloud.com/server/latest/developer_manual/getting_started/devenv.html#set-up-web-server-and-database
## Released version
v20.0.4
https://github.com/nextcloud/server/releases/tag/v20.0.4
## Developer API
* the latest version API
https://docs.nextcloud.com/server/latest/developer_manual/
* Of each version API
https://docs.nextcloud.com/

## Built in formwork
https://docs.nextcloud.com/server/21/developer_manual/basics/front-end/templates.html


## nextcloud-vue

## Development environment installation
* windows adopt VMWorkstation install Ubuntu 20.04 LTS 
* windows adopt


https://github.com/nextcloud/nextcloud-vue

Topics: PHP Docker