@@ -147,7 +147,7 @@ func MigrateViewedFromJson(jsonDB, bboltDB TorrServerDB) error {
147147func MigrateSingle (source , target TorrServerDB , xpath , name string ) (bool , error ) {
148148 sourceData := source .Get (xpath , name )
149149 if sourceData == nil {
150- if getDebug () {
150+ if IsDebug () {
151151 log .TLogln (fmt .Sprintf ("No data to migrate for %s/%s" , xpath , name ))
152152 }
153153 return false , nil
@@ -157,7 +157,7 @@ func MigrateSingle(source, target TorrServerDB, xpath, name string) (bool, error
157157 if targetData != nil {
158158 // Check if already identical
159159 if equal , err := isByteArraysEqualJson (sourceData , targetData ); err == nil && equal {
160- if getDebug () {
160+ if IsDebug () {
161161 log .TLogln (fmt .Sprintf ("Skipping %s/%s (already identical)" , xpath , name ))
162162 }
163163 return false , nil
@@ -166,15 +166,15 @@ func MigrateSingle(source, target TorrServerDB, xpath, name string) (bool, error
166166
167167 // Perform migration
168168 target .Set (xpath , name , sourceData )
169- if getDebug () {
169+ if IsDebug () {
170170 log .TLogln (fmt .Sprintf ("Migrating %s/%s" , xpath , name ))
171171 }
172172
173173 // Verify migration
174174 if err := verifyMigration (source , target , xpath , name , sourceData ); err != nil {
175175 return false , fmt .Errorf ("migration verification failed for %s/%s: %w" , xpath , name , err )
176176 }
177- if getDebug () {
177+ if IsDebug () {
178178 log .TLogln (fmt .Sprintf ("Successfully migrated %s/%s" , xpath , name ))
179179 }
180180 return true , nil
@@ -185,7 +185,7 @@ func MigrateSingle(source, target TorrServerDB, xpath, name string) (bool, error
185185func MigrateAll (source , target TorrServerDB , xpath string ) (int , int , error ) {
186186 names := source .List (xpath )
187187 if len (names ) == 0 {
188- if getDebug () {
188+ if IsDebug () {
189189 log .TLogln (fmt .Sprintf ("No entries to migrate for %s" , xpath ))
190190 }
191191 return 0 , 0 , nil
@@ -194,14 +194,14 @@ func MigrateAll(source, target TorrServerDB, xpath string) (int, int, error) {
194194 migratedCount := 0
195195 skippedCount := 0
196196 var firstError error
197- if getDebug () {
197+ if IsDebug () {
198198 log .TLogln (fmt .Sprintf ("Starting migration of %d %s entries" , len (names ), xpath ))
199199 }
200200 for i , name := range names {
201201 sourceData := source .Get (xpath , name )
202202 if sourceData == nil {
203203 skippedCount ++
204- if getDebug () {
204+ if IsDebug () {
205205 log .TLogln (fmt .Sprintf ("[%d/%d] Skipping %s/%s (no data in source)" ,
206206 i + 1 , len (names ), xpath , name ))
207207 }
@@ -213,7 +213,7 @@ func MigrateAll(source, target TorrServerDB, xpath string) (int, int, error) {
213213 // Check if already identical
214214 if equal , err := isByteArraysEqualJson (sourceData , targetData ); err == nil && equal {
215215 skippedCount ++
216- if getDebug () {
216+ if IsDebug () {
217217 log .TLogln (fmt .Sprintf ("[%d/%d] Skipping %s/%s (already identical)" ,
218218 i + 1 , len (names ), xpath , name ))
219219 }
@@ -233,7 +233,7 @@ func MigrateAll(source, target TorrServerDB, xpath string) (int, int, error) {
233233 }
234234 } else {
235235 migratedCount ++
236- if getDebug () {
236+ if IsDebug () {
237237 log .TLogln (fmt .Sprintf ("[%d/%d] Successfully migrated %s/%s" ,
238238 i + 1 , len (names ), xpath , name ))
239239 }
@@ -245,7 +245,7 @@ func MigrateAll(source, target TorrServerDB, xpath string) (int, int, error) {
245245 if firstError != nil {
246246 summary += fmt .Sprintf (", 1+ errors (first: %v)" , firstError )
247247 }
248- if getDebug () {
248+ if IsDebug () {
249249 log .TLogln (summary )
250250 }
251251
@@ -348,7 +348,7 @@ func verifyMigration(source, target TorrServerDB, xpath, name string, originalDa
348348 } else if ! equal {
349349 return fmt .Errorf ("data mismatch after migration for %s/%s" , xpath , name )
350350 }
351- if getDebug () {
351+ if IsDebug () {
352352 log .TLogln (fmt .Sprintf ("Verified migration of %s/%s" , xpath , name ))
353353 }
354354 return nil
0 commit comments