class Database_Adapter_Null_Indexer
{
- public function addRepo(Repository $repo, $crdate = null) {}
+ public function addRepo(Repository $repo, $crdate = null)
+ {
+ }
- public function updateRepo(Repository $repo, $crdate = null) {}
+ public function updateRepo(Repository $repo, $crdate = null)
+ {
+ }
- public function deleteAllRepos() {}
- public function deleteRepo(Repository $repo) {}
+ public function deleteAllRepos()
+ {
+ }
+
+ public function deleteRepo(Repository $repo)
+ {
+ }
}
?>
class Database_Adapter_Null_Setup
{
- public function setup() {}
- public function reset() {}
+ public function setup()
+ {
+ }
+
+ public function reset()
+ {
+ }
}
?>
//quick hack until https://pear.php.net/bugs/bug.php?id=19385 is fixed
$cmd = new GitCommandBinary($this->repo->getVc());
$cmd->setSubCommand('show');
- return //$this->repo->getVc()->getCommand('show')
- $cmd
+ return $cmd
->addArgument($this->repo->hash . ':' . $this->path)
->execute();
}
/**
* Get a link to the file
*
- * @param string $type Link type. Supported are:
- * - "raw"
- * - "tool"
- * @param string $option
+ * @param string $type Link type. Supported are:
+ * - "raw"
+ * - "tool"
+ * @param string $option Additional option, e.g. tool name
*
* @return string
*/
. '/' . $this->getFilename();
}
} else if ($type == 'tool') {
- return '/' . $this->repo->id . '/tool/' . $option . '/' . $this->getFilename();
+ return '/' . $this->repo->id
+ . '/tool/' . $option
+ . '/' . $this->getFilename();
}
throw new Exception('Unknown type');
}
$rs = new Repositories();
$new = $rs->createNew();
$vc = $new->getVc();
- \rmdir($new->gitDir);//VersionControl_Git wants an existing dir, git clone not
+
+ //VersionControl_Git wants an existing dir, git clone not
+ \rmdir($new->gitDir);
+
$vc->getCommand('clone')
//this should be setOption, but it fails with a = between name and value
->addArgument('--separate-git-dir')
- ->addArgument($GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $new->id . '.git')
+ ->addArgument(
+ $GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $new->id . '.git'
+ )
->addArgument($pathOrUrl)
->addArgument($new->workDir)
->execute();
protected $pager;
/**
+ * Create a new pager
+ *
+ * @param integer $itemCount Number of items in total
+ * @param integer $perPage Number of items on one page
* @param integer $currentPage Current page, beginning with 1
+ * @param string $filename URL the page number shall be appended
*/
public function __construct($itemCount, $perPage, $currentPage, $filename)
{
if ($retval != 0) {
$html = '<div class="alert">'
- . 'rst2html encountered some error; return value ' . $retval . '<br/>'
+ . 'rst2html encountered some error; return value '
+ . $retval . '<br/>'
. 'Error message: ' . $errors
. '</div>'
. $html;
{
chdir($this->gitDir);
$dirs = glob('*.git', GLOB_ONLYDIR);
- array_walk($dirs, function ($dir) { return substr($dir, 0, -4); });
+ array_walk(
+ $dirs,
+ function ($dir) {
+ return substr($dir, 0, -4);
+ }
+ );
sort($dirs, SORT_NUMERIC);
$n = end($dirs) + 1;
/**
* Get a link to the repository
*
- * @param string $type Link type. Supported are:
- * - "edit"
- * - "delete"
- * - "delete-confirm"
- * - "display"
- * - "fork"
- * - "revision"
- * @param string $option
+ * @param string $type Link type. Supported are:
+ * - "edit"
+ * - "delete"
+ * - "delete-confirm"
+ * - "display"
+ * - "fork"
+ * - "revision"
+ * @param string $option Additional link option, e.g. revision number
*
* @return string
*/
$r = intval($r / $quot);
$g = intval($g / $quot);
}
- $string = str_repeat('g', $g) . str_repeat('r', $r) . str_repeat('n', 7 - $g - $r);
+ $string = str_repeat('g', $g)
+ . str_repeat('r', $r)
+ . str_repeat('n', 7 - $g - $r);
return str_split($string);
}
if ($name == '') {
if ($bUpload) {
- $name = Tools::sanitizeFilename($_FILES['files']['name'][$num]['upload']);
+ $name = Tools::sanitizeFilename(
+ $_FILES['files']['name'][$num]['upload']
+ );
} else {
$name = $this->getNextNumberedFile('phork')
. '.' . $arFile['type'];
$bCommit = true;
} else if ($bUpload) {
move_uploaded_file(
- $_FILES['files']['tmp_name'][$num]['upload'], $file->getFullPath()
+ $_FILES['files']['tmp_name'][$num]['upload'],
+ $file->getFullPath()
);
$command = $vc->getCommand('add')
->addArgument($file->getFilename())
->execute();
$bCommit = true;
- } else if ($bNew || (isset($arFile['content']) && $file->getContent() != $arFile['content'])) {
+ } else if ($bNew
+ || (isset($arFile['content'])
+ && $file->getContent() != $arFile['content']
+ )
+ ) {
file_put_contents($file->getFullPath(), $arFile['content']);
$command = $vc->getCommand('add')
->addArgument($file->getFilename())
$vc->getCommand('commit')
->setOption('message', '')
->setOption('allow-empty-message')
- ->setOption('author', $sessionData['name'].' <'.$sessionData['email'].'>')
+ ->setOption(
+ 'author',
+ $sessionData['name'] . ' <' . $sessionData['email'] . '>'
+ )
->execute();
//FIXME: git needs ref BEFORE add
//quick hack until http://pear.php.net/bugs/bug.php?id=19605 is fixed
$vc->getCommand('notes --ref=identity add')
- ->setOption('force')
+ ->setOption('force')
->setOption('message', "$notes")
->execute();
$bChanged = true;
$vc->getCommand('init')
//this should be setOption, but it fails with a = between name and value
->addArgument('--separate-git-dir')
- ->addArgument($GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $repo->id . '.git')
+ ->addArgument(
+ $GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $repo->id . '.git'
+ )
->addArgument($repo->workDir)
->execute();
$es = parse_url($this->elasticsearch);
if (!preg_match("#/.+/#", $es['path'], $matches)) {
- $this->fail('Improper elasticsearch url. Elasticsearch requires a'
- . ' search domain to store your data. (e.g. http://localhost:9200/phorkie/)');
+ $this->fail(
+ 'Improper elasticsearch url. Elasticsearch requires a'
+ . ' search domain to store your data.'
+ . ' (e.g. http://localhost:9200/phorkie/)'
+ );
}
$dbs = new Database();
$dbs->getSetup()->setup();