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.
7 Project page: http://sourceforge.net/p/phorkie/
9 .. contents:: Table of Contents
14 - every paste is a git repository
16 - repositories can be cloned
17 - clone url can be displayed
21 - delete existing files
22 - replace file with upload
23 - multiple files in one paste
24 - syntax highlighting with GeSHi
26 - image upload + display
27 - external tool support
31 - history in the sidebar
33 - old files can be downloaded easily
34 - search across pastes: description, file names and file content
36 - options: quoting, logical and, or, not, partial words
42 1. Unzip the phorkie release file::
44 $ tar xjvf phorkie-0.2.0.tar.bz2
46 2. Create the git directories::
48 $ mkdir -p repos/git repos/work
49 $ chmod og+w repos/git repos/work
51 3. Install dependencies_
53 4. Copy ``data/config.php.dist`` to ``data/config.php`` and adjust it
56 $ cp data/config.php.dist data/config.php
57 $ $EDITOR data/config.php
59 Look at ``config.default.php`` for values that you may adjust.
61 5. Set your web server's document root to ``/path/to/phorkie-0.2.0/www/``
63 6. Open phorkie in your web browser
68 phorkie stands on the shoulders of giants.
72 $ pear install versioncontrol_git-alpha
73 $ pear install services_libravatar-alpha
74 $ pear install http_request2
76 $ pear install date_humandiff-alpha
78 $ pear channel-discover pear.twig-project.org
79 $ pear install twig/Twig
81 $ pear channel-discover mediawiki.googlecode.com/svn
82 $ pear install mediawiki/geshi
84 $ pear channel-discover zustellzentrum.cweiske.de
85 $ pear install zz/mime_type_plaindetect-alpha
87 Note that this version of GeSHi is a bit outdated, but it's the fastest
95 phorkie makes use of an Elasticsearch__ installation if you have one.
97 It is used to provide search capabilities and the list of recent pastes.
99 __ http://www.elasticsearch.org/
103 Edit ``config.php``, setting the ``elasticsearch`` property to the HTTP URL
104 of the index, e.g. ::
106 http://localhost:9200/phorkie/
108 Run the index script to import all existing pastes into the index::
110 php scripts/index.php
112 That's all. Open phorkie in your browser, and you'll notice the search box
118 In case something really went wrong and you need to reset the search
119 index, run the following command::
121 $ curl -XDELETE http://localhost:9200/phorkie/
122 {"ok":true,"acknowledged"}
124 Phorkie will automatically re-index everything when ``setupcheck`` is enabled
125 in the configuration file.
132 Make git repositories clonable
133 ==============================
134 To make git repositories clonable, you need to install ``git-daemon``
135 (``git-daemon-run`` package on Debian/Ubuntu).
137 Now make the repositories available by symlinking the paste repository
138 directory (``$GLOBALS['phorkie']['cfg']['repos']`` setting) into
139 ``/var/cache/git``, e.g.::
141 $ ln -s /home/user/www/paste/repos/git /var/cache/git/paste
143 Edit your ``config.php`` and set the ``$GLOBALS['phorkie']['cfg']['git']['public']``
144 setting to ``git://$yourhostname/git/paste/``.
145 The rest will be appended automatically.
148 You're on your own to setup writable repositories.
157 - OpenID-Login to get username+email as authorship information
158 - filters (``xmllint --format``, ``rapper``)
159 - document how to keep disk usage low (block size)
161 - when 2 people edit, merge changes
163 - configurable highlights
164 - Atom feed for new pastes
165 - Atom feed for paste changes
174 Display page for paste
178 Display raw file contents
179 ``/[0-9]/tool/[a-zA-Z]+/(.+)``
180 Run a tool on the given file
181 ``/[0-9]/rev/[a-z0-9]+``
182 Show specific revision of the paste
186 Create a fork of the paste
187 ``/search?q=..(&page=[0-9]+)?``
188 Search for term, with optional page
190 List all pastes, with optional page
192 Shows form for new paste
194 Login page for protecting site
196 Edit logged-in user information
199 Internal directory layout
200 =========================
205 1/ - work directory for paste #1
206 2/ - work directory for paste #2
208 1.git/ - git repository for paste #1
209 description - Description for the repository
210 2.git/ - git repository for paste #2
214 If you use nginx, place the following lines into your ``server`` block:
218 if (!-e $request_uri) {
219 rewrite ^/([0-9]+)$ /display.php?id=$1;
220 rewrite ^/([0-9]+)/delete$ /delete.php?id=$1;
221 rewrite ^/([0-9]+)/delete/confirm$ /delete.php?id=$1&confirm=1;
222 rewrite ^/([0-9]+)/edit$ /edit.php?id=$1;
223 rewrite ^/([0-9]+)/fork$ /fork.php?id=$1;
224 rewrite ^/([0-9]+)/raw/(.+)$ /raw.php?id=$1&file=$2;
225 rewrite ^/([0-9]+)/rev/(.+)$ /revision.php?id=$1&rev=$2;
226 rewrite ^/([0-9]+)/rev-raw/(.+)$ /raw.php?id=$1&rev=$2&file=$3;
227 rewrite ^/([0-9]+)/tool/([^/]+)/(.+)$ /tool.php?id=$1&tool=$2&file=$3;
229 rewrite ^/new$ /new.php;
230 rewrite ^/list$ /list.php;
231 rewrite ^/list/([0-9]+)$ /list.php?page=$1;
233 rewrite ^/search$ /search.php;
234 rewrite ^/search/([0-9]+)$ /search.php?page=$1;
236 rewrite ^/login$ /login.php;
237 rewrite ^/user$ /user.php;