本文整理汇总了PHP中OC_Mount_Config::writeData方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Mount_Config::writeData方法的具体用法?PHP OC_Mount_Config::writeData怎么用?PHP OC_Mount_Config::writeData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Mount_Config
的用法示例。
在下文中一共展示了OC_Mount_Config::writeData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeConfig
/**
* Write the storages to the configuration.
*
* @param array $storages map of storage id to storage config
*/
public function writeConfig($storages)
{
// let the horror begin
$mountPoints = [];
foreach ($storages as $storageConfig) {
$mountPoint = $storageConfig->getMountPoint();
$oldBackendOptions = $storageConfig->getBackendOptions();
$storageConfig->setBackendOptions(\OC_Mount_Config::encryptPasswords($oldBackendOptions));
// system mount
$rootMountPoint = '/$user/files/' . ltrim($mountPoint, '/');
$applicableUsers = $storageConfig->getApplicableUsers();
$applicableGroups = $storageConfig->getApplicableGroups();
foreach ($applicableUsers as $applicable) {
$this->addMountPoint($mountPoints, \OC_Mount_Config::MOUNT_TYPE_USER, $applicable, $rootMountPoint, $storageConfig);
}
foreach ($applicableGroups as $applicable) {
$this->addMountPoint($mountPoints, \OC_Mount_Config::MOUNT_TYPE_GROUP, $applicable, $rootMountPoint, $storageConfig);
}
// if neither "applicableGroups" or "applicableUsers" were set, use "all" user
if (empty($applicableUsers) && empty($applicableGroups)) {
$this->addMountPoint($mountPoints, \OC_Mount_Config::MOUNT_TYPE_USER, 'all', $rootMountPoint, $storageConfig);
}
// restore old backend options where the password was not encrypted,
// because we don't want to change the state of the original object
$storageConfig->setBackendOptions($oldBackendOptions);
}
\OC_Mount_Config::writeData(null, $mountPoints);
}
示例2: writeConfig
/**
* Write the storages to the user's configuration.
*
* @param array $storages map of storage id to storage config
*/
public function writeConfig($storages)
{
$user = $this->userSession->getUser()->getUID();
// let the horror begin
$mountPoints = [];
foreach ($storages as $storageConfig) {
$mountPoint = $storageConfig->getMountPoint();
$oldBackendOptions = $storageConfig->getBackendOptions();
$storageConfig->setBackendOptions(\OC_Mount_Config::encryptPasswords($oldBackendOptions));
$rootMountPoint = '/' . $user . '/files/' . ltrim($mountPoint, '/');
$this->addMountPoint($mountPoints, \OC_Mount_Config::MOUNT_TYPE_USER, $user, $rootMountPoint, $storageConfig);
// restore old backend options where the password was not encrypted,
// because we don't want to change the state of the original object
$storageConfig->setBackendOptions($oldBackendOptions);
}
\OC_Mount_Config::writeData($user, $mountPoints);
}
示例3: writeLegacyConfig
/**
* Write legacy config data
*
* @param array $mountPoints
*/
protected function writeLegacyConfig(array $mountPoints)
{
// write global config
\OC_Mount_Config::writeData(null, $mountPoints);
}
示例4: writeLegacyConfig
/**
* Write legacy config data
*
* @param array $mountPoints
*/
protected function writeLegacyConfig(array $mountPoints)
{
// write user config
$user = $this->getUser()->getUID();
\OC_Mount_Config::writeData($user, $mountPoints);
}