示例#1
0
}
require_once $SYSTEM_ROOT . '/core/include/init.inc';
// firstly let's check that we are OK for the version
if (version_compare(PHP_VERSION, SQ_REQUIRED_PHP_VERSION, '<')) {
    trigger_error('<i>' . SQ_SYSTEM_LONG_NAME . '</i> requires PHP Version ' . SQ_REQUIRED_PHP_VERSION . '.<br/> You may need to upgrade.<br/> Your current version is ' . PHP_VERSION, E_USER_ERROR);
}
// only use console stuff if we're running from the command line
require_once 'Console/Getopt.php';
$shortopt = '';
$longopt = array('package=');
$con = new Console_Getopt();
$args = $con->readPHPArgv();
array_shift($args);
$options = $con->getopt($args, $shortopt, $longopt);
if (is_array($options[0])) {
    $package_list = get_console_list($options[0]);
}
// check to see if the default/ tech email in main.inc are provided and are correct
// for more info see bug report 5804 Default and Tech Emails shouldnt break install
require_once SQ_FUDGE_PATH . '/general/www.inc';
$SQ_CONF_DEFAULT_EMAIL = SQ_CONF_DEFAULT_EMAIL;
if (!empty($SQ_CONF_DEFAULT_EMAIL) && !valid_email($SQ_CONF_DEFAULT_EMAIL)) {
    echo "Value '{$SQ_CONF_DEFAULT_EMAIL}' configued for 'SQ_CONF_DEFAULT_EMAIL' in main.inc is not valid.\nPlease fix it and try running the script again.\n";
    exit(1);
}
$SQ_CONF_TECH_EMAIL = SQ_CONF_TECH_EMAIL;
if (!empty($SQ_CONF_TECH_EMAIL) && !valid_email($SQ_CONF_TECH_EMAIL)) {
    echo "Value '{$SQ_CONF_TECH_EMAIL}' configured for 'SQ_CONF_TECH_EMAIL' in main.inc is not valid.\nPlease fix it and try running the script again.\n";
    exit(1);
}
// Clean up any remembered data.
if (!is_dir($SYSTEM_ROOT) || !is_readable($SYSTEM_ROOT . '/core/include/init.inc')) {
    echo "ERROR: Path provided doesn't point to a Matrix installation's System Root. Please provide correct path and try again.\n";
    exit;
}
// Include init first so it can set the right error_reporting levels.
require_once $SYSTEM_ROOT . '/core/include/init.inc';
require_once 'Console/Getopt.php';
$shortopt = 'd:rf';
$longopt = array();
$con = new Console_Getopt();
$args = $con->readPHPArgv();
array_shift($args);
// remove the system root
$options = $con->getopt($args, $shortopt, $longopt);
if (is_array($options[0])) {
    $opt_list = get_console_list($options[0]);
    $locale_list = $opt_list['locale'];
}
$root_user =& $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('root_user');
// log in as root
if (!$GLOBALS['SQ_SYSTEM']->setCurrentUser($root_user)) {
    echo "Failed login in as root user\n";
    exit;
}
// get the list of functions used during install
require_once $SYSTEM_ROOT . '/install/install.inc';
require_once SQ_FUDGE_PATH . '/general/file_system.inc';
require_once 'XML/Tree.php';
if (empty($opt_list['dir'])) {
    $opt_list['dir'] = SQ_SYSTEM_ROOT . '/data/temp/locale_backup';
}