* 02110-1301 USA. * * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive * Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com. * * The interactive user interfaces in original and modified versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the Zurmo * logo and Zurmo copyright notice. If the display of the logo is not reasonably * feasible for technical reasons, the Appropriate Legal Notices must display the words * "Copyright Zurmo Inc. 2013. All rights reserved". ********************************************************************************/ require_once 'testRoots.php'; require_once 'TestConfigFileUtils.php'; TestConfigFileUtils::configureConfigFiles(); $debug = INSTANCE_ROOT . '/protected/config/debugTest.php'; $yiit = COMMON_ROOT . "/../yii/framework/yiit.php"; $config = INSTANCE_ROOT . "/protected/config/test.php"; require_once COMMON_ROOT . "/version.php"; require_once COMMON_ROOT . "/protected/modules/install/utils/InstallUtil.php"; require_once COMMON_ROOT . "/protected/core/utils/ZurmoPasswordSecurityUtil.php"; InstallUtil::setZurmoTokenAndWriteToPerInstanceFile(INSTANCE_ROOT, 'perInstanceTest.php'); ZurmoPasswordSecurityUtil::setPasswordSaltAndWriteToPerInstanceFile(INSTANCE_ROOT, 'perInstanceTest.php'); require_once $debug; require_once $yiit; require_once COMMON_ROOT . '/protected/core/components/WebApplication.php'; require_once COMMON_ROOT . '/protected/tests/WebTestApplication.php'; Yii::createApplication('WebTestApplication', $config);
/** * Given an installSettingsForm, run the install including the schema creation and default data load. This is * used by the interactice install and the command line install. * @param object $form * @param object $messageStreamer */ public static function runInstallation($form, &$messageStreamer) { assert('$form instanceof InstallSettingsForm'); assert('$messageStreamer instanceof MessageStreamer'); if (defined('IS_TEST')) { $perInstanceFilename = "perInstanceTest.php"; $debugFilename = "debugTest.php"; } else { @set_time_limit(1200); $perInstanceFilename = "perInstance.php"; $debugFilename = "debug.php"; } $messageStreamer->add(Zurmo::t('InstallModule', 'Connecting to Database.')); InstallUtil::connectToDatabase($form->databaseType, $form->databaseHostname, $form->databaseName, $form->databaseUsername, $form->databasePassword, $form->databasePort); ForgetAllCacheUtil::forgetAllCaches(); $messageStreamer->add(Zurmo::t('InstallModule', 'Dropping existing tables.')); InstallUtil::dropAllTables(); $messageStreamer->add(Zurmo::t('InstallModule', 'Creating super user.')); InstallUtil::createSuperUser('super', $form->superUserPassword); $messageLogger = new MessageLogger($messageStreamer); Yii::app()->custom->runBeforeInstallationAutoBuildDatabase($messageLogger); $messageStreamer->add(Zurmo::t('InstallModule', 'Starting database schema creation.')); $startTime = microtime(true); $messageStreamer->add('debugOn:' . BooleanUtil::boolToString(YII_DEBUG)); $messageStreamer->add('phpLevelCaching:' . BooleanUtil::boolToString(PHP_CACHING_ON)); $messageStreamer->add('memcacheLevelCaching:' . BooleanUtil::boolToString(MEMCACHE_ON)); InstallUtil::autoBuildDatabase($messageLogger); $endTime = microtime(true); $messageStreamer->add(Zurmo::t('InstallModule', 'Total autobuild time: {formattedTime} seconds.', array('{formattedTime}' => number_format($endTime - $startTime, 3)))); if (SHOW_QUERY_DATA) { $messageStreamer->add(PageView::getTotalAndDuplicateQueryCountContent()); $messageStreamer->add(PageView::makeNonHtmlDuplicateCountAndQueryContent()); } $messageStreamer->add(Zurmo::t('InstallModule', 'Database schema creation complete.')); $messageStreamer->add(Zurmo::t('InstallModule', 'Rebuilding Permissions.')); ReadPermissionsOptimizationUtil::rebuild(); $messageStreamer->add(Zurmo::t('InstallModule', 'Freezing database.')); InstallUtil::freezeDatabase(); $messageStreamer->add(Zurmo::t('InstallModule', 'Writing Configuration File.')); InstallUtil::writeConfiguration(INSTANCE_ROOT, $form->databaseType, $form->databaseHostname, $form->databaseName, $form->databaseUsername, $form->databasePassword, $form->databasePort, $form->memcacheHostname, (int) $form->memcachePortNumber, true, Yii::app()->language, $perInstanceFilename, $debugFilename, $form->hostInfo, $form->scriptUrl, $form->submitCrashToSentry); $messageStreamer->add(Zurmo::t('InstallModule', 'Setting up default data.')); DefaultDataUtil::load($messageLogger); Yii::app()->custom->runAfterInstallationDefaultDataLoad($messageLogger); // Send notification to super admin to delete test.php file in case if this // installation is used in production mode. $message = new NotificationMessage(); $message->textContent = Zurmo::t('InstallModule', 'If this website is in production mode, please remove the app/test.php file.'); $rules = new RemoveApiTestEntryScriptFileNotificationRules(); NotificationsUtil::submit($message, $rules); // If minify is disabled, inform user that they should fix issues and enable minify $setIncludePathServiceHelper = new SetIncludePathServiceHelper(); if (!$setIncludePathServiceHelper->runCheckAndGetIfSuccessful()) { $message = new NotificationMessage(); $message->textContent = Zurmo::t('InstallModule', 'Minify has been disabled due to a system issue. Try to resolve the problem and re-enable Minify.'); $rules = new EnableMinifyNotificationRules(); NotificationsUtil::submit($message, $rules); } InstallUtil::setZurmoTokenAndWriteToPerInstanceFile(INSTANCE_ROOT); ZurmoPasswordSecurityUtil::setPasswordSaltAndWriteToPerInstanceFile(INSTANCE_ROOT); $messageStreamer->add(Zurmo::t('InstallModule', 'Installation Complete.')); }