@@ -412,13 +412,18 @@ func (repo *Repository) ComposeMetas() map[string]string {
412
412
}
413
413
414
414
// DeleteUncyclo removes the actual and local copy of repository wiki.
415
- func (repo * Repository ) DeleteUncyclo () {
415
+ func (repo * Repository ) DeleteUncyclo () error {
416
+ return repo .deleteUncyclo (x )
417
+ }
418
+
419
+ func (repo * Repository ) deleteUncyclo (e Engine ) error {
416
420
wikiPaths := []string {repo .UncycloPath (), repo .LocalUncycloPath ()}
417
421
for _ , wikiPath := range wikiPaths {
418
- RemoveAllWithNotice ( "Delete repository wiki" , wikiPath )
422
+ removeAllWithNotice ( e , "Delete repository wiki" , wikiPath )
419
423
}
420
424
421
- x .Where ("repo_id = ?" , repo .ID ).And ("type = ?" , UnitTypeUncyclo ).Delete (new (RepoUnit ))
425
+ _ , err := e .Where ("repo_id = ?" , repo .ID ).And ("type = ?" , UnitTypeUncyclo ).Delete (new (RepoUnit ))
426
+ return err
422
427
}
423
428
424
429
func (repo * Repository ) getAssignees (e Engine ) (_ []* User , err error ) {
@@ -1620,27 +1625,25 @@ func DeleteRepository(uid, repoID int64) error {
1620
1625
return err
1621
1626
}
1622
1627
1623
- // Remove repository files.
1628
+ // FIXME: Remove repository files should be executed after transaction succeed .
1624
1629
repoPath := repo .repoPath (sess )
1625
- RemoveAllWithNotice ( "Delete repository files" , repoPath )
1630
+ removeAllWithNotice ( sess , "Delete repository files" , repoPath )
1626
1631
1627
- repo .DeleteUncyclo ( )
1632
+ repo .deleteUncyclo ( sess )
1628
1633
1629
1634
// Remove attachment files.
1630
1635
for i := range attachmentPaths {
1631
- RemoveAllWithNotice ( "Delete attachment" , attachmentPaths [i ])
1636
+ removeAllWithNotice ( sess , "Delete attachment" , attachmentPaths [i ])
1632
1637
}
1633
1638
1634
1639
// Remove LFS objects
1635
1640
var lfsObjects []* LFSMetaObject
1636
-
1637
1641
if err = sess .Where ("repository_id=?" , repoID ).Find (& lfsObjects ); err != nil {
1638
1642
return err
1639
1643
}
1640
1644
1641
1645
for _ , v := range lfsObjects {
1642
1646
count , err := sess .Count (& LFSMetaObject {Oid : v .Oid })
1643
-
1644
1647
if err != nil {
1645
1648
return err
1646
1649
}
0 commit comments