本文整理汇总了PHP中OC_App::loadApp方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_App::loadApp方法的具体用法?PHP OC_App::loadApp怎么用?PHP OC_App::loadApp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_App
的用法示例。
在下文中一共展示了OC_App::loadApp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showShare
public static function showShare($args)
{
\OC_Util::checkAppEnabled('files_sharing');
$token = $args['token'];
\OC_App::loadApp('files_sharing');
\OC_User::setIncognitoMode(true);
require_once \OC_App::getAppPath('files_sharing') . '/public.php';
}
示例2: setUpEncryptionTrait
protected function setUpEncryptionTrait()
{
$isReady = \OC::$server->getEncryptionManager()->isReady();
if (!$isReady) {
$this->markTestSkipped('Encryption not ready');
}
\OC_App::loadApp('encryption');
$this->encryptionApp = new Application([], $isReady);
$this->config = \OC::$server->getConfig();
$this->encryptionWasEnabled = $this->config->getAppValue('core', 'encryption_enabled', 'no');
$this->originalEncryptionModule = $this->config->getAppValue('core', 'default_encryption_module');
$this->config->setAppValue('core', 'default_encryption_module', \OCA\Encryption\Crypto\Encryption::ID);
$this->config->setAppValue('core', 'encryption_enabled', 'yes');
$this->assertTrue(\OC::$server->getEncryptionManager()->isEnabled());
}
示例3: setUp
<?php
OC_App::loadApp('bookmarks');
use OCA\Bookmarks\Controller\Lib\Bookmarks;
class Test_LibBookmarks_Bookmarks extends PHPUnit_Framework_TestCase
{
private $userid;
private $db;
protected function setUp()
{
$this->userid = \OCP\User::getUser();
$this->db = \OC::$server->getDb();
}
function testAddBookmark()
{
$this->cleanDB();
$this->assertCount(0, Bookmarks::findBookmarks($this->userid, $this->db, 0, 'id', array(), true, -1));
Bookmarks::addBookmark($this->userid, $this->db, 'http://owncloud.org', 'Owncloud project', array('oc', 'cloud'), 'An Awesome project');
$this->assertCount(1, Bookmarks::findBookmarks($this->userid, $this->db, 0, 'id', array(), true, -1));
}
function testFindBookmarks()
{
$this->cleanDB();
Bookmarks::addBookmark($this->userid, $this->db, "http://www.google.de", "Google", array("one"), "PrivateNoTag", false);
Bookmarks::addBookmark($this->userid, $this->db, "http://www.heise.de", "Heise", array("one", "two"), "PrivatTag", false);
Bookmarks::addBookmark($this->userid, $this->db, "http://www.golem.de", "Golem", array("one"), "PublicNoTag", true);
Bookmarks::addBookmark($this->userid, $this->db, "http://www.9gag.com", "9gag", array("two", "three"), "PublicTag", true);
$outputPrivate = Bookmarks::findBookmarks($this->userid, $this->db, 0, "", array(), true, -1, false);
$this->assertCount(4, $outputPrivate);
$outputPrivateFiltered = Bookmarks::findBookmarks($this->userid, $this->db, 0, "", array("one"), true, -1, false);
$this->assertCount(3, $outputPrivateFiltered);
示例4: doAppUpgrade
/**
* upgrades all apps within a major ownCloud upgrade. Also loads "priority"
* (types authentication, filesystem, logging, in that order) afterwards.
*
* @throws NeedsUpdateException
*/
protected function doAppUpgrade()
{
$apps = \OC_App::getEnabledApps();
$priorityTypes = array('authentication', 'filesystem', 'logging');
$pseudoOtherType = 'other';
$stacks = array($pseudoOtherType => array());
foreach ($apps as $appId) {
$priorityType = false;
foreach ($priorityTypes as $type) {
if (!isset($stacks[$type])) {
$stacks[$type] = array();
}
if (\OC_App::isType($appId, $type)) {
$stacks[$type][] = $appId;
$priorityType = true;
break;
}
}
if (!$priorityType) {
$stacks[$pseudoOtherType][] = $appId;
}
}
foreach ($stacks as $type => $stack) {
foreach ($stack as $appId) {
if (\OC_App::shouldUpgrade($appId)) {
$this->emit('\\OC\\Updater', 'appUpgradeStarted', [$appId, \OC_App::getAppVersion($appId)]);
\OC_App::updateApp($appId);
$this->emit('\\OC\\Updater', 'appUpgrade', [$appId, \OC_App::getAppVersion($appId)]);
}
if ($type !== $pseudoOtherType) {
// load authentication, filesystem and logging apps after
// upgrading them. Other apps my need to rely on modifying
// user and/or filesystem aspects.
\OC_App::loadApp($appId, false);
}
}
}
}
示例5: array
<?php
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
//encryption app needs to be loaded
OC_App::loadApp('files_encryption');
// init encryption app
$params = array('uid' => \OCP\User::getUser(), 'password' => $_POST['password']);
$view = new OC\Files\View('/');
$util = new \OCA\Encryption\Util($view, \OCP\User::getUser());
$l = \OC_L10N::get('settings');
$result = $util->initEncryption($params);
if ($result !== false) {
try {
$successful = $util->decryptAll();
} catch (\Exception $ex) {
\OCP\Util::writeLog('encryption library', "Decryption finished unexpected: " . $ex->getMessage(), \OCP\Util::ERROR);
$successful = false;
}
$util->closeEncryptionSession();
if ($successful === true) {
\OCP\JSON::success(array('data' => array('message' => $l->t('Files decrypted successfully'))));
} else {
\OCP\JSON::error(array('data' => array('message' => $l->t('Couldn\'t decrypt your files, please check your owncloud.log or ask your administrator'))));
}
} else {
\OCP\JSON::error(array('data' => array('message' => $l->t('Couldn\'t decrypt your files, check your password and try again'))));
}
示例6: setUp
<?php
OC_App::loadApp('mozilla_sync');
class Test_StorageService extends UnitTestCase
{
private $userName = 'testUser';
private $userHash = 'qwegffggh';
private $password = 'testPassword';
private $email = 'testUser@owncloud.org';
public function setUp()
{
OCA_mozilla_sync\Utils::setTestState();
// Create ownCloud Test User
OC_User::createUser($this->userName, $this->password);
OC_User::setUserId($this->userName);
OC_Preferences::setValue($this->userName, 'settings', 'email', $this->email);
OCA_mozilla_sync\OutputData::$outputFlag = OCA_mozilla_sync\OutputData::ConstOutputBuffer;
OCA_mozilla_sync\Utils::setTestState();
OCA_mozilla_sync\User::createUser($this->userHash, $this->password, $this->email);
}
public function tearDown()
{
$userId = OCA_mozilla_sync\User::userHashToId($this->userHash);
if ($userId != false) {
OCA_mozilla_sync\Storage::deleteStorage($userId);
OCA_mozilla_sync\User::deleteUser($userId);
}
OC_Preferences::deleteUser($this->userName);
OC_User::deleteUser($this->userName);
}
public function test_BasicScenario()
示例7: define
<?php
if (!defined('PHPUNIT_RUN')) {
define('PHPUNIT_RUN', 1);
}
require_once '/home/camila/Projects/Owncloud/owncloud/lib/base.php';
\OC::$loader->addValidRoot(\OC::$SERVERROOT . '/tests');
\OC_App::loadApp('popcornapp');
if (!class_exists('PHPUnit_Framework_TestCase')) {
require_once 'PHPUnit/Autoload.php';
}
OC_Hook::clear();
示例8: define
<?php
if (!defined('PHPUNIT_RUN')) {
define('PHPUNIT_RUN', 1);
}
require_once __DIR__ . '/../../../lib/base.php';
if (!class_exists('PHPUnit_Framework_TestCase')) {
require_once 'PHPUnit/Autoload.php';
}
\OC_App::loadApp('files_texteditor');
示例9: setUp
<?php
/**
* Copyright (c) 2012 Tom Needham <tom@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OC_App::loadApp('provisioning_api');
class Test_Provisioning_API extends UnitTestCase
{
public function setUp()
{
}
public function testAddUser()
{
}
private function testAPIResponse($response)
{
$xml = new DOMDocument();
$xml->loadXML($reponse);
}
}
示例10: define
<?php
if (!defined('PHPUNIT_RUN')) {
define('PHPUNIT_RUN', 1);
}
require_once __DIR__ . '/../../../lib/base.php';
if (!class_exists('PHPUnit_Framework_TestCase')) {
require_once 'PHPUnit/Autoload.php';
}
\OC_App::loadApp('richdocuments');
OC_Hook::clear();
示例11: define
<?php
if (!defined('PHPUNIT_RUN')) {
define('PHPUNIT_RUN', 1);
}
require_once __DIR__ . '/../../../lib/base.php';
\OC::$loader->addValidRoot(\OC::$SERVERROOT . '/tests');
\OC_App::loadApp('files_pdfviewer');
if (!class_exists('PHPUnit_Framework_TestCase')) {
require_once 'PHPUnit/Autoload.php';
}
OC_Hook::clear();
示例12: define
/**
* @author Joas Schilling <nickvergessen@owncloud.com>
*
* @copyright Copyright (c) 2015, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
if (!defined('PHPUNIT_RUN')) {
define('PHPUNIT_RUN', 1);
}
require_once __DIR__ . '/../../../lib/base.php';
// Fix for "Autoload path not allowed: .../tests/lib/testcase.php"
\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
// Fix for "Autoload path not allowed: .../notifications/tests/testcase.php"
\OC_App::loadApp('notifications');
if (!class_exists('PHPUnit_Framework_TestCase')) {
require_once 'PHPUnit/Autoload.php';
}
OC_Hook::clear();
示例13: define
<?php
define('PHPUNIT_RUN', 1);
require_once __DIR__ . '/../../../lib/base.php';
require_once __DIR__ . '/../vendor/autoload.php';
if (version_compare(implode('.', \OCP\Util::getVersion()), '8.2', '>=')) {
\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
\OC_App::loadApp('mail');
}
if (!class_exists('PHPUnit_Framework_TestCase')) {
require_once 'PHPUnit/Autoload.php';
}
OC_Hook::clear();
示例14: xsetUpBeforeClass
<?php
/**
* Copyright (c) 2013 Thomas Tanghus (thomas@tanghus.net)
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OC_App::loadApp('contacts');
class Test_Contacts_Backend_Datebase extends \OCA\Contacts\TestCase
{
protected static $schema_file = 'static://test_db_scheme';
protected static $test_prefix;
protected static $backend;
protected static $user;
protected static $addressBooksTableName;
protected static $cardsTableName;
public static function xsetUpBeforeClass()
{
$dbfile = __DIR__ . '/../../appinfo/database.xml';
self::$test_prefix = '_' . OC_Util::generateRandomBytes('4') . '_';
$content = file_get_contents($dbfile);
$content = str_replace('*dbprefix*', '*dbprefix*' . self::$test_prefix, $content);
file_put_contents(self::$schema_file, $content);
OC_DB::createDbFromStructure(self::$schema_file);
self::$addressBooksTableName = '*PREFIX*' . self::$test_prefix . 'contacts_addressbooks';
self::$cardsTableName = '*PREFIX*' . self::$test_prefix . 'contacts_cards';
OC_User::clearBackends();
OC_User::useBackend('dummy');
self::$user = uniqid('user_');
OC_User::createUser(self::$user, 'pass');
示例15: testDecryptAll
function testDecryptAll()
{
$filename = "/decryptAll" . $this->getUniqueID() . ".txt";
$datadir = \OC_Config::getValue('datadirectory', \OC::$SERVERROOT . '/data/');
$userdir = $datadir . '/' . $this->userId . '/files/';
$this->view->file_put_contents($this->userId . '/files/' . $filename, $this->dataShort);
$fileInfoEncrypted = $this->view->getFileInfo($this->userId . '/files/' . $filename);
$this->assertTrue($fileInfoEncrypted instanceof \OC\Files\FileInfo);
$this->assertEquals($fileInfoEncrypted['encrypted'], 1);
$encContent = file_get_contents($userdir . $filename);
\OC_App::disable('files_encryption');
$user = \OCP\User::getUser();
$this->logoutHelper();
$this->loginHelper($user, false, false, false);
$content = file_get_contents($userdir . $filename);
//content should be encrypted
$this->assertSame($encContent, $content);
// now we load the encryption app again
\OC_App::loadApp('files_encryption');
// init encryption app
$params = array('uid' => \OCP\User::getUser(), 'password' => \OCP\User::getUser());
$view = new \OC\Files\View('/');
$util = new \OCA\Files_Encryption\Util($view, \OCP\User::getUser());
$result = $util->initEncryption($params);
$this->assertTrue($result instanceof \OCA\Files_Encryption\Session);
$successful = $util->decryptAll();
$this->assertTrue($successful);
$this->logoutHelper();
$this->loginHelper($user, false, false, false);
// file should be unencrypted and fileInfo should contain the correct values
$content = file_get_contents($userdir . $filename);
// now we should get the plain data
$this->assertSame($this->dataShort, $content);
$fileInfoUnencrypted = $this->view->getFileInfo($this->userId . '/files/' . $filename);
$this->assertTrue($fileInfoUnencrypted instanceof \OC\Files\FileInfo);
// check if mtime and etags unchanged
$this->assertEquals($fileInfoEncrypted['mtime'], $fileInfoUnencrypted['mtime']);
$this->assertSame($fileInfoEncrypted['etag'], $fileInfoUnencrypted['etag']);
// file should no longer be encrypted
$this->assertEquals(0, $fileInfoUnencrypted['encrypted']);
$backupPath = $this->getBackupPath('decryptAll');
// check if the keys where moved to the backup location
$this->assertTrue($this->view->is_dir($backupPath . '/keys'));
$this->assertTrue($this->view->file_exists($backupPath . '/keys/' . $filename . '/fileKey'));
$this->assertTrue($this->view->file_exists($backupPath . '/keys/' . $filename . '/' . $user . '.shareKey'));
// cleanup
$this->view->unlink($this->userId . '/files/' . $filename);
$this->view->deleteAll($backupPath);
\OC_App::enable('files_encryption');
}