rename purge_inactive to purge_unactivated

This commit is contained in:
Jeff Atwood 2014-12-02 21:36:25 -08:00
parent 44c1a895b5
commit ea269ccfb2
13 changed files with 17 additions and 21 deletions

View File

@ -3,7 +3,7 @@ module Jobs
every 1.day
def execute(args)
User.purge_inactive
User.purge_unactivated
end
end
end

View File

@ -791,16 +791,12 @@ class User < ActiveRecord::Base
end
end
# Delete inactive accounts that are over a week old
def self.purge_inactive
# Delete unactivated accounts (without verified email) that are over a week old
def self.purge_unactivated
# You might be wondering why this query matches on post_count = 0. The reason
# is a long time ago we had a bug where users could post before being activated
# and some sites still have those records which can't be purged.
to_destroy = User.where(active: false)
.joins('INNER JOIN user_stats AS us ON us.user_id = users.id')
.where("created_at < ?", SiteSetting.purge_inactive_users_grace_period_days.days.ago)
.where('us.post_count = 0')
.where("created_at < ?", SiteSetting.purge_unactivated_users_grace_period_days.days.ago)
.where('NOT admin AND NOT moderator')
.limit(100)

View File

@ -845,7 +845,7 @@ en:
clean_up_uploads: "Remove orphan unreferenced uploads to prevent illegal hosting. WARNING: you may want to back up of your /uploads directory before enabling this setting."
clean_orphan_uploads_grace_period_hours: "Grace period (in hours) before an orphan upload is removed."
purge_deleted_uploads_grace_period_days: "Grace period (in days) before a deleted upload is erased."
purge_inactive_users_grace_period_days: "Grace period (in days) before a user who has not activated their account is deleted."
purge_unactivated_users_grace_period_days: "Grace period (in days) before a user who has not activated their account is deleted."
enable_s3_uploads: "Place uploads on Amazon S3 storage. IMPORTANT: requires valid S3 credentials (both access key id & secret access key)."
s3_use_iam_profile: 'Use AWS EC2 IAM role to retrieve keys. NOTE: enabling will override "s3 access key id" and "s3 secret access key" settings.'
s3_upload_bucket: "The Amazon S3 bucket name that files will be uploaded into. WARNING: must be lowercase, no periods, no underscores."

View File

@ -749,7 +749,7 @@ es:
clean_up_uploads: "Eliminar subidas huérfanas sin referencia para prevenir hosting ilegal. AVISO: antes de habilitar esta opción quizá quieres hacer un backup de tu directorio de /uploads"
clean_orphan_uploads_grace_period_hours: "Período de gracia (en horas) antes de que una subida huérfana sea eliminada."
purge_deleted_uploads_grace_period_days: "Período de gracia (en días) antes de que una subida eliminada sea borrada totalmente."
purge_inactive_users_grace_period_days: "Periodo de gracia (en días) durante los cuales un usuario que no haya activado su cuenta no será aún eliminado."
purge_unactivated_users_grace_period_days: "Periodo de gracia (en días) durante los cuales un usuario que no haya activado su cuenta no será aún eliminado."
enable_s3_uploads: "Coloca los archivos subidos en el almacén Amazon S3. IMPORTANTE: requiere de credenciales de S3 validas. (ambas clave de acceso y clave de acceso secreta)."
s3_use_iam_profile: 'Usar el rol de AWS EC2 IAM para descargar las llaves. NOTA: habilitando esta opción ignorará la "llave de acceso s3" y "la llave de acceso secreta s3".'
s3_upload_bucket: "El nombre del bucket Amazon S3 donde se subirán los archivos. AVISO: debe ser en minúsculas, sin puntos ni guiones bajos."

View File

@ -733,7 +733,7 @@ fi:
clean_up_uploads: "Poista orpoutuneet liitetiedostot, joita ei käytetä viesteissä, laittoman hostauksen estämiseksi. VAROITUS: kannattaa varmuuskopioida /uploads kansio ennen tämän asetuksen ottamista käyttöön."
clean_orphan_uploads_grace_period_hours: "Varoaika (tunteina) kunnes orpoutuneet liitetiedostot poistetaan"
purge_deleted_uploads_grace_period_days: "Varoaika (päivinä) kunnes poistettu liitetiedosto tuhotaan."
purge_inactive_users_grace_period_days: "Varoaika (päivinä) kunnes aktivoimaton käyttäjätili tuhotaan."
purge_unactivated_users_grace_period_days: "Varoaika (päivinä) kunnes aktivoimaton käyttäjätili tuhotaan."
enable_s3_uploads: "Lataa liitetiedostot Amazon S3:een. Tärkeää: edellyttää toimivat S3 kirjautumistiedot (access key id ja secret access key)."
s3_use_iam_profile: 'Käytä AWS EC2 IAM roolia avainten hakuun. HUOM: käyttöönotto korvaa "s3 access key id" ja "s3 secret access key" asetukset.'
s3_access_key_id: "Amazon S3 access key id, jota käytetään kuvien sijoittamisessa."

View File

@ -744,7 +744,7 @@ fr:
clean_up_uploads: "Retirer les fichiers téléchargés orphelins pour prévenir les hébergements illégaux. ATTENTION: vous devriez faire une sauvegarde de votre répertoire /uploads avant d'activer ce paramètre."
clean_orphan_uploads_grace_period_hours: "La période de grâce (en heures) avant qu'un fichier envoyé orphelin soit retiré."
purge_deleted_uploads_grace_period_days: "La période de grâce (en jours) avant qu'un fichier envoyé et supprimé soit effacé."
purge_inactive_users_grace_period_days: "Période de grâce (en jours) avant qu'un utilisateur qui n'a pas activé son compte soit supprimé."
purge_unactivated_users_grace_period_days: "Période de grâce (en jours) avant qu'un utilisateur qui n'a pas activé son compte soit supprimé."
enable_s3_uploads: "Placez les fichiers envoyés sur un stockage Amazon S3. IMPORTANT: nécessite un accès valide à S3 (l'identifiant et la clé secrète)."
s3_use_iam_profile: 'Utiliser un role AWS EC2 IAM pour la récupération des clés. NOTE: si activé, surcharge les paramètres "s3 access key id" et "s3 secret access key".'
s3_upload_bucket: "Le nom du bucket Amazon S3 qui contiendra les fichiers téléchargés. ATTENTION : doit être en minuscule, sans points et sans caractères de soulignement."

View File

@ -726,7 +726,7 @@ he:
clean_up_uploads: "הסירו העלאות יתומות וללא הפניה כדי למנוע אירוח בלתי חוקי של חומר. אזהרה: אתם עלולי לרצות לגבות את תיקיית ה-/uploads שלכם לפנו שתאפשרו הגדרה זו."
clean_orphan_uploads_grace_period_hours: "Grace period (in hours) before an orphan upload is removed."
purge_deleted_uploads_grace_period_days: "Grace period (in days) before a deleted upload is erased."
purge_inactive_users_grace_period_days: "תקופת המתנה (בימים) לפני שמשתמש שלא הפעיל את החשבון שלו יימחק."
purge_unactivated_users_grace_period_days: "תקופת המתנה (בימים) לפני שמשתמש שלא הפעיל את החשבון שלו יימחק."
enable_s3_uploads: "אחסן העלאות (uploads) על תשתית של Amazon S3. חשוב: מצריך מפתח גישה + מפתח גישה סודי שיהיו חוקיים."
s3_use_iam_profile: 'השתמש ב-AWS EC2 IAM role על מנת לאחזר מפתחות. שימו לב: איפשור של זה ידרוס את ההגדרות "S3 access key id" וכן את "s3 secret access key".'
s3_access_key_id: "מפתח הגישה (access key id) של Amazon S3 שישמש להעלאת התמונות."

View File

@ -691,7 +691,7 @@ ko:
clean_up_uploads: "불법 호스팅을 막기 위해서 참조되지 않은 업로드 파일은 제거한다. 주의 : 이 설정을 활성화 하기 전에 `/uploads` 디렉토리를 백업하는 것이 좋다."
clean_orphan_uploads_grace_period_hours: "참조되지 않은 업로드 파일을 제거하기 전 기간(시간)"
purge_deleted_uploads_grace_period_days: "참조되지 않은 업로드 파일을 완전 삭제하지 전 기간(일)"
purge_inactive_users_grace_period_days: "활성화 되지 않은 사용자를 삭제하기 까지의 기간(일)"
purge_unactivated_users_grace_period_days: "활성화 되지 않은 사용자를 삭제하기 까지의 기간(일)"
s3_access_key_id: "이미지를 업로드 할 때 사용할 Amazon S3의 access key id"
s3_secret_access_key: "이미지를 업로드 할 때 사용할 Amazon S3의 secret access key"
s3_region: "이미지를 업로드 할 때 사용할 Amazon S3 region"

View File

@ -661,7 +661,7 @@ pt_BR:
clean_up_uploads: "Remover envios sem referência para evitar hospedagem ilegal. AVISO: você pode querer fazer um backup do seu diretório de /uploads antes de habilitar essa configuração."
clean_orphan_uploads_grace_period_hours: "Carência (em horas) antes de um upload órfão ser removido."
purge_deleted_uploads_grace_period_days: "Carência (em dias) antes que um upload excluído seja apagado."
purge_inactive_users_grace_period_days: "Carência (em dias) antes de um usuário que não tenha ativado sua conta seja deletado."
purge_unactivated_users_grace_period_days: "Carência (em dias) antes de um usuário que não tenha ativado sua conta seja deletado."
min_trust_to_create_topic: "O nível de confiança mínimo necessário para criar um novo tópico."
min_trust_to_edit_wiki_post: "O nível de confiança mínimo necessário para editar uma postagem marcada como wiki."
title_fancy_entities: "Converter caracteres ASCII comuns em entidades HTML nos títulos dos tópicos, ala SmartyPants http://daringfireball.net/projects/smartypants/"

View File

@ -749,7 +749,7 @@ sq:
clean_up_uploads: "Remove orphan unreferenced uploads to prevent illegal hosting. WARNING: you may want to back up of your /uploads directory before enabling this setting."
clean_orphan_uploads_grace_period_hours: "Grace period (in hours) before an orphan upload is removed."
purge_deleted_uploads_grace_period_days: "Grace period (in days) before a deleted upload is erased."
purge_inactive_users_grace_period_days: "Grace period (in days) before a user who has not activated their account is deleted."
purge_unactivated_users_grace_period_days: "Grace period (in days) before a user who has not activated their account is deleted."
enable_s3_uploads: "Place uploads on Amazon S3 storage. IMPORTANT: requires valid S3 credentials (both access key id & secret access key)."
s3_use_iam_profile: 'Use AWS EC2 IAM role to retrieve keys. NOTE: enabling will override "s3 access key id" and "s3 secret access key" settings.'
s3_upload_bucket: "The Amazon S3 bucket name that files will be uploaded into. WARNING: must be lowercase, no periods, no underscores."

View File

@ -719,7 +719,7 @@ zh_CN:
clean_up_uploads: "移除孤立的已上传资料。警告:您可能想要在启用这个设定前备份一下 /uploads 目录。"
clean_orphan_uploads_grace_period_hours: "删除孤立上传资料的宽限期(单位:小时)"
purge_deleted_uploads_grace_period_days: "移除已删除的孤立上传资料的宽限期(单位:小时)"
purge_inactive_users_grace_period_days: "删除不活跃用户账户的宽限期(单位:天)。"
purge_unactivated_users_grace_period_days: "删除不活跃用户账户的宽限期(单位:天)。"
enable_s3_uploads: "上传至 Amazon S3 存储的地址。重要:需要有效的 S3 验证资料(包括 access key id & secret access key。"
s3_use_iam_profile: '使用 AWS EC2 IAM 角色来获得 key。注意启用这个会覆盖“S3 access key id”和“S3 secret access key” 设置。'
s3_upload_bucket: "上传文件保存于 Amazon S3 的 bucket 名字。警告:必须为小写,无句点,无下划线。"

View File

@ -285,7 +285,7 @@ users:
default: false
email_token_valid_hours: 24
email_token_grace_period_hours: 0
purge_inactive_users_grace_period_days: 7
purge_unactivated_users_grace_period_days: 7
public_user_custom_fields:
type: list
default: ''

View File

@ -1155,13 +1155,13 @@ describe User do
end
end
describe "#purge_inactive" do
describe "#purge_unactivated" do
let!(:user) { Fabricate(:user) }
let!(:inactive) { Fabricate(:user, active: false) }
let!(:inactive_old) { Fabricate(:user, active: false, created_at: 1.month.ago) }
it 'should only remove old, inactive users' do
User.purge_inactive
it 'should only remove old, unactivated users' do
User.purge_unactivated
all_users = User.all
all_users.include?(user).should == true
all_users.include?(inactive).should == true