move all scripts into one location

- standardize includes, namings
- made migrate executable
- updated ConfigurationCombinationsTest generator to work with current persistance API
This commit is contained in:
El RIDO 2022-11-05 09:32:30 +01:00
parent 8389c2a2d6
commit 62bb68344c
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92
5 changed files with 13 additions and 7 deletions

2
.gitattributes vendored
View File

@ -1,3 +1,5 @@
bin/configuration-test-generator export-ignore
bin/icon-test export-ignore
doc/ export-ignore doc/ export-ignore
tst/ export-ignore tst/ export-ignore
img/browserstack.svg export-ignore img/browserstack.svg export-ignore

View File

@ -9,7 +9,9 @@
* DANGER: Too many options/settings and too high max iteration setting may trigger * DANGER: Too many options/settings and too high max iteration setting may trigger
* a fork bomb. Please save your work before executing this script. * a fork bomb. Please save your work before executing this script.
*/ */
include 'Bootstrap.php';
define('PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
include PATH . 'tst' . DIRECTORY_SEPARATOR . 'Bootstrap.php';
$vd = array('view', 'delete'); $vd = array('view', 'delete');
$vcd = array('view', 'create', 'delete'); $vcd = array('view', 'create', 'delete');
@ -392,7 +394,7 @@ class ConfigurationTestGenerator
} }
} }
$code .= '}' . PHP_EOL; $code .= '}' . PHP_EOL;
file_put_contents('ConfigurationCombinationsTest.php', $code); file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'tst' . DIRECTORY_SEPARATOR . 'ConfigurationCombinationsTest.php', $code);
} }
/** /**
@ -428,6 +430,8 @@ class ConfigurationCombinationsTest extends PHPUnit_Framework_TestCase
Helper::confBackup(); Helper::confBackup();
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
$this->_model = new Filesystem(array('dir' => $this->_path)); $this->_model = new Filesystem(array('dir' => $this->_path));
ServerSalt::setStore($this->_model);
TrafficLimiter::setStore($this->_model);
$this->reset(); $this->reset();
} }

9
bin/migrate.php → bin/migrate Normal file → Executable file
View File

@ -1,7 +1,8 @@
#!/usr/bin/env php
<?php <?php
// change this, if your php files and data is outside of your webservers document root // change this, if your php files and data is outside of your webservers document root
define('PATH', '..' . DIRECTORY_SEPARATOR); define('PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
define('PUBLIC_PATH', __DIR__ . DIRECTORY_SEPARATOR); define('PUBLIC_PATH', __DIR__ . DIRECTORY_SEPARATOR);
require PATH . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; require PATH . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
@ -171,9 +172,9 @@ function helpexit ()
print("migrate.php - Copy data between PrivateBin backends print("migrate.php - Copy data between PrivateBin backends
Usage: Usage:
php migrate.php [--delete-after] [--delete-during] [-f] [-n] [-v] srcconfdir migrate [--delete-after] [--delete-during] [-f] [-n] [-v] srcconfdir
[<dstconfdir>] [<dstconfdir>]
php migrate.php [-h] migrate [-h]
Options: Options:
--delete-after delete data from source after all pastes and comments have --delete-after delete data from source after all pastes and comments have

View File

@ -1,7 +1,6 @@
<phpunit bootstrap="Bootstrap.php" colors="true"> <phpunit bootstrap="Bootstrap.php" colors="true">
<testsuite name="PrivateBin Test Suite"> <testsuite name="PrivateBin Test Suite">
<directory suffix=".php">./</directory> <directory suffix=".php">./</directory>
<exclude>ConfigurationTestGenerator.php</exclude>
</testsuite> </testsuite>
<filter> <filter>
<whitelist> <whitelist>