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

ddev import-files should work any time upload_dirs are implied or specified #5127

Closed
1 task done
stasadev opened this issue Jul 12, 2023 · 3 comments
Closed
1 task done
Assignees
Milestone

Comments

@stasadev
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem?

Describe your solution

I noticed that not every project type supports ddev import-files:

appTypeMatrix = map[string]appTypeFuncs{
nodeps.AppTypeBackdrop: {
settingsCreator: createBackdropSettingsFile,
uploadDirs: getBackdropUploadDirs,
hookDefaultComments: getBackdropHooks,
appTypeSettingsPaths: setBackdropSiteSettingsPaths,
appTypeDetect: isBackdropApp,
postImportDBAction: backdropPostImportDBAction,
postStartAction: backdropPostStartAction,
importFilesAction: backdropImportFilesAction,
defaultWorkingDirMap: docrootWorkingDir,
},
nodeps.AppTypeCraftCms: {
importFilesAction: craftCmsImportFilesAction,
appTypeDetect: isCraftCmsApp,
configOverrideAction: craftCmsConfigOverrideAction,
postStartAction: craftCmsPostStartAction,
},
nodeps.AppTypeDjango4: {
settingsCreator: django4SettingsCreator,
appTypeDetect: isDjango4App,
configOverrideAction: django4ConfigOverrideAction,
postConfigAction: django4PostConfigAction,
postStartAction: django4PostStartAction,
},
nodeps.AppTypeDrupal6: {
settingsCreator: createDrupalSettingsPHP,
uploadDirs: getDrupalUploadDirs,
hookDefaultComments: getDrupal6Hooks,
appTypeSettingsPaths: setDrupalSiteSettingsPaths,
appTypeDetect: isDrupal6App,
configOverrideAction: drupal6ConfigOverrideAction,
postStartAction: drupal6PostStartAction,
importFilesAction: drupalImportFilesAction,
defaultWorkingDirMap: docrootWorkingDir,
},
nodeps.AppTypeDrupal7: {
settingsCreator: createDrupalSettingsPHP,
uploadDirs: getDrupalUploadDirs,
hookDefaultComments: getDrupal7Hooks,
appTypeSettingsPaths: setDrupalSiteSettingsPaths,
appTypeDetect: isDrupal7App,
postStartAction: drupal7PostStartAction,
importFilesAction: drupalImportFilesAction,
defaultWorkingDirMap: docrootWorkingDir,
},
nodeps.AppTypeDrupal8: {
settingsCreator: createDrupalSettingsPHP,
uploadDirs: getDrupalUploadDirs,
hookDefaultComments: getDrupal8Hooks,
appTypeSettingsPaths: setDrupalSiteSettingsPaths,
appTypeDetect: isDrupal8App,
configOverrideAction: drupal8ConfigOverrideAction,
postStartAction: drupal8PostStartAction,
importFilesAction: drupalImportFilesAction,
},
nodeps.AppTypeDrupal9: {
settingsCreator: createDrupalSettingsPHP,
uploadDirs: getDrupalUploadDirs,
hookDefaultComments: getDrupal8Hooks,
appTypeSettingsPaths: setDrupalSiteSettingsPaths,
appTypeDetect: isDrupal9App,
postStartAction: drupalPostStartAction,
importFilesAction: drupalImportFilesAction,
},
nodeps.AppTypeDrupal10: {
settingsCreator: createDrupalSettingsPHP,
uploadDirs: getDrupalUploadDirs,
hookDefaultComments: getDrupal8Hooks,
appTypeSettingsPaths: setDrupalSiteSettingsPaths,
appTypeDetect: isDrupal10App,
configOverrideAction: drupal10ConfigOverrideAction,
postStartAction: drupalPostStartAction,
importFilesAction: drupalImportFilesAction,
},
nodeps.AppTypeLaravel: {
appTypeDetect: isLaravelApp,
postStartAction: laravelPostStartAction,
configOverrideAction: laravelConfigOverrideAction,
},
nodeps.AppTypeMagento: {
settingsCreator: createMagentoSettingsFile,
uploadDirs: getMagentoUploadDirs,
appTypeSettingsPaths: setMagentoSiteSettingsPaths,
appTypeDetect: isMagentoApp,
configOverrideAction: magentoConfigOverrideAction,
importFilesAction: magentoImportFilesAction,
},
nodeps.AppTypeMagento2: {
settingsCreator: createMagento2SettingsFile,
uploadDirs: getMagento2UploadDirs,
appTypeSettingsPaths: setMagento2SiteSettingsPaths,
appTypeDetect: isMagento2App,
configOverrideAction: magento2ConfigOverrideAction,
importFilesAction: magentoImportFilesAction,
},
nodeps.AppTypePHP: {
postStartAction: phpPostStartAction,
importFilesAction: phpImportFilesAction,
},
nodeps.AppTypePython: {
appTypeDetect: isPythonApp,
configOverrideAction: pythonConfigOverrideAction,
postConfigAction: pythonPostConfigAction,
},
nodeps.AppTypeShopware6: {
appTypeDetect: isShopware6App,
appTypeSettingsPaths: setShopware6SiteSettingsPaths,
uploadDirs: getShopwareUploadDirs,
postStartAction: shopware6PostStartAction,
importFilesAction: shopware6ImportFilesAction,
},
nodeps.AppTypeTYPO3: {
settingsCreator: createTypo3SettingsFile,
uploadDirs: getTypo3UploadDirs,
hookDefaultComments: getTypo3Hooks,
appTypeSettingsPaths: setTypo3SiteSettingsPaths,
appTypeDetect: isTypo3App,
importFilesAction: typo3ImportFilesAction,
},
nodeps.AppTypeWordPress: {
settingsCreator: createWordpressSettingsFile,
uploadDirs: getWordpressUploadDirs,
hookDefaultComments: getWordpressHooks,
appTypeSettingsPaths: setWordpressSiteSettingsPaths,
appTypeDetect: isWordpressApp,
importFilesAction: wordpressImportFilesAction,
},
}

nodeps.AppTypeDjango4, nodeps.AppTypeLaravel and nodeps.AppTypePython are missing importFilesAction.

I guess it was just missed in the massive #5005.

Not sure about the specific actions for Django and Python, but Laravel should be the same as the generic PHP type.

Describe alternatives

No response

Additional context

No response

@rfay
Copy link
Member

rfay commented Jul 12, 2023

Not all project types have an explicit location for user-generated files. For example, with Craft CMS and Laravel it's completely a developer choice. Same with php.

However, if upload_dirs is specified, ddev import-files should still work.

@stasadev
Copy link
Member Author

However, if upload_dirs is specified, ddev import-files should still work.

Unfortunately, it doesn't work:

# prepare a test folder with a test file
mkdir test && cd test && mkdir test_folder && touch test_folder/file.txt

# try to import files for PHP project type
ddev config --auto --upload-dirs=test_folder2 --project-type=php
ddev import-files --source=test_folder
Successfully imported files for test

# try to import files for Laravel project type
ddev config --auto --upload-dirs=test_folder2 --project-type=laravel
ddev import-files --source=test_folder
Error: failed to import files for test: this project type (laravel) does not support import-files

nodeps.AppTypeDjango4, nodeps.AppTypeLaravel and nodeps.AppTypePython are missing importFilesAction.

@rfay rfay changed the title Add all project types to ddev import-files ddev import-files should work any time upload_dirs are implied or specified Jul 12, 2023
@rfay rfay added this to the v1.22 milestone Jul 12, 2023
@rfay
Copy link
Member

rfay commented Jul 12, 2023

I intended to fix this with a separate PR but looks like I'll need it to get tests to pass for the panic PR, #5126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants