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


PHP RedBeanDatabase::unfreeze方法代码示例

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


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

示例1: testSaveModelFromPostSuccessfulSave

 public function testSaveModelFromPostSuccessfulSave()
 {
     //Unfreeze since the test model is not part of the standard schema.
     $freezeWhenComplete = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freezeWhenComplete = true;
     }
     Yii::app()->user->userModel = User::getByUsername('super');
     $savedSuccessfully = false;
     $modelToStringValue = null;
     $postData = array('member' => 'abc');
     $model = new OwnedSecurableTestItem();
     $this->assertFalse($model->hasErrors());
     $controllerUtil = new ZurmoControllerUtil();
     $model = $controllerUtil->saveModelFromPost($postData, $model, $savedSuccessfully, $modelToStringValue);
     $this->assertTrue($savedSuccessfully);
     $this->assertEquals('abc', $modelToStringValue);
     $this->assertFalse($model->hasErrors());
     $this->assertTrue($model->id > 0);
     //Re-freeze if needed.
     if ($freezeWhenComplete) {
         RedBeanDatabase::freeze();
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:25,代码来源:ZurmoControllerUtilTest.php

示例2: setup

 public function setup()
 {
     parent::setUp();
     $freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freeze = true;
     }
     $this->freeze = $freeze;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:10,代码来源:DynamicTriggeredModelRelationUserWorkflowEmailMessageRecipientFormTest.php

示例3: setUp

 public function setUp()
 {
     parent::setUp();
     Yii::app()->user->userModel = User::getByUsername('super');
     $freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freeze = true;
     }
     $this->freeze = $freeze;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:11,代码来源:MatrixReportDataProviderTest.php

示例4: setup

 public function setup()
 {
     parent::setUp();
     Yii::app()->user->userModel = User::getByUsername('super');
     DisplayAttributeForReportForm::resetCount();
     $freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freeze = true;
     }
     $this->freeze = $freeze;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:12,代码来源:ReportResultsRowDataTest.php

示例5: setUp

 public function setUp()
 {
     parent::setUp();
     if (strlen(Yii::app()->params['testApiUrl']) > 0) {
         $this->serverUrl = Yii::app()->params['testApiUrl'];
     }
     $freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freeze = true;
     }
     $this->freeze = $freeze;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:13,代码来源:ApiBaseTest.php

示例6: setup

 public function setup()
 {
     parent::setUp();
     Yii::app()->user->userModel = User::getByUsername('super');
     DisplayAttributeForReportForm::resetCount();
     ModelRelationsAndAttributesToSummableReportAdapter::forgetAll();
     ModelRelationsAndAttributesToRowsAndColumnsReportAdapter::forgetAll();
     ModelRelationsAndAttributesToMatrixReportAdapter::forgetAll();
     $freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freeze = true;
     }
     $this->freeze = $freeze;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:15,代码来源:CalculatedNumberForReportListViewColumnAdapterTest.php

示例7: testSequentialProcessViewFactory

 public function testSequentialProcessViewFactory()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $freezeWhenComplete = false;
     //Unfreeze since the test model is not part of the standard schema.
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freezeWhenComplete = true;
     }
     $testModels = ImportModelTestItem::getAll();
     $this->assertEquals(0, count($testModels));
     $import = new Import();
     $mappingData = array('column_0' => array('attributeIndexOrDerivedType' => 'string', 'type' => 'importColumn', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => null))), 'column_23' => array('attributeIndexOrDerivedType' => 'FullName', 'type' => 'importColumn', 'mappingRulesData' => array('FullNameDefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => null))));
     $serializedData['importRulesType'] = 'ImportModelTestItem';
     $serializedData['mappingData'] = $mappingData;
     $serializedData['firstRowIsHeaderRow'] = true;
     $import->serializedData = serialize($serializedData);
     $this->assertTrue($import->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('importAnalyzerTest.csv', $import->getTempTableName());
     $config = array('pagination' => array('pageSize' => 2));
     $dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
     $sequentialProcess = new ImportCreateUpdateModelsSequentialProcess($import, $dataProvider);
     $sequentialProcess->run(null, null);
     $route = 'default/someAction';
     $view = SequentialProcessViewFactory::makeBySequentialProcess($sequentialProcess, $route);
     $content = $view->render();
     $this->assertNotNull($content);
     $this->assertEquals('SequentialProcessView', get_class($view));
     $this->assertEquals('processRows', $sequentialProcess->getNextStep());
     //Now process the first run. Will process page 0.
     $sequentialProcess = new ImportCreateUpdateModelsSequentialProcess($import, $dataProvider);
     $sequentialProcess->run('processRows', null);
     $route = 'default/someAction';
     $view = SequentialProcessViewFactory::makeBySequentialProcess($sequentialProcess, $route);
     $content = $view->render();
     $this->assertNotNull($content);
     $this->assertEquals('SequentialProcessView', get_class($view));
     $this->assertEquals(array('page' => 1), $sequentialProcess->getNextParams());
     //Confirm 2 models were successfully added.
     $testModels = ImportModelTestItem::getAll();
     $this->assertEquals(2, count($testModels));
     //Re-freeze if needed.
     if ($freezeWhenComplete) {
         RedBeanDatabase::freeze();
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:46,代码来源:ImportCreateUpdateModelsSequentialProcessTest.php

示例8: makeDatabaseTableByFileHandleAndTableName

 /**
  * Given a file resource, convert the file into a database table based on the table name provided.
  * Assumes the file is a csv.
  * @param resource $fileHandle
  * @param string $tableName
  * @return true on success.
  */
 public static function makeDatabaseTableByFileHandleAndTableName($fileHandle, $tableName, $delimiter = ',', $enclosure = "'")
 {
     assert('gettype($fileHandle) == "resource"');
     assert('is_string($tableName)');
     assert('$tableName == strtolower($tableName)');
     assert('$delimiter != null && is_string($delimiter)');
     assert('$enclosure != null && is_string($enclosure)');
     $freezeWhenComplete = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freezeWhenComplete = true;
     }
     R::exec("drop table if exists {$tableName}");
     $columns = self::optimizeTableImportColumnsAndGetColumnNames($fileHandle, $tableName, $delimiter, $enclosure);
     rewind($fileHandle);
     self::convertCsvIntoRowsInTable($fileHandle, $tableName, $delimiter, $enclosure, $columns);
     self::optimizeTableNonImportColumns($tableName);
     if ($freezeWhenComplete) {
         RedBeanDatabase::freeze();
     }
     return true;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:29,代码来源:ImportDatabaseUtil.php

示例9: testAutoBuildUpgrade

 /**
  * @depends testAutoBuildDatabase
  */
 public function testAutoBuildUpgrade()
 {
     $this->unfreezeWhenDone = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $this->unfreezeWhenDone = true;
     }
     // adding Text Field
     $metadata = Account::getMetadata();
     $metadata['Account']['members'][] = 'newField';
     $rules = array('newField', 'type', 'type' => 'string');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'string128';
     $rules = array('string128', 'type', 'type' => 'string');
     $metadata['Account']['rules'][] = $rules;
     $rules = array('string128', 'length', 'min' => 3, 'max' => 128);
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'string555';
     $rules = array('string555', 'type', 'type' => 'string');
     $metadata['Account']['rules'][] = $rules;
     $rules = array('string555', 'length', 'min' => 1, 'max' => 555);
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'string100000';
     $rules = array('string100000', 'type', 'type' => 'string');
     $metadata['Account']['rules'][] = $rules;
     $rules = array('string100000', 'length', 'min' => 1, 'max' => 100000);
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'textField';
     $rules = array('textField', 'type', 'type' => 'text');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'longTextField';
     $rules = array('longTextField', 'type', 'type' => 'longtext');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'dateField';
     $rules = array('dateField', 'type', 'type' => 'date');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'booleanField';
     $rules = array('booleanField', 'boolean');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'integerField';
     $rules = array('integerField', 'type', 'type' => 'integer');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'dateTimeField';
     $rules = array('dateTimeField', 'type', 'type' => 'datetime');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'urlField';
     $rules = array('urlField', 'url');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'floatField';
     $rules = array('floatField', 'type', 'type' => 'float');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'longTextField';
     $rules = array('longTextField', 'type', 'type' => 'longtext');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'blobField';
     $rules = array('blobField', 'type', 'type' => 'blob');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'longBlobField';
     $rules = array('longBlobField', 'type', 'type' => 'longblob');
     $metadata['Account']['rules'][] = $rules;
     Account::setMetadata($metadata);
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $messageLogger = new MessageLogger();
     $beforeRowCount = DatabaseCompatibilityUtil::getTableRowsCountTotal();
     InstallUtil::autoBuildDatabase($messageLogger);
     $afterRowCount = DatabaseCompatibilityUtil::getTableRowsCountTotal();
     $this->assertEquals($beforeRowCount, $afterRowCount);
     //Check Account fields
     $tableName = RedBeanModel::getTableName('Account');
     $columns = R::$writer->getColumns($tableName);
     $this->assertEquals('text', $columns['newfield']);
     $this->assertEquals('varchar(128)', $columns['string128']);
     $this->assertEquals('text', $columns['string555']);
     $this->assertEquals('longtext', $columns['string100000']);
     $this->assertEquals('text', $columns['textfield']);
     $this->assertEquals('date', $columns['datefield']);
     $this->assertEquals('tinyint(1)', $columns['booleanfield']);
     $this->assertEquals('int(11) unsigned', $columns['integerfield']);
     $this->assertEquals('datetime', $columns['datetimefield']);
     $this->assertEquals('varchar(255)', $columns['urlfield']);
     $this->assertEquals('double', $columns['floatfield']);
     $this->assertEquals('longtext', $columns['longtextfield']);
     $this->assertEquals('blob', $columns['blobfield']);
     $this->assertEquals('longblob', $columns['longblobfield']);
     $account = new Account();
     $account->name = 'Test Name';
     $account->owner = $super;
     $randomString = str_repeat("Aa", 64);
     $account->string128 = $randomString;
     $this->assertTrue($account->save());
     $metadata = Account::getMetadata();
     foreach ($metadata['Account']['rules'] as $key => $rule) {
         if ($rule[0] == 'string128' && $rule[1] == 'length') {
             $metadata['Account']['rules'][$key]['max'] = 64;
         }
     }
//.........这里部分代码省略.........
开发者ID:youprofit,项目名称:Zurmo,代码行数:101,代码来源:AutoBuildDatabaseTest.php

示例10: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // We need to unfreeze here as we are working with custom field values
     self::$freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         self::$freeze = true;
     }
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     self::$super = User::getByUsername('super');
     Yii::app()->user->userModel = self::$super;
     $currencies = Currency::getAll();
     $currencyValue1 = new CurrencyValue();
     $currencyValue1->value = 100;
     $currencyValue1->currency = $currencies[0];
     $multiDropDownCustomFieldData1 = new CustomFieldData();
     $multiDropDownCustomFieldData1->name = 'multiDropDown1';
     $multiDropDownCustomFieldData1->serializedData = serialize(array('Ten', 11, 'XII'));
     $saved = $multiDropDownCustomFieldData1->save();
     assert('$saved');
     // Not Coding Standard
     $multiDropDownCustomFieldValue1 = new CustomFieldValue();
     $multiDropDownCustomFieldValue1->value = 'Ten';
     $multiDropDownCustomFieldValue2 = new CustomFieldValue();
     $multiDropDownCustomFieldValue2->value = 11;
     $multiDropDownCustomFieldValue3 = new CustomFieldValue();
     $multiDropDownCustomFieldValue3->value = 'XII';
     $tagCustomFieldData1 = new CustomFieldData();
     $tagCustomFieldData1->name = 'tagCloud1';
     $tagCustomFieldData1->serializedData = serialize(array('Apache', 'PHP'));
     $saved = $tagCustomFieldData1->save();
     assert('$saved');
     // Not Coding Standard
     $tagCustomFieldValue1 = new CustomFieldValue();
     $tagCustomFieldValue1->value = 'PHP';
     $tagCustomFieldValue2 = new CustomFieldValue();
     $tagCustomFieldValue2->value = 'Apache';
     $primaryEmail1 = new Email();
     $primaryEmail1->emailAddress = "info@zurmo.com";
     $primaryEmail1->isInvalid = true;
     $primaryEmail1->optOut = false;
     $secondaryEmail1 = new Email();
     $secondaryEmail1->emailAddress = "jake@zurmo.com";
     $secondaryEmail1->isInvalid = false;
     $secondaryEmail1->optOut = true;
     $address1 = new Address();
     $address1->street1 = "SomeStreet1";
     $address1->street2 = "SomeStreet2";
     $address1->city = "SomeCity";
     $address1->state = "SomeState";
     $address1->postalCode = 1111;
     $address1->country = "SomeCountry";
     $likeContactState1 = new ContactState();
     $likeContactState1->name = 'Customer';
     $likeContactState1->order = 0;
     $users = User::getAll();
     $user1 = new User();
     $user1->lastName = 'Kevin';
     $user1->hash = 'rieWoy3aijohP6chaigaokohs1oovohf';
     $user1->language = 'es';
     $user1->timeZone = 'America/Chicago';
     $user1->username = 'dave';
     $user1->currency = $currencies[0];
     $user1->manager = $users[0];
     //Custom attribute
     $attributeForm = new TextAttributeForm();
     $attributeForm->attributeName = 'custom';
     $attributeForm->attributeLabels = array('en' => 'test label en');
     $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName(new EmailTemplateModelTestItem());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     $model = new EmailTemplateModelTestItem();
     $model->string = 'abc';
     $model->firstName = 'James';
     $model->lastName = 'Jackson';
     $model->phone = 1122334455;
     $model->boolean = true;
     $model->date = '2008-12-31';
     $model->dateTime = '2008-12-31 07:48:04';
     $model->textArea = 'Multiple Lines\\nOf Text';
     $model->url = 'http://www.zurmo.com/';
     $model->integer = 999;
     $model->float = 999.999;
     $model->currencyValue = $currencyValue1;
     $model->dropDown->value = "DropdownSelectedValue";
     $model->radioDropDown->value = "RadioDropdownSelectedValue";
     $model->primaryEmail = $primaryEmail1;
     $model->secondaryEmail = $secondaryEmail1;
     $model->primaryAddress = $address1;
     $model->likeContactState = $likeContactState1;
     $model->user = $user1;
     $model->multiDropDown->data = $multiDropDownCustomFieldData1;
     $model->tagCloud->data = $tagCustomFieldData1;
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue1);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue2);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue3);
     $model->tagCloud->values->add($tagCustomFieldValue1);
     $model->tagCloud->values->add($tagCustomFieldValue2);
//.........这里部分代码省略.........
开发者ID:youprofit,项目名称:Zurmo,代码行数:101,代码来源:WorkflowMergeTagsUtilTest.php

示例11: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     self::$freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         self::$freeze = true;
     }
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     self::$super = User::getByUsername('super');
     Yii::app()->user->userModel = self::$super;
     $currencies = Currency::getAll();
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 100;
     $currencyValue->currency = $currencies[0];
     $multiDropDownCustomFieldData = new CustomFieldData();
     $multiDropDownCustomFieldData->name = 'multiDropDown';
     $multiDropDownCustomFieldData->serializedData = serialize(array('Ten', 11, 'XII'));
     $saved = $multiDropDownCustomFieldData->save();
     assert('$saved');
     // Not Coding Standard
     $multiDropDownCustomFieldValue1 = new CustomFieldValue();
     $multiDropDownCustomFieldValue1->value = 'Ten';
     $multiDropDownCustomFieldValue2 = new CustomFieldValue();
     $multiDropDownCustomFieldValue2->value = 11;
     $multiDropDownCustomFieldValue3 = new CustomFieldValue();
     $multiDropDownCustomFieldValue3->value = 'XII';
     $tagCustomFieldData = new CustomFieldData();
     $tagCustomFieldData->name = 'tagCloud';
     $tagCustomFieldData->serializedData = serialize(array('Apache', 'PHP'));
     $saved = $tagCustomFieldData->save();
     assert('$saved');
     // Not Coding Standard
     $tagCustomFieldValue1 = new CustomFieldValue();
     $tagCustomFieldValue1->value = 'PHP';
     $tagCustomFieldValue2 = new CustomFieldValue();
     $tagCustomFieldValue2->value = 'Apache';
     $primaryEmail = new Email();
     $primaryEmail->emailAddress = "info@zurmo.com";
     $primaryEmail->isInvalid = true;
     $primaryEmail->optOut = false;
     $secondaryEmail = new Email();
     $secondaryEmail->emailAddress = "jake@zurmo.com";
     $secondaryEmail->isInvalid = false;
     $secondaryEmail->optOut = true;
     $address = new Address();
     $address->street1 = "SomeStreet1";
     $address->street2 = "SomeStreet2";
     $address->city = "SomeCity";
     $address->state = "SomeState";
     $address->postalCode = 1111;
     $address->country = "SomeCountry";
     $likeContactState = new ContactState();
     $likeContactState->name = 'Customer';
     $likeContactState->order = 0;
     $users = User::getAll();
     $user = new User();
     $user->lastName = 'Kevin';
     $user->hash = 'rieWoy3aijohP6chaigaokohs1oovohf';
     $user->language = 'es';
     $user->timeZone = 'America/Chicago';
     $user->username = 'kevinjones';
     $user->currency = $currencies[0];
     $user->manager = $users[0];
     //Custom attribute
     $attributeForm = new TextAttributeForm();
     $attributeForm->attributeName = 'custom';
     $attributeForm->attributeLabels = array('en' => 'test label en');
     $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName(new EmailTemplateModelTestItem());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     $model = new EmailTemplateModelTestItem();
     $model->string = 'abc';
     $model->firstName = 'James';
     $model->lastName = 'Jackson';
     $model->phone = 1122334455;
     $model->boolean = true;
     $model->date = '2008-12-31';
     $model->dateTime = '2008-12-31 07:48:04';
     $model->textArea = 'Multiple Lines\\nOf Text';
     $model->url = 'http://www.zurmo.com/';
     $model->integer = 999;
     $model->float = 999.999;
     $model->currencyValue = $currencyValue;
     $model->dropDown->value = "DropdownSelectedValue";
     $model->radioDropDown->value = "RadioDropdownSelectedValue";
     $model->primaryEmail = $primaryEmail;
     $model->secondaryEmail = $secondaryEmail;
     $model->primaryAddress = $address;
     $model->likeContactState = $likeContactState;
     $model->user = $user;
     $model->multiDropDown->data = $multiDropDownCustomFieldData;
     $model->tagCloud->data = $tagCustomFieldData;
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue1);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue2);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue3);
     $model->tagCloud->values->add($tagCustomFieldValue1);
     $model->tagCloud->values->add($tagCustomFieldValue2);
     $model->customCstm = 'text custom';
//.........这里部分代码省略.........
开发者ID:youprofit,项目名称:Zurmo,代码行数:101,代码来源:ContactMergeTagsUtilTest.php

示例12: runAutoBuildFromUpdateSchemaCommand

 /**
  * From the command line, run the autobuild method which will effectively update
  * the database schema.
  */
 public static function runAutoBuildFromUpdateSchemaCommand($messageLogger)
 {
     assert('$messageLogger instanceof MessageLogger');
     ForgetAllCacheUtil::forgetAllCaches();
     $freezeWhenDone = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freezeWhenDone = true;
     }
     self::autoBuildDatabase($messageLogger);
     if ($freezeWhenDone) {
         RedBeanDatabase::freeze();
     }
     // Send notification to super admin to clean assets folder(optional).
     $message = new NotificationMessage();
     $message->textContent = Zurmo::t('InstallModule', 'Please delete all files from assets folder on server.');
     $rules = new ClearAssetsFolderNotificationRules();
     NotificationsUtil::submit($message, $rules);
     return true;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:24,代码来源:InstallUtil.php

示例13: manageFrozenStateAndAutoBuildModels

 /**
  * @param array $modelClassNames
  * @param MessageLogger $messageLogger
  */
 public static function manageFrozenStateAndAutoBuildModels(array $modelClassNames, &$messageLogger)
 {
     RedBeanDatabase::unfreeze();
     self::autoBuildModels($modelClassNames, $messageLogger);
     RedBeanDatabase::freeze();
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:10,代码来源:RedBeanDatabaseBuilderUtil.php

示例14: testSettingExplicitReadWriteModelPermissionsDuringImport

 /**
  * @depends testSimpleImportWithStringAndFullNameWhichAreRequiredAttributeOnImportTestModelItem
  */
 public function testSettingExplicitReadWriteModelPermissionsDuringImport()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $testModels = ImportModelTestItem::getAll();
     $this->assertEquals(0, count($testModels));
     //Add a read only user for import. Then all models should be readable by jim in addition to super.
     $explicitReadWriteModelPermissions = new ExplicitReadWriteModelPermissions();
     $explicitReadWriteModelPermissions->addReadOnlyPermitable(User::getByUsername('jim'));
     //Unfreeze since the test model is not part of the standard schema.
     $freezeWhenComplete = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freezeWhenComplete = true;
     }
     $testModels = ImportModelTestItem::getAll();
     $this->assertEquals(0, count($testModels));
     $import = new Import();
     $serializedData['importRulesType'] = 'ImportModelTestItem';
     $serializedData['firstRowIsHeaderRow'] = true;
     $import->serializedData = serialize($serializedData);
     $this->assertTrue($import->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('importAnalyzerTest.csv', $import->getTempTableName());
     $this->assertEquals(13, ImportDatabaseUtil::getCount($import->getTempTableName()));
     // includes header rows.
     $mappingData = array('column_0' => array('attributeIndexOrDerivedType' => 'string', 'type' => 'importColumn', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => null))), 'column_23' => array('attributeIndexOrDerivedType' => 'FullName', 'type' => 'importColumn', 'mappingRulesData' => array('FullNameDefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => null))));
     $importRules = ImportRulesUtil::makeImportRulesByType('ImportModelTestItem');
     $page = 0;
     $config = array('pagination' => array('pageSize' => 3));
     //This way all rows are processed.
     $dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
     $dataProvider->getPagination()->setCurrentPage($page);
     $importResultsUtil = new ImportResultsUtil($import);
     $messageLogger = new ImportMessageLogger();
     ImportUtil::importByDataProvider($dataProvider, $importRules, $mappingData, $importResultsUtil, $explicitReadWriteModelPermissions, $messageLogger);
     $importResultsUtil->processStatusAndMessagesForEachRow();
     //Confirm that 3 models where created.
     $testModels = ImportModelTestItem::getAll();
     $this->assertEquals(3, count($testModels));
     $jim = User::getByUsername('jim');
     foreach ($testModels as $model) {
         $this->assertEquals(array(Permission::READ, Permission::NONE), $model->getExplicitActualPermissions($jim));
     }
     //Clear out data in table
     R::exec("delete from " . ImportModelTestItem::getTableName('ImportModelTestItem'));
     //Now test with read/write permissions being set.
     $explicitReadWriteModelPermissions = new ExplicitReadWriteModelPermissions();
     $explicitReadWriteModelPermissions->addReadWritePermitable(User::getByUsername('jim'));
     $dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
     $dataProvider->getPagination()->setCurrentPage($page);
     $importResultsUtil = new ImportResultsUtil($import);
     $messageLogger = new ImportMessageLogger();
     ImportUtil::importByDataProvider($dataProvider, $importRules, $mappingData, $importResultsUtil, $explicitReadWriteModelPermissions, $messageLogger);
     $importResultsUtil->processStatusAndMessagesForEachRow();
     //Confirm that 3 models where created.
     $testModels = ImportModelTestItem::getAll();
     $this->assertEquals(3, count($testModels));
     $jim = User::getByUsername('jim');
     foreach ($testModels as $model) {
         $this->assertEquals(array(Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER, Permission::NONE), $model->getExplicitActualPermissions($jim));
     }
     //Re-freeze if needed.
     if ($freezeWhenComplete) {
         RedBeanDatabase::freeze();
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:68,代码来源:ImportUtilTest.php

示例15: createImportModelTestItem4

 public static function createImportModelTestItem4($name)
 {
     $freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freeze = true;
     }
     $model = new ImportModelTestItem4();
     $model->name = $name;
     $saved = $model->save();
     assert('$saved');
     if ($freeze) {
         RedBeanDatabase::freeze();
     }
     return $model;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:16,代码来源:ImportTestHelper.php


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