CACTI_PATH); // pre-flush output buffer to avoid header warning flush(); /* * TEST: include all installation upgrade files * This will find function name collisions */ print "TEST: Including all Install upgrade files" . PHP_EOL; $install_upgrades_dir = CACTI_PATH . '/install/upgrades'; $dh = opendir($install_upgrades_dir); if ($dh === false) { throw new Exception('Failed to open directory: ' . $install_upgrades_dir); } while (($file = readdir($dh)) !== false) { // only include .php files, skip index.php if (substr($file, -4) == '.php' && $file != 'index.php') { print ' Include File: ' . $install_upgrades_dir . '/' . $file . PHP_EOL; require_once($install_upgrades_dir . '/' . $file); // confirm upgrade function exists $function_name = 'upgrade_to_' . substr($file, 0, -4); if (! function_exists($function_name)) { throw new Exception('Install upgrade function ' . $function_name . ' not found'); } } } closedir($dh); exit(0); /* * Error handler function to cause exception on error and warnings */ function error_handler($err_number, $err_string, $err_file, $err_line) { $msg = $err_string . " in " . $err_file . " on line " . $err_line; if ($err_number == E_NOTICE || $err_number == E_WARNING) { throw new ErrorException($msg, $err_number); } else { echo $msg; } }