Ugly patch to maintain old DB handle code working quietly

We have to replace this database engine with a modern one
This commit is contained in:
Diogo Cordeiro
2019-04-27 18:21:14 +01:00
parent d75b5d2f4a
commit daa5f87fd4
21 changed files with 7017 additions and 7099 deletions

View File

@@ -25,32 +25,32 @@
define('DB_DATAOBJECT_NO_OVERLOAD', 1);
//require_once 'DB/DataObject/Generator.php';
require_once 'DB/DataObject/Generator.php';
require_once 'Generator.php';
if (php_sapi_name() != 'cli') {
PEAR::raiseError("\nERROR: You must turn use the cli sapi to run this", null, PEAR_ERROR_DIE);
(new PEAR)->raiseError("\nERROR: You must turn use the cli sapi to run this", null, PEAR_ERROR_DIE);
}
if (!ini_get('register_argc_argv')) {
PEAR::raiseError("\nERROR: You must turn register_argc_argv On in you php.ini file for this to work\neg.\n\nregister_argc_argv = On\n\n", null, PEAR_ERROR_DIE);
(new PEAR)->raiseError("\nERROR: You must turn register_argc_argv On in you php.ini file for this to work\neg.\n\nregister_argc_argv = On\n\n", null, PEAR_ERROR_DIE);
exit;
}
if (!@$_SERVER['argv'][1]) {
PEAR::raiseError("\nERROR: createTable.php usage:\n\n" .$_SERVER['argv'][0] . " example.ini\n\n", null, PEAR_ERROR_DIE);
(new PEAR)->raiseError("\nERROR: createTable.php usage:\n\n" . $_SERVER['argv'][0] . " example.ini\n\n", null, PEAR_ERROR_DIE);
exit;
}
$config = parse_ini_file($_SERVER['argv'][1], true);
foreach ($config as $class=>$values) {
$options = &PEAR::getStaticProperty($class, 'options');
foreach ($config as $class => $values) {
$options = &(new PEAR)->getStaticProperty($class, 'options');
$options = $values;
}
$options = &PEAR::getStaticProperty('DB_DataObject', 'options');
$options = &(new PEAR)->getStaticProperty('DB_DataObject', 'options');
if (empty($options)) {
PEAR::raiseError("\nERROR: could not read ini file\n\n", null, PEAR_ERROR_DIE);
(new PEAR)->raiseError("\nERROR: could not read ini file\n\n", null, PEAR_ERROR_DIE);
exit;
}
set_time_limit(0);