Ejemplo n.º 1
0
         // No breaks
         // Update to 0.7.0
     // No breaks
     // Update to 0.7.0
     case '0.3.1':
         // Lets change our test_enable to false
         $umil->config_update('test_enable', false);
         // Lets remove some of those permission settings we added before
         $umil->permission_remove(array(array('f_test_mod', false), array('u_test_mod', true)));
         // Now to add a table (this uses the layout from develop/create_schema_files.php and from phpbb_db_tools)
         $umil->table_add('phpbb_test', array('COLUMNS' => array('test_id' => array('UINT', NULL, 'auto_increment'), 'test_text' => array('VCHAR_UNI', ''), 'test_bool' => array('BOOL', 0)), 'PRIMARY_KEY' => 'test_id', 'KEYS' => array('test_bool' => array('INDEX', 'test_bool'))));
         // Update to 0.9.0
     // Update to 0.9.0
     case '0.7.0':
         // Lets add a new column to the phpbb_test table named test_time
         $umil->table_column_add('phpbb_test', 'test_time', array('TIMESTAMP', 0));
         // Lets make the test_time column we just added an index
         $umil->table_index_add('phpbb_test', 'test_time', 'test_time');
         // Alright, now lets add some modules to the ACP
         $umil->module_add(array(array('acp', 'ACP_CAT_DOT_MODS', 'ACP_CAT_TEST_MOD'), array('acp', 'ACP_CAT_TEST_MOD', array('module_basename' => 'board', 'modes' => array('settings', 'features'))), array('acp', 'ACP_CAT_TEST_MOD', array('module_basename' => 'board', 'module_langname' => 'ACP_AVATAR_SETTINGS', 'module_mode' => 'avatar', 'module_auth' => 'acl_a_board'))));
         // Update to 0.9.1
     // Update to 0.9.1
     case '0.9.0':
         // This is done in the custom function from umil_auto_example
         $sql_ary = array('test_text' => 'This is a test message.', 'test_bool' => 1, 'test_time' => time());
         $sql = 'INSERT INTO ' . $table_prefix . 'test ' . $db->sql_build_array('INSERT', $sql_ary);
         $db->sql_query($sql);
         // Update to 1.0.0
     // Update to 1.0.0
     case '0.9.1':
 }
    }
    trigger_error('NOT_AUTHORISED');
}
if (!class_exists('umil')) {
    include $phpbb_root_path . 'umil/umil.' . $phpEx;
}
$umil = new umil(true);
$mod = array('name' => 'Legend Repositioning', 'version' => '1.0.3', 'config' => 'legend_repositioning_version', 'enable' => 'legend_repositioning_enable');
if (confirm_box(true)) {
    // Install the base 1.0.3 version
    if (!$umil->config_exists($mod['config'])) {
        // Lets add a config setting for enabling/disabling the MOD and set it to true
        $umil->config_add($mod['enable'], true);
        // We must handle the version number ourselves.
        $umil->config_add($mod['config'], $mod['version']);
        $umil->table_column_add('phpbb_groups', 'group_position', array('UINT', '0'));
        // Select all groups that have no set position
        $sql = 'SELECT group_id
			FROM ' . GROUPS_TABLE . '
			WHERE group_position = 0';
        $result = $db->sql_query($sql);
        // Set default positions for groups (so that all positions are not set to 0)
        $group_position = 0;
        while ($row = $db->sql_fetchrow($result)) {
            $group_position++;
            $sql = 'UPDATE ' . GROUPS_TABLE . '
				SET group_position = ' . $group_position . '
				WHERE group_id = ' . $row['group_id'];
            $db->sql_query($sql);
        }
        $db->sql_freeresult($result);