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


PHP RedBeanDatabase::setup方法代码示例

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


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

示例1: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     global $freeze;
     if ($freeze) {
         $schemaFile = sys_get_temp_dir() . '/autobuilt.sql';
         $success = preg_match("/;dbname=([^;]+)/", Yii::app()->db->connectionString, $matches);
         // Not Coding Standard
         assert('$success == 1');
         // Not Coding Standard
         $databaseName = $matches[1];
         if (file_exists($schemaFile) && filesize($schemaFile) > 0) {
             system('mysql -u' . Yii::app()->db->username . ' -p' . Yii::app()->db->password . ' ' . $databaseName . " < {$schemaFile}");
         }
     }
     RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password);
     assert('RedBeanDatabase::isSetup()');
     // Not Coding Standard
     GeneralCache::forgetAll();
     if ($freeze) {
         RedBeanDatabase::freeze();
         TestDatabaseUtil::deleteRowsFromAllTablesExceptLog();
     } else {
         TestDatabaseUtil::deleteAllTablesExceptLog();
     }
     Yii::app()->user->userModel = null;
     Yii::app()->user->clearStates();
     //reset session.
     Yii::app()->language = Yii::app()->getConfigLanguageValue();
     Yii::app()->timeZoneHelper->setTimeZone(Yii::app()->getConfigTimeZoneValue());
     Yii::app()->timeZoneHelper->load();
     //resets timezone
     Yii::app()->languageHelper->flushModuleLabelTranslationParameters();
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:34,代码来源:BaseTest.php

示例2: tearDown

 public function tearDown()
 {
     RedBeanDatabase::close();
     RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password, true);
     if (is_file($this->databaseBackupTestFile)) {
         unlink($this->databaseBackupTestFile);
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:8,代码来源:DatabaseCompatibilityUtilTest.php

示例3: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     global $freeze;
     RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password);
     assert('RedBeanDatabase::isSetup()');
     // Not Coding Standard
     if ($freeze) {
         $schemaFile = sys_get_temp_dir() . '/autobuilt.sql';
         $success = preg_match("/;dbname=([^;]+)/", Yii::app()->db->connectionString, $matches);
         // Not Coding Standard
         assert('$success == 1');
         // Not Coding Standard
         $databaseName = $matches[1];
         if (is_readable($schemaFile) && filesize($schemaFile) > 0) {
             $systemOutput = system('mysql -u' . Yii::app()->db->username . ' -p' . Yii::app()->db->password . ' ' . $databaseName . " < {$schemaFile}");
             if ($systemOutput != null) {
                 echo 'Loading schema using system command. Output: ' . $systemOutput . "\n\n";
             }
         } else {
             echo "The schema file is not readable: {$schemaFile}. \n\n";
             exit;
         }
     }
     CustomFieldData::forgetAllPhpCache();
     GeneralCache::forgetAll();
     BeanModelCache::forgetAll();
     if ($freeze) {
         RedBeanDatabase::freeze();
         TestDatabaseUtil::deleteRowsFromAllTablesExceptLog();
     } else {
         TestDatabaseUtil::deleteAllTablesExceptLog();
     }
     Yii::app()->user->userModel = null;
     Yii::app()->user->clearStates();
     //reset session.
     Yii::app()->language = Yii::app()->getConfigLanguageValue();
     Yii::app()->timeZoneHelper->setTimeZone(Yii::app()->getConfigTimeZoneValue());
     Yii::app()->timeZoneHelper->load();
     //resets timezone
     Yii::app()->languageHelper->flushModuleLabelTranslationParameters();
     if (static::$activateDefaultLanguages) {
         Yii::app()->languageHelper->load();
         Yii::app()->languageHelper->activateLanguagesForTesting();
         Yii::app()->languageHelper->importMessagesForTesting();
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:47,代码来源:BaseTest.php

示例4: setupDatabaseConnection

 protected static function setupDatabaseConnection($force = false)
 {
     if (!RedBeanDatabase::isSetup() || $force) {
         RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password);
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:6,代码来源:TestSuite.php

示例5: testRun

 public function testRun()
 {
     chdir(COMMON_ROOT . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'commands');
     $command = "php zurmocTest.php install {$this->temporaryDatabaseHostname} {$this->temporaryDatabaseName} ";
     $command .= "{$this->temporaryDatabaseUsername} {$this->temporaryDatabasePassword} {$this->temporaryDatabasePort} ";
     $command .= "{$this->superUserPassword} 'http://sampleHost' 'app/index.php' demodata 1";
     if (!IS_WINNT) {
         $command .= ' 2>&1';
     }
     exec($command, $output);
     $instanceRoot = INSTANCE_ROOT;
     $perInstanceConfigFile = "{$instanceRoot}/protected/config/perInstanceTest.php";
     $debugConfigFile = "{$instanceRoot}/protected/config/debugTest.php";
     $perInstanceConfiguration = file_get_contents($perInstanceConfigFile);
     $debugConfiguration = file_get_contents($debugConfigFile);
     //Check if config files is updated.
     $this->assertRegExp('/\\$connectionString = \'mysql:host=' . $this->temporaryDatabaseHostname . ';port=' . $this->temporaryDatabasePort . ';dbname=' . $this->temporaryDatabaseName . '\';/', $perInstanceConfiguration);
     $this->assertRegExp('/\\$username         = \'' . $this->temporaryDatabaseUsername . '\';/', $perInstanceConfiguration);
     $this->assertRegExp('/\\$password         = \'' . $this->temporaryDatabasePassword . '\';/', $perInstanceConfiguration);
     RedBeanDatabase::close();
     RedBeanDatabase::setup(Yii::app()->tempDb->connectionString, Yii::app()->tempDb->username, Yii::app()->tempDb->password, true);
     $count = R::getRow('select count(*) count from _user');
     $this->assertEquals(9, $count['count']);
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:24,代码来源:InstallCommandTest.php

示例6: reconnectToDatabase

 protected static function reconnectToDatabase()
 {
     RedBeanDatabase::close();
     RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:5,代码来源:ImapBaseJob.php

示例7: connectToDatabase

 /**
  * Connects to the database.
  */
 public static function connectToDatabase($databaseType, $host, $databaseName, $username, $password, $port)
 {
     assert('in_array($databaseType, static::getSupportedDatabaseTypes())');
     assert('is_string($host)         && $host         != ""');
     assert('is_string($databaseName) && $databaseName != ""');
     assert('is_string($username)     && $username     != ""');
     assert('is_string($password)');
     $connectionString = "{$databaseType}:host={$host};port={$port};dbname={$databaseName}";
     // Not Coding Standard
     RedBeanDatabase::setup($connectionString, $username, $password);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:14,代码来源:InstallUtil.php

示例8: handleSetupDatabaseConnection

 public function handleSetupDatabaseConnection($event)
 {
     RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password);
     if (!Yii::app()->isApplicationInstalled()) {
         throw new NotSupportedException();
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:7,代码来源:BeginRequestBehavior.php

示例9: intval

 *
 * 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. 2014. All rights reserved".
 ********************************************************************************/
require_once '../../config/debug.php';
require_once '../common/bootstrap.php';
if (!($argc == 1 || $argc == 3 && $argv[1] == '-n' && is_numeric($argv[2]))) {
    echo "\nAuditLog - Displays the audit log.\nUsage:   php AuditLog.php [-n #]\nOptions: -n # Displays the tail of the log up to # entries.\n";
    exit;
}
$count = $argc == 3 ? intval($argv[2]) : null;
try {
    RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password);
} catch (Exception $e) {
    echo "Could not open the database.\n";
    exit;
}
try {
    Yii::app()->user->userModel = User::getByUsername('super');
} catch (Exception $e) {
    echo "Super user does not exist.\n";
    exit;
}
$AuditEventsList = $count === null ? AuditEvent::getAll() : AuditEvent::getTailEvents($count);
foreach ($AuditEventsList as $auditEvent) {
    $moduleName = $auditEvent->moduleName;
    echo $moduleName::stringifyAuditEvent($auditEvent) . "\n";
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:31,代码来源:AuditLog.php

示例10: connectToDatabaseWithConnectionString

 /**
  * Connects to the database with a connection string.
  */
 public static function connectToDatabaseWithConnectionString($connectionString, $username, $password)
 {
     assert('is_string($connectionString) && $connectionString != ""');
     assert('is_string($username)         && $username         != ""');
     assert('is_string($password)');
     RedBeanDatabase::setup($connectionString, $username, $password);
     assert('RedBeanDatabase::isSetup()');
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:11,代码来源:InstallUtil.php

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

示例12: tearDown

 public function tearDown()
 {
     RedBeanDatabase::close();
     RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password, true);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:5,代码来源:InstallUtilTest.php


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