* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-# Abort if called from a web server
+// Abort if called from a web server
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
ENDOFHELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
// Assume we're on a terminal if on Windows, otherwise posix_isatty tells us.
define('CONSOLE_INTERACTIVE', !function_exists('posix_isatty') || posix_isatty(0));
if (CONSOLE_INTERACTIVE) {
if (CONSOLE_READLINE) {
$line = readline($prompt);
- readline_add_history($line);
- if (defined('CONSOLE_HISTORY')) {
- // Save often; it's easy to hit fatal errors.
- readline_write_history(CONSOLE_HISTORY);
+ if (trim($line) != '') {
+ readline_add_history($line);
+ if (defined('CONSOLE_HISTORY')) {
+ // Save often; it's easy to hit fatal errors.
+ readline_write_history(CONSOLE_HISTORY);
+ }
}
return $line;
} else {