wiki:jazz/Trac_Updates

Version 13 (modified by jazz, 15 years ago) (diff)

--

2009-04-19

  • 由於把系統從 Etch 升級到 Lenny, Python 環境因而從 2.4 升級到 2.5, Trac 從 0.10 升級到 0.11, 不管是 trac 舊的設定檔以及 plugin 都不管用了。只好從頭把 Trac Plugin 重裝一次。
  • 設定檔的部分:先用 trac-admin testbed initenv 產生一個全新的範本目錄,然後用 vimdiff 比對有哪些新參數要加進去。
  • Plugin 部分:
    • 首先要注意的是 Trac 0.11 已經把 TracAccountManager 跟 TracWebAdmin 納入,因此不可以再裝,否則會有一堆錯誤。
    • Graphviz Plugin - 用 graphviz 語法畫圖的擴充套件
      $ w3m "http://trac-hacks.org/changeset/latest/graphvizplugin/0.11-0.7.4?old_path=/&filename=graphvizplugin/0.11-0.7.4&format=zip"
      $ unzip unzip graphvizplugin_0.11-0.7.4-r5537.zip
      $ cd graphvizplugin/0.11-0.7.4
      graphvizplugin/0.11-0.7.4$ sudo python setup.py bdist_egg
      graphvizplugin/0.11-0.7.4$ sudo easy_install dist/graphviz-0.7.4-py2.5.egg
      
    • WikiInclude - 讓用 [[WikiInclude(WikiStart)]] 語法來包含其他 Wiki 頁面中的內容
      $ wget "http://trac-hacks.org/attachment/wiki/WikiIncludePlugin/0.11.versions.tbz2?format=raw" -O wikiincludeplugin-0.11.tar.gz
      $ tar jxvf wikiincludeplugin-0.11.tar.gz
      $ cd 0.11
      0.11$ cat > setup.py << EOF
      from setuptools import setup
      
      PACKAGE = 'WikiInclude'
      VERSION = '0.2'
      DESCRIPTION = 'Page include plugin for Trac Wiki'
      
      setup(name=PACKAGE,
            version=VERSION,
            packages=['wikiinclude'],
            entry_points={'trac.plugins': ['wikiinclude.wikiinclude=wikiinclude.wikiinclude']})
      EOF
      0.11$ sudo python setup.py bdist_egg
      0.11$ sudo easy_install dist/WikiInclude-0.2-py2.5.egg
      
    • TracRedirect - 用 [[redirect(網址)]] 語法來作頁面自動轉址
      $ svn co http://svn.ipd.uka.de/repos/javaparty/JP/trac/plugins/redirect-0.11/
      $ cd redirect-0.11/
      redirect-0.11$ sudo python setup.py bdist_egg
      redirect-0.11$ sudo easy_install dist/TracRedirect-0.11.3.dev_r3272-py2.5.egg
      
    • Svnauthz File Administration Plugin - 用來管理誰有權限讀取 SVN 目錄的擴充套件
      $ svn co http://trac-hacks.org/svn/svnauthzadminplugin/0.11/ svnauthzadminplugin-0.11
      $ cd svnauthzadminplugin-0.11
      svnauthzadminplugin-0.11$ sudo python setup.py bdist_egg
      svnauthzadminplugin-0.11$ sudo easy_install dist/SvnAuthzAdminPlugin-0.1.2._Moved.to.Trac.0.11_-py2.5.egg
      
  • 過去習慣會修改的字型大小
    • /usr/share/pyshared/trac/htdocs/css/trac.css

      old new  
      11body { background: #fff; color: #000; margin: 10px; padding: 0; }
      22body, th, td {
      3  font: normal 12px Verdana,Arial,'Bitstream Vera Sans',Helvetica,sans-serif;
       3 font: normal 16px Verdana,Arial,'Bitstream Vera Sans',Helvetica,sans-serif;
      44}
      55h1, h2, h3, h4 {
      66 font-family: Arial,Verdana,'Bitstream Vera Sans',Helvetica,sans-serif;
  • 以前的 template 也失效了,要改用 site.html 重新定義 - 參考 Site Appearance

2009-04-23

  • 把 /usr/share/pyshared/trac/wiki/default-pages 搬到 /usr/share/pyshared/trac/wiki/default-pages.dpkg,只留下 RecentChangesTitleIndexWikiStart 三個預設頁面。
  • 安裝 AccountManager 擴充套件
    $ svn co http://trac-hacks.org/svn/accountmanagerplugin/0.11 TracAccountManager-0.11
    $ cd TracAccountManager-0.11/
    TracAccountManager-0.11$ sudo python setup.py bdist_egg
    TracAccountManager-0.11$ sudo easy_install dist/TracAccountManager-0.2.1dev_r5273-py2.5.egg
    

2009-05-05

  • 參考 2008-03-28 的紀錄,進行 Cloud 跟 Grid 兩個的 Ticket 攻擊清除。
    ~$ sudo sqlite3 /forge/trac_pool/cloud/db/trac.db
    sqlite> delete from ticket where id >= 1;
    sqlite> delete from ticket_change where time >= 1241185964;
    sqlite> .quit
    ~$ sudo sqlite3 /forge/trac_pool/grid/db/trac.db
    sqlite> delete from ticket where id=10;
    sqlite> delete from ticket where id=11;
    sqlite> delete from ticket where id=12;
    sqlite> delete from ticket where id=27;
    sqlite> delete from ticket_change where time=1240251436;
    sqlite> delete from ticket_change where time=1240007219;
    sqlite> delete from ticket_change where time=1240031903;
    sqlite> .quit
    
  • 由於 0.11 版會把 Timeline 的日期用中文表示,因此如果要自訂 Timeline 顯示的話,會出現錯誤。可能程式邏輯還是衍用 2009-05-05 的格式,因此就在範本加入格式的字串,讓 Form 送出的日期字串可以符合程式邏輯。
    "2009年05月05日" is an invalid date, or the date format is not known. Try "YYYY年MM月DD日" instead.
    
    • timeline/templates/timeline.html

      old new  
      1717
      1818      <form id="prefs" method="get" action="">
      1919       <div>
      20         <label>View changes from <input type="text" size="10" name="from" value="${format_date(fromdate)}" /></label> <br />
       20        <label>View changes from <input type="text" size="10" name="from" value="${format_date(fromdate,'%Y-%m-%d')}" /></label> <br />
      2121        and <label><input type="text" size="3" name="daysback" value="$daysback" /> days back</label>.
      2222       </div>
      2323       <fieldset>

2009-06-09

  • 安裝 piwik 來統計檔案下載次數
    # apt-get install php5-mysql php5-gd libsparkline-php mysql-server phpmyadmin
    # apache2ctl restart
    # cd /var/www/
    /var/www# wget http://piwik.org/latest.zip
    /var/www# unzip latest.zip
    /var/www# chown -R www-data:www-data piwik/
    
  • 完成設定後,系統會告知如何把像 Google Analytics 的 javascript 加到 HTML 裡
    <!-- Piwik -->
    <script type="text/javascript">
    var pkBaseURL = (("https:" == document.location.protocol) ? "https://classcloud.org/piwik/" : "http://classcloud.org/piwik/");
    document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
    </script><script type="text/javascript">
    try {
    var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
    piwikTracker.trackPageView();
    piwikTracker.enableLinkTracking();
    } catch( err ) {}
    </script>
    <!-- End Piwik Tag --> 
    
  • 安裝 awstats 統計 deb 下載次數
    • 把 /usr/share/doc/awstats/examples/apache.conf 的內容加入 /etc/apache2/sites-enabled/classcloud.conf
      <VirtualHost X.X.X.X:80>
        ServerName  www.classcloud.org
        ErrorLog    /var/log/classcloud-error_log
        CustomLog   /var/log/classcloud-access_log common
        DocumentRoot "/var/www/hadoop"
        <Directory "/var/www/hadoop">
          Order deny,allow
          Allow from all
        </Directory>
        <Directory /var/lib/awstats>
          Options None
          AllowOverride None
          Order allow,deny
          Allow from all
        </Directory>
        <Directory /usr/share/awstats/icon>
          Options None
          AllowOverride None
          Order allow,deny
          Allow from all
        </Directory>
        Alias /icon/ /usr/share/awstats/icon/
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
          AllowOverride None
          Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
          Order allow,deny
          Allow from all
        </Directory>
      </VirtualHost>
      

Attachments (22)

Download all attachments as: .zip