本文整理汇总了PHP中OC_Appconfig::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Appconfig::getValue方法的具体用法?PHP OC_Appconfig::getValue怎么用?PHP OC_Appconfig::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Appconfig
的用法示例。
在下文中一共展示了OC_Appconfig::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isEnabled
/**
* @brief checks whether or not an app is enabled
* @param $app app
* @returns true/false
*
* This function checks whether or not an app is enabled.
*/
public static function isEnabled($app)
{
if ('yes' == OC_Appconfig::getValue($app, 'enabled')) {
return true;
}
return false;
}
示例2: check
/**
* Check if a new version is available
*/
public static function check()
{
OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
if (OC_Appconfig::getValue('core', 'installedat', '') == '') {
OC_Appconfig::setValue('core', 'installedat', microtime(true));
}
$updaterurl = 'http://apps.owncloud.com/updater.php';
$version = OC_Util::getVersion();
$version['installed'] = OC_Appconfig::getValue('core', 'installedat');
$version['updated'] = OC_Appconfig::getValue('core', 'lastupdatedat');
$version['updatechannel'] = 'stable';
$version['edition'] = OC_Util::getEditionString();
$versionstring = implode('x', $version);
//fetch xml data from updater
$url = $updaterurl . '?version=' . $versionstring;
$xml = @file_get_contents($url);
if ($xml == FALSE) {
return array();
}
$data = @simplexml_load_string($xml);
$tmp = array();
$tmp['version'] = $data->version;
$tmp['versionstring'] = $data->versionstring;
$tmp['url'] = $data->url;
$tmp['web'] = $data->web;
return $tmp;
}
示例3: check
/**
* Check if a new version is available
*/
public static function check()
{
OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
if (OC_Appconfig::getValue('core', 'installedat', '') == '') {
OC_Appconfig::setValue('core', 'installedat', microtime(true));
}
$updaterurl = 'http://apps.owncloud.com/updater.php';
$version = OC_Util::getVersion();
$version['installed'] = OC_Appconfig::getValue('core', 'installedat');
$version['updated'] = OC_Appconfig::getValue('core', 'lastupdatedat');
$version['updatechannel'] = 'stable';
$version['edition'] = OC_Util::getEditionString();
$versionstring = implode('x', $version);
//fetch xml data from updater
$url = $updaterurl . '?version=' . $versionstring;
// set a sensible timeout of 10 sec to stay responsive even if the update server is down.
$ctx = stream_context_create(array('http' => array('timeout' => 10)));
$xml = @file_get_contents($url, 0, $ctx);
if ($xml == false) {
return array();
}
$data = @simplexml_load_string($xml);
$tmp = array();
$tmp['version'] = $data->version;
$tmp['versionstring'] = $data->versionstring;
$tmp['url'] = $data->url;
$tmp['web'] = $data->web;
return $tmp;
}
示例4: check
/**
* Check if a new version is available
* @param string $updaterUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php'
* @return array | bool
*/
public function check($updaterUrl)
{
// Look up the cache - it is invalidated all 30 minutes
if (\OC_Appconfig::getValue('core', 'lastupdatedat') + 1800 > time()) {
return json_decode(\OC_Appconfig::getValue('core', 'lastupdateResult'), true);
}
\OC_Appconfig::setValue('core', 'lastupdatedat', time());
if (\OC_Appconfig::getValue('core', 'installedat', '') == '') {
\OC_Appconfig::setValue('core', 'installedat', microtime(true));
}
$version = \OC_Util::getVersion();
$version['installed'] = \OC_Appconfig::getValue('core', 'installedat');
$version['updated'] = \OC_Appconfig::getValue('core', 'lastupdatedat');
$version['updatechannel'] = \OC_Util::getChannel();
$version['edition'] = \OC_Util::getEditionString();
$version['build'] = \OC_Util::getBuild();
$versionString = implode('x', $version);
//fetch xml data from updater
$url = $updaterUrl . '?version=' . $versionString;
// set a sensible timeout of 10 sec to stay responsive even if the update server is down.
$ctx = stream_context_create(array('http' => array('timeout' => 10)));
$xml = @file_get_contents($url, 0, $ctx);
if ($xml == false) {
return array();
}
$data = @simplexml_load_string($xml);
$tmp = array();
$tmp['version'] = $data->version;
$tmp['versionstring'] = $data->versionstring;
$tmp['url'] = $data->url;
$tmp['web'] = $data->web;
// Cache the result
\OC_Appconfig::setValue('core', 'lastupdateResult', json_encode($data));
return $tmp;
}
示例5: getUser
/**
* gets user info
*/
public static function getUser($parameters)
{
$userid = $parameters['userid'];
$return = array();
$return['email'] = OC_Preferences::getValue($userid, 'settings', 'email', '');
$default = OC_Appconfig::getValue('files', 'default_quota', 0);
$return['quota'] = OC_Preferences::getValue($userid, 'files', 'quota', $default);
return $return;
}
示例6: __construct
function __construct()
{
$this->ldap_host = OC_Appconfig::getValue('user_ldap', 'ldap_host', '');
$this->ldap_port = OC_Appconfig::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT);
$this->ldap_dn = OC_Appconfig::getValue('user_ldap', 'ldap_dn', '');
$this->ldap_password = OC_Appconfig::getValue('user_ldap', 'ldap_password', '');
$this->ldap_base = OC_Appconfig::getValue('user_ldap', 'ldap_base', '');
$this->ldap_filter = OC_Appconfig::getValue('user_ldap', 'ldap_filter', '');
if (!empty($this->ldap_host) && !empty($this->ldap_port) && !empty($this->ldap_dn) && !empty($this->ldap_password) && !empty($this->ldap_base) && !empty($this->ldap_filter)) {
$this->configured = true;
}
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:12,代码来源:owncloud_apps_user_ldap_user_ldap.php
示例7: testGetValue
public function testGetValue()
{
$query = \OC_DB::prepare('SELECT `configvalue` FROM `*PREFIX*appconfig` WHERE `appid` = ? AND `configkey` = ?');
$result = $query->execute(array('testapp', 'installed_version'));
$expected = $result->fetchRow();
$value = \OC_Appconfig::getValue('testapp', 'installed_version');
$this->assertEquals($expected['configvalue'], $value);
$value = \OC_Appconfig::getValue('testapp', 'nonexistant');
$this->assertNull($value);
$value = \OC_Appconfig::getValue('testapp', 'nonexistant', 'default');
$this->assertEquals('default', $value);
}
示例8: checkNext
public static function checkNext()
{
// check both 1 file and 1 folder, this way new files are detected quicker because there are less folders than files usually
$previousFile = \OC_Appconfig::getValue('files', 'backgroundwatcher_previous_file', 0);
$previousFolder = \OC_Appconfig::getValue('files', 'backgroundwatcher_previous_folder', 0);
$nextFile = self::getNextFileId($previousFile, false);
$nextFolder = self::getNextFileId($previousFolder, true);
\OC_Appconfig::setValue('files', 'backgroundwatcher_previous_file', $nextFile);
\OC_Appconfig::setValue('files', 'backgroundwatcher_previous_folder', $nextFolder);
if ($nextFile > 0) {
self::checkUpdate($nextFile);
}
if ($nextFolder > 0) {
self::checkUpdate($nextFolder);
}
}
示例9: __construct
function __construct()
{
$this->db_conn = false;
$db_host = OC_Appconfig::getValue('user_django_auth', 'django_auth_db_host', '');
$db_name = OC_Appconfig::getValue('user_django_auth', 'django_auth_db_name', '');
$db_driver = OC_Appconfig::getValue('user_django_auth', 'django_auth_db_driver', 'mysql');
$db_user = OC_Appconfig::getValue('user_django_auth', 'django_auth_db_user', '');
$db_password = OC_Appconfig::getValue('user_django_auth', 'django_auth_db_password', '');
$dsn = "{$db_driver}:host={$db_host};dbname={$db_name}";
try {
$this->db = new PDO($dsn, $db_user, $db_password);
$this->db_conn = true;
} catch (PDOException $e) {
OC_Log::write('OC_User_Django_Auth', 'OC_User_Django_Auth, Failed to connect to django auth database: ' . $e->getMessage(), OC_Log::ERROR);
}
return false;
}
示例10: doNextStep
/**
* @brief does a single task
* @return boolean
*
* This method executes one task. It saves the last state and continues
* with the next step. This method should be used by webcron and ajax
* services.
*/
public static function doNextStep()
{
$laststep = OC_Appconfig::getValue('core', 'backgroundjobs_step', 'regular_tasks');
if ($laststep == 'regular_tasks') {
// get last app
$lasttask = OC_Appconfig::getValue('core', 'backgroundjobs_task', '');
// What's the next step?
$regular_tasks = OC_BackgroundJob_RegularTask::all();
ksort($regular_tasks);
$done = false;
// search for next background job
foreach ($regular_tasks as $key => $value) {
if (strcmp($key, $lasttask) > 0) {
OC_Appconfig::setValue('core', 'backgroundjobs_task', $key);
$done = true;
call_user_func($value);
break;
}
}
if ($done == false) {
// Next time load queued tasks
OC_Appconfig::setValue('core', 'backgroundjobs_step', 'queued_tasks');
}
} else {
$tasks = OC_BackgroundJob_QueuedTask::all();
if (count($tasks)) {
$task = $tasks[0];
// delete job before we execute it. This prevents endless loops
// of failing jobs.
OC_BackgroundJob_QueuedTask::delete($task['id']);
// execute job
call_user_func(array($task['klass'], $task['method']), $task['parameters']);
} else {
// Next time load queued tasks
OC_Appconfig::setValue('core', 'backgroundjobs_step', 'regular_tasks');
OC_Appconfig::setValue('core', 'backgroundjobs_task', '');
}
}
return true;
}
示例11: __construct
public function __construct()
{
$this->pwauth_bin_path = OC_Appconfig::getValue('user_pwauth', 'pwauth_path', OC_USER_BACKEND_PWAUTH_PATH);
$list = explode(";", OC_Appconfig::getValue('user_pwauth', 'uid_list', OC_USER_BACKEND_PWAUTH_UID_LIST));
$r = array();
foreach ($list as $entry) {
if (strpos($entry, "-") === FALSE) {
$r[] = $entry;
} else {
$range = explode("-", $entry);
if ($range[0] < 0) {
$range[0] = 0;
}
if ($range[1] < $range[0]) {
$range[1] = $range[0];
}
for ($i = $range[0]; $i <= $range[1]; $i++) {
$r[] = $i;
}
}
}
$this->pwauth_uid_list = $r;
}
示例12: __construct
/**
* @brief if session is started, check if ownCloud key pair is set up, if not create it
* @param \OC_FilesystemView $view
*
* @note The ownCloud key pair is used to allow public link sharing even if encryption is enabled
*/
public function __construct($view)
{
$this->view = $view;
if (!$this->view->is_dir('owncloud_private_key')) {
$this->view->mkdir('owncloud_private_key');
}
$publicShareKeyId = \OC_Appconfig::getValue('files_encryption', 'publicShareKeyId');
if ($publicShareKeyId === null) {
$publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8);
\OC_Appconfig::setValue('files_encryption', 'publicShareKeyId', $publicShareKeyId);
}
if (!$this->view->file_exists("/public-keys/" . $publicShareKeyId . ".public.key") || !$this->view->file_exists("/owncloud_private_key/" . $publicShareKeyId . ".private.key")) {
$keypair = Crypt::createKeypair();
// Disable encryption proxy to prevent recursive calls
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
// Save public key
if (!$view->is_dir('/public-keys')) {
$view->mkdir('/public-keys');
}
$this->view->file_put_contents('/public-keys/' . $publicShareKeyId . '.public.key', $keypair['publicKey']);
// Encrypt private key empty passphrase
$encryptedPrivateKey = Crypt::symmetricEncryptFileContent($keypair['privateKey'], '');
// Save private key
$this->view->file_put_contents('/owncloud_private_key/' . $publicShareKeyId . '.private.key', $encryptedPrivateKey);
\OC_FileProxy::$enabled = $proxyStatus;
}
if (\OCA\Encryption\Helper::isPublicAccess()) {
// Disable encryption proxy to prevent recursive calls
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
$encryptedKey = $this->view->file_get_contents('/owncloud_private_key/' . $publicShareKeyId . '.private.key');
$privateKey = Crypt::decryptPrivateKey($encryptedKey, '');
$this->setPublicSharePrivateKey($privateKey);
\OC_FileProxy::$enabled = $proxyStatus;
}
}
示例13: getParams
public function getParams()
{
$array = array();
foreach ($this->params as $key => $param) {
$array[$param] = OC_Appconfig::getValue('user_wordpress', $param, '');
}
if (empty($array['wordpress_db_host'])) {
$array['wordpress_db_host'] = OC_Config::getValue("dbhost", "");
}
if (empty($array['wordpress_db_name'])) {
$array['wordpress_db_name'] = OC_Config::getValue("dbname", "owncloud");
}
if (empty($array['wordpress_db_user'])) {
$array['wordpress_db_user'] = OC_Config::getValue("dbuser", "");
}
if (empty($array['wordpress_db_password'])) {
$array['wordpress_db_password'] = OC_Config::getValue("dbpassword", "");
}
if (empty($array['wordpress_have_to_be_logged'])) {
$array['wordpress_have_to_be_logged'] = '0';
OC_Appconfig::setValue('user_wordpress', 'wordpress_have_to_be_logged', '0');
}
return $array;
}
示例14: isUpdateAvailable
/**
* Check if an update for the app is available
* @param string $app
* @return string|false false or the version number of the update
*
* The function will check if an update for a version is available
*/
public static function isUpdateAvailable($app)
{
static $isInstanceReadyForUpdates = null;
if ($isInstanceReadyForUpdates === null) {
$installPath = OC_App::getInstallPath();
if ($installPath === false || $installPath === null) {
$isInstanceReadyForUpdates = false;
} else {
$isInstanceReadyForUpdates = true;
}
}
if ($isInstanceReadyForUpdates === false) {
return false;
}
$ocsid = OC_Appconfig::getValue($app, 'ocsid', '');
if ($ocsid != '') {
$ocsdata = OC_OCSClient::getApplication($ocsid);
$ocsversion = (string) $ocsdata['version'];
$currentversion = OC_App::getAppVersion($app);
if (version_compare($ocsversion, $currentversion, '>')) {
return $ocsversion;
} else {
return false;
}
} else {
return false;
}
}
示例15: expire
/**
* @brief Erase a file's versions which exceed the set quota
*/
private static function expire($filename, $versionsSize = null, $offset = 0)
{
if (\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED) == 'true') {
list($uid, $filename) = self::getUidAndFilename($filename);
$versionsFileview = new \OC\Files\View('/' . $uid . '/files_versions');
// get available disk space for user
$softQuota = true;
$quota = \OC_Preferences::getValue($uid, 'files', 'quota');
if ($quota === null || $quota === 'default') {
$quota = \OC_Appconfig::getValue('files', 'default_quota');
}
if ($quota === null || $quota === 'none') {
$quota = \OC\Files\Filesystem::free_space('/');
$softQuota = false;
} else {
$quota = \OCP\Util::computerFileSize($quota);
}
// make sure that we have the current size of the version history
if ($versionsSize === null) {
$versionsSize = self::getVersionsSize($uid);
if ($versionsSize === false || $versionsSize < 0) {
$versionsSize = self::calculateSize($uid);
}
}
// calculate available space for version history
// subtract size of files and current versions size from quota
if ($softQuota) {
$files_view = new \OC\Files\View('/' . $uid . '/files');
$rootInfo = $files_view->getFileInfo('/');
$free = $quota - $rootInfo['size'];
// remaining free space for user
if ($free > 0) {
$availableSpace = $free * self::DEFAULTMAXSIZE / 100 - ($versionsSize + $offset);
// how much space can be used for versions
} else {
$availableSpace = $free - $versionsSize - $offset;
}
} else {
$availableSpace = $quota - $offset;
}
// with the probability of 0.1% we reduce the number of all versions not only for the current file
$random = rand(0, 1000);
if ($random == 0) {
$allFiles = true;
} else {
$allFiles = false;
}
$allVersions = Storage::getVersions($uid, $filename);
$versionsByFile[$filename] = $allVersions;
$sizeOfDeletedVersions = self::delOldVersions($versionsByFile, $allVersions, $versionsFileview);
$availableSpace = $availableSpace + $sizeOfDeletedVersions;
$versionsSize = $versionsSize - $sizeOfDeletedVersions;
// if still not enough free space we rearrange the versions from all files
if ($availableSpace <= 0 || $allFiles) {
$result = Storage::getAllVersions($uid);
$versionsByFile = $result['by_file'];
$allVersions = $result['all'];
$sizeOfDeletedVersions = self::delOldVersions($versionsByFile, $allVersions, $versionsFileview);
$availableSpace = $availableSpace + $sizeOfDeletedVersions;
$versionsSize = $versionsSize - $sizeOfDeletedVersions;
}
// Check if enough space is available after versions are rearranged.
// If not we delete the oldest versions until we meet the size limit for versions,
// but always keep the two latest versions
$numOfVersions = count($allVersions) - 2;
$i = 0;
while ($availableSpace < 0 && $i < $numOfVersions) {
$version = current($allVersions);
$versionsFileview->unlink($version['path'] . '.v' . $version['version']);
$versionsSize -= $version['size'];
$availableSpace += $version['size'];
next($allVersions);
$i++;
}
return $versionsSize;
// finally return the new size of the version history
}
return false;
}