本文整理汇总了PHP中ZurmoDatabaseCompatibilityUtil类的典型用法代码示例。如果您正苦于以下问题:PHP ZurmoDatabaseCompatibilityUtil类的具体用法?PHP ZurmoDatabaseCompatibilityUtil怎么用?PHP ZurmoDatabaseCompatibilityUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ZurmoDatabaseCompatibilityUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
$super = SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = User::getByUsername('super');
$headquarters = AccountTestHelper::createAccountByNameForOwner('Headquarters', $super);
$division1 = AccountTestHelper::createAccountByNameForOwner('Division1', $super);
$division2 = AccountTestHelper::createAccountByNameForOwner('Division2', $super);
$ceo = ContactTestHelper::createContactWithAccountByNameForOwner('ceo', $super, $headquarters);
$div1President = ContactTestHelper::createContactWithAccountByNameForOwner('div1 President', $super, $division1);
$div2President = ContactTestHelper::createContactWithAccountByNameForOwner('div2 President', $super, $division2);
$opportunity = OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('big opp', $super, $headquarters);
$opportunityDiv1 = OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('div1 small opp', $super, $division1);
$opportunityDiv2 = OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('div2 small opp', $super, $division2);
//attach divisions to headquarters
$headquarters->accounts->add($division1);
$headquarters->accounts->add($division2);
assert($headquarters->save());
// Not Coding Standard
//attach opportunities to contacts
$opportunity->contacts->add($ceo);
assert($opportunity->save());
// Not Coding Standard
//Forget models to ensure relations are known on the next retrieval
$headquarters->forget();
$division1->forget();
$division2->forget();
$ceo->forget();
}
示例2: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
SecurityTestHelper::createUsers();
SecurityTestHelper::createGroups();
SecurityTestHelper::createRoles();
RedBeanModel::forgetAll();
//do the rebuild to ensure the tables get created properly.
ReadPermissionsOptimizationUtil::rebuild();
//Manually build the test model munge tables.
ReadPermissionsOptimizationUtil::recreateTable(ReadPermissionsOptimizationUtil::getMungeTableName('OwnedSecurableTestItem'));
ReadPermissionsOptimizationUtil::recreateTable(ReadPermissionsOptimizationUtil::getMungeTableName('OwnedSecurableTestItem2'));
$benny = User::getByUsername('benny');
$model = new OwnedSecurableTestItem();
$model->member = 'test';
assert($model->save());
// Not Coding Standard
$model = new OwnedSecurableTestItem();
$model->member = 'test2';
assert($model->save());
// Not Coding Standard
$model = new OwnedSecurableTestItem();
$model->member = 'test3';
$model->owner = $benny;
assert($model->save());
// Not Coding Standard
assert(OwnedSecurableTestItem::getCount() == 3);
// Not Coding Standard
$model = new OwnedSecurableTestItem2();
$model->member = 'test5';
assert($model->save());
// Not Coding Standard
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:35,代码来源:OwnedSecurableItemReadPermissionOptimizationTest.php
示例3: rebuild
/**
* At some point if performance is a problem with rebuilding activity models, then the stored procedure
* needs to be refactored to somehow support more joins dynamically.
* @see https://www.pivotaltracker.com/story/show/38804909
* @param boolean $forcePhp
*/
public static function rebuild($forcePhp = false)
{
//Forcing php way until we can fix failing tests here: AccountReadPermissionsOptimizationScenariosTest
$forcePhp = true;
assert('is_bool($forcePhp)');
foreach (self::getMungableModelClassNames() as $modelClassName) {
if (!SECURITY_OPTIMIZED || $forcePhp) {
self::rebuildViaSlowWay($modelClassName);
} else {
//models that extend activity are special and can only be done with the PHP process. They cannot
//be done using the stored procedure because it does not support the extra joins needed to determine
//which securable items to look at.
if (is_subclass_of($modelClassName, 'Activity')) {
self::rebuildViaSlowWay($modelClassName);
} else {
$modelTableName = RedBeanModel::getTableName($modelClassName);
$mungeTableName = self::getMungeTableName($modelClassName);
if (!is_subclass_of($modelClassName, 'OwnedSecurableItem')) {
throw new NotImplementedException($message, $code, $previous);
}
if (is_subclass_of($modelClassName, 'Person')) {
if ($modelClassName != 'Contact') {
throw new NotSupportedException();
} else {
$modelTableName = Person::getTableName('Person');
}
}
ZurmoDatabaseCompatibilityUtil::callProcedureWithoutOuts("rebuild('{$modelTableName}', '{$mungeTableName}')");
}
}
}
}
示例4: forgetAll
public static function forgetAll($forgetDbLevelCache = true)
{
if (static::supportsAndAllowsDatabaseCaching() && $forgetDbLevelCache) {
ZurmoDatabaseCompatibilityUtil::callProcedureWithoutOuts("clear_cache_actual_rights()");
}
parent::forgetAll();
}
示例5: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
Yii::app()->user->userModel = SecurityTestHelper::createSuperAdmin();
SecurityTestHelper::createUsers();
}
示例6: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = User::getByUsername('super');
$billy = UserTestHelper::createBasicUser('billy');
}
示例7: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
UserTestHelper::createBasicUser('billy');
UserTestHelper::createBasicUser('sally');
}
示例8: generateCampaignItemsForDueCampaigns
/**
* @return bool
*/
public function generateCampaignItemsForDueCampaigns()
{
$nowTimestamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
// Begin Not Coding Standard
$sql = "`generate_campaign_items`(" . Campaign::STATUS_ACTIVE . "," . Campaign::STATUS_PROCESSING . ",'{$nowTimestamp}')";
// End Not Coding Standard
ZurmoDatabaseCompatibilityUtil::callProcedureWithoutOuts($sql);
Yii::app()->jobQueue->add('CampaignQueueMessagesInOutbox', 5);
return true;
}
示例9: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
//do the rebuild to ensure the tables get created properly.
AllPermissionsOptimizationUtil::rebuild();
//Manually build the test model munge tables.
ReadPermissionsOptimizationUtil::recreateTable(ReadPermissionsOptimizationUtil::getMungeTableName('OwnedSecurableTestItem'));
}
示例10: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = User::getByUsername('super');
$loaded = ContactsModule::loadStartingData();
assert('$loaded');
// Not Coding Standard
}
示例11: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = User::getByUsername('super');
SecurityTestHelper::createUsers();
SecurityTestHelper::createGroups();
SecurityTestHelper::createAccounts();
AllPermissionsOptimizationUtil::rebuild();
}
示例12: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
SecurityTestHelper::createUsers();
SecurityTestHelper::createGroups();
SecurityTestHelper::createRoles();
//Forget the cache, otherwise user/role/group information is not properly reflected in the cache.
RedBeanModel::forgetAll();
}
示例13: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
$billy = UserTestHelper::createBasicUser('billy');
$group = Group::getByName('Super Administrators');
$group->users->add($billy);
$saved = $group->save();
assert($saved);
// Not Coding Standard
UserTestHelper::createBasicUser('sally');
}
示例14: rebuild
/**
* At some point if performance is a problem with rebuilding activity models, then the stored procedure
* needs to be refactored to somehow support more joins dynamically.
* @see https://www.pivotaltracker.com/story/show/38804909
* @param boolean $overwriteExistingTables
* @param boolean $forcePhp
*/
public static function rebuild($overwriteExistingTables = true, $forcePhp = false, $messageStreamer = null)
{
//Forcing php way until we can fix failing tests here: AccountReadPermissionsOptimizationScenariosTest
$forcePhp = true;
assert('is_bool($overwriteExistingTables)');
assert('is_bool($forcePhp)');
foreach (PathUtil::getAllMungableModelClassNames() as $modelClassName) {
$mungeTableName = self::getMungeTableName($modelClassName);
$readTableExists = ZurmoRedBean::$writer->doesTableExist($mungeTableName);
if (!$overwriteExistingTables && $readTableExists) {
if (isset($messageStreamer)) {
$messageStreamer->add(Zurmo::t('ZurmoModule', "Skipping {{tableName}}", array('{{tableName}}' => $mungeTableName)));
}
// skip if we don't want to overwrite existing tables and table already exists
continue;
}
if (isset($messageStreamer)) {
$messageStreamer->add(Zurmo::t('ZurmoModule', "Building {{tableName}}", array('{{tableName}}' => $mungeTableName)));
}
if (!SECURITY_OPTIMIZED || $forcePhp) {
self::rebuildViaSlowWay($modelClassName);
} else {
//models that extend activity are special and can only be done with the PHP process. They cannot
//be done using the stored procedure because it does not support the extra joins needed to determine
//which securable items to look at.
if (is_subclass_of($modelClassName, 'Activity')) {
self::rebuildViaSlowWay($modelClassName);
} else {
$modelTableName = $modelClassName::getTableName();
if (!is_subclass_of($modelClassName, 'OwnedSecurableItem')) {
throw new NotImplementedException();
}
if (is_subclass_of($modelClassName, 'Person')) {
if ($modelClassName != 'Contact') {
throw new NotSupportedException();
} else {
$modelTableName = Person::getTableName();
}
}
ZurmoDatabaseCompatibilityUtil::callProcedureWithoutOuts("rebuild('{$modelTableName}', '{$mungeTableName}')");
}
}
}
}
示例15: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::createActualPermissionsCacheTable();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
StarredUtil::createStarredTables();
$account = new Account();
$account->owner = $super;
$account->name = 'Test Account0';
$account->officePhone = '1234567890';
$account->save();
StarredUtil::markModelAsStarred($account);
$account = new Account();
$account->owner = $super;
$account->name = 'Test Account1';
$account->officePhone = '1234567891';
$account->save();
}