本文整理汇总了PHP中OCP\Config::getSystemValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getSystemValue方法的具体用法?PHP Config::getSystemValue怎么用?PHP Config::getSystemValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\Config
的用法示例。
在下文中一共展示了Config::getSystemValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($AppName, IRequest $Request, $CurrentUID, IL10N $L10N)
{
parent::__construct($AppName, $Request);
$this->CurrentUID = $CurrentUID;
$this->L10N = $L10N;
if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) {
$this->DbType = 1;
}
$this->CanCheckForUpdate = Tools::CanCheckForUpdate();
$this->Settings = new Settings();
$this->Settings->SetKey('WhichDownloader');
$this->WhichDownloader = $this->Settings->GetValue();
$this->WhichDownloader = is_null($this->WhichDownloader) ? 'ARIA2' : $this->WhichDownloader;
$this->Settings->SetKey('AllowProtocolHTTP');
$this->AllowProtocolHTTP = $this->Settings->GetValue();
$this->AllowProtocolHTTP = is_null($this->AllowProtocolHTTP) || \OC_User::isAdminUser($this->CurrentUID) ? true : strcmp($this->AllowProtocolHTTP, 'Y') == 0;
$this->Settings->SetKey('AllowProtocolFTP');
$this->AllowProtocolFTP = $this->Settings->GetValue();
$this->AllowProtocolFTP = is_null($this->AllowProtocolFTP) || \OC_User::isAdminUser($this->CurrentUID) ? true : strcmp($this->AllowProtocolFTP, 'Y') == 0;
$this->Settings->SetKey('AllowProtocolYT');
$this->AllowProtocolYT = $this->Settings->GetValue();
$this->AllowProtocolYT = is_null($this->AllowProtocolYT) || \OC_User::isAdminUser($this->CurrentUID) ? true : strcmp($this->AllowProtocolYT, 'Y') == 0;
$this->Settings->SetKey('AllowProtocolBT');
$this->AllowProtocolBT = $this->Settings->GetValue();
$this->AllowProtocolBT = is_null($this->AllowProtocolBT) || \OC_User::isAdminUser($this->CurrentUID) ? true : strcmp($this->AllowProtocolBT, 'Y') == 0;
}
示例2: __construct
public function __construct($AppName, IRequest $Request, $CurrentUID, IL10N $L10N)
{
parent::__construct($AppName, $Request);
if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) {
$this->DbType = 1;
}
$this->CurrentUID = $CurrentUID;
$Settings = new Settings();
$Settings->SetKey('ProxyAddress');
$this->ProxyAddress = $Settings->GetValue();
$Settings->SetKey('ProxyPort');
$this->ProxyPort = intval($Settings->GetValue());
$Settings->SetKey('ProxyUser');
$this->ProxyUser = $Settings->GetValue();
$Settings->SetKey('ProxyPasswd');
$this->ProxyPasswd = $Settings->GetValue();
$Settings->SetKey('ProxyOnlyWithYTDL');
$this->ProxyOnlyWithYTDL = $Settings->GetValue();
$this->ProxyOnlyWithYTDL = is_null($this->ProxyOnlyWithYTDL) ? false : strcmp($this->ProxyOnlyWithYTDL, 'Y') == 0;
$Settings->SetKey('WhichDownloader');
$this->WhichDownloader = $Settings->GetValue();
$this->WhichDownloader = is_null($this->WhichDownloader) ? 0 : (strcmp($this->WhichDownloader, 'ARIA2') == 0 ? 0 : 1);
// 0 means ARIA2, 1 means CURL
$Settings->SetTable('personal');
$Settings->SetUID($this->CurrentUID);
$Settings->SetKey('DownloadsFolder');
$this->DownloadsFolder = $Settings->GetValue();
$this->DownloadsFolder = '/' . (is_null($this->DownloadsFolder) ? 'Downloads' : $this->DownloadsFolder);
$this->AbsoluteDownloadsFolder = \OC\Files\Filesystem::getLocalFolder($this->DownloadsFolder);
$this->L10N = $L10N;
}
示例3: deleteUser_hook
/**
* @brief clean up user specific settings if user gets deleted
* @param array with uid
*
* This function is connected to the pre_deleteUser signal of OC_Users
* to remove the used space for versions stored in the database
*/
public static function deleteUser_hook($params)
{
if (\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED) == 'true') {
$uid = $params['uid'];
Storage::deleteUser($uid);
}
}
示例4: __construct
public function __construct($Table = 'admin')
{
if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) {
$this->DbType = 1;
}
$this->Table = $Table;
}
示例5: __construct
public function __construct($params)
{
$host = $params['host'];
//remove leading http[s], will be generated in createBaseUri()
if (substr($host, 0, 8) == "https://") {
$host = substr($host, 8);
} else {
if (substr($host, 0, 7) == "http://") {
$host = substr($host, 7);
}
}
$this->host = $host;
$this->user = $params['user'];
$this->password = $params['password'];
$this->secure = isset($params['secure']) && $params['secure'] == 'true' ? true : false;
$this->root = isset($params['root']) ? $params['root'] : '/';
if (!$this->root || $this->root[0] != '/') {
$this->root = '/' . $this->root;
}
if (substr($this->root, -1, 1) != '/') {
$this->root .= '/';
}
$settings = array('baseUri' => $this->createBaseUri(), 'userName' => $this->user, 'password' => $this->password);
$this->client = new OC_Connector_Sabre_Client($settings);
if ($caview = \OCP\Files::getStorage('files_external')) {
$certPath = \OCP\Config::getSystemValue('datadirectory') . $caview->getAbsolutePath("") . 'rootcerts.crt';
if (file_exists($certPath)) {
$this->client->addTrustedCertificates($certPath);
}
}
//create the root folder if necesary
$this->mkdir('');
}
示例6: write_hook
/**
* listen to write event.
*/
public static function write_hook($params)
{
if (\OCP\App::isEnabled('files_versions')) {
$path = $params[\OC\Files\Filesystem::signal_param_path];
$user = \OCP\User::getUser();
$excluded = false;
$excludes = \OCP\Config::getSystemValue('files_versions_excludes', NULL);
if (isset($excludes) && array_key_exists($user, $excludes)) {
$user_excludes = $excludes[$user];
foreach ($user_excludes as &$pat) {
if (fnmatch($pat, $path)) {
// TODO: Not certain if logging of the files names and patters is allowed.
\OCP\Util::writeLog('files_versions', "write_hook: user='" . $user . "', path='" . $path . "' matched to '" . $pat . "', excluding!", \OCP\Util::INFO);
$excluded = true;
break;
}
}
unset($pat);
}
if ($excluded) {
return;
}
if ($path != '') {
Storage::store($path);
}
}
}
示例7: Load
private static function Load()
{
if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) {
self::$DbType = 1;
}
self::$CurrentUID = \OC::$server->getUserSession()->getUser();
self::$CurrentUID = self::$CurrentUID ? self::$CurrentUID->getUID() : '';
self::$L10N = \OC::$server->getL10N('ocdownloader');
$Settings = new Settings();
$Settings->SetKey('ProxyAddress');
self::$ProxyAddress = $Settings->GetValue();
$Settings->SetKey('ProxyPort');
self::$ProxyPort = intval($Settings->GetValue());
$Settings->SetKey('ProxyUser');
self::$ProxyUser = $Settings->GetValue();
$Settings->SetKey('ProxyPasswd');
self::$ProxyPasswd = $Settings->GetValue();
$Settings->SetTable('personal');
$Settings->SetUID(self::$CurrentUID);
$Settings->SetKey('DownloadsFolder');
self::$DownloadsFolder = $Settings->GetValue();
self::$DownloadsFolder = '/' . (is_null(self::$DownloadsFolder) ? 'Downloads' : self::$DownloadsFolder);
self::$AbsoluteDownloadsFolder = \OC\Files\Filesystem::getLocalFolder(self::$DownloadsFolder);
$Settings->SetKey('YTDLBinary');
$YTDLBinary = $Settings->GetValue();
self::$YTDLBinary = '/usr/local/bin/youtube-dl';
// default path
if (!is_null($YTDLBinary)) {
self::$YTDLBinary = $YTDLBinary;
}
}
示例8: __construct
public function __construct(\OC\Files\Storage\Storage $storage)
{
$this->storage = $storage;
$this->storageId = $this->storage->getId();
$this->cache = $storage->getCache();
$this->cacheActive = !Config::getSystemValue('filesystem_cache_readonly', false);
}
示例9: run
protected function run($argument)
{
// Remove activities that are older then one year
$expireDays = \OCP\Config::getSystemValue('activity_expire_days', 365);
$data = new \OCA\Activity\Data(\OC::$server->getActivityManager());
$data->expire($expireDays);
}
示例10: runStep
/**
* Send an email to {$limit} users
*
* @param int $limit Number of users we want to send an email to
* @return int Number of users we sent an email to
*/
protected function runStep($limit)
{
// Get all users which should receive an email
$affectedUsers = $this->mqHandler->getAffectedUsers($limit);
if (empty($affectedUsers)) {
// No users found to notify, mission abort
return 0;
}
$preferences = new \OC\Preferences(\OC_DB::getConnection());
$userLanguages = $preferences->getValueForUsers('core', 'lang', $affectedUsers);
$userEmails = $preferences->getValueForUsers('settings', 'email', $affectedUsers);
// Get all items for these users
// We don't use time() but "time() - 1" here, so we don't run into
// runtime issues and delete emails later, which were created in the
// same second, but were not collected for the emails.
$sendTime = time() - 1;
$mailData = $this->mqHandler->getItemsForUsers($affectedUsers, $sendTime);
// Send Email
$default_lang = \OCP\Config::getSystemValue('default_language', 'en');
foreach ($mailData as $user => $data) {
if (!isset($userEmails[$user])) {
// The user did not setup an email address
// So we will not send an email :(
continue;
}
$language = isset($userLanguages[$user]) ? $userLanguages[$user] : $default_lang;
$this->mqHandler->sendEmailToUser($user, $userEmails[$user], $language, $data);
}
// Delete all entries we dealt with
$this->mqHandler->deleteSentItems($affectedUsers, $sendTime);
return sizeof($affectedUsers);
}
示例11: getThumbnail
/**
* {@inheritDoc}
*/
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview)
{
$this->initCmd();
if (is_null($this->cmd)) {
return false;
}
$absPath = $fileview->toTmpFile($path);
$tmpDir = \OC::$server->getTempManager()->getTempBaseDir();
$defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';
$clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters);
$exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
shell_exec($exec);
//create imagick object from pdf
$pdfPreview = null;
try {
list($dirname, , , $filename) = array_values(pathinfo($absPath));
$pdfPreview = $dirname . '/' . $filename . '.pdf';
$pdf = new \imagick($pdfPreview . '[0]');
$pdf->setImageFormat('jpg');
} catch (\Exception $e) {
unlink($absPath);
unlink($pdfPreview);
\OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR);
return false;
}
$image = new \OC_Image();
$image->loadFromData($pdf);
unlink($absPath);
unlink($pdfPreview);
if ($image->valid()) {
$image->scaleDownToFit($maxX, $maxY);
return $image;
}
return false;
}
示例12: getThumbnail
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview)
{
$this->initCmd();
if (is_null($this->cmd)) {
return false;
}
$absPath = $fileview->toTmpFile($path);
$tmpDir = get_temp_dir();
$defaultParameters = ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ';
$clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters);
$exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
$export = 'export HOME=/' . $tmpDir;
shell_exec($export . "\n" . $exec);
//create imagick object from pdf
try {
$pdf = new \imagick($absPath . '.pdf' . '[0]');
$pdf->setImageFormat('jpg');
} catch (\Exception $e) {
unlink($absPath);
unlink($absPath . '.pdf');
\OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
return false;
}
$image = new \OC_Image();
$image->loadFromData($pdf);
unlink($absPath);
unlink($absPath . '.pdf');
return $image->valid() ? $image : false;
}
示例13: __construct
public function __construct($AppName, IRequest $Request, IL10N $L10N)
{
parent::__construct($AppName, $Request);
if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) {
$this->DbType = 1;
}
$this->L10N = $L10N;
$this->Settings = new Settings();
}
示例14: thumb
function thumb($path)
{
$thumb_path = \OCP\Config::getSystemValue('datadirectory') . '/' . \OC_User::getUser() . '/reader';
if (file_exists($thumb_path . $path)) {
return new \OC_Image($thumb_path . $path);
}
if (!\OC\Files\Filesystem::file_exists($path)) {
return false;
}
}
示例15: hostKeysPath
private function hostKeysPath()
{
try {
$storage_view = \OCP\Files::getStorage('files_external');
if ($storage_view) {
return \OCP\Config::getSystemValue('datadirectory') . $storage_view->getAbsolutePath('') . 'ssh_hostKeys';
}
} catch (\Exception $e) {
}
return false;
}