Remove unused scripts from misc/testing folder.

This commit is contained in:
DariusIII
2017-12-22 13:59:36 +01:00
parent 6e1f42f165
commit 1890536174
16 changed files with 0 additions and 1139 deletions
-56
View File
@@ -1,56 +0,0 @@
<?php
//
// This script is used to test the regular expressions identified
// within a nntmux database are valid.
//
// by l2g
//
require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';
use nntmux\db\DB;
use nntmux\Releases;
function handleError($errno, $errstr, $errfile, $errline, array $errcontext)
{
// error was suppressed with the @-operator
if (0 === error_reporting()) {
return false;
}
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler('handleError');
$regs = [
'empty' => '',
'illformed' => '[](9()))))))))) [34543/34]',
'simple' => '"data.mp3',
];
$releases = new Releases();
$db = new DB();
// fetch enabled regular expression
$catsql = 'select ID,groupname,regex from releaseregex where status = 1';
$res = $db->query($catsql);
$total = count($res);
$errcnt = 0;
echo "\n";
foreach ($res as $regexrow) {
foreach ($regs as $regex) {
try {
$res = preg_match($regexrow['regex'], $regex);
} catch (Exception $e) {
$errcnt++;
$strerr = str_pad((int) $errcnt, 2, ' ', STR_PAD_LEFT);
echo "$strerr. id=".$regexrow['id'].
', group='.$regexrow['groupname']."\n";
echo " regex='".$regexrow['regex']."'\n";
echo ' error='.$e->getMessage()."\n\n";
break;
}
}
}
echo "Scanned $total record(s), $errcnt error(s) found.\n";
exit(($errcnt > 0) ? 1 : 0);
-54
View File
@@ -1,54 +0,0 @@
<?php
//
// This script is used to test the regular expressions identified
// within a nntmux database are valid.
//
// by l2g
//
require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';
use nntmux\db\DB;
function handleError($errno, $errstr, $errfile, $errline, array $errcontext)
{
// error was suppressed with the @-operator
if (0 === error_reporting()) {
return false;
}
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler('handleError');
$regs = [
'empty' => '',
'illformed' => '[](9()))))))))) [34543/34]',
'simple' => '"data.mp3',
];
$db = new DB();
// fetch enabled regular expression
$catsql = 'select ID,groupname,regex from releaseregex where status = 1';
$res = $db->query($catsql);
$total = count($res);
$errcnt = 0;
echo "\n";
foreach ($res as $regexrow) {
foreach ($regs as $regex) {
try {
$res = preg_match($regexrow['regex'], $regex);
} catch (Exception $e) {
$errcnt++;
$strerr = str_pad((int) $errcnt, 2, ' ', STR_PAD_LEFT);
echo "$strerr. id=".$regexrow['id'].
', group='.$regexrow['groupname']."\n";
echo " regex='".$regexrow['regex']."'\n";
echo ' error='.$e->getMessage()."\n\n";
break;
}
}
}
echo "Scanned $total record(s), $errcnt error(s) found.\n";
exit(($errcnt > 0) ? 1 : 0);
-26
View File
@@ -1,26 +0,0 @@
<?php
//This Script Verifies your System Time vs Myself Time vs PHP Time
require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';
use nntmux\db\DB;
$res = '';
$db = new DB();
$res = $db->queryOneRow(sprintf('Select now()'));
foreach ($res as $time) {
echo 'Mysql Time Is Now '.$time."\n";
}
$res = '';
$res = date('r');
echo 'PHP Time Is Now '.$res."\n";
$res = '';
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
exec('time /t', $res);
echo 'System Time is Now '.$res['0']."\n";
} else {
exec('date', $res);
echo 'System Time is Now '.$res['0']."\n";
}
-51
View File
@@ -1,51 +0,0 @@
<?php
require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';
use nntmux\db\DB;
try {
// Create the first database class instance (which will initialize the PDO connection)
$db = new DB();
// For debug set the error mode
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Start the transaction
if ($db->beginTransaction()) {
// Loop 20 times
for ($i = 1; $i <= 20; $i++) {
// Header
echo "--[ Insert run: {$i} ]----------------------------------------".PHP_EOL;
// Create a new db class instance (multiple can exist)
$newDb = new DB();
// Check that there is a new db class instance, but no new PDO instance
var_dump($newDb, $newDb->getPDO());
// Insert some data
$sql = sprintf(
"
INSERT INTO `testdata`
(`id` ,`field1` ,`field2` ,`field3` ,`field4`)
VALUES
('%s', '%s', '%s', '%s', '%s')",
$i,
$i,
$i,
$i,
$i
);
$newDb->exec($sql);
// Check for inserted data
var_dump($newDb->query(sprintf('SELECT * FROM `testdata` WHERE id = %d', $i)));
}
// Now rollback using the last db class instance
var_dump($newDb->rollback());
}
} catch (PDOException $e) {
var_dump($e);
}