Update jQuery from 1.12.4 to 3.7.1
[phorkie.git] / www / fork.php
index 10bd1e201d0dcc91a18612618e0f6bc0c2792ddb..cddf2bb516fdc4075f9c74b3fdfd9f9f15982a1c 100644 (file)
@@ -3,7 +3,7 @@
  * Fork a repository
  */
 namespace phorkie;
-$secureAtLevel = '1';
+$reqWritePermissions = true;
 require_once 'www-header.php';
 
 if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
@@ -13,22 +13,9 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
 $repo = new Repository();
 $repo->loadFromRequest();
 
-$rs = new Repositories();
-$new = $rs->createNew();
-$vc = $new->getVc();
-\rmdir($new->gitDir);//VersionControl_Git wants an existing dir, git clone not
-$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($repo->gitDir)
-    ->addArgument($new->workDir)
-    ->execute();
-\copy($repo->gitDir . '/description', $new->gitDir . '/description');
-foreach (\glob($new->gitDir . '/hooks/*') as $hookfile) {
-    \unlink($hookfile);
-}
+$forker = new Forker();
+$new    = $forker->forkLocal($repo);
 
-//FIXME: where to put fork source link?
-redirect($new->getLink('display'));
+FlashMessage::save('Paste has been forked');
+redirect($new->getLink('display', null, true));
 ?>