Browse Source

Replace old config code with usage of proper APIs

tags/v9.0beta1
Morris Jobke 8 years ago
parent
commit
37ecde065b
3 changed files with 16 additions and 10 deletions
  1. 4
    3
      apps/files_trashbin/tests/trashbin.php
  2. 8
    5
      lib/private/installer.php
  3. 4
    2
      lib/private/setup.php

+ 4
- 3
apps/files_trashbin/tests/trashbin.php View File

//disable encryption //disable encryption
\OC_App::disable('encryption'); \OC_App::disable('encryption');


$config = \OC::$server->getConfig();
//configure trashbin //configure trashbin
self::$rememberRetentionObligation = \OC_Config::getValue('trashbin_retention_obligation', Files_Trashbin\Expiration::DEFAULT_RETENTION_OBLIGATION);
\OC_Config::setValue('trashbin_retention_obligation', 'auto, 2');
self::$rememberRetentionObligation = $config->getSystemValue('trashbin_retention_obligation', Files_Trashbin\Expiration::DEFAULT_RETENTION_OBLIGATION);
$config->setSystemValue('trashbin_retention_obligation', 'auto, 2');


// register hooks // register hooks
Files_Trashbin\Trashbin::registerHooks(); Files_Trashbin\Trashbin::registerHooks();
// cleanup test user // cleanup test user
\OC_User::deleteUser(self::TEST_TRASHBIN_USER1); \OC_User::deleteUser(self::TEST_TRASHBIN_USER1);


\OC_Config::setValue('trashbin_retention_obligation', self::$rememberRetentionObligation);
\OC::$server->getConfig()->setSystemValue('trashbin_retention_obligation', self::$rememberRetentionObligation);


\OC_Hook::clear(); \OC_Hook::clear();



+ 8
- 5
lib/private/installer.php View File

if (is_null($info)) { if (is_null($info)) {
return false; return false;
} }
\OC::$server->getAppConfig()->setValue($app, 'installed_version', OC_App::getAppVersion($app));

$config = \OC::$server->getConfig();

$config->setAppValue($app, 'installed_version', OC_App::getAppVersion($app));
if (array_key_exists('ocsid', $info)) { if (array_key_exists('ocsid', $info)) {
\OC::$server->getAppConfig()->setValue($app, 'ocsid', $info['ocsid']);
$config->setAppValue($app, 'ocsid', $info['ocsid']);
} }


//set remote/public handlers //set remote/public handlers
foreach($info['remote'] as $name=>$path) { foreach($info['remote'] as $name=>$path) {
OCP\CONFIG::setAppValue('core', 'remote_'.$name, $app.'/'.$path);
$config->setAppValue('core', 'remote_'.$name, $app.'/'.$path);
} }
foreach($info['public'] as $name=>$path) { foreach($info['public'] as $name=>$path) {
OCP\CONFIG::setAppValue('core', 'public_'.$name, $app.'/'.$path);
$config->setAppValue('core', 'public_'.$name, $app.'/'.$path);
} }


OC_App::setAppTypes($info['id']); OC_App::setAppTypes($info['id']);
*/ */
public static function checkCode($folder) { public static function checkCode($folder) {
// is the code checker enabled? // is the code checker enabled?
if(!OC_Config::getValue('appcodechecker', false)) {
if(!\OC::$server->getConfig()->getSystemValue('appcodechecker', false)) {
return true; return true;
} }



+ 4
- 2
lib/private/setup.php View File

$content.= "</ifModule>\n\n"; $content.= "</ifModule>\n\n";
$content.= "# section for Apache 2.2 and 2.4\n"; $content.= "# section for Apache 2.2 and 2.4\n";
$content.= "IndexIgnore *\n"; $content.= "IndexIgnore *\n";
file_put_contents(\OC_Config::getValue('datadirectory', \OC::$SERVERROOT.'/data').'/.htaccess', $content);
file_put_contents(\OC_Config::getValue('datadirectory', \OC::$SERVERROOT.'/data').'/index.html', '');

$baseDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data');
file_put_contents($baseDir . '/.htaccess', $content);
file_put_contents($baseDir . '/index.html', '');
} }
} }

Loading…
Cancel
Save