当前位置: 首页>>代码示例>>PHP>>正文


PHP InstallUtil::connectToDatabase方法代码示例

本文整理汇总了PHP中InstallUtil::connectToDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP InstallUtil::connectToDatabase方法的具体用法?PHP InstallUtil::connectToDatabase怎么用?PHP InstallUtil::connectToDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InstallUtil的用法示例。


在下文中一共展示了InstallUtil::connectToDatabase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testConnectToDatabaseCreateSuperUserBuildDatabase

 public function testConnectToDatabaseCreateSuperUserBuildDatabase()
 {
     InstallUtil::connectToDatabase('mysql', $this->temporaryDatabaseHostname, $this->temporaryDatabaseName, $this->temporaryDatabaseUsername, $this->temporaryDatabasePassword, $this->temporaryDatabasePort);
     $messageLogger = new MessageLogger();
     InstallUtil::autoBuildDatabase($messageLogger, true);
     $this->assertFalse($messageLogger->isErrorMessagePresent());
     AllPermissionsOptimizationUtil::rebuild();
     $tableNames = ZurmoRedBean::$writer->getTables();
     $expectedTables = array('_group', '_group__user', '_right', '_user', 'account', 'account_read', 'account_read_subscription', 'accountstarred', 'activelanguage', 'activity', 'activity_item', 'address', 'auditevent', 'autoresponder', 'autoresponderitem', 'autoresponderitemactivity', 'basecustomfield', 'bytimeworkflowinqueue', 'calculatedderivedattributemetadata', 'campaign', 'campaign_read', 'campaignitem', 'campaignitemactivity', 'comment', 'contact', 'contact_opportunity', 'contact_read', 'contact_read_subscription', 'contactstarred', 'contactstate', 'contactwebform', 'contactwebform_read', 'contactwebformentry', 'conversation', 'conversation_item', 'conversation_read', 'conversationstarred', 'conversationparticipant', 'currency', 'currencyvalue', 'customfield', 'customfielddata', 'customfieldvalue', 'dashboard', 'derivedattributemetadata', 'dropdowndependencyderivedattributemetadata', 'email', 'emailaccount', 'emailbox', 'emailfolder', 'emailmessage', 'emailmessage_read', 'emailmessageactivity', 'emailmessagecontent', 'emailmessagerecipient', 'emailmessagesender', 'emailmessagesenderror', 'emailmessageurl', 'emailsignature', 'emailtemplate', 'emailtemplate_read', 'exportfilemodel', 'exportitem', 'filecontent', 'filemodel', 'gamebadge', 'gamelevel', 'gamenotification', 'gamepoint', 'gamepointtransaction', 'gamescore', 'globalmetadata', 'import', 'item', 'jobinprocess', 'joblog', 'marketinglist', 'marketinglist_read', 'marketinglistmember', 'meeting', 'meeting_read', 'meeting_read_subscription', 'messagesource', 'messagetranslation', 'mission', 'mission_read', 'modelcreationapisync', 'multiplevaluescustomfield', 'namedsecurableitem', 'note', 'note_read', 'notification', 'notificationmessage', 'opportunity', 'opportunity_read', 'opportunitystarred', 'ownedsecurableitem', 'permission', 'permitable', 'person', 'personwhohavenotreadlatest', 'perusermetadata', 'policy', 'portlet', 'product', 'product_productcategory', 'product_read', 'productcatalog', 'productcatalog_productcategory', 'productcategory', 'productcategory_producttemplate', 'producttemplate', 'role', 'savedreport', 'savedreport_read', 'savedsearch', 'savedworkflow', 'securableitem', 'sellpriceformula', 'socialitem', 'socialitem_read', 'task', 'task_read', 'task_read_subscription', 'workflowmessageinqueue');
     foreach ($expectedTables as $expectedTable) {
         $this->assertTrue(in_array($expectedTable, $tableNames));
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:13,代码来源:InstallUtilTest.php

示例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.'));
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:67,代码来源:InstallUtil.php

示例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);
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:17,代码来源:InstallUtilTest.php


注:本文中的InstallUtil::connectToDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。