本文整理汇总了PHP中DBUtil::createTable方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::createTable方法的具体用法?PHP DBUtil::createTable怎么用?PHP DBUtil::createTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtil
的用法示例。
在下文中一共展示了DBUtil::createTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
public function install()
{
if (!SecurityUtil::checkPermission('Files::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
// set content of the files .htaccess and .locked
$htaccessContent = "# Avoid direct web access to folder files\r\nOrder deny,allow\r\nDeny from all\r\n";
$lockedContent = "# Avoid direct web access with the file file.php\r\n";
// Create module table
if (!DBUtil::createTable('Files')) {
return false;
}
//Create indexes
$pntable = DBUtil::getTables();
$c = $pntable['Files_column'];
DBUtil::createIndex($c['userId'], 'Files', 'userId');
// create security files
FileUtil::writeFile(ModUtil::getVar('Files', 'folderPath') . '/.htaccess', $htaccessContent, true);
FileUtil::writeFile(ModUtil::getVar('Files', 'folderPath') . '/.locked', $lockedContent, true);
FileUtil::writeFile(ModUtil::getVar('Files', 'folderPath') . '/' . ModUtil::getVar('Files', 'usersFolder') . '/.htaccess', $htaccessContent, true);
FileUtil::writeFile(ModUtil::getVar('Files', 'folderPath') . '/' . ModUtil::getVar('Files', 'usersFolder') . '/.locked', $lockedContent, true);
//Create module vars
ModUtil::setVar('Files', 'showHideFiles', '0');
ModUtil::setVar('Files', 'allowedExtensions', 'gif,png,jpg,odt,doc,pdf,zip');
ModUtil::setVar('Files', 'defaultQuota', 1);
ModUtil::setVar('Files', 'groupsQuota', 's:0:"";');
ModUtil::setVar('Files', 'filesMaxSize', '1000000');
ModUtil::setVar('Files', 'maxWidth', '250');
ModUtil::setVar('Files', 'maxHeight', '250');
ModUtil::setVar('Files', 'editableExtensions', 'php,htm,html,htaccess,css,js,tpl');
// Set up module hook
ModUtil::registerHook('item', 'display', 'GUI', 'Files', 'user', 'Files');
return true;
}
示例2: Install
public function Install() {
// Checks if module IWmain is installed. If not returns error
$modid = ModUtil::getIdFromName('IWmain');
$modinfo = ModUtil::getInfo($modid);
if ($modinfo['state'] != 3) {
return LogUtil::registerError($this->__('Module IWmain is needed. You have to install the IWmain module before installing it.'));
}
// Check if the version needed is correct
$versionNeeded = '2.0';
if (!ModUtil::func('IWmain', 'admin', 'checkVersion', array('version' => $versionNeeded))) {
return false;
}
// create module tables
$tables = array('IWstats', 'IWstats_summary');
foreach ($tables as $table) {
if (!DBUtil::createTable($table)) {
return false;
}
}
// create several indexes for IWstats table
$table = DBUtil::getTables();
$c = $table['IWstats_column'];
if (!DBUtil::createIndex($c['moduleid'], 'IWstats', 'moduleid')) {
return false;
}
if (!DBUtil::createIndex($c['uid'], 'IWstats', 'uid')) {
return false;
}
if (!DBUtil::createIndex($c['ip'], 'IWstats', 'ip')) {
return false;
}
if (!DBUtil::createIndex($c['ipForward'], 'IWstats', 'ipForward')) {
return false;
}
if (!DBUtil::createIndex($c['ipClient'], 'IWstats', 'ipClient')) {
return false;
}
if (!DBUtil::createIndex($c['userAgent'], 'IWstats', 'userAgent')) {
return false;
}
if (!DBUtil::createIndex($c['isadmin'], 'IWstats', 'isadmin')) {
return false;
}
// Set up config variables
$this->setVar('skippedIps', '')
->setVar('modulesSkipped', '')
->setVar('deleteFromDays', 90)
->setVar('keepDays', 90);
// create the system init hook
EventUtil::registerPersistentModuleHandler('IWstats', 'core.postinit', array('IWstats_Listeners', 'coreinit'));
// Initialisation successful
return true;
}
示例3: install
public function install() {
if (!SecurityUtil::checkPermission('IWdocmanager::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
// Checks if module IWmain is installed. If not returns error
if (!ModUtil::available('IWmain')) {
return LogUtil::registerError(__('Module IWmain is required. You have to install the IWmain module previously to install it.'));
}
// Check if the version needed is correct
$versionNeeded = '3.0.0';
if (!ModUtil::func('IWmain', 'admin', 'checkVersion', array('version' => $versionNeeded))) {
return false;
}
if (!DBUtil::createTable('IWdocmanager'))
return false;
if (!DBUtil::createTable('IWdocmanager_categories'))
return false;
//Create indexes
$table = DBUtil::getTables();
$c = $table['IWdocmanager_column'];
DBUtil::createIndex($c['author'], 'IWdocmanager', 'author');
DBUtil::createIndex($c['categoryId'], 'IWdocmanager', 'categoryId');
//Create module vars
$this->setVar('documentsFolder', 'documents')
->setVar('notifyMail', '')
->setVar('editTime', '45')
->setVar('deleteTime', '20');
return true;
}
示例4: install
/**
* initialise the Feeds module
*/
public function install()
{
// create table
if (!DBUtil::createTable('feeds')) {
return false;
}
// create cache directory
CacheUtil::createLocalDir('feeds');
// set up config variables
$modvars = array(
'enablecategorization' => true,
'bold' => false,
'openinnewwindow' => false,
'itemsperpage' => 10,
'cachedirectory' => 'feeds',
'cacheinterval' => 180,
'multifeedlimit' => 0,
'usingcronjob' => 0,
'key' => md5(time())
);
// create our default category
if (!$this->_feeds_createdefaultcategory()) {
LogUtil::registerStatus(__('Warning! Could not create the default Feeds category tree. If you want to use categorisation with Feeds, register at least one property for the module in the Category Registry.'));
$modvars['enablecategorization'] = false;
}
// set up module variables
ModUtil::setVars('Feeds', $modvars);
// initialisation successful
return true;
}
示例5: Install
public function Install() {
// Checks if module IWmain is installed. If not returns error
$modid = ModUtil::getIdFromName('IWmain');
$modinfo = ModUtil::getInfo($modid);
if ($modinfo['state'] != 3) {
return LogUtil::registerError($this->$this->__('Module IWmain is needed. You have to install the IWmain module before installing it.'));
}
// Check if the version needed is correct
$versionNeeded = '3.0.0';
if (!ModUtil::func('IWmain', 'admin', 'checkVersion', array('version' => $versionNeeded))) {
return false;
}
// Create module table
if (!DBUtil::createTable('IWusers'))
return false;
if (!DBUtil::createTable('IWusers_friends'))
return false;
// Create the index
if (!DBUtil::createIndex('iw_uid', 'IWusers', 'uid'))
return false;
if (!DBUtil::createIndex('iw_uid', 'IWusers_friends', 'uid'))
return false;
if (!DBUtil::createIndex('iw_fid', 'IWusers_friends', 'fid'))
return false;
//Create module vars
$this->setVar('friendsSystemAvailable', 1)
->setVar('invisibleGroupsInList', '$')
->setVar('usersCanManageName', 0)
->setVar('allowUserChangeAvatar', '1')
->setVar('allowUserSetTheirSex', '0')
->setVar('allowUserDescribeTheirSelves', '1')
->setVar('avatarChangeValidationNeeded', '1')
->setVar('usersPictureFolder', 'photos');
return true;
}
示例6: install
/**
* initialise the groups module
* This function is only ever called once during the lifetime of a particular
* module instance
* @return bool true if initialisation succesful, false otherwise
*/
public function install()
{
// create the groups table
if (!DBUtil::createTable('groups')) {
return false;
}
// create the group membership table
if (!DBUtil::createTable('group_membership')) {
return false;
}
// create the groups applications table
if (!DBUtil::createTable('group_applications')) {
return false;
}
// set all our module vars
$this->setVar('itemsperpage', 25);
$this->setVar('defaultgroup', 1);
$this->setVar('mailwarning', 0);
$this->setVar('hideclosed', 0);
// Set the primary admin group gid as a module var so it is accessible by other modules,
// but it should not be editable at this time. For now it is read-only.
$this->setVar('primaryadmingroup', 2);
// create the default data for the modules module
$this->defaultdata();
// Initialisation successful
return true;
}
示例7: install
/**
* Install the Extensions module.
*
* @return boolean
*/
public function install()
{
// modules
if (!DBUtil::createTable('modules')) {
return false;
}
// module_vars
if (!DBUtil::createTable('module_vars')) {
return false;
}
// hooks
if (!DBUtil::createTable('hooks')) {
return false;
}
// module_deps
if (!DBUtil::createTable('module_deps')) {
return false;
}
// create hook provider table.
Doctrine_Core::createTablesFromArray(array('Zikula_Doctrine_Model_HookArea', 'Zikula_Doctrine_Model_HookProvider', 'Zikula_Doctrine_Model_HookSubscriber', 'Zikula_Doctrine_Model_HookBinding', 'Zikula_Doctrine_Model_HookRuntime'));
EventUtil::registerPersistentModuleHandler('Extensions', 'controller.method_not_found', array('Extensions_HookUI', 'hooks'));
EventUtil::registerPersistentModuleHandler('Extensions', 'controller.method_not_found', array('Extensions_HookUI', 'moduleservices'));
// populate default data
$this->defaultdata();
$this->setVar('itemsperpage', 25);
// Initialisation successful
return true;
}
示例8: mediashareCreateInvitationTable
function mediashareCreateInvitationTable()
{
// Media DB creation
if (!DBUtil::createTable('mediashare_invitation')) {
return false;
}
return true;
}
示例9: install
/**
* Initialise the IWTimeFrames module creating module tables and module vars
* @author Albert Pérez Monfort (aperezm@xtec.cat)
* @author Josep Ferràndiz Farré (jferran6@xtec.cat)
* @return bool true if successful, false otherwise
*/
public function install() {
// Create module tables
if (!DBUtil::createTable('IWtimeframes')) return false;
if (!DBUtil::createTable('IWtimeframes_definition')) return false;
//Create module vars
$this->setVar('frames', '10'); //franges horàries
//Initialation successfull
return true;
}
示例10: Install
/**
* Initialise the IWmenu module creating module tables and module vars
* @author Albert Perez Monfort (aperezm@xtec.cat)
* @return bool true if successful, false otherwise
*/
public function Install() {
// Checks if module IWmain is installed. If not returns error
$modid = ModUtil::getIdFromName('IWmain');
$modinfo = ModUtil::getInfo($modid);
if ($modinfo['state'] != 3) {
return LogUtil::registerError($this->__('Module IWmain is needed. You have to install the IWmain module previously to install it.'));
}
// Check if the version needed is correct
$versionNeeded = '3.0.0';
if (!ModUtil::func('IWmain', 'admin', 'checkVersion', array('version' => $versionNeeded))) {
return false;
}
// Create module table
if (!DBUtil::createTable('IWmenu'))
return false;
//Create indexes
$pntable = DBUtil::getTables();
$c = $pntable['IWmenu_column'];
if (!DBUtil::createIndex($c['id_parent'], 'IWmenu', 'id_parent'))
return false;
//Create module vars
ModUtil::setVar('IWmenu', 'height', 26); // Default height
ModUtil::setVar('IWmenu', 'width', 200); // Default width
ModUtil::setVar('IWmenu', 'imagedir', "menu"); // Default directori of menu images
// checks if module vhmenu exists. If it exists import module vhmenu tables
$modid = ModUtil::getIdFromName('IWmenu');
$modinfo = ModUtil::getInfo($modid);
if ($modinfo['state'] == 3) {
// get the objects from the db
ModUtil::load('IWvhmenu', 'user');
$items = DBUtil::selectObjectArray('IWvhmenu');
if ($items) {
foreach ($items as $item) {
$groups = str_replace('|0', '', $item['groups']);
$groups = substr($groups, 1, strlen($groups));
$itemArray = array('text' => $item['text'],
'url' => $item['url'],
'icon' => '',
'id_parent' => $item['id_parent'],
'groups' => $groups,
'active' => $item['active'],
'target' => $item['target'],
'descriu' => $item['descriu']);
DBUtil::insertObject($itemArray, 'IWmenu', 'mid');
}
}
}
return true;
}
示例11: install
/**
* Initialise the IWwebbox module creating module tables and module vars
* @author Albert Pérez Monfort (intraweb@xtec.cat)
* @return bool true if successful, false otherwise
*/
public function install() {
// Create module table
if (!DBUtil::createTable('IWwebbox'))
return false;
//Create module vars
$this->setVar('url', 'http://phobos.xtec.cat/intraweb')
->setVar('width', '100')
->setVar('height', '600')
->setVar('scrolls', '1')
->setVar('widthunit', '%');
return true;
}
示例12: Admin_Messages_init
/**
* initialise the Admin module
* This function is only ever called once during the lifetime of a particular
* module instance
* @author Mark West
* @return bool true if initialisation succcesful, false otherwise
*/
function Admin_Messages_init()
{
if (!DBUtil::createTable('message')) {
return false;
}
// Set a default value for a module variable
ModUtil::setVar('Admin_Messages', 'itemsperpage', 25);
ModUtil::setVar('Admin_Messages', 'allowsearchinactive', false);
// create the default data for the modules module
Admin_Messages_defaultdata();
// Initialisation successful
return true;
}
示例13: install
/**
* Initialise the dynamic user data module.
*
* @return boolean True on success or false on failure.
*/
public function install()
{
if (!DBUtil::createTable('user_property')) {
return false;
}
$this->setVars($this->getDefaultModVars());
// create the default data for the module
$this->defaultdata();
EventUtil::registerPersistentEventHandlerClass($this->name, 'Profile_Listener_UsersUiHandler');
// Initialisation successful
return true;
}
示例14: Install
/**
* Initialise the IWnoteboard module creating module tables and module vars
* @author Albert Pérez Monfort (aperezm@xtec.cat)
* @return bool true if successful, false otherwise
*/
public function Install() {
// Checks if module IWmain is installed. If not returns error
$modid = ModUtil::getIdFromName('IWmain');
$modinfo = ModUtil::getInfo($modid);
if ($modinfo['state'] != 3) {
return LogUtil::registerError($this->__('Module IWmain is required. You have to install the IWmain module previously to install it.'));
}
// Check if the version needed is correct
$versionNeeded = '3.0.0';
if (!ModUtil::func('IWmain', 'admin', 'checkVersion', array('version' => $versionNeeded))) {
return false;
}
// Create module tables
if (!DBUtil::createTable('IWnoteboard'))
return false;
if (!DBUtil::createTable('IWnoteboard_topics'))
return false;
//Create module vars
$this->setVar('grups', '')
->setVar('permisos', '')
->setVar('marcat', '')
->setVar('verifica', '')
->setVar('caducitat', '30')
->setVar('repperdefecte', '1')
->setVar('colorrow1', '#FFFFFF')
->setVar('colorrow2', '#FFFFCC')
->setVar('colornewrow1', '#FFCC99')
->setVar('colornewrow2', '#99FFFF')
->setVar('attached', 'noteboard')
->setVar('notRegisteredSeeRedactors', '1')
->setVar('multiLanguage', '0')
->setVar('topicsSystem', '0')
->setVar('shipHeadersLines', '0')
->setVar('notifyNewEntriesByMail', '0')
->setVar('editPrintAfter', '-1')
->setVar('notifyNewCommentsByMail', '1')
->setVar('commentCheckedByDefault', '1')
->setVar('smallAvatar', '0');
HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
//Initialation successfull
return true;
}
示例15: Install
/**
* Initialise the IWforums module creating module tables and module vars
* @author Albert Pérez Monfort (aperezm@xtec.cat)
* @return bool true if successful, false otherwise
*/
public function Install() {
// Checks if module IWmain is installed. If not returns error
$modid = ModUtil::getIdFromName('IWmain');
$modinfo = ModUtil::getInfo($modid);
if ($modinfo['state'] != 3) {
return LogUtil::registerError($this->__('Module IWmain is required. You have to install the IWmain module previously to install it.'));
}
// Check if the version needed is correct
$versionNeeded = '3.0.2';
if (!ModUtil::func('IWmain', 'admin', 'checkVersion', array('version' => $versionNeeded))) {
return false;
}
// Create module tables
if (!DBUtil::createTable('IWforums_definition'))
return false;
if (!DBUtil::createTable('IWforums_temes'))
return false;
if (!DBUtil::createTable('IWforums_msg'))
return false;
//Create indexes
$tables = DBUtil::getTables();
$c = $tables['IWforums_msg_column'];
if (!DBUtil::createIndex($c['idparent'], 'IWforums_msg', 'idparent'))
return false;
if (!DBUtil::createIndex($c['ftid'], 'IWforums_msg', 'ftid'))
return false;
if (!DBUtil::createIndex($c['fid'], 'IWforums_msg', 'fid'))
return false;
$c = $tables['IWforums_temes_column'];
if (!DBUtil::createIndex($c['fid'], 'IWforums_temes', 'fid'))
return false;
//Create module vars
$this->setVar('urladjunts', 'forums')
->setVar('avatarsVisible', '1')
->setVar('restyledTheme', '1')
->setVar('smiliesActive', '1');
HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
//Initialation successfull
return true;
}