Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable10] [PR 34898] Add the apps-external directory during setup only #34902

Merged
merged 1 commit into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ core_vendor=core/vendor

core_doc_files=AUTHORS COPYING README.md CHANGELOG.md
core_src_files=$(wildcard *.php) index.html db_structure.xml .htaccess .user.ini robots.txt
core_src_dirs=apps apps-external core l10n lib occ ocs ocs-provider ocm-provider resources settings
core_src_dirs=apps core l10n lib occ ocs ocs-provider ocm-provider resources settings
core_test_dirs=tests
core_all_src=$(core_src_files) $(core_src_dirs) $(core_doc_files)
core_config_files=config/config.sample.php config/config.apps.sample.php
Expand Down Expand Up @@ -262,7 +262,7 @@ $(dist_dir)/owncloud: $(composer_deps) $(core_vendor) $(core_all_src)
rm -Rf $@/core/vendor/*/{.bower.json,bower.json,package.json,testem.json}
rm -Rf $@/l10n/
find $@/core/ -iname \*.sh -delete
find $@/{apps/,apps-external/,lib/composer/,core/vendor/} \( \
find $@/{apps/,lib/composer/,core/vendor/} \( \
-name bin -o \
-name test -o \
-name tests -o \
Expand All @@ -273,7 +273,7 @@ $(dist_dir)/owncloud: $(composer_deps) $(core_vendor) $(core_all_src)
-name travis -o \
-iname \*.sh \
\) -print | xargs rm -Rf
find $@/{apps/,apps-external/,lib/composer/} -iname \*.exe -delete
find $@/{apps/,lib/composer/} -iname \*.exe -delete
# Set build
$(eval _BUILD="$(shell date -u --iso-8601=seconds) $(shell git rev-parse HEAD)")
# Replace channel in version.php
Expand Down Expand Up @@ -313,7 +313,7 @@ $(dist_dir)/qa/owncloud: $(composer_dev_deps) $(core_vendor) $(core_all_src) $(c
rm -Rf $@/core/vendor/*/{.bower.json,bower.json,package.json,testem.json}
rm -Rf $@/l10n/
find $@/core/ -iname \*.sh -delete
find $@/{apps/,apps-external/,lib/composer/,core/vendor/} \( \
find $@/{apps/,lib/composer/,core/vendor/} \( \
-name test -o \
-name examples -o \
-name demo -o \
Expand All @@ -322,7 +322,7 @@ $(dist_dir)/qa/owncloud: $(composer_dev_deps) $(core_vendor) $(core_all_src) $(c
-name travis -o \
-iname \*.sh \
\) -print | xargs rm -Rf
find $@/{apps/,apps-external/,lib/composer/} -iname \*.exe -delete
find $@/{apps/,lib/composer/} -iname \*.exe -delete
# Set build
$(eval _BUILD="$(shell date -u --iso-8601=seconds) $(shell git rev-parse HEAD)")
# Replace channel in version.php
Expand Down
Empty file removed apps-external/.gitkeep
Empty file.
21 changes: 18 additions & 3 deletions lib/private/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,22 @@ public function install($options) {
) {
$error[] = $l->t("Can't create or write into the data directory %s", [$dataDir]);
}


// create the apps-external directory only during installation
$appsExternalDir = \OC::$SERVERROOT.'/apps-external';
if (!\file_exists($appsExternalDir)) {
@\mkdir($appsExternalDir);
}

// validate the apps-external directory
if (
(!\is_dir($appsExternalDir) and !\mkdir($appsExternalDir)) or
!\is_writable($appsExternalDir)
) {
$htmlAppsExternalDir = \htmlspecialchars_decode($appsExternalDir);
$error[] = $l->t("Can't create or write into the apps-external directory %s", $htmlAppsExternalDir);
}

if (\count($error) != 0) {
return $error;
}
Expand Down Expand Up @@ -383,10 +398,10 @@ public function install($options) {
$config->setSystemValue('logtimezone', \date_default_timezone_get());
}

// adding the apps-external directory by default using apps_path
// add the apps-external directory to config using apps_path
// add the key only if it does not exist (protect against overwriting)
$apps2Key = \OC::$server->getSystemConfig()->getValue('apps_paths', false);

// add the key only if it does not exist (protect against overwriting)
if ($apps2Key === false) {
$defaultAppsPaths = [
'apps_paths' => [
Expand Down