本文整理汇总了PHP中InstallUtil::freezeDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP InstallUtil::freezeDatabase方法的具体用法?PHP InstallUtil::freezeDatabase怎么用?PHP InstallUtil::freezeDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InstallUtil
的用法示例。
在下文中一共展示了InstallUtil::freezeDatabase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionInstallDemoData
/**
* Added forgetAllCaches in case you are debugging and want to run this action again with a saved db.
*/
public function actionInstallDemoData()
{
RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password);
InstallUtil::freezeDatabase();
ForgetAllCacheUtil::forgetAllCaches();
Yii::app()->user->userModel = User::getByUsername('super');
$nextView = new InstallCompleteView($this->getId(), $this->getModule()->getId());
$view = new InstallPageView($nextView);
echo $view->render();
$template = ZurmoHtml::script("\$('#logging-table').prepend('{message}<br/>');");
$messageStreamer = new MessageStreamer($template);
$messageStreamer->add(Zurmo::t('InstallModule', 'Starting to load demo data.'));
$messageLogger = new MessageLogger($messageStreamer);
DemoDataUtil::load($messageLogger, 6);
$messageStreamer->add(Zurmo::t('InstallModule', 'Finished loading demo data.'));
$messageStreamer->add(Zurmo::t('InstallModule', 'Locking Installation.'));
InstallUtil::writeInstallComplete(INSTANCE_ROOT);
ForgetAllCacheUtil::forgetAllCaches();
echo ZurmoHtml::script('$("#progress-table").hide(); $("#complete-table").show();');
}
示例2: runInstallation
/**
* 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.'));
}
示例3: testConnectToDatabaseCreateSuperUserBuildDatabaseAndFreeze
public function testConnectToDatabaseCreateSuperUserBuildDatabaseAndFreeze()
{
// This test cannot run as saltdev. It is therefore skipped on the server.
if ($this->temporaryDatabaseUsername == 'root') {
$this->assertTrue(DatabaseCompatibilityUtil::createDatabase('mysql', $this->temporaryDatabaseHostname, $this->temporaryDatabaseUsername, $this->temporaryDatabasePassword, $this->temporaryDatabasePort, $this->temporaryDatabaseName));
$this->assertTrue(DatabaseCompatibilityUtil::createDatabaseUser('mysql', $this->temporaryDatabaseHostname, $this->temporaryDatabaseUsername, $this->temporaryDatabasePassword, $this->temporaryDatabasePort, $this->temporaryDatabaseName, 'wacko', 'wacked'));
InstallUtil::connectToDatabase('mysql', $this->temporaryDatabaseHostname, 'wacky', $this->temporaryDatabaseUsername, $this->temporaryDatabasePassword, $this->temporaryDatabasePort);
Yii::app()->user->userModel = InstallUtil::createSuperUser('super', 'super');
$messageLogger = new MessageLogger();
InstallUtil::autoBuildDatabase($messageLogger);
$this->assertFalse($messageLogger->isErrorMessagePresent());
ReadPermissionsOptimizationUtil::rebuild();
InstallUtil::freezeDatabase();
$tableNames = R::getCol('show tables');
$this->assertEquals(array('_group', '_group__user', '_right', '_user', 'account', 'account_read', 'activity', 'activity_item', 'actual_permissions_cache', 'address', 'auditevent', 'contact', 'contact_opportunity', 'contact_read', 'contactstate', 'currency', 'currencyvalue', 'customfield', 'customfielddata', 'dashboard', 'email', 'filecontent', 'filemodel', 'globalmetadata', 'item', 'log', 'mashableactivity', 'meeting', 'meeting_read', 'namedsecurableitem', 'note', 'note_read', 'opportunity', 'opportunity_read', 'ownedcustomfield', 'ownedsecurableitem', 'permission', 'permitable', 'person', 'perusermetadata', 'policy', 'portlet', 'role', 'securableitem', 'task', 'task_read'), $tableNames);
}
}