Manual:MigrateUserGroup.php/es

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:MigrateUserGroup.php and the translation is 41% complete.

Other languages:
English • ‎español • ‎polski • ‎português do Brasil • ‎हिन्दी • ‎中文 • ‎日本語

Detalles

El archivo migrateUserGroup.php es un script de mantenimiento para reasignar todos los usuarios de un grupo viejo a uno nuevo. Este script puede ser útil, por ejemplo, luego de renombrar un grupo de usuarios en LocalSettings.php y quieres que los usuarios miembros del mismo sigan siéndolo luego del renombramiento. Otro caso de uso es cuando se quiere eliminar un grupo de todos sus miembros.

Si un miembro del grupo viejo ya es un miembro del nuevo, el script se encarga de eliminar el grupo viejo de su cuenta de usuario.

Only works on explicit user groups, meaning on those groups, which are actually stored in the user_groups table inside the database. Does not work with implicit groups like "*" or "user", which are not stored in the table. This means the script currently cannot be used to e.g. add all users from the "user" group to another group.

Uso

Opción/parámetro Descripción
--oldgroup Old user group key. This is the old group name as it had been used in $wgGroupPermissions.
--newgroup New user group key. The new group name.

Ejemplo

You had a group called "ninja" with some group rights set up, e.g. $wgGroupPermissions['ninja']['block'] = true;. Now you want to move all users from that group to the group named "peaceful-ninja":

$  php ./maintenance/migrateUserGroup.php 'ninja' 'peaceful-ninja'

Doing users 1 to 200

Done! 2 users in group 'ninja' are now in 'peaceful-ninja' instead.

Obtaining 'Lost' Keys

If you don't know the names of old groups that are preventing users from joining a renamed group, you can see all assigned groups by looking into the database table user_groups in your database. The column ug_group will contain the user group key of the group, which a user is member of.

A bit more advanced would be to use DISTINCT in the SQL query like so:

SELECT DISTINCT `ug_group` FROM `user_groups`;

That will show you a list of all different values in that column - meaning: Each group, which is assigned to at least one user, will only be listed once, no matter how many different members it actually has.