aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2017-10-13 18:25:40 +0200
committerChristian Weiske <cweiske@cweiske.de>2017-10-13 18:25:40 +0200
commit25b59cbc644e59559296beef66b8509fd4cdefcf (patch)
tree1c6950e4e0577e179be13df51a84b458efc4649b
parentede9ef521fbe3b9fc3ee95c410edd906f8e64284 (diff)
downloadphorkie-25b59cbc644e59559296beef66b8509fd4cdefcf.tar.gz
phorkie-25b59cbc644e59559296beef66b8509fd4cdefcf.zip
Make random IDs configurable
-rw-r--r--data/config.default.php1
-rw-r--r--data/config.php.dist1
-rw-r--r--src/phorkie/Repositories.php6
3 files changed, 7 insertions, 1 deletions
diff --git a/data/config.default.php b/data/config.default.php
index 6e4c20c..06b53ed 100644
--- a/data/config.default.php
+++ b/data/config.default.php
@@ -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 */
diff --git a/data/config.php.dist b/data/config.php.dist
index f1b8704..85499fe 100644
--- a/data/config.php.dist
+++ b/data/config.php.dist
@@ -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;
diff --git a/src/phorkie/Repositories.php b/src/phorkie/Repositories.php
index 7ed3188..9021a2e 100644
--- a/src/phorkie/Repositories.php
+++ b/src/phorkie/Repositories.php
@@ -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 . '/';