本文整理汇总了PHP中OC_App::disable方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_App::disable方法的具体用法?PHP OC_App::disable怎么用?PHP OC_App::disable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_App
的用法示例。
在下文中一共展示了OC_App::disable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$appManager = \OC::$server->getAppManager();
self::$trashBinStatus = $appManager->isEnabledForUser('files_trashbin');
// reset backend
\OC_User::clearBackends();
\OC_User::useBackend('database');
// clear share hooks
\OC_Hook::clear('OCP\\Share');
\OC::registerShareHooks();
$application = new \OCA\Files_Sharing\AppInfo\Application();
$application->registerMountProviders();
//disable encryption
\OC_App::disable('encryption');
$config = \OC::$server->getConfig();
//configure trashbin
self::$rememberRetentionObligation = $config->getSystemValue('trashbin_retention_obligation', Files_Trashbin\Expiration::DEFAULT_RETENTION_OBLIGATION);
$config->setSystemValue('trashbin_retention_obligation', 'auto, 2');
// register hooks
Files_Trashbin\Trashbin::registerHooks();
// create test user
self::loginHelper(self::TEST_TRASHBIN_USER2, true);
self::loginHelper(self::TEST_TRASHBIN_USER1, true);
}
示例2: setUp
public function setUp()
{
// remember files_encryption state
$this->stateFilesEncryption = \OC_App::isEnabled('files_encryption');
// we want to tests with the encryption app disabled
\OC_App::disable('files_encryption');
$this->storage = new \OC\Files\Storage\Temporary(array());
$textData = "dummy file data\n";
$imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png');
$this->storage->mkdir('folder');
$this->storage->file_put_contents('foo.txt', $textData);
$this->storage->file_put_contents('foo.png', $imgData);
$this->storage->file_put_contents('folder/bar.txt', $textData);
$this->storage->file_put_contents('folder/bar2.txt', $textData);
$this->scanner = $this->storage->getScanner();
$this->scanner->scan('');
$this->cache = $this->storage->getCache();
\OC\Files\Filesystem::tearDown();
if (!self::$user) {
self::$user = uniqid();
}
\OC_User::createUser(self::$user, 'password');
\OC_User::setUserId(self::$user);
\OC\Files\Filesystem::init(self::$user, '/' . self::$user . '/files');
Filesystem::clearMounts();
Filesystem::mount($this->storage, array(), '/' . self::$user . '/files');
\OC_Hook::clear('OC_Filesystem');
}
示例3: finalize
protected function finalize()
{
foreach ($this->appsToDisable as $appId) {
\OC_App::disable($appId);
}
parent::finalize();
}
示例4: setUp
public function setUp()
{
if (!getenv('RUN_OBJECTSTORE_TESTS')) {
$this->markTestSkipped('objectstore tests are unreliable on travis');
}
\OC_App::disable('files_sharing');
\OC_App::disable('files_versions');
// reset backend
\OC_User::clearBackends();
\OC_User::useBackend('database');
// create users
$users = array('test');
foreach ($users as $userName) {
\OC_User::deleteUser($userName);
\OC_User::createUser($userName, $userName);
}
// main test user
$userName = 'test';
\OC_Util::tearDownFS();
\OC_User::setUserId('');
\OC\Files\Filesystem::tearDown();
\OC_User::setUserId('test');
$testContainer = 'oc-test-container-' . substr(md5(rand()), 0, 7);
$params = array('username' => 'facebook100000330192569', 'password' => 'Dbdj1sXnRSHxIGc4', 'container' => $testContainer, 'autocreate' => true, 'region' => 'RegionOne', 'url' => 'http://8.21.28.222:5000/v2.0', 'tenantName' => 'facebook100000330192569', 'serviceName' => 'swift', 'user' => \OC_User::getManager()->get($userName));
$this->objectStorage = new ObjectStoreToTest($params);
$params['objectstore'] = $this->objectStorage;
$this->instance = new ObjectStoreStorage($params);
}
示例5: tearDown
function tearDown()
{
// reset app files_trashbin
if ($this->stateFilesTrashbin) {
OC_App::enable('files_trashbin');
} else {
OC_App::disable('files_trashbin');
}
}
示例6: tearDown
function tearDown()
{
// reset app files_encryption
if ($this->stateFilesEncryption) {
\OC_App::enable('files_encryption');
} else {
\OC_App::disable('files_encryption');
}
}
示例7: tearDown
protected function tearDown()
{
// reset app files_trashbin
if ($this->stateFilesTrashbin) {
\OC_App::enable('files_trashbin');
} else {
\OC_App::disable('files_trashbin');
}
parent::tearDown();
}
示例8: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$appId = $input->getArgument('app-id');
if (\OC_App::isEnabled($appId)) {
\OC_App::disable($appId);
$output->writeln($appId . ' disabled');
} else {
$output->writeln('No such app enabled: ' . $appId);
}
}
示例9: tearDown
function tearDown()
{
// reset app files_trashbin
if ($this->stateFilesTrashbin) {
OC_App::enable('files_trashbin');
} else {
OC_App::disable('files_trashbin');
}
$this->assertTrue(\OC_FileProxy::$enabled);
}
示例10: tearDown
function tearDown()
{
// reset app files_trashbin
if ($this->stateFilesTrashbin) {
OC_App::enable('files_trashbin');
} else {
OC_App::disable('files_trashbin');
}
$this->assertTrue(\OC_FileProxy::$enabled);
\OCP\Config::deleteSystemValue('cipher');
}
示例11: tearDown
protected function tearDown()
{
// reset app files_trashbin
if ($this->stateFilesTrashbin) {
\OC_App::enable('files_trashbin');
} else {
\OC_App::disable('files_trashbin');
}
$this->assertTrue(\OC_FileProxy::$enabled);
$this->config->deleteSystemValue('cipher');
parent::tearDown();
}
示例12: login
/**
* @brief Startup encryption backend upon user login
* @note This method should never be called for users using client side encryption
*/
public static function login($params)
{
$l = new \OC_L10N('files_encryption');
//check if all requirements are met
if (!Helper::checkRequirements()) {
$error_msg = $l->t("Missing requirements.");
$hint = $l->t('Please make sure that PHP 5.3.3 or newer is installed and that the OpenSSL PHP extension is enabled and configured properly. For now, the encryption app has been disabled.');
\OC_App::disable('files_encryption');
\OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);
\OCP\Template::printErrorPage($error_msg, $hint);
}
$view = new \OC_FilesystemView('/');
// ensure filesystem is loaded
if (!\OC\Files\Filesystem::$loaded) {
\OC_Util::setupFS($params['uid']);
}
$util = new Util($view, $params['uid']);
// setup user, if user not ready force relogin
if (Helper::setupUser($util, $params['password']) === false) {
return false;
}
$encryptedKey = Keymanager::getPrivateKey($view, $params['uid']);
$privateKey = Crypt::decryptPrivateKey($encryptedKey, $params['password']);
if ($privateKey === false) {
\OCP\Util::writeLog('Encryption library', 'Private key for user "' . $params['uid'] . '" is not valid! Maybe the user password was changed from outside if so please change it back to gain access', \OCP\Util::ERROR);
}
$session = new \OCA\Encryption\Session($view);
$session->setPrivateKey($privateKey);
// Check if first-run file migration has already been performed
$ready = false;
if ($util->getMigrationStatus() === Util::MIGRATION_OPEN) {
$ready = $util->beginMigration();
}
// If migration not yet done
if ($ready) {
$userView = new \OC_FilesystemView('/' . $params['uid']);
// Set legacy encryption key if it exists, to support
// depreciated encryption system
if ($userView->file_exists('encryption.key') && ($encLegacyKey = $userView->file_get_contents('encryption.key'))) {
$plainLegacyKey = Crypt::legacyDecrypt($encLegacyKey, $params['password']);
$session->setLegacyKey($plainLegacyKey);
}
// Encrypt existing user files:
// This serves to upgrade old versions of the encryption
// app (see appinfo/spec.txt)
if ($util->encryptAll('/' . $params['uid'] . '/' . 'files', $session->getLegacyKey(), $params['password'])) {
\OC_Log::write('Encryption library', 'Encryption of existing files belonging to "' . $params['uid'] . '" completed', \OC_Log::INFO);
}
// Register successful migration in DB
$util->finishMigration();
}
return true;
}
示例13: login
/**
* @brief Startup encryption backend upon user login
* @note This method should never be called for users using client side encryption
*/
public static function login($params)
{
if (\OCP\App::isEnabled('files_encryption') === false) {
return true;
}
$l = new \OC_L10N('files_encryption');
$view = new \OC_FilesystemView('/');
// ensure filesystem is loaded
if (!\OC\Files\Filesystem::$loaded) {
\OC_Util::setupFS($params['uid']);
}
$privateKey = \OCA\Encryption\Keymanager::getPrivateKey($view, $params['uid']);
// if no private key exists, check server configuration
if (!$privateKey) {
//check if all requirements are met
if (!Helper::checkRequirements() || !Helper::checkConfiguration()) {
$error_msg = $l->t("Missing requirements.");
$hint = $l->t('Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled.');
\OC_App::disable('files_encryption');
\OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);
\OCP\Template::printErrorPage($error_msg, $hint);
}
}
$util = new Util($view, $params['uid']);
// setup user, if user not ready force relogin
if (Helper::setupUser($util, $params['password']) === false) {
return false;
}
$session = $util->initEncryption($params);
// Check if first-run file migration has already been performed
$ready = false;
if ($util->getMigrationStatus() === Util::MIGRATION_OPEN) {
$ready = $util->beginMigration();
}
// If migration not yet done
if ($ready) {
$userView = new \OC_FilesystemView('/' . $params['uid']);
// Set legacy encryption key if it exists, to support
// depreciated encryption system
if ($userView->file_exists('encryption.key') && ($encLegacyKey = $userView->file_get_contents('encryption.key'))) {
$plainLegacyKey = Crypt::legacyDecrypt($encLegacyKey, $params['password']);
$session->setLegacyKey($plainLegacyKey);
}
// Encrypt existing user files:
if ($util->encryptAll('/' . $params['uid'] . '/' . 'files', $session->getLegacyKey(), $params['password'])) {
\OC_Log::write('Encryption library', 'Encryption of existing files belonging to "' . $params['uid'] . '" completed', \OC_Log::INFO);
}
// Register successful migration in DB
$util->finishMigration();
}
return true;
}
示例14: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
// disable file proxy by default
\OC_FileProxy::$enabled = false;
// remember files_trashbin state
self::$stateFilesTrashbin = \OC_App::isEnabled('files_trashbin');
// we don't want to tests with app files_trashbin enabled
\OC_App::disable('files_trashbin');
// create test user
\OC_User::deleteUser(self::TEST_USER);
parent::loginHelper(self::TEST_USER, true);
}
示例15: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$appId = $input->getArgument('app-id');
if (\OC_App::isEnabled($appId)) {
try {
\OC_App::disable($appId);
$output->writeln($appId . ' disabled');
} catch (\Exception $e) {
$output->writeln($e->getMessage());
return 2;
}
} else {
$output->writeln('No such app enabled: ' . $appId);
}
}