From a4667104ff9b4131c1aceaea022e65d0976a15d6 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Sun, 5 Jan 2014 21:22:31 +0100
Subject: [PATCH] added git warning

---
 lib/plugins/extension/helper/extension.php | 10 ++++++++++
 lib/plugins/extension/helper/list.php      |  4 ++++
 lib/plugins/extension/lang/en/lang.php     |  4 +++-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php
index 9cf4848ad..d200d5ab0 100644
--- a/lib/plugins/extension/helper/extension.php
+++ b/lib/plugins/extension/helper/extension.php
@@ -86,6 +86,16 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin {
         return is_dir($this->getInstallDir());
     }
 
+    /**
+     * If the extension is under git control
+     *
+     * @return bool
+     */
+    public function isGitControlled() {
+        if(!$this->isInstalled()) return false;
+        return is_dir($this->getInstallDir().'/.git');
+    }
+
     /**
      * If the extension is bundled
      *
diff --git a/lib/plugins/extension/helper/list.php b/lib/plugins/extension/helper/list.php
index e33dbfa04..901a4e8fa 100644
--- a/lib/plugins/extension/helper/list.php
+++ b/lib/plugins/extension/helper/list.php
@@ -476,6 +476,10 @@ class helper_plugin_extension_list extends DokuWiki_Plugin {
                 }
             }
 
+            if ($extension->isGitControlled()){
+                $errors .= '<p class="permerror">'.$this->getLang('git').'</p>';
+            }
+
         }else{
             if (($canmod = $extension->canModify()) === true) {
                 if ($extension->getDownloadURL()) {
diff --git a/lib/plugins/extension/lang/en/lang.php b/lib/plugins/extension/lang/en/lang.php
index 593794ef2..c1e73d023 100644
--- a/lib/plugins/extension/lang/en/lang.php
+++ b/lib/plugins/extension/lang/en/lang.php
@@ -80,4 +80,6 @@ $lang['error_copy']                   = 'There was a file copy error while attem
 
 $lang['noperms']                      = 'Extension directory is not writable';
 $lang['notplperms']                   = 'Template directory is not writable';
-$lang['nopluginperms']                = 'Plugin directory is not writable';
\ No newline at end of file
+$lang['nopluginperms']                = 'Plugin directory is not writable';
+
+$lang['git']                          = 'This extension was installed via git, you may not want to update it here.';
\ No newline at end of file
-- 
GitLab