<?php $root = dirname(__FILE__) . '/'; //chdir($root); //on the command line you can pass -c=/path/to/config.php to set the config file. require_once $root . 'go/base/util/Cli.php'; $args = \GO\Base\Util\Cli::parseArgs(); if (isset($args['c'])) { define("GO_CONFIG_FILE", $args['c']); } //initialize autoloading of library require_once $root . 'go/GO.php'; \GO::init(); if (!isset($args['q'])) { echo "\nGroup-Office CLI - Copyright Intermesh BV.\n\n"; } if (PHP_SAPI != 'cli') { exit("ERROR: This script must be run on the command line\n\n"); } if (empty($args['r'])) { echo "ERROR: You must pass a controller route to use the command line script.\n" . "eg.:\n\n" . "sudo -u www-data php index.php -c=/path/to/config.php -r=maintenance/upgrade --param=value\n\n"; exit; } elseif (isset($args['u'])) { $password = isset($args['p']) ? $args['p'] : \GO\Base\Util\Cli::passwordPrompt("Enter password for user " . $args['u'] . ":"); $user = \GO::session()->login($args['u'], $password); if (!$user) { echo "Login failed for user " . $args['u'] . "\n"; exit(1); } unset($args['u']); } \GO::router()->runController($args);
* Copyright Intermesh * * This file is part of Group-Office. You should have received a copy of the * Group-Office license along with Group-Office. See the file /LICENSE.TXT * * If you have questions write an e-mail to info@intermesh.nl * * @copyright Copyright Intermesh * @version $Id: autoinstall.php 17264 2014-04-07 08:59:38Z mschering $ * @author Merijn Schering <*****@*****.**> */ $root = dirname(dirname(__FILE__)) . '/'; if (PHP_SAPI == 'cli') { //on the command line you can pass -c=/path/to/config.php to set the config file. require_once $root . 'go/base/util/Cli.php'; $args = \GO\Base\Util\Cli::parseArgs(); if (isset($args['c'])) { define("GO_CONFIG_FILE", $args['c']); } } try { $exampleUsage = 'sudo -u www-data php /var/www/trunk/www/install/autoinstall.php --adminusername=admin --adminpassword=admin --adminemail=admin@intermesh.dev --modules="email,addressbook,files"'; $requiredArgs = array('adminusername', 'adminpassword', 'adminemail'); foreach ($requiredArgs as $ra) { if (empty($args[$ra])) { throw new Exception($ra . " must be supplied.\n\nExample usage:\n\n" . $exampleUsage . "\n\n"); } } chdir(dirname(__FILE__)); require '../GO.php'; \GO::setIgnoreAclPermissions();