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


PHP DataExtension::requireDefaultRecords方法代码示例

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


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

示例1: requireDefaultRecords

 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     // Add default author group if no other group exists
     $frontend_group = Group::get()->filter("Code", "users-frontend");
     if (!$frontend_group->exists()) {
         $frontend_group = new Group();
         $frontend_group->Code = 'users-frontend';
         $frontend_group->Title = "Frontend Users";
         $frontend_group->Sort = 1;
         $frontend_group->write();
         Permission::grant($frontend_group->ID, 'USERS_MANAGE_ACCOUNT');
         DB::alteration_message('Front end users group created', 'created');
     }
     // Add a verified users group (only used if we turn on
     // verification)
     $verify_group = Group::get()->filter("Code", "users-verified");
     if (!$verify_group->exists()) {
         $verify_group = new Group();
         $verify_group->Code = 'users-verified';
         $verify_group->Title = "Verified Users";
         $verify_group->Sort = 1;
         $verify_group->write();
         Permission::grant($verify_group->ID, 'USERS_VERIFIED');
         DB::alteration_message('Verified users group created', 'created');
     }
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-users,代码行数:27,代码来源:Ext_Users_Group.php

示例2: requireDefaultRecords

 /**
  * @throws ValidationException
  * @throws null
  */
 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     /**
      * Add default site admin group if none with
      * permission code SITE_ADMIN exists
      *
      * @var Group $siteAdminGroup
      */
     $siteAdminGroups = DataObject::get('Group')->filter(array('Code' => 'site-administrators'));
     if (!$siteAdminGroups->count()) {
         $siteAdminGroup = Group::create();
         $siteAdminGroup->Code = 'site-administrators';
         $siteAdminGroup->Title = _t('BoilerplateGroupExtension.SiteAdminGroupTitle', 'Site Administrators');
         $siteAdminGroup->Sort = 0;
         $siteAdminGroup->write();
         /** Default CMS permissions */
         Permission::grant($siteAdminGroup->ID, 'CMS_ACCESS_LeftAndMain');
         Permission::grant($siteAdminGroup->ID, 'SITETREE_VIEW_ALL');
         Permission::grant($siteAdminGroup->ID, 'SITETREE_EDIT_ALL');
         Permission::grant($siteAdminGroup->ID, 'SITETREE_REORGANISE');
         Permission::grant($siteAdminGroup->ID, 'VIEW_DRAFT_CONTENT');
         Permission::grant($siteAdminGroup->ID, 'SITETREE_GRANT_ACCESS');
         Permission::grant($siteAdminGroup->ID, 'EDIT_SITECONFIG');
     }
 }
开发者ID:helpfulrobot,项目名称:ryanpotter-silverstripe-boilerplate,代码行数:30,代码来源:BoilerplateGroupExtension.php

示例3: requireDefaultRecords

 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     DB::query(sprintf('UPDATE "ContentModule" SET "Locale" = \'%s\' WHERE "Locale" = \'\' OR "Locale" IS NULL', Translatable::default_locale()));
     DB::query(sprintf('UPDATE "ContentModule_Live" SET "Locale" = \'%s\' WHERE "Locale" = \'\' OR "Locale" IS NULL', Translatable::default_locale()));
     DB::query(sprintf('UPDATE "ContentModule_versions" SET "Locale" = \'%s\' WHERE "Locale" = \'\' OR "Locale" IS NULL', Translatable::default_locale()));
     DB::alteration_message('Updated ContentModule for Translatable', 'changed');
 }
开发者ID:webtorque7,项目名称:inpage-modules,代码行数:8,代码来源:ContentModuleLanguageExtension.php

示例4: requireDefaultRecords

 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     $imagesToProcess = GalleryImage::get()->filter('ExifRead', 0);
     foreach ($imagesToProcess as $image) {
         $image->processExifData();
     }
     DB::alteration_message('Updated image metadata where EXIF has not been ' . 'processed', 'changed');
 }
开发者ID:gordonbanderson,项目名称:ss3gallery,代码行数:9,代码来源:ImageMetaDataExtension.php

示例5: requireDefaultRecords

 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     $siteConfig = SiteConfig::current_site_config();
     if ($siteConfig->BraftonApiUrl == null) {
         $siteConfig->BraftonApiUrl = _t('BraftonApi.DEFAULTAPIURL', 'http://api.brafton.com/');
         $siteConfig->write();
     }
 }
开发者ID:textagroup,项目名称:brafton-api,代码行数:9,代码来源:BraftonSiteConfigExtension.php

示例6: requireDefaultRecords

 function requireDefaultRecords()
 {
     if (!Group::get()->filter(array("Code" => "team-member"))->First()) {
         $group = new Group();
         $group->Title = "Team Member";
         $group->Code = "team-member";
         $group->Sort = 2;
         $group->write();
         $group->flushCache();
         DB::alteration_message('Team Member Group created', 'created');
     }
     parent::requireDefaultRecords();
 }
开发者ID:helpfulrobot,项目名称:thezenmonkey-quickstripe,代码行数:13,代码来源:TeamMemberExtension.php

示例7: requireDefaultRecords

 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     // Add default author group if no other group exists
     $curr_group = Group::get()->filter("Code", "customers");
     if (!$curr_group->exists()) {
         $group = new Group();
         $group->Code = 'customers';
         $group->Title = "Customers";
         $group->Sort = 1;
         $group->write();
         DB::alteration_message('Customers group created', 'created');
     }
 }
开发者ID:i-lateral,项目名称:silverstripe-orders,代码行数:14,代码来源:OrdersGroupExtension.php

示例8: requireDefaultRecords

 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     $siteConfig = SiteConfig::current_site_config();
     if (!$siteConfig->StoreKey) {
         $key = FoxyCart::setStoreKey();
         while (!ctype_alnum($key)) {
             $key = FoxyCart::setStoreKey();
         }
         $siteConfig->StoreKey = $key;
         $siteConfig->write();
         DB::alteration_message($siteConfig->ClassName . ": created FoxyCart Store Key " . $key, 'created');
     }
 }
开发者ID:helpfulrobot,项目名称:dynamic-foxystripe,代码行数:14,代码来源:FoxyStripeSiteConfig.php

示例9: requireDefaultRecords

 function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     // If css file does not exist on current theme, copy from module
     $copyfrom = BASE_PATH . "/" . CONTENTBLOCKS_MODULE_DIR . "/css/block.css";
     $theme = SSViewer::current_theme();
     $copyto = BASE_PATH . "/themes/" . $theme . "/css/block.css";
     if (!file_exists($copyto)) {
         if (file_exists($copyfrom)) {
             copy($copyfrom, $copyto);
             echo '<li style="green: green">block.css copied to: ' . $copyto . '</li>';
         } else {
             echo '<li style="red">The default css file was not found: ' . $copyfrom . '</li>';
         }
     }
 }
开发者ID:Design-Collective,项目名称:Silverstripe-Content-Blocks,代码行数:16,代码来源:ContentBlocksModule.php

示例10: requireDefaultRecords

 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     $groups = Config::inst()->get('Group', 'default_groups');
     foreach ($groups as $group) {
         $groupObj = Group::singleton()->findOrCreate(array('Code' => $group['code']));
         $groupObj->Title = $group['title'];
         $groupObj->write();
         if (!empty($group['permissions'])) {
             foreach ($group['permissions'] as $permission) {
                 if (!in_array($permission, $groupObj->Permissions()->column('Code'))) {
                     Permission::grant($groupObj->ID, $permission);
                     DB::alteration_message('Permission ' . $permission . ' has been granted to group ' . $groupObj->Title, 'created');
                 }
             }
         }
     }
 }
开发者ID:jallen0927,项目名称:lytech,代码行数:18,代码来源:LTMemberExtension.php

示例11: requireDefaultRecords

 public function requireDefaultRecords()
 {
     // init parent
     parent::requireDefaultRecords();
     //
     $pages = SiteTree::get();
     if ($pages->count() > 0) {
         $count = 0;
         foreach ($pages as $page) {
             if ($page->OpenGraphData == null) {
                 $page->OpenGraphData = json_encode(self::$OpenGraphProtocol);
                 $page->write();
                 $count++;
             }
         }
         if ($count > 0) {
             DB::alteration_message('Open Graph Data added to ' . $count . ' page(s)', 'created');
         }
     }
 }
开发者ID:graphiques-digitale,项目名称:silverstripe-seo-open-graph,代码行数:20,代码来源:SEO_OpenGraph_SiteTree_DataExtension.php

示例12: requireDefaultRecords

 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     // Add default FrontendMember group if none with permission code ADMIN exists
     if (!defined('CreateDefaultGroupsOnce')) {
         define('CreateDefaultGroupsOnce', true);
         $authorGroup = Group::get_one("Group", "Code='content-authors'");
         if (!$authorGroup) {
             $authorGroup = new Group();
             $authorGroup->Code = 'content-authors';
             $authorGroup->Title = _t('Group.DefaultGroupTitleContentAuthors', 'Content Authors');
             $authorGroup->Sort = 1;
             $authorGroup->write();
             Permission::grant($authorGroup->ID, 'CMS_ACCESS_CMSMain');
             Permission::grant($authorGroup->ID, 'CMS_ACCESS_AssetAdmin');
             Permission::grant($authorGroup->ID, 'CMS_ACCESS_ReportAdmin');
             Permission::grant($authorGroup->ID, 'SITETREE_REORGANISE');
         }
         Permission::grant($authorGroup->ID, 'ACCESS_CONTENT');
         DB::alteration_message('Content Authors Group Permissions added', "created");
     }
 }
开发者ID:andrelohmann,项目名称:vagrant-cloud,代码行数:22,代码来源:DefaultGroups.php

示例13: requireDefaultRecords

 /**
  * Add default records to database.
  *
  * This function is called whenever the database is built, after the
  * database tables have all been created.
  */
 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     // Add default poster group if it doesn't exist
     $poster = Group::get()->filter("Code", 'discussions-posters')->first();
     if (!$poster) {
         $poster = new Group();
         $poster->Code = 'discussions-posters';
         $poster->Title = _t('Discussions.DefaultGroupTitlePosters', 'Discussion Posters');
         $poster->Sort = 1;
         $poster->write();
         Permission::grant($poster->ID, 'DISCUSSIONS_REPLY');
         DB::alteration_message('Discussion Poster Group Created', 'created');
     }
     // Add default modrator group if none exists
     $moderator = Permission::get_groups_by_permission('DISCUSSIONS_MODERATION')->first();
     if (!$moderator) {
         $moderator = new Group();
         $moderator->Code = 'discussions-moderators';
         $moderator->Title = _t('Discussions.DefaultGroupTitleModerators', 'Discussion Moderators');
         $moderator->Sort = 0;
         $moderator->write();
         Permission::grant($moderator->ID, 'DISCUSSIONS_MODERATION');
         DB::alteration_message('Discussion Moderator Group Created', 'created');
     }
     // Now add these groups to a discussion holder (if one exists)
     foreach (DiscussionHolder::get() as $page) {
         if (!$page->PosterGroups()->count()) {
             $page->PosterGroups()->add($poster);
             $page->write();
             DB::alteration_message('Added Poster Group to Discussions Holder', 'created');
         }
         if (!$page->ModeratorGroups()->count()) {
             $page->ModeratorGroups()->add($moderator);
             $page->write();
             DB::alteration_message('Added Moderator Group to Discussions Holder', 'created');
         }
     }
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-discussions,代码行数:45,代码来源:DiscussionsGroup.php


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