Phorkie

From Leo's Notes
Last edited on 1 September 2019, at 01:36.

Phorkie is a self hosted pastebin-like web application written in PHP. It uses only git repositories as its data store.

The original Phorkie can be found at https://github.com/cweiske/phorkie.git. The installation steps outlined below uses my modified version.

Installation

Phorkie can be installed on any server with PHP.

$ cd /home/leo/www
$ git clone https://github.com/kohrar/phorkie.git

$ # Set up git directories that act as the data store
$ cd phorkie
$ mkdir -p www/repos/git www/repos/work
$ cp data/config.php.dist data/config.php

$ # Get dependencies
$ composer install

MediaWiki Integration

You can integrate Phorkie into your MediaWiki installation using the Phorkie MediaWiki extension available at https://github.com/kohrar/phorkie-mediawiki

Issues

Cannot Create New Text/Paste

Whenever a new paste is created, the following error appears:

Error
Some errors in executing git command Output: Error: *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: empty ident name (for <leo@web.home.steamr.com>) not allowed

This is a bug with Phorkie where the git command being passed is defining the git user and not owner. This can be fixed by modifying the src/phorkie/Repository/Setup.php file so owner.name and owner.email becomes user.name and user.email.

//keep track of owner
        $vc->getCommand('config')
            ->addArgument('owner.name')
            ->addArgument($_SESSION['name'])
            ->execute();
        $vc->getCommand('config')
            ->addArgument('owner.email')
            ->addArgument($_SESSION['email'])
            ->execute();
//keep track of owner
        $vc->getCommand('config')
            ->addArgument('user.name')
            ->addArgument($_SESSION['name'])
            ->execute();
        $vc->getCommand('config')
            ->addArgument('user.email')
            ->addArgument($_SESSION['email'])
            ->execute();

Moving Repo Directory

If the repo directory location changes (such as moving to a new server), you need to update the git repositories' configuration files as well since they have the absolute path of the worktree defined.

Under the repos/git directory, run the following:

/bin/grep -iR "phorkie/www/repos/work" *