本文整理汇总了PHP中ZurmoDatabaseCompatibilityUtil类的典型用法代码示例。如果您正苦于以下问题:PHP ZurmoDatabaseCompatibilityUtil类的具体用法?PHP ZurmoDatabaseCompatibilityUtil怎么用?PHP ZurmoDatabaseCompatibilityUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ZurmoDatabaseCompatibilityUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:30,代码来源:ModelsRollUpTest.php
示例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}')");
}
}
}
}
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:38,代码来源:ReadPermissionsOptimizationUtil.php
示例4: forgetAll
public static function forgetAll($forgetDbLevelCache = true)
{
if (static::supportsAndAllowsDatabaseCaching() && $forgetDbLevelCache) {
ZurmoDatabaseCompatibilityUtil::callProcedureWithoutOuts("clear_cache_actual_rights()");
}
parent::forgetAll();
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:7,代码来源:RightsCache.php
示例5: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
Yii::app()->user->userModel = SecurityTestHelper::createSuperAdmin();
SecurityTestHelper::createUsers();
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:7,代码来源:FormLayoutSecurityUtilTest.php
示例6: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = User::getByUsername('super');
$billy = UserTestHelper::createBasicUser('billy');
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:8,代码来源:LatestActivitiesUtilTest.php
示例7: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
UserTestHelper::createBasicUser('billy');
UserTestHelper::createBasicUser('sally');
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:8,代码来源:ZurmoLanguageHelperTest.php
示例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;
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:13,代码来源:CampaignItemsUtil.php
示例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'));
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:10,代码来源:OwnedSecurableTestItemTest.php
示例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
}
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:10,代码来源:ModelAutoCompleteUtilTest.php
示例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();
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:11,代码来源:ControllerSecurityUtilTest.php
示例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();
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:11,代码来源:RightTest.php
示例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');
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:13,代码来源:ZurmoConfigurationFormAdapterTest.php
示例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}')");
}
}
}
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:51,代码来源:ReadPermissionsOptimizationUtil.php
示例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();
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:21,代码来源:StarredModelDataProviderTest.php
示例16: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::createActualPermissionsCacheTable();
ZurmoDatabaseCompatibilityUtil::createNamedSecurableActualPermissionsCacheTable();
ZurmoDatabaseCompatibilityUtil::createActualRightsCacheTable();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
PermissionsCache::forgetAll();
AllPermissionsOptimizationCache::forgetAll();
RightsCache::forgetAll();
PoliciesCache::forgetAll();
Currency::resetCaches();
//php only cache
Permission::resetCaches();
//php only cache
self::$activitiesObserver = new ActivitiesObserver();
self::$activitiesObserver->init();
//runs init();
self::$conversationsObserver = new ConversationsObserver();
self::$conversationsObserver->init();
//runs init();
self::$emailMessagesObserver = new EmailMessagesObserver();
self::$emailMessagesObserver->init();
//runs init();
self::$contactLatestActivityDateTimeObserver = new ContactLatestActivityDateTimeObserver();
self::$contactLatestActivityDateTimeObserver->init();
//runs init();
self::$accountLatestActivityDateTimeObserver = new AccountLatestActivityDateTimeObserver();
self::$accountLatestActivityDateTimeObserver->init();
//runs init();
self::$accountContactAffiliationObserver = new AccountContactAffiliationObserver();
self::$accountContactAffiliationObserver->init();
//runs init();
Yii::app()->gameHelper;
Yii::app()->gamificationObserver;
//runs init();
Yii::app()->gameHelper->resetDeferredPointTypesAndValuesByUserIdToAdd();
Yii::app()->emailHelper->sendEmailThroughTransport = false;
Yii::app()->jobQueue->deleteAll();
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:40,代码来源:ZurmoBaseTest.php
示例17: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::createActualPermissionsCacheTable();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
PermissionsCache::forgetAll();
RightsCache::forgetAll();
PoliciesCache::forgetAll();
Currency::resetCaches();
//php only cache
$activitiesObserver = new ActivitiesObserver();
$activitiesObserver->init();
//runs init();
$conversationsObserver = new ConversationsObserver();
$conversationsObserver->init();
//runs init();
Yii::app()->gameHelper;
Yii::app()->gamificationObserver;
//runs init();
Yii::app()->gameHelper->resetDeferredPointTypesAndValuesByUserIdToAdd();
Yii::app()->emailHelper->sendEmailThroughTransport = false;
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:22,代码来源:ZurmoBaseTest.php
示例18: autoBuildDatabase
/**
* Auto builds the database. Must manually set AuditEvent first to avoid issues building the AuditEvent
* table. This is because AuditEvent is specially optimized during this build process to reduce how
* long this takes to do.
*/
public static function autoBuildDatabase(&$messageLogger)
{
$rootModels = array();
$rootModels[] = 'AuditEvent';
foreach (Module::getModuleObjects() as $module) {
$moduleAndDependenciesRootModelNames = $module->getRootModelNamesIncludingDependencies();
$rootModels = array_merge($rootModels, array_diff($moduleAndDependenciesRootModelNames, $rootModels));
}
ZurmoDatabaseCompatibilityUtil::createStoredFunctionsAndProcedures();
RedBeanDatabaseBuilderUtil::autoBuildModels($rootModels, $messageLogger);
ZurmoDatabaseCompatibilityUtil::createIndexes();
}
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:17,代码来源:InstallUtil.php
示例19: getInheritedActualRight
public function getInheritedActualRight($moduleName, $rightName)
{
assert('is_string($moduleName)');
assert('is_string($rightName)');
assert('$moduleName != ""');
assert('$rightName != ""');
if ($this->isEveryone) {
return Right::NONE;
}
if (!SECURITY_OPTIMIZED) {
return parent::getInheritedActualRight($moduleName, $rightName);
} else {
// Optimizations work on the database,
// anything not saved will not work.
assert('$this->id > 0');
return intval(ZurmoDatabaseCompatibilityUtil::callFunction("get_group_inherited_actual_right({$this->id}, '{$moduleName}', '{$rightName}')"));
}
}
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:18,代码来源:Group.php
示例20: getExplicitActualPolicy
/**
* @param string $moduleName
* @param string $policyName
* @return mixed|null|string
*/
public function getExplicitActualPolicy($moduleName, $policyName)
{
assert('is_string($moduleName)');
assert('is_string($policyName)');
assert('$moduleName != ""');
assert('$policyName != ""');
if (!SECURITY_OPTIMIZED) {
// The slow way will remain here as documentation
// for what the optimized way is doing.
foreach ($this->policies as $policy) {
if ($policy->moduleName == $moduleName && $policy->name == $policyName) {
return $policy->value;
}
}
return null;
} else {
$permitableId = $this->getClassId('Permitable');
try {
// not using $default because computing default value would involve extra cpu cycles each time.
return PoliciesCache::getEntry($permitableId . $moduleName . $policyName . 'ExplicitActualPolicy');
} catch (NotFoundException $e) {
$explictActualPolicy = ZurmoDatabaseCompatibilityUtil::callFunction("get_permitable_explicit_actual_policy(\n {$permitableId}, '{$moduleName}', '{$policyName}')");
}
PoliciesCache::cacheEntry($permitableId . $moduleName . $policyName . 'ExplicitActualPolicy', $explictActualPolicy);
return $explictActualPolicy;
}
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:32,代码来源:Permitable.php
注:本文中的ZurmoDatabaseCompatibilityUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论