Make random IDs configurable
authorChristian Weiske <cweiske@cweiske.de>
Fri, 13 Oct 2017 16:25:40 +0000 (18:25 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Fri, 13 Oct 2017 16:25:40 +0000 (18:25 +0200)
data/config.default.php
data/config.php.dist
src/phorkie/Repositories.php

index 6e4c20c58219f9772535460d498d7c2610ac1581..06b53edaaa3c5c1a5783d56ce7197e5a8d997b2d 100644 (file)
@@ -34,6 +34,7 @@ $GLOBALS['phorkie']['cfg'] = array(
     'elasticsearch' => null,
     'index'         => 'new',//"new" or "list"
     'perPage'       => 10,
+    'randomIds'     => false,
     'defaultListPage' => 'last',//a number or "last"
     'notificator'   => array(
         /* send out pingback/webmentions when a remote paste is forked */
index f1b87048f55663d42284bfe252890c50cf25b3f2..85499fe3f78541192311ee6cc49122bffc0d3d1d 100644 (file)
@@ -8,6 +8,7 @@
 //$GLOBALS['phorkie']['cfg']['elasticsearch'] = 'http://localhost:9200/phorkie/';
 //$GLOBALS['phorkie']['cfg']['setupcheck'] = false;
 //$GLOBALS['phorkie']['cfg']['perPage'] = 10;
+//$GLOBALS['phorkie']['cfg']['randomIds'] = false;
 
 //$GLOBALS['phorkie']['auth']['securityLevel'] = 0;
 //$GLOBALS['phorkie']['auth']['listedUsersOnly'] = false;
index 7ed3188e383ec61f5bb11f2cf05496d6bc12abc4..9021a2e1a549cfe2e5dd4bc754c104982c5c27f2 100644 (file)
@@ -23,7 +23,11 @@ class Repositories
             }
         );
         sort($dirs, SORT_NUMERIC);
-        $n = end($dirs) + mt_rand(65536, 16777216);
+        if ($GLOBALS['phorkie']['cfg']['randomIds']) {
+            $n = end($dirs) + mt_rand(65536, 16777216);
+        } else {
+            $n = end($dirs) + 1;
+        }
 
         chdir($this->workDir);
         $dir = $this->workDir . '/' . $n . '/';