mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Actual delete command for mediawiki, now moves all user revisions to a special "DeletedUser" username
This commit is contained in:
@@ -33,7 +33,7 @@ USE_I18N = True
|
|||||||
|
|
||||||
# Absolute path to the directory that holds media.
|
# Absolute path to the directory that holds media.
|
||||||
# Example: "/home/media/media.lawrence.com/"
|
# Example: "/home/media/media.lawrence.com/"
|
||||||
MEDIA_ROOT = '/home/dreddit/www/auth.dredd.it/auth/media'
|
MEDIA_ROOT = './media'
|
||||||
|
|
||||||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||||
# trailing slash if there is a path component (optional in other cases).
|
# trailing slash if there is a path component (optional in other cases).
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ class MediawikiService(BaseService):
|
|||||||
SQL_ENABLE_USER = r"UPDATE user SET user_password = %s WHERE user_name = %s"
|
SQL_ENABLE_USER = r"UPDATE user SET user_password = %s WHERE user_name = %s"
|
||||||
SQL_CHECK_USER = r"SELECT user_name from user WHERE user_name = %s"
|
SQL_CHECK_USER = r"SELECT user_name from user WHERE user_name = %s"
|
||||||
|
|
||||||
|
SQL_DEL_REV = r"UPDATE revision SET rev_user = (SELECT user_id FROM user WHERE user_name = 'DeletedUser'), rev_user_text = 'DeletedUser' WHERE rev_user = (SELECT user_id FROM user WHERE user_name = '%s')"
|
||||||
|
SQL_DEL_USER = r"DELETE FROM USER WHERE user_name = '%s'"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
# Use the master DB settings, bar the database name
|
# Use the master DB settings, bar the database name
|
||||||
@@ -65,7 +68,9 @@ class MediawikiService(BaseService):
|
|||||||
|
|
||||||
def delete_user(self, uid):
|
def delete_user(self, uid):
|
||||||
""" Delete a user """
|
""" Delete a user """
|
||||||
self.disable_user(uid)
|
self._dbcursor.execute(self.SQL_DEL_REV, [uid])
|
||||||
|
self._dbcursor.execute(self.SQL_DEL_USER, [uid])
|
||||||
|
self._db.connection.commit()
|
||||||
|
|
||||||
def disable_user(self, uid):
|
def disable_user(self, uid):
|
||||||
""" Disable a user """
|
""" Disable a user """
|
||||||
|
|||||||
Reference in New Issue
Block a user