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


PHP Installer::createRoles方法代码示例

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


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

示例1: VARCHAR

				`name` VARCHAR( 255 ) NULL DEFAULT NULL ,
				`data` MEDIUMTEXT NULL DEFAULT NULL ,
				`url` VARCHAR( 255 ) NULL DEFAULT NULL ,
				`clicks` INT( 11 ) NOT NULL DEFAULT '0' ,
				`created` DATETIME NULL DEFAULT NULL ,
				`updated` DATETIME NULL DEFAULT NULL ,
				PRIMARY KEY ( `id` )
			) ENGINE=MYISAM DEFAULT CHARSET=utf8
SQL;
		if ( ! Installer::createTable($facts_table,$facts_table_sql) ) Installer::failInstall( 'facts', __('Could not create table 1 of 1.') );
		
		//	create new permissions
		if ( ! Installer::createPermissions('facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' );

		//	create new roles
		if ( ! Installer::createRoles('facts admin,facts editor,facts user') ) Installer::failInstall( 'facts' );
			
		//	assign permissions
		//	note: admin_view is needed in case they don't have any other permissions, otherwise they won't be able to log in to admin interface
		if ( ! Installer::assignPermissions('administrator','facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' );
		if ( ! Installer::assignPermissions('editor','facts_view') ) Installer::failInstall( 'facts' );
		if ( ! Installer::assignPermissions('facts admin','admin_view,facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' );
		if ( ! Installer::assignPermissions('facts editor','admin_view,facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' );
		if ( ! Installer::assignPermissions('facts user','admin_view,facts_view') ) Installer::failInstall( 'facts' );
		
		//	setup plugin settings
		$settings = array(
			'version'		=>	'0.0.2'
		);
		if ( ! Plugin::setAllSettings($settings, 'facts') ) Installer::failInstall( 'facts', __('Unable to store plugin settings!') );
			
开发者ID:realslacker,项目名称:Facts-Plugin,代码行数:30,代码来源:enable.php

示例2: __

			'filemode'		=>	'0664',
			'dirmode'		=>	'0775',
			'target'		=>	'_blank'
		);
		if ( ! Plugin::setAllSettings($settings, 'banner') ) Installer::failInstall( 'banner', __('Unable to store plugin settings!') );
		
		Flash::set('success', __('Successfully installed Banner plugin.'));
		
		//	we must exit the switch so upgrades are not applied to new installation (they should already be integrated for new installs)
		break;
		

	//	upgrade 0.0.1 to 0.0.2
	case '0.0.1':

		if ( ! Installer::createRoles('banner admin,banner manager') ) Installer::failInstall('banner');
		if ( ! Installer::assignPermissions('banner admin','admin_view,banner_view,banner_new,banner_edit,banner_delete,banner_settings') ) Installer::failInstall('banner');
		if ( ! Installer::assignPermissions('banner manager','admin_view,banner_view,banner_new,banner_edit,banner_delete') ) Installer::failInstall('banner');
		$settings = array('version'	=> '0.0.2');
		if ( ! Plugin::setAllSettings($settings, 'banner') ) Installer::failInstall( 'banner', __('Unable to store plugin settings!') );
		
		Flash::set('success', __('Successfully upgraded Banner plugin.'));


	//	upgrade 0.0.2 to 0.0.3
	case '0.0.2':
		// nothing here because we're still on 0.0.2, if we were on 0.0.1 and this was 0.0.3 upgrades would process in order
	
}

开发者ID:realslacker,项目名称:Banner-Plugin,代码行数:29,代码来源:enable.php

示例3: array

				`created` DATETIME DEFAULT NULL ,
				`updated` DATETIME DEFAULT NULL
			);
			INSERT INTO `{$errors_table}` ( `url`, `hits`, `created`, `updated` )
				SELECT `url`, `hits`, `created_on`, `created_on`
				FROM `{$errors_table}_old`;
			DROP TABLE `{$errors_table}_old`;
SQL;
		$sql = $driver == 'mysql' ? $errors_table_mysql : $errors_table_sqlite ;
		if ( ! Installer::query($sql) ) Installer::failInstall( 'redirector', __('Could not alter table 2 of 2.') );

		//	create new permissions
		if ( ! Installer::createPermissions('redirector_view,redirector_new,redirector_edit,redirector_delete,redirector_settings') ) Installer::failInstall( 'redirector' );

		//	create new roles
		if ( ! Installer::createRoles('redirector admin,redirector editor,redirector user') ) Installer::failInstall( 'redirector' );
			
		//	assign permissions
		//	note: admin_view is needed in case they don't have any other permissions, otherwise they won't be able to log in to admin interface
		if ( ! Installer::assignPermissions('administrator','redirector_view,redirector_new,redirector_edit,redirector_delete,redirector_settings') ) Installer::failInstall( 'redirector' );
		if ( ! Installer::assignPermissions('editor','redirector_view') ) Installer::failInstall( 'redirector' );
		if ( ! Installer::assignPermissions('redirector admin','admin_view,redirector_view,redirector_new,redirector_edit,redirector_delete,redirector_settings') ) Installer::failInstall( 'redirector' );
		if ( ! Installer::assignPermissions('redirector editor','admin_view,redirector_view,redirector_new,redirector_edit,redirector_delete') ) Installer::failInstall( 'redirector' );
		if ( ! Installer::assignPermissions('redirector user','admin_view,redirector_view') ) Installer::failInstall( 'redirector' );
		
		//	setup plugin settings
		$settings = array(
			'version'		=>	'0.2.5',
			'threshold'		=>	'10',
			'expireafter'	=>	'365'
		);
开发者ID:realslacker,项目名称:Redirector-Plugin,代码行数:31,代码来源:enable.php

示例4: __

		
		Flash::set('success', __('Successfully installed Download Manager plugin.'));
		
		//	we must exit the switch so upgrades are not applied to new installation (they should already be integrated for new installs)
		break;
		
	//	upgrade 0.0.1 to 0.0.2
	case '0.0.1':
	
		$settings = array('version'	=> '0.0.2');
		if ( ! Plugin::setAllSettings($settings, 'downloads') ) Installer::failInstall( 'downloads', __('Unable to store plugin settings!') );

	//	upgrade 0.0.2 to 0.0.3
	case '0.0.2':
		
		//	create new roles
		if ( ! Installer::createRoles('download manager user') ) Installer::failInstall('downloads');
		
		//	assign permissions
		//	note: admin_view is needed in case they don't have any other permissions, otherwise they won't be able to log in to admin interface
		if ( ! Installer::assignPermissions('download manager user','admin_view,downloads_view') ) Installer::failInstall('downloads');
	
		$settings = array('version'	=> '0.0.3');
		if ( ! Plugin::setAllSettings($settings, 'downloads') ) Installer::failInstall( 'downloads', __('Unable to store plugin settings!') );
		
		
		//	this line should come after all upgrade cases so that it's only set once
		Flash::set('success', __('Successfully upgraded Download Manager plugin.'));
		
	
}
开发者ID:realslacker,项目名称:Downloads-Plugin,代码行数:30,代码来源:enable.php


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