Phorkie: Difference between revisions

From Leo's Notes
This page was last edited on 1 September 2019, at 01:36.
Updated git repository to mine. Added mediawiki
m Text replacement - "{\| " to "{| class="wikitable" "
 
(4 intermediate revisions by the same user not shown)
Line 6: Line 6:
Phorkie can be installed on any server with PHP.
Phorkie can be installed on any server with PHP.


{{Highlight|lang=bash|code=
{{highlight|lang=terminal|code=
cd /home/leo/www
$ cd /home/leo/www
git clone https://github.com/kohrar/phorkie.git
$ git clone https://github.com/kohrar/phorkie.git


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


# Get dependencies
$ # Get dependencies
composer install
$ composer install
}}
}}


Line 25: Line 25:
=== Cannot Create New Text/Paste ===
=== Cannot Create New Text/Paste ===
Whenever a new paste is created, the following error appears:
Whenever a new paste is created, the following error appears:
{{Highlight|lang=text|code=
{{highlight|lang=text|code=
Error
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
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
Line 32: Line 32:
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 {{code|src/phorkie/Repository/Setup.php}} file so owner.name and owner.email becomes user.name and user.email.
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 {{code|src/phorkie/Repository/Setup.php}} file so owner.name and owner.email becomes user.name and user.email.


{|
{| class="wikitable"
| {{Highlight|lang=php|code=
| {{highlight|lang=php|code=
         //keep track of owner
         //keep track of owner
         $vc->getCommand('config')
         $vc->getCommand('config')
Line 44: Line 44:
             ->execute();
             ->execute();
}}
}}
| {{Highlight|lang=php|code=
| {{highlight|lang=php|code=
         //keep track of owner
         //keep track of owner
         $vc->getCommand('config')
         $vc->getCommand('config')
Line 61: Line 61:


Under the {{code|repos/git directory}}, run the following:
Under the {{code|repos/git directory}}, run the following:
{{highlight|lang=bash|code=
{{highlight|lang=terminal|code=
/bin/grep -iR "phorkie/www/repos/work" * | awk -F: '{print $1}' | while read i ; do sed -i "s/\/old\/path/\/new\/path/g" $i ; echo $i ; done
/bin/grep -iR "phorkie/www/repos/work" * | awk -F: '{print $1}' | while read i ; do sed -i "s/\/old\/path/\/new\/path/g" $i ; echo $i ; done
}}
}}


[[Category:Code]]
[[Category:Code]]

Latest revision as of 01:36, 1 September 2019

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" *