39d940db929b43c3d0a4246bcd639916c58ac49f
[phorkie.git] / README.rst
1 ************************************
2 phorkie - PHP and Git based pastebin
3 ************************************
4 Self-hosted pastebin software written in PHP.
5 Pastes are editable, may have multiple files and are stored in git repositories.
6
7 Homepage: http://sourceforge.net/p/phorkie/
8
9 .. contents:: Table of Contents
10
11 ========
12 Features
13 ========
14 - every paste is a git repository
15
16   - repositories can be cloned
17   - clone url can be displayed
18 - paste editing
19
20   - add new files
21   - delete existing files
22   - replace file with upload
23 - multiple files in one paste
24 - syntax highlighting with GeSHi
25 - rST rendering
26 - image upload + display
27 - external tool support
28
29   - xmllint
30   - php syntax check
31 - history in the sidebar
32
33   - old files can be downloaded easily
34 - search across pastes: description, file names and file content
35
36   - options: quoting, logical and, or, not, partial words
37
38
39 ============
40 Dependencies
41 ============
42 phorkie stands on the shoulders of giants.
43
44 ::
45
46   $ pear install versioncontrol_git-alpha
47   $ pear install services_libravatar-alpha
48   $ pear install http_request2
49   $ pear install pager
50   $ pear install https://github.com/downloads/cweiske/Date_HumanDiff/Date_HumanDiff-0.1.0.tgz
51
52   $ pear channel-discover pear.twig-project.org
53   $ pear install twig/Twig
54
55   $ pear channel-discover mediawiki.googlecode.com/svn
56   $ pear install mediawiki/geshi
57
58 Note that this version of GeSHi is a bit outdated, but it's the fastest
59 way to install it.
60
61
62 ======
63 Search
64 ======
65
66 phorkie makes use of an Elasticsearch__ installation if you have one.
67
68 It is used to provide search capabilities and the list of recent pastes.
69
70 __ http://www.elasticsearch.org/
71
72 Setup
73 =====
74 Edit ``config.php``, setting the ``elasticsearch`` property to the HTTP URL
75 of the index, e.g. ::
76
77   http://localhost:9200/phorkie/
78
79 Run the index script to import all existing pastes into the index::
80
81   php scripts/index.php
82
83 That's all. Open phorkie in your browser, and you'll notice the search box
84 in the top menu.
85
86
87 =====
88 HowTo
89 =====
90
91 Make git repositories clonable
92 ==============================
93 To make git repositories clonable, you need to install ``git-daemon``
94 (``git-daemon-run`` package on Debian/Ubuntu).
95
96 Now make the repositories available by symlinking the paste repository
97 directory (``$GLOBALS['phorkie']['cfg']['repos']`` setting) into
98 ``/var/cache/git``, e.g.::
99
100   $ ln -s /home/user/www/paste/repos/git /var/cache/git/paste
101
102 Edit your ``config.php`` and set the ``$GLOBALS['phorkie']['cfg']['git']['public']``
103 setting to ``git://$yourhostname/git/paste/``.
104 The rest will be appended automatically.
105
106
107 You're on your own to setup writable repositories.
108
109
110 =================
111 Technical details
112 =================
113
114 TODO
115 ====
116 - OpenID-Login to get username+email as authorship information
117 - filters (``xmllint --format``, ``rapper``)
118 - document how to keep disk usage low (block size)
119 - comments
120 - when 2 people edit, merge changes
121 - diff changes
122 - configurable highlights
123 - Atom feed for new pastes
124 - Atom feed for paste changes
125
126
127 URLs
128 ====
129
130 ``/``
131   Index page. Shows form for new paste
132 ``/[0-9]+``
133   Display page for paste
134 ``/[0-9]/edit``
135   Edit the paste
136 ``/[0-9]+/raw/(.+)``
137   Display raw file contents
138 ``/[0-9]/tool/[a-zA-Z]+/(.+)``
139   Run a tool on the given file
140 ``/[0-9]/rev/[a-z0-9]+``
141   Show specific revision of the paste
142 ``/[0-9]/delete``
143   Delete the paste
144 ``/[0-9]/fork``
145   Create a fork of the paste
146 ``/search?q=..(&page=[0-9]+)?``
147   Search for term, with optional page
148 ``/list(/[0-9])?``
149   List all pastes, with optional page
150
151
152 Internal directory layout
153 =========================
154 ::
155
156   repos/
157     work/
158       1/ - work directory for paste #1
159       2/ - work directory for paste #2
160     git/
161       1.git/ - git repository for paste #1
162         description - Description for the repository
163       2.git/ - git repository for paste #2
164
165
166 Search
167 ======
168 Use ``ack-grep``
169
170
171
172