#!/usr/bin/env php * @category Horde * @copyright 2007-2017 Horde LLC * @license http://www.horde.org/licenses/lgpl LGPL-2 * @package Horde */ $baseFile = __DIR__ . '/../lib/Application.php'; if (file_exists($baseFile)) { require_once $baseFile; } else { require_once 'PEAR/Config.php'; require_once PEAR_Config::singleton() ->get('horde_dir', null, 'pear.horde.org') . '/lib/Application.php'; } Horde_Registry::appInit('horde', array( 'authentication' => 'none', 'cli' => true )); $dbh = $injector->getInstance('Horde_Db_Adapter'); // read sql file for statements to run $statements = new Horde_Db_StatementParser($_SERVER['argv'][1]); foreach ($statements as $stmt) { $cli->writeln('Running:'); $cli->writeln(' ' . preg_replace('/\s+/', ' ', $stmt)); $dbh->execute($stmt); $cli->writeln(' ...done.'); }