本文整理汇总了PHP中OC_App::getAppPath方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_App::getAppPath方法的具体用法?PHP OC_App::getAppPath怎么用?PHP OC_App::getAppPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_App
的用法示例。
在下文中一共展示了OC_App::getAppPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update($tmpDir = '') {
Helper::mkdir($tmpDir, true);
$this->collect();
try {
foreach ($this->appsToUpdate as $appId) {
if (!@file_exists($this->newBase . '/' . $appId)){
continue;
}
$path = \OC_App::getAppPath($appId);
if ($path) {
Helper::move($path, $tmpDir . '/' . $appId);
// ! reverted intentionally
$this->done [] = array(
'dst' => $path,
'src' => $tmpDir . '/' . $appId
);
Helper::move($this->newBase . '/' . $appId, $path);
} else {
// The app is new and doesn't exist in the current instance
$pathData = first(\OC::$APPSROOTS);
Helper::move($this->newBase . '/' . $appId, $pathData['path'] . '/' . $appId);
}
}
$this->finalize();
} catch (\Exception $e) {
$this->rollback(true);
throw $e;
}
}
示例2: loadCommands
/**
* @param OutputInterface $output
*/
public function loadCommands(OutputInterface $output)
{
// $application is required to be defined in the register_command scripts
$application = $this->application;
require_once \OC::$SERVERROOT . '/core/register_command.php';
if ($this->config->getSystemValue('installed', false)) {
if (!\OCP\Util::needUpgrade()) {
OC_App::loadApps();
foreach (\OC::$server->getAppManager()->getInstalledApps() as $app) {
$appPath = \OC_App::getAppPath($app);
\OC::$loader->addValidRoot($appPath);
$file = $appPath . '/appinfo/register_command.php';
if (file_exists($file)) {
require $file;
}
}
} else {
$output->writeln("ownCloud or one of the apps require upgrade - only a limited number of commands are available");
}
} else {
$output->writeln("ownCloud is not installed - only a limited number of commands are available");
}
$input = new ArgvInput();
if ($input->getFirstArgument() !== 'check') {
$errors = \OC_Util::checkServer(\OC::$server->getConfig());
if (!empty($errors)) {
foreach ($errors as $error) {
$output->writeln((string) $error['error']);
$output->writeln((string) $error['hint']);
$output->writeln('');
}
throw new \Exception("Environment not properly prepared.");
}
}
}
示例3: doFind
/**
* @param string $script
*/
public function doFind($script)
{
$theme_dir = 'themes/' . $this->theme . '/';
if (strpos($script, '3rdparty') === 0 && $this->appendIfExist($this->thirdpartyroot, $script . '.js')) {
return;
}
if (strpos($script, '/l10n/') !== false) {
// For language files we try to load them all, so themes can overwrite
// single l10n strings without having to translate all of them.
$found = 0;
$found += $this->appendIfExist($this->serverroot, 'core/' . $script . '.js');
$found += $this->appendIfExist($this->serverroot, $theme_dir . 'core/' . $script . '.js');
$found += $this->appendIfExist($this->serverroot, $script . '.js');
$found += $this->appendIfExist($this->serverroot, $theme_dir . $script . '.js');
$found += $this->appendIfExist($this->serverroot, $theme_dir . 'apps/' . $script . '.js');
if ($found) {
return;
}
} else {
if ($this->appendIfExist($this->serverroot, $theme_dir . 'apps/' . $script . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . $script . '.js') || $this->appendIfExist($this->serverroot, $script . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . 'core/' . $script . '.js') || $this->appendIfExist($this->serverroot, 'core/' . $script . '.js')) {
return;
}
}
$app = substr($script, 0, strpos($script, '/'));
$script = substr($script, strpos($script, '/') + 1);
$app_path = \OC_App::getAppPath($app);
$app_url = \OC_App::getAppWebPath($app);
// missing translations files fill be ignored
if (strpos($script, 'l10n/') === 0) {
$this->appendIfExist($app_path, $script . '.js', $app_url);
return;
}
$this->append($app_path, $script . '.js', $app_url);
}
示例4: getAppPath
/**
* Provides \OC_App::getAppPath($appId)
*
* @param string $appId
* @return string
* @throws \Exception If the app cannot be found
*/
public function getAppPath($appId)
{
$path = \OC_App::getAppPath($appId);
if ($path === false) {
throw new \Exception('App not found');
}
return $path;
}
示例5: analyse
/**
* @param string $appId
* @return array
*/
public function analyse($appId)
{
$appPath = \OC_App::getAppPath($appId);
if ($appPath === false) {
throw new \RuntimeException("No app with given id <{$appId}> known.");
}
return $this->analyseFolder($appPath);
}
示例6: 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';
}
示例7: __construct
public function __construct()
{
$this->filePath = \OC_App::getAppPath('owncollab_talks') . '/config/config.php';
if (is_file($this->filePath)) {
$this->read();
} else {
$this->error = 'File "owncollab_talks/config/config.php" not exist';
}
}
示例8: analyse
/**
* @param string $appId
* @return array
*/
public function analyse($appId)
{
$appPath = \OC_App::getAppPath($appId);
if ($appPath === false) {
throw new \RuntimeException("No app with given id <{$appId}> known.");
}
$errors = [];
$info = $this->infoParser->parse($appPath . '/appinfo/info.xml');
foreach ($info as $key => $value) {
if (is_array($value)) {
$value = json_encode($value);
}
if (in_array($key, $this->mandatoryFields)) {
$this->emit('InfoChecker', 'mandatoryFieldFound', [$key, $value]);
continue;
}
if (in_array($key, $this->optionalFields)) {
$this->emit('InfoChecker', 'optionalFieldFound', [$key, $value]);
continue;
}
if (in_array($key, $this->deprecatedFields)) {
// skip empty arrays - empty arrays for remote and public are always added
if ($value === '[]' && in_array($key, ['public', 'remote', 'info'])) {
continue;
}
$this->emit('InfoChecker', 'deprecatedFieldFound', [$key, $value]);
continue;
}
$this->emit('InfoChecker', 'unusedFieldFound', [$key, $value]);
}
foreach ($this->mandatoryFields as $key) {
if (!isset($info[$key])) {
$this->emit('InfoChecker', 'mandatoryFieldMissing', [$key]);
$errors[] = ['type' => 'mandatoryFieldMissing', 'field' => $key];
}
}
$versionFile = $appPath . '/appinfo/version';
if (is_file($versionFile)) {
$version = trim(file_get_contents($versionFile));
if (isset($info['version'])) {
if ($info['version'] !== $version) {
$this->emit('InfoChecker', 'differentVersions', [$version, $info['version']]);
$errors[] = ['type' => 'differentVersions', 'message' => 'appinfo/version: ' . $version . ' - appinfo/info.xml: ' . $info['version']];
} else {
$this->emit('InfoChecker', 'sameVersions', [$versionFile]);
}
} else {
$this->emit('InfoChecker', 'migrateVersion', [$version]);
}
} else {
if (!isset($info['version'])) {
$this->emit('InfoChecker', 'mandatoryFieldMissing', ['version']);
$errors[] = ['type' => 'mandatoryFieldMissing', 'field' => 'version'];
}
}
return $errors;
}
示例9: generateFileURL
/**
* @PublicPage
* @NoCSRFRequired
*
* @return TemplateResponse
*/
public function generateFileURL($file)
{
$url = sha1($file . mt_rand());
$app_path = \OC_App::getAppPath("libreonline");
$tmp_path = $app_path . '/tmp';
//FIXME: We should use owncloud api here.
copy("/var/www/owncloud/data/" . $this->userId . "/files{$file}", "{$tmp_path}/{$url}");
$uri = \OC_App::getAppWebPath('libreonline') . "/tmp/{$url}";
return $uri;
}
示例10: doFind
/**
* @param string $style
*/
public function doFind($style)
{
if (strpos($style, '3rdparty') === 0 && $this->appendIfExist($this->thirdpartyroot, $style . '.css') || $this->appendIfExist($this->serverroot, $style . '.css') || $this->appendIfExist($this->serverroot, 'core/' . $style . '.css')) {
return;
}
$app = substr($style, 0, strpos($style, '/'));
$style = substr($style, strpos($style, '/') + 1);
$app_path = \OC_App::getAppPath($app);
$app_url = \OC_App::getAppWebPath($app);
$this->append($app_path, $style . '.css', $app_url);
}
示例11: execute
/**
* Executes the current command.
*
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
* @return null|int null or 0 if everything went fine, or an error code
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$appName = $input->getArgument('app');
$path = \OC_App::getAppPath($appName);
if ($path !== false) {
$output->writeln($path);
return 0;
}
// App not found, exit with non-zero
return 1;
}
示例12: generateFileURL
/**
* @PublicPage
* @NoCSRFRequired
*
* @return TemplateResponse
*/
public function generateFileURL($file)
{
$url = sha1($file . mt_rand());
$app_path = \OC_App::getAppPath("libreonline");
$tmp_path = $app_path . '/tmp';
$config = \OC::$server->getConfig();
$datadirectory = $config->getSystemValue('datadirectory', false);
copy("{$datadirectory}/" . $this->userId . "/files{$file}", "{$tmp_path}/{$url}");
$uri = \OC_App::getAppWebPath('libreonline') . "/tmp/{$url}";
return $uri;
}
示例13: getRoutingFiles
public function getRoutingFiles()
{
if (!isset($this->routing_files)) {
$this->routing_files = array();
foreach (OC_APP::getEnabledApps() as $app) {
$file = OC_App::getAppPath($app) . '/appinfo/routes.php';
if (file_exists($file)) {
$this->routing_files[$app] = $file;
}
}
}
return $this->routing_files;
}
示例14: findTemplate
/**
* find the template with the given name
* @param string $name of the template file (without suffix)
*
* Will select the template file for the selected theme.
* Checking all the possible locations.
* @param string $theme
* @param string $app
* @return array
*/
protected function findTemplate($theme, $app, $name)
{
// Check if it is a app template or not.
if ($app !== '') {
$dirs = $this->getAppTemplateDirs($theme, $app, OC::$SERVERROOT, OC_App::getAppPath($app));
} else {
$dirs = $this->getCoreTemplateDirs($theme, OC::$SERVERROOT);
}
$locator = new \OC\Template\TemplateFileLocator($dirs);
$template = $locator->find($name);
$path = $locator->getPath();
return array($path, $template);
}
示例15: doFind
public function doFind($style)
{
if (strpos($style, '3rdparty') === 0 && $this->appendIfExist($this->thirdpartyroot, $style . '.css') || $this->appendIfExist($this->serverroot, $style . $this->form_factor . '.css') || $this->appendIfExist($this->serverroot, $style . '.css') || $this->appendIfExist($this->serverroot, 'core/' . $style . $this->form_factor . '.css') || $this->appendIfExist($this->serverroot, 'core/' . $style . '.css')) {
return;
}
$app = substr($style, 0, strpos($style, '/'));
$style = substr($style, strpos($style, '/') + 1);
$app_path = \OC_App::getAppPath($app);
$app_url = $this->webroot . '/index.php/apps/' . $app;
if ($this->appendIfExist($app_path, $style . $this->form_factor . '.css', $app_url) || $this->appendIfExist($app_path, $style . '.css', $app_url)) {
return;
}
throw new \Exception('css file not found: style:' . $style);
}