]> source.dussan.org Git - gitea.git/commitdiff
cmd: code fix for #905
authorUnknwon <joe2010xtmf@163.com>
Mon, 9 Feb 2015 02:26:14 +0000 (21:26 -0500)
committerUnknwon <joe2010xtmf@163.com>
Mon, 9 Feb 2015 02:26:14 +0000 (21:26 -0500)
- routers/admin: add rewrite update hook operation
- conf/locale: update locale file due to ini behavior changes
- cmd/cert_stub.go: remove useless code
- cmd/fix.go: no longer need fix command(at least now)

24 files changed:
cmd/cert_stub.go
cmd/dump.go
cmd/fix.go [deleted file]
cmd/serve.go
cmd/update.go
cmd/web.go
conf/locale/locale_de-DE.ini
conf/locale/locale_en-US.ini
conf/locale/locale_es-ES.ini
conf/locale/locale_fr-CA.ini
conf/locale/locale_ja-JP.ini
conf/locale/locale_lv-LV.ini
conf/locale/locale_nl-NL.ini
conf/locale/locale_ru-RU.ini
conf/locale/locale_zh-CN.ini
conf/locale/locale_zh-HK.ini
gogs.go
models/action.go
models/publickey.go
models/repo.go
routers/admin/admin.go
templates/.VERSION
templates/admin/dashboard.tmpl
templates/user/dashboard/feeds.tmpl

index 69c9821e0276eb35c9b8d628a5e0cd191742d8fd..1b68ca83f1c17af1ba2d34776d31aaa6f70b330e 100644 (file)
@@ -9,7 +9,6 @@ package cmd
 import (
        "fmt"
        "os"
-       "time"
 
        "github.com/codegangsta/cli"
 )
@@ -20,14 +19,6 @@ var CmdCert = cli.Command{
        Description: `Generate a self-signed X.509 certificate for a TLS server. 
 Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`,
        Action: runCert,
-       Flags: []cli.Flag{
-               cli.StringFlag{"host", "", "Comma-separated hostnames and IPs to generate a certificate for", ""},
-               cli.StringFlag{"ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521", ""},
-               cli.IntFlag{"rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set", ""},
-               cli.StringFlag{"start-date", "", "Creation date formatted as Jan 1 15:04:05 2011", ""},
-               cli.DurationFlag{"duration", 365 * 24 * time.Hour, "Duration that certificate is valid for", ""},
-               cli.BoolFlag{"ca", "whether this cert should be its own Certificate Authority", ""},
-       },
 }
 
 func runCert(ctx *cli.Context) {
index 57f1113ea30af687c838653df456387fb0800b57..36bb4f0305a4e8c2ec0add3f6e17091ef37731b5 100644 (file)
@@ -25,8 +25,8 @@ var CmdDump = cli.Command{
 It can be used for backup and capture Gogs server image to send to maintainer`,
        Action: runDump,
        Flags: []cli.Flag{
+               cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
                cli.BoolFlag{"verbose, v", "show process details", ""},
-               cli.StringFlag{"config, c", "custom/conf/app.ini", "Configuration file", ""},
        },
 }
 
diff --git a/cmd/fix.go b/cmd/fix.go
deleted file mode 100644 (file)
index eff85d6..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright 2014 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package cmd
-
-import (
-       "bufio"
-       "fmt"
-       "io"
-       "io/ioutil"
-       "os"
-       "path"
-       "runtime"
-       "strings"
-
-       "github.com/Unknwon/com"
-       "github.com/codegangsta/cli"
-
-       "github.com/gogits/gogs/models"
-       "github.com/gogits/gogs/modules/setting"
-)
-
-var CmdFix = cli.Command{
-       Name:        "fix",
-       Usage:       "This command for upgrade from old version",
-       Action:      runFix,
-       Subcommands: fixCommands,
-       Flags:       []cli.Flag{},
-}
-
-func runFix(ctx *cli.Context) {
-}
-
-var fixCommands = []cli.Command{
-       {
-               Name:  "location",
-               Usage: "Change Gogs app location",
-               Description: `Command location fixes location change of Gogs
-
-gogs fix location <old Gogs path>
-`,
-               Action: runFixLocation,
-       },
-}
-
-// rewriteAuthorizedKeys replaces old Gogs path to the new one.
-func rewriteAuthorizedKeys(sshPath, oldPath, newPath string) error {
-       fr, err := os.Open(sshPath)
-       if err != nil {
-               return err
-       }
-       defer fr.Close()
-
-       tmpPath := sshPath + ".tmp"
-       fw, err := os.Create(tmpPath)
-       if err != nil {
-               return err
-       }
-       defer fw.Close()
-
-       oldPath = "command=\"" + oldPath + " serv"
-       newPath = "command=\"" + newPath + " serv"
-       buf := bufio.NewReader(fr)
-       for {
-               line, errRead := buf.ReadString('\n')
-               line = strings.TrimSpace(line)
-
-               if errRead != nil {
-                       if errRead != io.EOF {
-                               return errRead
-                       }
-
-                       // Reached end of file, if nothing to read then break,
-                       // otherwise handle the last line.
-                       if len(line) == 0 {
-                               break
-                       }
-               }
-
-               // Still finding the line, copy the line that currently read.
-               if _, err = fw.WriteString(strings.Replace(line, oldPath, newPath, 1) + "\n"); err != nil {
-                       return err
-               }
-
-               if errRead == io.EOF {
-                       break
-               }
-       }
-
-       if err = os.Remove(sshPath); err != nil {
-               return err
-       }
-       return os.Rename(tmpPath, sshPath)
-}
-
-func rewriteUpdateHook(path, appPath string) error {
-       if runtime.GOOS == "windows" {
-               rp := strings.NewReplacer("\\", "/")
-               appPath = "\"" + rp.Replace(appPath) + "\""
-       } else {
-               rp := strings.NewReplacer("\\", "/", " ", "\\ ")
-               appPath = rp.Replace(appPath)
-       }
-
-       if err := ioutil.WriteFile(path, []byte(fmt.Sprintf(models.TPL_UPDATE_HOOK,
-               setting.ScriptType, appPath)), os.ModePerm); err != nil {
-               return err
-       }
-       return nil
-}
-
-func walkDir(rootPath, recPath, appPath string, depth int) error {
-       depth++
-       if depth > 3 {
-               return nil
-       } else if depth == 3 {
-               if err := rewriteUpdateHook(path.Join(rootPath, "hooks/update"), appPath); err != nil {
-                       return err
-               }
-       }
-
-       dir, err := os.Open(rootPath)
-       if err != nil {
-               return err
-       }
-       defer dir.Close()
-
-       fis, err := dir.Readdir(0)
-       if err != nil {
-               return err
-       }
-
-       for _, fi := range fis {
-               if strings.Contains(fi.Name(), ".DS_Store") {
-                       continue
-               }
-
-               relPath := path.Join(recPath, fi.Name())
-               curPath := path.Join(rootPath, fi.Name())
-               if fi.IsDir() {
-                       if err = walkDir(curPath, relPath, appPath, depth); err != nil {
-                               return err
-                       }
-               }
-       }
-       return nil
-}
-
-func runFixLocation(ctx *cli.Context) {
-       if len(ctx.Args()) != 1 {
-               fmt.Println("Incorrect arguments number, expect 1")
-               os.Exit(2)
-       }
-
-       execPath, _ := setting.ExecPath()
-
-       oldPath := ctx.Args().First()
-       fmt.Printf("Old location: %s\n", oldPath)
-       fmt.Println("This command should be executed in the new Gogs path")
-       fmt.Printf("Do you want to change Gogs app path from old location to:\n")
-       fmt.Printf("-> %s?\n", execPath)
-       fmt.Print("Press <enter> to continue, use <Ctrl+c> to exit.")
-       fmt.Scanln()
-
-       // Fix in authorized_keys file.
-       sshPath := path.Join(models.SSHPath, "authorized_keys")
-       if com.IsFile(sshPath) {
-               fmt.Printf("Fixing pathes in file: %s\n", sshPath)
-               if err := rewriteAuthorizedKeys(sshPath, oldPath, execPath); err != nil {
-                       fmt.Println(err)
-                       os.Exit(1)
-               }
-       }
-
-       // Fix position in gogs-repositories.
-       setting.NewConfigContext()
-       fmt.Printf("Fixing pathes in repositories: %s\n", setting.RepoRootPath)
-       if err := walkDir(setting.RepoRootPath, "", execPath, 0); err != nil {
-               fmt.Println(err)
-               os.Exit(1)
-       }
-       fmt.Println("Fix position finished!")
-}
index af18e05c1e5b52c0f25b1d745747bf90e761209c..28fd40134a180c48ac8ccb8d758177cb60b6ce12 100644 (file)
@@ -28,7 +28,7 @@ var CmdServ = cli.Command{
        Description: `Serv provide access auth for repositories`,
        Action:      runServ,
        Flags: []cli.Flag{
-               cli.StringFlag{"config, c", "custom/conf/app.ini", "Configuration file", ""},
+               cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
        },
 }
 
index 2ea7e942ddfd881a2502c7bb98243a79dcc5521d..c9eaeccf7bf871b91c5f899b26aa8fefdb93fa3b 100644 (file)
@@ -20,7 +20,7 @@ var CmdUpdate = cli.Command{
        Description: `Update get pushed info and insert into database`,
        Action:      runUpdate,
        Flags: []cli.Flag{
-               cli.StringFlag{"config, c", "custom/conf/app.ini", "Configuration file", ""},
+               cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
        },
 }
 
index ceb2134447c4eab6531fc14364ab5ed4cc684dfb..3284acb9df65a8a774d6d9781fc46fca0522c6df 100644 (file)
@@ -55,7 +55,7 @@ and it takes care of all the other things for you`,
        Action: runWeb,
        Flags: []cli.Flag{
                cli.StringFlag{"port, p", "3000", "Temporary port number to prevent conflict", ""},
-               cli.StringFlag{"config, c", "custom/conf/app.ini", "Configuration file", ""},
+               cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
        },
 }
 
@@ -166,11 +166,12 @@ func newMacaron() *macaron.Macaron {
 }
 
 func runWeb(ctx *cli.Context) {
+       checkVersion()
+
        if ctx.IsSet("config") {
                setting.CustomConf = ctx.String("config")
        }
        routers.GlobalInit()
-       checkVersion()
 
        m := newMacaron()
 
index 2d22d0491c21527c825ff64306d554b4b7b7785a..1dc7523b0f727b8f0d1ca25898bc579f41f3e3c7 100755 (executable)
@@ -59,6 +59,8 @@ run_user=Ausführender Benutzer
 run_user_helper=Der Benutzer muss die Zugriffsberechtigung für das Repository Root-Verzeichnis haben und der ausführende Benutzer von Gogs sein.\r
 domain=Domain\r
 domain_helper=Dies hat Auswirkung auf die SSH clone URLs.\r
+http_port=HTTP Port\r
+http_port_helper=Port number which application will listen on.\r
 app_url=Anwendungs-URL\r
 app_url_helper=Dies hat Auswirkung auf die HTTP/HTTPS clone URLs und für die E-Mails.\r
 email_title=E-Mail-Service Einstellungen (optional)\r
@@ -512,6 +514,11 @@ dashboard.delete_repo_archives=Alle Repository-Archive löschen
 dashboard.delete_repo_archives_success=Alle Repositoriy-Archive wurden gelöscht.\r
 dashboard.git_gc_repos=Führe Garbage Collection auf Repositories aus\r
 dashboard.git_gc_repos_success=Garbage Collection wurde auf allen Repositories erfolgreich ausgeführt.\r
+dashboard.resync_all_sshkeys=Rewrite '.ssh/autorized_key' file (caution: non-Gogs keys will be lost)\r
+dashboard.resync_all_sshkeys_success=All public keys have been rewritten successfully.\r
+dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)\r
+dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.\r
+\r
 dashboard.server_uptime=Server-Uptime\r
 dashboard.current_goroutine=Aktuelle Goroutines\r
 dashboard.current_memory_usage=Aktuelle Speichernutzung\r
@@ -631,7 +638,7 @@ config.db_path_helper=(nur für "sqlite3")
 config.service_config=Service-Einstellungen\r
 config.register_email_confirm=E-Mail-Bestätigung bei Registrierung\r
 config.disable_register=Registrierung deaktivieren\r
-config.show_registration_button = Registrierungs-Button anzeigen\r
+config.show_registration_button=Show Register Button\r
 config.require_sign_in_view=Ansehen erfordert Registrierung\r
 config.mail_notify=E-Mail-Benachrichtigung\r
 config.enable_cache_avatar=Avatar-Cache aktivieren\r
@@ -687,8 +694,8 @@ notices.delete_success=System-Mitteilung erfolgreich gelöscht.
 [action]\r
 create_repo=hat Repository <a href="%s/%s">%s</a> erstellt\r
 commit_repo=hat nach <a href="%s/%s/src/%s">%s</a> in <a href="%s/%s">%s</a> gepusht\r
-create_issue=hat Issue <a href="%s/%s/issues/%s">%s#%s</a> eröffnet\r
-comment_issue=hat Issue <a href="%s/%s/issues/%s">%s#%s</a> kommentiert\r
+create_issue=`hat Issue <a href="%s/issues/%s">%[1]s#%[2]s</a> eröffnet`\r
+comment_issue=`hat Issue <a href="%s/issues/%s">%[1]s#%[2]s</a> kommentiert`\r
 transfer_repo=hat Repository <code>%s</code> transferiert an <a href="/%s%s">%s</a>\r
 push_tag=hat nach <a href="%s/%s/src/%s">%s</a> in <a href="%s/%s">%s</a> gepusht\r
 compare_2_commits=Zeige Vergleich dieser 2 Commits\r
@@ -714,16 +721,3 @@ years=%[2]s %[1]d Jahren
 raw_seconds=Sekunden\r
 raw_minutes=Minuten\r
 \r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
index 4b8325ef4e886fd318b7b3221890ee6df311d819..8ea383f26bc081aa25ad43bd1372a13e9fe3f8ec 100644 (file)
@@ -67,7 +67,7 @@ email_title = E-mail Service Settings (Optional)
 smtp_host = SMTP Host
 mailer_user = Sender E-mail
 mailer_password = Sender Password
-notify_title = Notification Settings(Optional)
+notify_title = Notification Settings (Optional)
 register_confirm = Enable Register Confirmation
 mail_notify = Enable Mail Notification
 admin_title = Admin Account Settings
@@ -280,7 +280,7 @@ license_helper = Select a license file
 init_readme = Initialize this repository with a README.md
 create_repo = Create Repository
 default_branch = Default Branch
-mirror_interval = Mirror Interval(hour)
+mirror_interval = Mirror Interval (hour)
 goget_meta = Go-Get Meta
 goget_meta_helper = This repository will be <span class="label label-blue label-radius">Go-Getable</span>
 
@@ -514,8 +514,11 @@ dashboard.delete_repo_archives = Delete all repositories archives
 dashboard.delete_repo_archives_success = All repositories archives have been deleted successfully.
 dashboard.git_gc_repos = Do garbage collection on repositories
 dashboard.git_gc_repos_success = All repositories have done garbage collection successfully.
-dashboard.resync_all_sshkeys = Rewrite '.ssh/autorized_key' file(caution: non-Gogs keys will be lost)
+dashboard.resync_all_sshkeys = Rewrite '.ssh/autorized_key' file (caution: non-Gogs keys will be lost)
 dashboard.resync_all_sshkeys_success = All public keys have been rewritten successfully.
+dashboard.resync_all_update_hooks = Rewrite all update hook of repositories (needed when custom config path is changed)
+dashboard.resync_all_update_hooks_success = All repositories' update hook have been rewritten successfully.
+
 dashboard.server_uptime = Server Uptime
 dashboard.current_goroutine = Current Goroutines
 dashboard.current_memory_usage = Current Memory Usage
@@ -691,8 +694,8 @@ notices.delete_success = System notice has been deleted successfully.
 [action]
 create_repo = created repository <a href="%s/%s">%s</a>
 commit_repo = pushed to <a href="%s/%s/src/%s">%s</a> at <a href="%s/%s">%s</a>
-create_issue = opened issue <a href="%s/%s/issues/%s">%s#%s</a>
-comment_issue = commented on issue <a href="%s/%s/issues/%s">%s#%s</a>
+create_issue = `opened issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`
+comment_issue = `commented on issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`
 transfer_repo = transfered repository <code>%s</code> to <a href="/%s%s">%s</a>
 push_tag = pushed tag <a href="%s/%s/src/%s">%s</a> to <a href="%s/%s">%s</a>
 compare_2_commits = View comparison for these 2 commits
index f76d0a314a751db1e22a160464a5352c61ea84f4..d7fab5f9615f2dc3a70d26aec5f884238b3ce39b 100755 (executable)
@@ -516,6 +516,9 @@ dashboard.git_gc_repos=Ejecutar la recolección de basura en los repositorios
 dashboard.git_gc_repos_success=Todos los repositorios han ejecutado correctamente el recolector de basuras.\r
 dashboard.resync_all_sshkeys=Reescribir el fichero '.ssh/authorized_key'(atención: se perderán las claves que no pertenezcan a Gogs)\r
 dashboard.resync_all_sshkeys_success=Todas las claves públicas se han reescrito correctamente.\r
+dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)\r
+dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.\r
+\r
 dashboard.server_uptime=Uptime del Servidor\r
 dashboard.current_goroutine=Gorutinas Actuales\r
 dashboard.current_memory_usage=Uso de Memoria Actual\r
@@ -691,8 +694,8 @@ notices.delete_success=System notice has been deleted successfully.
 [action]\r
 create_repo=created repository <a href="%s/%s">%s</a>\r
 commit_repo=pushed to <a href="%s/%s/src/%s">%s</a> at <a href="%s/%s">%s</a>\r
-create_issue=opened issue <a href="%s/%s/issues/%s">%s#%s</a>\r
-comment_issue=commented on issue <a href="%s/%s/issues/%s">%s#%s</a>\r
+create_issue=`opened issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
+comment_issue=`commented on issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
 transfer_repo=transfered repository <code>%s</code> to <a href="/%s%s">%s</a>\r
 push_tag=pushed tag <a href="%s/%s/src/%s">%s</a> to <a href="%s/%s">%s</a>\r
 compare_2_commits=View comparison for these 2 commits\r
index ebe74e19bb8812f491ca4583f75c62d509dce6d5..94a2e968675e07fe3f08f9ae04bf145e5a4808cc 100755 (executable)
@@ -59,6 +59,8 @@ run_user=Entrer un Utilisateur
 run_user_helper=L'utilisateur doit avoir accès à la Racine du Référentiel et éxécuter Gogs.\r
 domain=Domaine\r
 domain_helper=Cela affecte les doublons d'URL SSH.\r
+http_port=HTTP Port\r
+http_port_helper=Port number which application will listen on.\r
 app_url=URL de l'Application\r
 app_url_helper=Cela affecte les doublons d'URL HTTP/HTTPS et le contenu d'e-mail.\r
 email_title=Paramètres du Service de Messagerie (Facultatif)\r
@@ -512,6 +514,11 @@ dashboard.delete_repo_archives=Supprimer toutes les archives de référentiels
 dashboard.delete_repo_archives_success=Toutes les archives de référentiels ont été supprimés avec succès.\r
 dashboard.git_gc_repos=Collecter les déchets des référentiels\r
 dashboard.git_gc_repos_success=Tous les référentiels ont effectué la collecte avec succès.\r
+dashboard.resync_all_sshkeys=Rewrite '.ssh/autorized_key' file (caution: non-Gogs keys will be lost)\r
+dashboard.resync_all_sshkeys_success=All public keys have been rewritten successfully.\r
+dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)\r
+dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.\r
+\r
 dashboard.server_uptime=Durée de Marche Serveur\r
 dashboard.current_goroutine=Goroutines actuelles\r
 dashboard.current_memory_usage=Utilisation Mémoire actuelle\r
@@ -631,6 +638,7 @@ config.db_path_helper=("sqlite3" uniquement)
 config.service_config=Configuration du Service\r
 config.register_email_confirm=Nécessite une confirmation par courriel\r
 config.disable_register=Désactiver l'Enregistrement\r
+config.show_registration_button=Show Register Button\r
 config.require_sign_in_view=Connexion Obligatoire pour Visualiser\r
 config.mail_notify=Mailer les Notifications\r
 config.enable_cache_avatar=Activer le Cache d'Avatar\r
@@ -686,8 +694,8 @@ notices.delete_success=Note système supprimée avec succès.
 [action]\r
 create_repo=a crée le Référentiel <a href="%s/%s">%s</a>\r
 commit_repo=a soumis à <a href="%s/%s/src/%s">%s</a> chez <a href="%s/%s">%s</a>\r
-create_issue=a ouvert un problème <a href="%s/%s/issues/%s">%s#%s</a>\r
-comment_issue=a commenté le problème <a href="%s/%s/issues/%s">%s#%s</a>\r
+create_issue=`a ouvert un problème <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
+comment_issue=`a commenté le problème <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
 transfer_repo=a transféré le Référentiel <code>%s</code> à <a href="/%s%s">%s</a>\r
 push_tag=a tagé <a href="%s/%s/src/%s">%s</a> à <a href="%s/%s">%s</a>\r
 compare_2_commits=Comparer ces 2 commissions\r
@@ -713,16 +721,3 @@ years=%d ans %s
 raw_seconds=secondes\r
 raw_minutes=minutes\r
 \r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
index a64ed0071f5f12d2957162f7299f1fd33a0376da..c8b70aa1cfbc6f7f808a9b67bb7edcff60a1ae1c 100755 (executable)
@@ -516,6 +516,9 @@ dashboard.git_gc_repos=リポジトリでのガベージコレクションを実
 dashboard.git_gc_repos_success=すべてのリポジトリは正常にガベージ コレクションを行いました。\r
 dashboard.resync_all_sshkeys='.ssh/ autorized_key' ファイルを再生成します。(警告:Gogsキー以外は失われます)\r
 dashboard.resync_all_sshkeys_success=すべての公開鍵が正常に書き換えられました。\r
+dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)\r
+dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.\r
+\r
 dashboard.server_uptime=サーバーの稼働時間\r
 dashboard.current_goroutine=現在のGoroutine\r
 dashboard.current_memory_usage=現在のメモリ使用量\r
@@ -691,8 +694,8 @@ notices.delete_success=システム通知が正常に削除されました。
 [action]\r
 create_repo=リポジトリ <a href="%s/%s"> %s</a>を作成しました\r
 commit_repo=<a href="%s/%s">%s</a>を<a href="%s/%s/src/%s">%s</a>にプッシュしました\r
-create_issue=問題 <a href="%s/%s/issues/%s"> %s #%s</a> を開きました\r
-comment_issue=問題 <a href="%s/%s/issues/%s"> %s #%s</a> のコメント\r
+create_issue=`問題 <a href="%s/issues/%s">%[1]s#%[2]s</a> を開きました`\r
+comment_issue=`問題 <a href="%s/issues/%s">%[1]s#%[2]s</a> のコメント`\r
 transfer_repo=リポジトリ <code>%s</code> を <a href="/%s%s">%s</a> へ転送しました\r
 push_tag=<a href="%s/%s">%s</a> に タグ <a href="%s/%s/src/%s">%s</a> をプッシュしました\r
 compare_2_commits=これら 2 のコミットの比較を閲覧する\r
index 34430ed64a7a5f2ea9cefbc43a0ec574d9f52a92..6ab814806f8c7fb16253fba08408e8958c1c62fd 100755 (executable)
@@ -516,6 +516,9 @@ dashboard.git_gc_repos=Veikt repozitoriju datu sakārtošānu (git gc)
 dashboard.git_gc_repos_success=Datu sakārtošana visiem repozitorijiem veiksmīgi pabeigta.\r
 dashboard.resync_all_sshkeys=Pārrakstīt '.ssh/authorized_key' failu (brīdinājums: ne-Git atslēgas tiks pazaudētas)\r
 dashboard.resync_all_sshkeys_success=Visas publiskās atslēgas tika veiksmīgi pārrakstītas.\r
+dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)\r
+dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.\r
+\r
 dashboard.server_uptime=Servera darbības laiks\r
 dashboard.current_goroutine=Izmantotās Gorutīnas\r
 dashboard.current_memory_usage=Pašreiz izmantotā atmiņa\r
@@ -691,8 +694,8 @@ notices.delete_success=Sistēmas paziņojums tika veiksmīgi izdzēsts.
 [action]\r
 create_repo=izveidoja repozitoriju <a href="%s/%s">%s</a>\r
 commit_repo=veica izmaiņu nosūtīšanu atzaram <a href="%s/%s/src/%s">%s</a> repozitorijā <a href="%s/%s">%s</a>\r
-create_issue=reģistrēja problēmu <a href="%s/%s/issues/%s">%s#%s</a>\r
-comment_issue=pievienoja komentāru problēmai <a href="%s/%s/issues/%s">%s#%s</a>\r
+create_issue=`reģistrēja problēmu <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
+comment_issue=`pievienoja komentāru problēmai <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
 transfer_repo=mainīja repozitorija <code>%s</code> īpašnieku uz <a href="/%s%s">%s</a>\r
 push_tag=pievienoja tagu <a href="%s/%s/src/%s">%s</a> repozitorijam <a href="%s/%s">%s</a>\r
 compare_2_commits=Veikt salīdzināšanu starp šīm 2 revīzijām\r
index 414eb1ff81ab288ec1173a44c1165702ea2f843d..adc98c9d5a6ff387deba298a612d2c552de0666a 100755 (executable)
@@ -516,6 +516,9 @@ dashboard.git_gc_repos=Garbage collectie uitvoeren
 dashboard.git_gc_repos_success=Garbage collectie met succes uitgevoerd.\r
 dashboard.resync_all_sshkeys=Herschrijf '.ssh/authorized_keys' (Let op: alle sleutels die niet van Gogs zijn zullen verloren gaan!)\r
 dashboard.resync_all_sshkeys_success=Alle publieke sleutels zijn herschreven.\r
+dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)\r
+dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.\r
+\r
 dashboard.server_uptime=Uptime server\r
 dashboard.current_goroutine=Huidige Goroutines\r
 dashboard.current_memory_usage=Huidige geheugen gebruik\r
@@ -691,8 +694,8 @@ notices.delete_success=Systeem bericht is met succes verwijderd.
 [action]\r
 create_repo=repositorie aangemaakt in <a href="%s/%s">%s</a>\r
 commit_repo=push update naar <a href="%s/%s/src/%s">%s</a> in <a href="%s/%s">%s</a\r
-create_issue=opende issue in <a href="%s/%s/issues/%s">%s#%s</a>\r
-comment_issue=reactie op issue <a href="%s/%s/issues/%s">%s#%s</a>\r
+create_issue=`opende issue in <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
+comment_issue=`reactie op issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
 transfer_repo=repositorie verplaatst naar <code>%s</code> naar <a href="/%s%s">%s</a>\r
 push_tag=geduwd label <a href="%s/%s/src/%s"> %s</a> naar <a href="%s/%s"> %s</a>\r
 compare_2_commits=Weergave vergelijking voor deze 2 commits\r
index dfb5870dfd8437a8e09de8e086e13384b48b0a73..aa2c0ee5588ab42ed5e32adcf076498a30e1af99 100755 (executable)
@@ -59,6 +59,8 @@ run_user=Пользователь
 run_user_helper=У пользователя должен быть доступ к пути к корню репозитория и к запуску Gogs.\r
 domain=Домен\r
 domain_helper=This affects SSH clone URLs.\r
+http_port=HTTP Port\r
+http_port_helper=Port number which application will listen on.\r
 app_url=URL приложения\r
 app_url_helper=This affects HTTP/HTTPS clone URL and somewhere in e-mail.\r
 email_title=Настройки службы электронной почты (опционально)\r
@@ -278,7 +280,7 @@ license_helper=Выберите файл лицензии
 init_readme=Создать репозиторий с файлом README.md\r
 create_repo=Создание репозитория\r
 default_branch=Ветка по умолчанию\r
-mirror_interval=Mirror Interval(hour)\r
+mirror_interval=Mirror Interval (hour)\r
 goget_meta=Go-Get Meta\r
 goget_meta_helper=This repository will be <span class="label label-blue label-radius">Go-Getable</span>\r
 \r
@@ -512,6 +514,11 @@ dashboard.delete_repo_archives=Удаление всех архивов репо
 dashboard.delete_repo_archives_success=Все архивы репозиториев были успешно удалены.\r
 dashboard.git_gc_repos=Выполнить сборку мусора на репозиториях\r
 dashboard.git_gc_repos_success=Сборка мусора на всех репозиториях успешно выполнена.\r
+dashboard.resync_all_sshkeys=Rewrite '.ssh/autorized_key' file (caution: non-Gogs keys will be lost)\r
+dashboard.resync_all_sshkeys_success=All public keys have been rewritten successfully.\r
+dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)\r
+dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.\r
+\r
 dashboard.server_uptime=Время непрерывной работы сервера\r
 dashboard.current_goroutine=Current Goroutines\r
 dashboard.current_memory_usage=Текущее использование памяти\r
@@ -631,7 +638,7 @@ config.db_path_helper=(for "sqlite3" only)
 config.service_config=Service Configuration\r
 config.register_email_confirm=Require E-mail Confirmation\r
 config.disable_register=Отключить регистрацию\r
-config.show_registration_button = Показать Регистрация Кнопка\r
+config.show_registration_button=Show Register Button\r
 config.require_sign_in_view=Для просмотра необходима авторизация\r
 config.mail_notify=Почтовые уведомления\r
 config.enable_cache_avatar=Кешировать аватар\r
@@ -687,8 +694,8 @@ notices.delete_success=System notice has been deleted successfully.
 [action]\r
 create_repo=создан репозиторий <a href="%s/%s"> %s</a>\r
 commit_repo=pushed to <a href="%s/%s/src/%s">%s</a> at <a href="%s/%s">%s</a>\r
-create_issue=opened issue <a href="%s/%s/issues/%s">%s#%s</a>\r
-comment_issue=commented on issue <a href="%s/%s/issues/%s">%s#%s</a>\r
+create_issue=`opened issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
+comment_issue=`commented on issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
 transfer_repo=transfered repository <code>%s</code> to <a href="/%s%s">%s</a>\r
 push_tag=pushed tag <a href="%s/%s/src/%s">%s</a> to <a href="%s/%s">%s</a>\r
 compare_2_commits=View comparison for these 2 commits\r
@@ -714,16 +721,3 @@ years=%d years %s
 raw_seconds=seconds\r
 raw_minutes=minutes\r
 \r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
index e188a648aef84de7e669d2fc8453bb37f5fdf115..efeca15adb0c9b84fc7119bdd4e4e84a2f4aca22 100755 (executable)
@@ -516,6 +516,9 @@ dashboard.git_gc_repos=对仓库进行垃圾回收
 dashboard.git_gc_repos_success=所有仓库垃圾回收成功!\r
 dashboard.resync_all_sshkeys=重新生成 '.ssh/autorized_key' 文件(警告:不是 Gogs 的密钥也会被删除)\r
 dashboard.resync_all_sshkeys_success=所有公钥重新生成成功!\r
+dashboard.resync_all_update_hooks=重新生成所有仓库的 Update 钩子(用于自定义配置文件被修改)\r
+dashboard.resync_all_update_hooks_success=所有仓库的 Update 钩子重新生成成功!\r
+\r
 dashboard.server_uptime=服务运行时间\r
 dashboard.current_goroutine=当前 Goroutines 数量\r
 dashboard.current_memory_usage=当前内存使用量\r
@@ -691,8 +694,8 @@ notices.delete_success=系统提示删除成功!
 [action]\r
 create_repo=创建了仓库 <a href="%s/%s">%s</a>\r
 commit_repo=推送了 <a href="%s/%s/src/%s">%s</a> 分支的代码到 <a href="%s/%s">%s</a>\r
-create_issue=创建了工单 <a href="%s/%s/issues/%s">%s#%s</a>\r
-comment_issue=评论了工单 <a href="%s/%s/issues/%s">%s#%s</a>\r
+create_issue=`创建了工单 <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
+comment_issue=`评论了工单 <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
 transfer_repo=将仓库 <code>%s</code> 转移至 <a href="/%s%s">%s</a>\r
 push_tag=推送了标签 <a href="%s/%s/src/%s">%s</a> 到 <a href="%s/%s">%s</a>\r
 compare_2_commits=查看 2 次提交的内容对比\r
index 2fa837896d5a9bd1019db0729efe41878a2ebaec..0c9ba1909186bb8384da521f13caa3c242cdbfb0 100755 (executable)
@@ -516,6 +516,9 @@ dashboard.git_gc_repos=對倉庫進行垃圾回收
 dashboard.git_gc_repos_success=所有倉庫的垃圾回收已成功完成!\r
 dashboard.resync_all_sshkeys=重新生成 '.ssh/autorized_key' 文件(警告:不是 Gogs 的密鑰也會被刪除)\r
 dashboard.resync_all_sshkeys_success=所有公鑰重新生成成功!\r
+dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)\r
+dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.\r
+\r
 dashboard.server_uptime=服務執行時間\r
 dashboard.current_goroutine=當前 Goroutines 數量\r
 dashboard.current_memory_usage=當前內存使用量\r
@@ -691,8 +694,8 @@ notices.delete_success=系統提示刪除成功!
 [action]\r
 create_repo=創建了倉庫 <a href="%s/%s">%s</a>\r
 commit_repo=推送了 <a href="%s/%s/src/%s">%s</a> 分支的代碼到 <a href="%s/%s">%s</a>\r
-create_issue=創建了問題 <a href="%s/%s/issues/%s">%s#%s</a>\r
-comment_issue=評論了問題 <a href="%s/%s/issues/%s">%s#%s</a>\r
+create_issue=`創建了問題 <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
+comment_issue=`評論了問題 <a href="%s/issues/%s">%[1]s#%[2]s</a>`\r
 transfer_repo=將倉庫 <code>%s</code> 轉移至 <a href="/%s%s">%s</a>\r
 push_tag=推送了標籤 <a href="%s/%s/src/%s">%s</a> 到 <a href="%s/%s">%s</a>\r
 compare_2_commits=查看 2 次提交的內容對比\r
diff --git a/gogs.go b/gogs.go
index c09c4ca196a3907633d47a90c136881ee1a9dcd7..6edf316f81fa70ea20c8a7cdd710ba2312f0670e 100644 (file)
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
        "github.com/gogits/gogs/modules/setting"
 )
 
-const APP_VER = "0.5.13.0207 Beta"
+const APP_VER = "0.5.13.0208 Beta"
 
 func init() {
        runtime.GOMAXPROCS(runtime.NumCPU())
@@ -33,7 +33,6 @@ func main() {
                cmd.CmdWeb,
                cmd.CmdServ,
                cmd.CmdUpdate,
-               cmd.CmdFix,
                cmd.CmdDump,
                cmd.CmdCert,
        }
index a6c6cfbfaa92aac7e01a668e6fd32f12a581b8e7..5cba2f515a4ca35ca4eed1ab3f9a5d8382e06f05 100644 (file)
@@ -98,7 +98,7 @@ func (a Action) GetRepoName() string {
 }
 
 func (a Action) GetRepoLink() string {
-       return path.Join(a.RepoUserName, a.RepoName)
+       return path.Join(setting.AppSubUrl, a.RepoUserName, a.RepoName)
 }
 
 func (a Action) GetBranch() string {
index 893ff5c96ad02f8c5cfe2d8a56a1556ba309b3a8..b1c7b6244957a80a9da12cf62da346a9749552b4 100644 (file)
@@ -29,7 +29,7 @@ import (
 
 const (
        // "### autogenerated by gitgos, DO NOT EDIT\n"
-       _TPL_PUBLICK_KEY = `command="%s serv --config=%s key-%d",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
+       _TPL_PUBLICK_KEY = `command="%s serv --config='%s' key-%d",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
 )
 
 var (
index 5a40c5b987c3950cff90c802ae81c309ad7d840d..f2f10baff0f07c9e6539c9ead6ce90023696db3f 100644 (file)
@@ -30,7 +30,7 @@ import (
 )
 
 const (
-       TPL_UPDATE_HOOK = "#!/usr/bin/env %s\n%s update --config=%s $1 $2 $3\n"
+       _TPL_UPDATE_HOOK = "#!/usr/bin/env %s\n%s update --config='%s' $1 $2 $3\n"
 )
 
 var (
@@ -402,15 +402,9 @@ func initRepoCommit(tmpPath string, sig *git.Signature) (err error) {
        return nil
 }
 
-func createHookUpdate(hookPath, content string) error {
-       pu, err := os.OpenFile(hookPath, os.O_CREATE|os.O_WRONLY, 0777)
-       if err != nil {
-               return err
-       }
-       defer pu.Close()
-
-       _, err = pu.WriteString(content)
-       return err
+func createHookUpdate(repoPath string) error {
+       return ioutil.WriteFile(path.Join(repoPath, "hooks/update"),
+               []byte(fmt.Sprintf(_TPL_UPDATE_HOOK, setting.ScriptType, "\""+appPath+"\"", setting.CustomConf)), 0777)
 }
 
 // InitRepository initializes README and .gitignore if needed.
@@ -423,8 +417,7 @@ func initRepository(f string, u *User, repo *Repository, initReadme bool, repoLa
        }
 
        // hook/post-update
-       if err := createHookUpdate(filepath.Join(repoPath, "hooks", "update"),
-               fmt.Sprintf(TPL_UPDATE_HOOK, setting.ScriptType, "\""+appPath+"\"", setting.CustomConf)); err != nil {
+       if err := createHookUpdate(repoPath); err != nil {
                return err
        }
 
@@ -1174,6 +1167,18 @@ func DeleteRepositoryArchives() error {
                })
 }
 
+// RewriteRepositoryUpdateHook rewrites all repositories' update hook.
+func RewriteRepositoryUpdateHook() error {
+       return x.Where("id > 0").Iterate(new(Repository),
+               func(idx int, bean interface{}) error {
+                       repo := bean.(*Repository)
+                       if err := repo.GetOwner(); err != nil {
+                               return err
+                       }
+                       return createHookUpdate(RepoPath(repo.Owner.Name, repo.Name))
+               })
+}
+
 var (
        // Prevent duplicate tasks.
        isMirrorUpdating = false
index ea50d5c4cbeac2de837956b8ed6bc4f36728e51c..d54bb629fd28e6efe831ee4ee665b63eb5af167c 100644 (file)
@@ -119,6 +119,7 @@ const (
        CLEAN_REPO_ARCHIVES
        GIT_GC_REPOS
        SYNC_SSH_AUTHORIZED_KEY
+       SYNC_REPOSITORY_UPDATE_HOOK
 )
 
 func Dashboard(ctx *middleware.Context) {
@@ -148,6 +149,9 @@ func Dashboard(ctx *middleware.Context) {
                case SYNC_SSH_AUTHORIZED_KEY:
                        success = ctx.Tr("admin.dashboard.resync_all_sshkeys_success")
                        err = models.RewriteAllPublicKeys()
+               case SYNC_REPOSITORY_UPDATE_HOOK:
+                       success = ctx.Tr("admin.dashboard.resync_all_update_hooks_success")
+                       err = models.RewriteRepositoryUpdateHook()
                }
 
                if err != nil {
index 5a5ed364d98437b3191fef97b8a24c95dc1645dd..a896ddd3309329cc971e2dea561d441e4ed2fbf8 100644 (file)
@@ -1 +1 @@
-0.5.13.0207 Beta
\ No newline at end of file
+0.5.13.0208 Beta
\ No newline at end of file
index b5705175360340d340db4e402c35d5afec272b7d..5db717bfe1252009d46a2bad6e841d3f6cec201b 100644 (file)
                                                 <td>{{.i18n.Tr "admin.dashboard.resync_all_sshkeys"}}</td>
                                                 <td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=5">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
                                             </tr>
-
+                                            <tr>
+                                                <td>{{.i18n.Tr "admin.dashboard.resync_all_update_hooks"}}</td>
+                                                <td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=6">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
+                                            </tr>
                                         </tbody>
                                     </table>
                                 </div>
index 834e5f0a5601cc751043d6136c802b00c463f4cc..8acf228963096d4b3bee4efd52d71e686d01da40 100644 (file)
             {{$.i18n.Tr "action.commit_repo" AppSubUrl .GetRepoLink .GetBranch .GetBranch AppSubUrl .GetRepoLink .GetRepoLink | Str2html}}
             {{else if eq .GetOpType 6}}
             {{ $index := index .GetIssueInfos 0}}
-            {{$.i18n.Tr "action.create_issue" AppSubUrl .GetRepoLink $index .GetRepoLink $index | Str2html}}
+            {{$.i18n.Tr "action.create_issue" .GetRepoLink $index | Str2html}}
             {{else if eq .GetOpType 8}}
             {{$.i18n.Tr "action.transfer_repo" .GetContent AppSubUrl .GetRepoLink .GetRepoLink | Str2html}}
             {{else if eq .GetOpType 9}}
             {{$.i18n.Tr "action.push_tag" AppSubUrl .GetRepoLink .GetBranch .GetBranch AppSubUrl .GetRepoLink .GetRepoLink | Str2html}}
             {{else if eq .GetOpType 10}}
             {{ $index := index .GetIssueInfos 0}}
-            {{$.i18n.Tr "action.comment_issue" AppSubUrl .GetRepoLink $index .GetRepoLink $index | Str2html}}
+            {{$.i18n.Tr "action.comment_issue" .GetRepoLink $index | Str2html}}
             {{end}}
         </p>
         {{if eq .GetOpType 5}}