MCPcopy Index your code
hub / github.com/ddev/ddev / Pull

Method Pull

pkg/ddevapp/provider.go:66–152  ·  view source on GitHub ↗

Pull performs an import of db and files

(provider *Provider, skipDBArg bool, skipFilesArg bool, skipImportArg bool)

Source from the content-addressed store, hash-verified

64
65// Pull performs an import of db and files
66func (app *DdevApp) Pull(provider *Provider, skipDBArg bool, skipFilesArg bool, skipImportArg bool) error {
67 var err error
68 err = app.ProcessHooks("pre-pull")
69 if err != nil {
70 return fmt.Errorf("failed to process pre-pull hooks: %v", err)
71 }
72
73 status, _ := app.SiteStatus()
74 if status != SiteRunning {
75 util.Warning("Project is not currently running. Starting project before performing pull.")
76 err = app.Start()
77 if err != nil {
78 return err
79 }
80 }
81
82 if provider.AuthCommand.Command != "" {
83 output.UserOut.Print("Authenticating...")
84 err = provider.app.ExecOnHostOrService(provider.AuthCommand.Service, provider.injectedEnvironment()+"; "+provider.AuthCommand.Command)
85 if err != nil {
86 return err
87 }
88 }
89
90 if skipDBArg {
91 output.UserOut.Println("Skipping database pull.")
92 } else {
93 output.UserOut.Println("Obtaining databases...")
94 fileLocation, importPath, err := provider.GetBackup("database")
95 if err != nil {
96 return err
97 }
98 err = app.MutagenSyncFlush()
99 if err != nil {
100 return err
101 }
102
103 if skipImportArg {
104 output.UserOut.Println("Skipping database import.")
105 } else {
106 err = app.MutagenSyncFlush()
107 if err != nil {
108 return err
109 }
110 output.UserOut.Printf("Importing databases %v", fileLocation)
111 err = provider.importDatabaseBackup(fileLocation, importPath)
112 if err != nil {
113 return err
114 }
115 }
116 }
117
118 if skipFilesArg {
119 output.UserOut.Println("Skipping files pull.")
120 } else {
121 output.UserOut.Println("Obtaining files...")
122 files, _, err := provider.GetBackup("files")
123 if err != nil {

Callers 8

TestLocalfilePullFunction · 0.45
TestAcquiaPullFunction · 0.45
TestPantheonPullFunction · 0.45
startAndCheckUpsunPullFunction · 0.45
TestLagoonPullFunction · 0.45
TestGitPullFunction · 0.45
appPullFunction · 0.45

Calls 11

ProcessHooksMethod · 0.95
SiteStatusMethod · 0.95
StartMethod · 0.95
MutagenSyncFlushMethod · 0.95
WarningFunction · 0.92
ErrorfMethod · 0.80
ExecOnHostOrServiceMethod · 0.80
injectedEnvironmentMethod · 0.80
GetBackupMethod · 0.80
importDatabaseBackupMethod · 0.80
doFilesImportMethod · 0.80

Tested by 7

TestLocalfilePullFunction · 0.36
TestAcquiaPullFunction · 0.36
TestPantheonPullFunction · 0.36
startAndCheckUpsunPullFunction · 0.36
TestLagoonPullFunction · 0.36
TestGitPullFunction · 0.36