* @author Michael J. Rubinsky <mrubinsk@horde.org>
*/
-// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../../lib/Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment.
-Horde_Cli::init();
-$cli = Horde_Cli::singleton();
+Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
/* Command line options */
$ret = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), 'hu:p:f:',
array('help', 'username=', 'password=', 'fields='));
+$cli = Horde_Cli::singleton();
if (is_a($ret, 'PEAR_Error')) {
$cli->fatal($ret->getMessage());
}
* @author Vijay Mahrra <webmaster@stain.net>
*/
-// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../../lib/Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment.
-Horde_Cli::init();
+Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
$cli = Horde_Cli::singleton();
-// Load Ansel.
-Horde_Registry::appInit('ansel', array('authentication' => 'none'));
-
// We accept the user name on the command-line.
$ret = Console_Getopt::getopt(Console_Getopt::readPHPArgv(),
'hu:p:lc:g:a:d:t:',
'caption='));
if (is_a($ret, 'PEAR_Error')) {
- var_dump($ret);
$error = _("Couldn't read command-line options.");
Horde::logMessage($error, __FILE__, __LINE__, PEAR_LOG_DEBUG);
$cli->fatal($error);
* directory.
*/
-// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../../lib/Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init
-// some variables, etc.
-Horde_Cli::init();
-
-Horde_Registry::appInit('ansel', array('authentication' => 'none'));
+Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
// Default arguments.
-$move = false;
-$verbose = false;
+$move = $verbose = false;
// Parse command-line arguments.
$ret = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), 'mv',
* @author Vijay Mahrra <webmaster@stain.net>
*/
-// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../../lib/Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment.
-Horde_Cli::init();
+Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
$cli = Horde_Cli::singleton();
-// Load Ansel.
-Horde_Registry::appInit('ansel', array('authentication' => 'none'));
-
// We accept the user name on the command-line.
$ret = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), 'hu:p:lc:g:a:d:k',
array('help', 'username=', 'password=', 'dir=', 'keep'));
* @author Michael J. Rubinsky <mrubinsk@horde.org>
*/
-require_once dirname(__FILE__) . '/../lib/base.load.php';
-require_once HORDE_BASE . '/lib/core.php';
-
-/* Horde_CLI */
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-Horde_Cli::init();
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
$cli = Horde_Cli::singleton();
/* Command line options */
* @author Michael J. Rubinsky <mrubinsk@horde.org>
*/
-// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../../lib/Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_CLI::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment.
-Horde_CLI::init();
+Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
$cli = Horde_CLI::singleton();
-Horde_Registry::appInit('ansel', array('authentication' => 'none'));
-
// First update the tables
$alter = array("ALTER TABLE ansel_images ADD COLUMN image_latitude VARCHAR(32) NOT NULL DEFAULT ''",
"ALTER TABLE ansel_images ADD COLUMN image_longitude VARCHAR(32) NOT NULL DEFAULT ''",
* @author Michael J. Rubinsky <mrubinsk@horde.org>
*/
-// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../../lib/Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment.
-Horde_Cli::init();
+Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
$cli = Horde_Cli::singleton();
-Horde_Registry::appInit('ansel', array('authentication' => 'none'));
-
$sql = 'SELECT image_id, image_original_date, image_uploaded_date FROM ansel_images';
$results = $ansel_db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC);
foreach ($results as $image) {
* @author Michael J. Rubinsky <mrubinsk@horde.org>
*/
-// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../../Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment.
-Horde_Cli::init();
+Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
$cli = Horde_Cli::singleton();
-Horde_Registry::appInit('ansel', array('authentication' => 'none'));
-
$sql = 'SELECT image_id, image_latitude, image_longitude FROM ansel_images_geolocation;';
$results = $ansel_db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC);
$sql = $ansel_db->prepare('UPDATE ansel_images_geolocation SET image_latitude = ?, image_longitude = ? WHERE image_id = ?');
* @author Michael J. Rubinsky <mrubinsk@horde.org>
*/
-// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/lib/Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment.
-Horde_Cli::init();
+Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
$cli = Horde_Cli::singleton();
-Horde_Registry::appInit('ansel', array('authentication' => 'none'));
-
$sql = 'SELECT image_id, image_latitude, image_longitude FROM ansel_images_geolocation;';
$results = $ansel_db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC);
$sql = $ansel_db->prepare('UPDATE ansel_images SET image_latitude = ?, image_longitude = ? WHERE image_id = ?');
* @param array $args Optional arguments:
* <pre>
* 'admin' - (boolean) Require authenticated user to be an admin?
+ * DEFAULT: false
* 'authentication' - (string) The type of authentication to use:
* 'none' - Do not authenticate
* 'throw' - Authenticate; on no auth, throw a Horde_Exception
* [DEFAULT] - Authenticate; on no auth redirect to login screen
- * 'nocompress' - (boolean) Controls whether the page should be
- * compressed.
+ * 'cli' - (boolean) Initialize a CLI interface.
+ * DEFAULT: false
+ * 'nocompress' - (boolean) If set, the page will not be compressed.
+ * DEFAULT: false
* 'nologintasks' - (boolean) If set, don't perform logintasks (never
* performed if authentication is 'none').
+ * DEFAULT: false
* 'session_control' - (string) Sets special session control limitations:
* 'netscape' - TODO; start read/write session
* 'none' - Do not start a session
* 'readonly' - Start session readonly
* [DEFAULT] - Start read/write session
* 'user' - (string) Set authentication to this user.
+ * DEFAULT: null
* </pre>
*
* @return Horde_Registry_Application The application object.
$args = array_merge(array(
'admin' => false,
'authentication' => null,
+ 'cli' => null,
'nocompress' => false,
'nologintasks' => false,
'session_control' => null,
Horde_Auth::authenticateFailure($app, $e);
}
+ /* CLI initialization. */
+ if ($args['cli']) {
+ /* Make sure no one runs from the web. */
+ if (!Horde_Cli::runningFromCLI()) {
+ fwrite(STDERR, "Must be run from the command line\n");
+ exit(1);
+ }
+
+ /* Load the CLI environment - make sure there's no time limit,
+ * init some variables, etc. */
+ Horde_Cli::init();
+
+ $args['nocompress'] = true;
+ }
+
if (!$args['nocompress']) {
Horde::compressOutput();
}
* @author Jan Schneider <jan@horde.org>
*/
-// Do CLI checks and environment setup first.
-require_once dirname(__FILE__) . '/../lib/core.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-Horde_Cli::init();
-
-// Include needed libraries.
-Horde_Registry::appInit('horde', array('authentication' => 'none'));
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
// Authenticate as administrator.
if (!count($conf['auth']['admins'])) {
* @author Chuck Hagenbuch <chuck@horde.org>
*/
-// Do CLI checks and environment setup first.
-require_once dirname(__FILE__) . '/../lib/core.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-Horde_Cli::init();
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
$cli = Horde_Cli::singleton();
-// Include needed libraries.
-Horde_Registry::appInit('horde', array('authentication' => 'none'));
-
// Get a database connection
$db = $GLOBALS['injector']->getInstance('Horde_Db_Adapter_Base');
* @author Ben Chavet <ben@horde.org>
*/
-// Do CLI checks and environment setup first.
-require_once dirname(__FILE__) . '/../lib/core.php';
-
-// Makre sure no one runs this from the web.
-if (!Horde_Cli::runningFromCli()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-$cli = Horde_Cli::singleton();
-$cli->init();
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
// Read command line parameters.
+$cli = Horde_Cli::singleton();
if ($argc != 2) {
$cli->message('Too many or too few parameters.', 'cli.error');
$cli->writeln('Usage: import_squirrelmail_prefs.php path-to-squirrelmail-data');
}
$data = $argv[1];
-// Make sure we load Horde base to get the auth config
-require_once dirname(__FILE__) . '/../lib/Application.php';
-Horde_Registry::appInit('horde', array('authentication' => 'none'));
-
require_once dirname(__FILE__) . '/import_squirrelmail_prefs.php';
// Get list of SquirrelMail pref files
case 'hour_format':
return array(array('name' => 'twentyFour', 'scope' => 'horde', 'value' => ($sm_pref_value == 1)));
break;
-
+
case 'internal_date_sort':
if ($sm_pref_value == 1) {
return array(array('name' => 'sortby', 'scope' => 'imp', 'value' => '1'));
*/
// Do CLI checks and environment setup first.
-require_once dirname(__FILE__) . '/../lib/core.php';
-
-// Makre sure no one runs this from the web.
-if (!Horde_Cli::runningFromCli()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-$cli = Horde_Cli::singleton();
-$cli->init();
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
// Read command line parameters.
+$cli = Horde_Cli::singleton();
if ($argc != 2) {
$cli->message('Too many or too few parameters.', 'cli.error');
$cli->writeln('Usage: import_squirrelmail_prefs.php DSN');
}
$dsn = $argv[1];
-// Make sure we load Horde base to get the auth config
-Horde_Registry::appInit('horde', array('authentication' => 'none'));
-
require_once dirname(__FILE__) . '/import_squirrelmail_prefs.php';
// Connect to database.
* tables and into its own database table.
*/
-// Do CLI checks and environment setup first.
-require_once dirname(__FILE__) . '/../../lib/core.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init
-// some variables, etc.
-Horde_Cli::init();
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
$cli = Horde_Cli::singleton();
-Horde_Registry::appInit('horde', array('authentication' => 'none'));
-
require_once 'Horde/DataTree.php';
$datatree = DataTree::factory('sql',
array_merge(
'whups_shares' => 'share_id');
/* Set up the CLI environment */
-require_once dirname(__FILE__) . '/../../lib/core.php';
-if (!Horde_Cli::runningFromCli()) {
- exit("Must be run from the command line\n");
-}
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
$cli = Horde_Cli::singleton();
-$cli->init();
-/* Grab what we need to steal the DB config */
-require_once HORDE_BASE . '/config/conf.php';
$config = $GLOBALS['conf']['sql'];
unset($config['charset']);
$schema = MDB2_Schema::factory($config, array('seqcol_name' => 'id'));
* (Horde 3.2+) native SQL Group backend.
*/
-// Do CLI checks and environment setup first.
-require_once dirname(__FILE__) . '/../../lib/core.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init
-// some variables, etc.
-Horde_Cli::init();
-
-Horde_Registry::appInit('horde', array('authentication' => 'none'));
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
require_once 'Horde/Group.php';
$g = Group::factory();
* new (Horde 3.2+) native SQL Perms backend.
*/
-// Do CLI checks and environment setup first.
-require_once dirname(__FILE__) . '/../../lib/core.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init
-// some variables, etc.
-Horde_Cli::init();
-
-Horde_Registry::appInit('horde', array('authentication' => 'none'));
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
$p = Perms::factory('datatree');
* the values stored in the preferences backend.
*/
-// Do CLI checks and environment setup first.
-require_once dirname(__FILE__) . '/../../lib/core.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init
-// some variables, etc.
-Horde_Cli::init();
-
-Horde_Registry::appInit('horde', array('authentication' => 'none'));
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
$cli = Horde_Cli::singleton();
$cManager = new Horde_Prefs_CategoryManager();
* tables and into its own database table.
*/
-// Do CLI checks and environment setup first.
-require_once dirname(__FILE__) . '/../../lib/core.php';
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init
-// some variables, etc.
-Horde_Cli::init();
$cli = Horde_Cli::singleton();
-
$cli->writeln($cli->yellow("Beginning migration. This may take a very long time to complete."));
$cli->writeln();
-Horde_Registry::appInit('horde', array('authentication' => 'none'));
-
require_once 'Horde/DataTree.php';
$datatree = DataTree::factory('sql', array_merge(Horde::getDriverConfig('datatree', 'sql'),
array('group' => 'horde.history')));
<?php
require_once dirname(__FILE__) . '/../lib/Application.php';
-$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none'));
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-/* Load the CLI environment - make sure there's no time limit, init
- * some variables, etc. */
-$cli = new Horde_Cli();
-$cli->init();
+$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none', 'cli' => true));
/* Create the fax information array. Set fax_type to 1 for outgoing. */
$info = array('fax_type' => 1);
<?php
require_once dirname(__FILE__) . '/../lib/Application.php';
-$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none'));
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-/* Load the CLI environment - make sure there's no time limit, init some
- * variables, etc. */
-$cli = &new Horde_Cli();
-$cli->init();
+$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none', 'cli' => true));
/* Create the fax information array. Set fax_type to 0 for incoming. */
$info = array('fax_type' => 0,
$info['job_id'] = (int)substr($file, 9, -4);
}
+$cli = Horde_Cli::singleton();
$fax_info = $cli->readStdin();
$fax_info = explode("\n", $fax_info);
foreach ($fax_info as $line) {
<?php
require_once dirname(__FILE__) . '/../lib/Application.php';
-$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none'));
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-/* Load the CLI environment - make sure there's no time limit, init some
- * variables, etc. */
-$cli = new Horde_Cli();
-$cli->init();
+$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none', 'cli' => true));
/* Store the raw fax postscript data. */
+$cli = Horde_Cli::singleton();
$data = $cli->readStdin();
if (empty($data)) {
Horde::logMessage('No print data received from standard input. Exiting fax submission.', __FILE__, __LINE__, PEAR_LOG_ERR);
<?php
require_once dirname(__FILE__) . '/../lib/Application.php';
-$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none'));
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-/* Load the CLI environment - make sure there's no time limit, init some
- * variables, etc. */
-$cli = new Horde_Cli();
-$cli->init();
+$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none', 'cli' => true));
/* Get the arguments. The first argument is the filename from which the job ID
* is obtained, in the format 'recvq/faxNNNNN.tif'. */
}
/* Store the raw fax postscript data. */
+$cli = Horde_Cli::singleton();
$data = $cli->readStdin();
if (empty($data)) {
Horde::logMessage('No print data received from standard input. Exiting fax submission.', __FILE__, __LINE__, PEAR_LOG_ERR);
<?php
require_once dirname(__FILE__) . '/../lib/Application.php';
-$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none'));
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-Horde_Cli::init();
+$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none', 'cli' => true));
/* The CUPS backend file. */
$hylafax_backend = file_get_contents(HYLAX_BASE . '/scripts/cups/hylafax');
* @author Jan Schneider <jan@horde.org>
*/
-define('IMP_CONFIG', dirname(__FILE__) . '/../config');
-require_once 'Horde/Cli.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('imp', array('authentication' => true, 'cli' => true));
-/* Make sure no one runs this from the web. */
-if (!Horde_Cli::runningFromCLI()) {
- fwrite(STDERR, "Must be run from the command line\n");
- exit(1);
-}
+$bounce_template = IMP_BASE . '/config/bounce.txt';
/* If there's no bounce template file then abort */
-if (!file_exists(IMP_CONFIG . '/bounce.txt')) {
+if (!file_exists($bounce_template)) {
exit(0);
}
-/* Load the CLI environment - make sure there's no time limit, init some
- * variables, etc. */
-Horde_Cli::init();
-
/* Read the message content. */
$data = Horde_Cli::readStdin();
$delivered_to = $matches[1][count($matches[1])-1];
/* Read the bounce template and construct the mail */
-$bounce = file_get_contents(IMP_CONFIG . '/bounce.txt');
+$bounce = file_get_contents($bounce_template);
$bounce = str_replace(array('%TO%', '%TARGET%'),
array($return_path, $delivered_to),
$bounce);
*/
require_once dirname(__FILE__) . '/lib/Application.php';
-Horde_Registry::appInit('kronolith', array('authentication' => 'none'));
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init
-// some variables, etc.
-Horde_Cli::init();
+Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'cli' => true));
send_agendas();
-exit(0);
-
/**
*/
* @author Jan Schneider <jan@horde.org>
*/
-$kronolith_authentication = 'none';
-@define('HORDE_BASE', dirname(__FILE__) . '/../..');
-
-// Do CLI checks and environment setup first.
-require_once HORDE_BASE . '/lib/core.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-$cli = Horde_Cli::singleton();
-$cli->init();
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'cli' => true));
// Read command line parameters.
+$cli = Horde_Cli::singleton();
if (count($argv) != 3) {
$cli->message('Too many or too few parameters.', 'cli.error');
usage();
usage();
}
-// Registry.
-$registry = Horde_Registry::singleton();
-
// Set user.
Horde_Auth::setAuth($user, array());
// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../lib/Application.php';
-
-// Makre sure no one runs this from the web.
-if (!Horde_Cli::runningFromCli()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-$cli = Horde_Cli::singleton();
-$cli->init();
+Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'cli' => true, 'user' => $conf['auth']['admins'] ? $conf['auth']['admins'][0] : array()));
// Read command line parameters.
+$cli = Horde_Cli::singleton();
if ($argc != 2) {
$cli->message('Too many or too few parameters.', 'cli.error');
$cli->writeln('Usage: import_squirrelmail_file_abook.php DSN');
$dsn = $argv[1];
$default_tz = date_default_timezone_get();
-// Make sure we load Horde base to get the auth config
-Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'user' => $conf['auth']['admins'] ? $conf['auth']['admins'][0] : array()));
-
// Connect to database.
$db = DB::connect($dsn);
if (is_a($db, 'PEAR_Error')) {
*/
/* Set up the CLI environment */
-require_once dirname(__FILE__) . '/../../lib/base.load.php';
-require_once HORDE_BASE . '/lib/core.php';
-if (!Horde_Cli::runningFromCli()) {
- exit("Must be run from the command line\n");
-}
-$cli = Horde_Cli::singleton();
-$cli->init();
+require_once dirname(__FILE__) . '/../../Application.php';
+Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'cli' => true));
-/* Grab what we need to steal the DB config */
-require_once HORDE_BASE . '/config/conf.php';
+$cli = Horde_Cli::singleton();
$config = $GLOBALS['conf']['sql'];
unset($config['charset']);
/* Set up the CLI environment. */
require_once dirname(__FILE__) . '/../../lib/Application.php';
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-$cli = Horde_Cli::singleton();
-$cli->init();
-
-/* Load required libraries. */
-Horde_Registry::appInit('kronolith', array('authentication' => 'none'));
+Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'cli' => true));
/* Prepare DB stuff. */
PEAR::staticPushErrorHandling(PEAR_ERROR_DIE);
$stmt = $db->prepare('UPDATE kronolith_events SET event_start = ?, event_end = ?, event_recurenddate = ? WHERE event_id = ?');
/* Confirm changes. */
+$cli = Horde_Cli::singleton();
if (!isset($argv[1]) || $argv[1] != '--yes') {
$answer = $cli->prompt('Running this script will convert all existing events to UTC. This conversion is not reversible. Is this what you want?', array('y' => 'Yes', 'n' => 'No'));
if ($answer != 'y') {
* @author Jan Schneider <jan@horde.org>
*/
-// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../lib/Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-$cli = Horde_Cli::singleton();
-$cli->init();
+Horde_Registry::appInit('nag', array('authentication' => 'none', 'cli' => true));
// Read command line parameters.
+$cli = Horde_Cli::singleton();
if (count($argv) != 3) {
$cli->message('Too many or too few parameters.', 'cli.error');
usage();
usage();
}
-// Registry.
-$registry = Horde_Registry::singleton();
-
// Set user.
Horde_Auth::setAuth($user, array());
// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../../lib/Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-Horde_Cli::init();
-
-Horde_Registry::appInit('nag', array('authentication' => 'none'));
+Horde_Registry::appInit('nag', array('authentication' => 'none', 'cli' => true));
if ($conf['storage']['driver'] != 'sql') {
exit('No conversion for drivers other than SQL currently.');
$storage = Nag_Driver::singleton('');
$storage->initialize();
-$db = &$storage->_db;
+$db = $storage->_db;
// Add db fields. We don't check for success/failure here in case someone did
// this manually.
}
}
-echo "\n** Creators successfully stored. ***\n";
-
-echo "\n** Please manually apply NOT NULL constraint to 'task_creator' column. ***\n";
+echo "\n** Creators successfully stored. ***\n\n".
+ "** Please manually apply NOT NULL constraint to 'task_creator' column. ***\n";
/* Set up the CLI environment */
require_once dirname(__FILE__) . '/../../lib/Application.php';
-if (!Horde_Cli::runningFromCli()) {
- exit("Must be run from the command line\n");
-}
+Horde_Registry::appInit('nag', array('authentication' => 'none', 'cli' => true));
$cli = Horde_Cli::singleton();
-$cli->init();
/* Grab what we need to steal the DB config */
require_once HORDE_BASE . '/config/conf.php';
// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../../lib/Application.php';
+Horde_Registry::appInit('nag', array('authentication' => 'none', 'cli' => true));
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
$cli = Horde_Cli::singleton();
-$cli->init();
-
-Horde_Registry::appInit('nag', array('authentication' => 'none'));
-
$history = Horde_History::singleton();
// Run through every tasklist.
$tasklists = $nag_shares->listAllShares();
foreach ($tasklists as $tasklist => $share) {
- echo "Creating default histories for $tasklist ...\n";
+ $cli->writeln("Creating default histories for $tasklist ...");
// List all tasks.
$storage = Nag_Driver::singleton($tasklist);
}
}
-echo "\n** Default histories successfully created ***\n";
+$cli->writeln("** Default histories successfully created ***");
// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true, 'user' => $conf['auth']['admins'] ? $conf['auth']['admins'][0] : null));
-// Makre sure no one runs this from the web.
-if (!Horde_Cli::runningFromCli()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-$cli = Horde_Cli::singleton();
-$cli->init();
+require_once TURBA_BASE . '/lib/Object/Group.php';
// Read command line parameters.
+$cli = Horde_Cli::singleton();
if ($argc != 2) {
$cli->message('Too many or too few parameters.', 'cli.error');
$cli->writeln('Usage: import_squirrelmail_file_abook.php path-to-squirrelmail-data');
}
$data = $argv[1];
-// Make sure we load Horde base to get the auth config
-Horde_Registry::appInit('turba', array('authentication' => 'none', 'user' => $conf['auth']['admins'] ? $conf['auth']['admins'][0] : null));
-
-require_once TURBA_BASE . '/lib/Object/Group.php';
-
// Get list of SquirrelMail address book files
if (is_dir($data)) {
if (!($handle = opendir($data))) {
// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true, 'user' => $conf['auth']['admins'] ? $conf['auth']['admins'][0] : null));
-// Makre sure no one runs this from the web.
-if (!Horde_Cli::runningFromCli()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-$cli = Horde_Cli::singleton();
-$cli->init();
+require_once TURBA_BASE . '/lib/Object/Group.php';
// Read command line parameters.
+$cli = Horde_Cli::singleton();
if ($argc != 2) {
$cli->message('Too many or too few parameters.', 'cli.error');
$cli->writeln('Usage: import_squirrelmail_file_abook.php DSN');
}
$dsn = $argv[1];
-Horde_Registry::appInit('turba', array('authentication' => 'none', 'user' => $conf['auth']['admins'] ? $conf['auth']['admins'][0] : null));
-
-require_once TURBA_BASE . '/lib/Object/Group.php';
-
// Connect to database.
$db = DB::connect($dsn);
if (is_a($db, 'PEAR_Error')) {
// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../lib/Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-$cli = Horde_Cli::singleton();
-$cli->init();
+Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true, 'user' => $user));
// Read command line parameters.
+$cli = Horde_Cli::singleton();
if (count($argv) != 3) {
$cli->message('Too many or too few parameters.', 'cli.error');
usage();
usage();
}
-// Registry.
-Horde_Registry::appInit('turba', array('authentication' => 'none', 'user' => $user));
-
// Import data.
$result = $registry->call('contacts/import',
array($vcard, 'text/x-vcard', $source));
$do_email = true;
/* YOU SHOULD NOT HAVE TO TOUCH ANYTHING BELOW THIS LINE */
+
/* Set up the CLI environment */
require_once dirname(__FILE__) . '/../../lib/Application.php';
-if (!Horde_Cli::runningFromCli()) {
- exit("Must be run from the command line\n");
-}
+Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true));
$cli = Horde_Cli::singleton();
-$cli->init();
/* Grab what we need to steal the DB config */
require_once HORDE_BASE . '/config/conf.php';
// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../lib/Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-Horde_Cli::init();
-
-Horde_Registry::appInit('turba', array('authentication' => 'none'));
+Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true));
// Instantiate DataTree.
require_once 'Horde/DataTree.php';
// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../lib/Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init
-// some variables, etc.
-Horde_Cli::init();
-
-Horde_Registry::appInit('turba', array('authentication' => 'none'));
-
-// Re-load source config.
-// require TURBA_BASE . '/config/sources.php';
+Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true));
// See if any of our sources are configured to use Horde_Share.
if (empty($_SESSION['turba']['has_share'])) {
// Do CLI checks and environment setup first.
require_once dirname(__FILE__) . '/../lib/Application.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init
-// some variables, etc.
-Horde_Cli::init();
-
-Horde_Registry::appInit('turba', array('authentication' => 'none'));
+Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true));
// Re-load source config.
require TURBA_BASE . '/config/sources.php';
/* Set up the CLI environment */
require_once dirname(__FILE__) . '/../../lib/Application.php';
-if (!Horde_Cli::runningFromCli()) {
- exit("Must be run from the command line\n");
-}
+Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true));
$cli = Horde_Cli::singleton();
-$cli->init();
/* Grab what we need to steal the DB config */
require_once HORDE_BASE . '/config/conf.php';
// Load Horde and Turba enviroments
require_once dirname(__FILE__) . '/../lib/Application.php';
-
-// Set up the CLI enviroment.
-if (!Horde_Cli::runningFromCLI()) {
- exit("Must be run from the command line\n");
-}
-Horde_Cli::init();
+Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true, 'user' => $conf['auth']['admins'] ? $conf['auth']['admins'][0] : null));
$CLI = Horde_Cli::singleton();
-// Make sure we load Horde base to get the auth config
-Horde_Registry::appInit('turba', array('authentication' => 'none', 'user' => $conf['auth']['admins'] ? $conf['auth']['admins'][0] : null));
-
$CLI->writeln('This script will turn all entries in the SQL address book into a globally shared address book.');
$CLI->writeln('Make sure you read the script comments and be sure you know what you are doing.');
$sure = $CLI->prompt('Are you ' . $CLI->bold('sure') . ' you want to do this?', array('no', 'yes'));