本文整理汇总了PHP中DBUtil::createIndex方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::createIndex方法的具体用法?PHP DBUtil::createIndex怎么用?PHP DBUtil::createIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtil
的用法示例。
在下文中一共展示了DBUtil::createIndex方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: Install
/**
* Initialise the IWbookings 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() {
// 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('IWbookings'))
return false;
if (!DBUtil::createTable('IWbookings_spaces'))
return false;
//Create indexes
$pntable = DBUtil::getTables();
$c = $pntable['IWbookings_column'];
if (!DBUtil::createIndex($c['sid'], 'IWbookings', 'sid'))
return false;
if (!DBUtil::createIndex($c['start'], 'IWbookings', 'start'))
return false;
//Create module vars
ModUtil::setVar('IWbookings', 'group', ''); //grup
ModUtil::setVar('IWbookings', 'weeks', '1'); // setmanes
ModUtil::setVar('IWbookings', 'month_panel', '0'); // taula_mes
ModUtil::setVar('IWbookings', 'weekends', '0'); // capssetmana
ModUtil::setVar('IWbookings', 'eraseold', '1'); // delantigues
ModUtil::setVar('IWbookings', 'showcolors', '0'); // mostracolors
ModUtil::setVar('IWbookings', 'NTPtime', '0');
//Initialation successfull
return true;
}
示例7: 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 = '3.0.0';
if (!ModUtil::func('IWmain', 'admin', 'checkVersion', array('version' => $versionNeeded))) {
return false;
}
// Create module tables
if (!DBUtil::createTable('IWmessages'))
return false;
//Create indexes
$pntable = DBUtil::getTables();
$c = $pntable['IWmessages_column'];
if (!DBUtil::createIndex($c['from_userid'], 'IWmessages', 'from_userid'))
return false;
if (!DBUtil::createIndex($c['to_userid'], 'IWmessages', 'to_userid'))
return false;
//Set module vars
$this->setVar('groupsCanUpdate', '$')
->setVar('uploadFolder', 'messages')
->setVar('multiMail', '$')
->setVar('limitInBox', '50')
->setVar('limitOutBox', '50')
->setVar('dissableSuggest', '0')
->setVar('smiliesActive', '1');
HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
return true;
}
示例8: Upgrade
/**
* upgrade
*
* @todo recode using DBUtil
*/
public function Upgrade($oldversion) {
switch ($oldversion) {
case '0.2':
// Create the system init hook (previous versions are for Zikula 1.2)
EventUtil::registerPersistentModuleHandler('IWstats', 'core.postinit', array('IWstats_Listeners', 'coreinit'));
case '3.0.0':
// Add new fields. Stop in case of error
if (!DBUtil::changeTable('IWstats')) {
return false;
}
// Create indexes. Don't stop in case of error
$table = pnDBGetTables();
$c = $table['IWstats_column'];
DBUtil::createIndex($c['ipForward'], 'IWstats', 'ipForward');
DBUtil::createIndex($c['ipClient'], 'IWstats', 'ipClient');
DBUtil::createIndex($c['userAgent'], 'IWstats', 'userAgent');
break;
}
// Update successful
return true;
}
示例9: Install
/**
* Initialise the IWforms 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 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 tables
if (!DBUtil::createTable('IWforms_definition'))
return false;
if (!DBUtil::createTable('IWforms_cat'))
return false;
if (!DBUtil::createTable('IWforms'))
return false;
if (!DBUtil::createTable('IWforms_note'))
return false;
if (!DBUtil::createTable('IWforms_note_definition'))
return false;
if (!DBUtil::createTable('IWforms_validator'))
return false;
if (!DBUtil::createTable('IWforms_group'))
return false;
//Create indexes
$pntable = DBUtil::getTables();
$c = $pntable['IWforms_definition_column'];
if (!DBUtil::createIndex($c['active'], 'IWforms_definition', 'active'))
return false;
$c = $pntable['IWforms_column'];
if (!DBUtil::createIndex($c['fid'], 'IWforms', 'fid'))
return false;
$c = $pntable['IWforms_group_column'];
if (!DBUtil::createIndex($c['fid'], 'IWforms_group', 'fid'))
return false;
$c = $pntable['IWforms_note_column'];
if (!DBUtil::createIndex($c['fmid'], 'IWforms_note', 'fmid'))
return false;
if (!DBUtil::createIndex($c['fndid'], 'IWforms_note', 'fndid'))
return false;
$c = $pntable['IWforms_note_definition_column'];
if (!DBUtil::createIndex($c['fid'], 'IWforms_note_definition', 'fid'))
return false;
$c = $pntable['IWforms_validator_column'];
if (!DBUtil::createIndex($c['fid'], 'IWforms_validator', 'fid'))
return false;
//Set module vars
$this->setVar('characters', '15')
->setVar('resumeview', '0')
->setVar('newsColor', '#90EE90')
->setVar('viewedColor', '#FFFFFF')
->setVar('completedColor', '#D3D3D3')
->setVar('validatedColor', '#CC9999')
->setVar('fieldsColor', '#ADD8E6')
->setVar('contentColor', '#FFFFE0')
->setVar('attached', 'forms')
->setVar('publicFolder', 'forms/public');
HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
//Successfull
return true;
}
示例10: upgrade
/**
* Update the IWmain module
* @author Albert Pérez Monfort (aperezm@xtec.cat)
* @author Jaume Fernàndez Valiente (jfern343@xtec.cat)
* @return bool true if successful, false otherwise
*/
public function upgrade($oldversion) {
switch ($oldversion) {
case ($oldversion < '3.0.0'):
// create new needed tables and index
if (!DBUtil::createTable('IWmain_logs'))
return false;
$table = DBUtil::getTables();
$c = $table['IWmain_logs_column'];
if (!DBUtil::createIndex($c['moduleName'], 'IWmain_logs', 'moduleName'))
return false;
if (!DBUtil::createIndex($c['visible'], 'IWmain_logs', 'visible'))
return false;
//Array de noms
$oldVarsNames = DBUtil::selectFieldArray("module_vars", 'name', "`modname` = 'IWmain'", '', false, '');
$newVarsNames = Array('url', 'email', 'documentRoot', 'extensions', 'maxsize', 'usersvarslife',
'cronHeaderText', 'cronFooterText', 'showHideFiles', 'URLBase');
$newVars = Array('url' => 'https://github.com/intraweb-modules13/IWmain',
'email' => 'intraweb@xtec.cat',
'documentRoot' => 'data',
'extensions' => 'odt|ods|odp|zip|pdf|doc|jpg|gif|txt',
'maxsize', '1000000',
'usersvarslife' => '60',
'cronHeaderText' => $this->__('Header text of the cron automatic emails with the new things to see'),
'cronFooterText' => $this->__('Footer text of the email'),
'showHideFiles' => '0',
'captchaPrivateCode' => '',
'captchaPublicCode' => '',
'URLBase' => System::getBaseUrl());
// Delete unneeded vars
$del = array_diff($oldVarsNames, $newVarsNames);
foreach ($del as $i) {
$this->delVar($i);
}
// Add new vars
$add = array_diff($newVarsNames, $oldVarsNames);
foreach ($add as $i) {
$this->setVar($i, $newVars[$i]);
}
case '3.0.0':
// Clean upgrade. Only fix iwcron problems and table definitions to run with IWusers 3.1.0
case '3.0.1':
// Add new vars
$this->setVar('cronPasswordActive', false)
->setVar('cronPasswrodString','')
->delVar('showHideFiles')
->setVar('cronSubjectText', $this->__('User Reports'))
->setVar('crAc_UserReports', false)
->setVar('crAc_UR_IWforums', false)
->setVar('crAc_UR_IWmessages', false)
->setVar('crAc_UR_IWforms', false)
->setVar('crAc_UR_IWnoteboard', false)
->setVar('crAc_UR_IWforums_hd', '')
->setVar('crAc_UR_IWmessages_hd', '')
->setVar('crAc_UR_IWforms_hd', '')
->setVar('crAc_UR_IWnoteboard_hd', '')
->setVar('everybodySubscribed', true)
->setVar('cronURfreq', '0');
}
return true;
}
示例11: Install
/**
* Initialise the IWagendas module creating module tables and module vars
*
* @return bool true if successful, false otherwise
*/
public function Install() {
// 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;
}
// Create module tables
if (!DBUtil::createTable('IWagendas'))
return false;
if (!DBUtil::createTable('IWagendas_definition'))
return false;
if (!DBUtil::createTable('IWagendas_subs'))
return false;
// Create indexes
$table = DBUtil::getTables();
$c = $table['IWagendas_column'];
if (!DBUtil::createIndex($c['usuari'], 'IWagendas', 'usuari'))
return false;
if (!DBUtil::createIndex($c['data'], 'IWagendas', 'data'))
return false;
if (!DBUtil::createIndex($c['rid'], 'IWagendas', 'rid'))
return false;
if (!DBUtil::createIndex($c['daid'], 'IWagendas', 'daid'))
return false;
if (!DBUtil::createIndex($c['origenid'], 'IWagendas', 'origenid'))
return false;
if (!DBUtil::createIndex($c['gCalendarEventId'], 'IWagendas', 'gCalendarEventId'))
return false;
$c = $table['IWagendas_definition_column'];
if (!DBUtil::createIndex($c['gCalendarId'], 'IWagendas_definition', 'gCalendarId'))
return false;
// Set module vars
$this->setVar('inicicurs', date('Y'))
->setVar('calendariescolar', 0)
->setVar('comentaris', '')
->setVar('festiussempre', '')
->setVar('altresfestius', '')
->setVar('informacions', '')
->setVar('periodes', '')
->setVar('llegenda', 0)
->setVar('infos', 0)
->setVar('vista', -1)
->setVar('colors', 'DBD4A6|555555|FFCC66|FFFFFF|E1EBFF|669ACC|FFFFFF|FFFFFF|FF8484|FFFFFF|DBD4A6|66FF66|3F6F3E|FFFFCC|BBBBBB|000000')
->setVar('maxnotes', '300')
->setVar('adjuntspersonals', '0')
->setVar('caducadies', '30')
->setVar('urladjunts', 'agendas')
->setVar('msgUsersRespDefault', __('You has been added to a new agenda as moderator. You can access the agenda throught the main menu. <br><br>The administrator'))
->setVar('msgUsersDefault', __('You has been added to a new agenda. You can access the agenda throught the main menu. <br><br>The administrator'))
->setVar('allowGCalendar', '0');
// Successfull
return true;
}
示例12: upgrade
public function upgrade($oldversion) {
if ($oldversion < 1.1) {
if (!DBUtil::changeTable('IWjclic'))
return false;
if (!DBUtil::changeTable('IWjclic_activities'))
return false;
if (!DBUtil::changeTable('IWjclic_groups'))
return false;
if (!DBUtil::changeTable('IWjclic_sessions'))
return false;
if (!DBUtil::changeTable('IWjclic_users'))
return false;
if (!DBUtil::changeTable('IWjclic_settings'))
return false;
//Create indexes
$tables = DBUtil::getTables();
$c = $tables['IWjclic_column'];
if (!DBUtil::createIndex($c['user'], 'IWjclic', 'user'))
return false;
$c = $tables['IWjclic_activities_column'];
if (!DBUtil::createIndex($c['session_id'], 'IWjclic_activities', 'session_id'))
return false;
$c = $tables['IWjclic_groups_column'];
if (!DBUtil::createIndex($c['jid'], 'IWjclic_groups', 'jid'))
return false;
$c = $tables['IWjclic_sessions_column'];
if (!DBUtil::createIndex($c['jclicid'], 'IWjclic_sessions', 'jclicid'))
return false;
if (!DBUtil::createIndex($c['session_id'], 'IWjclic_sessions', 'session_id'))
return false;
if (!DBUtil::createIndex($c['user_id'], 'IWjclic_sessions', 'user_id'))
return false;
$c = $tables['IWjclic_settings_column'];
if (!DBUtil::createIndex($c['setting_key'], 'IWjclic_settings', 'setting_key'))
return false;
$c = $tables['IWjclic_users_column'];
if (!DBUtil::createIndex($c['jid'], 'IWjclic_users', 'jid'))
return false;
}
// Update successful
return true;
}
示例13: upgrade
/**
* Update the IWvhmenu module
* @author Albert Pï¿œrez Monfort (aperezm@xtec.cat)
* @return bool true if successful, false otherwise
*/
public function upgrade($oldversion) {
if ($oldversion < 1.1) {
if (!DBUtil::changeTable('IWvhmenu'))
return false;
//Create indexes
$table = DBUtil::getTables();
$c = $table['IWvhmenu_column'];
if (!DBUtil::createIndex($c['id_parent'], 'IWvhmenu', 'id_parent'))
return false;
}
return true;
}