Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add apprtype and apprlevel to AllPagesGenerator #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ashotjanibekyan
Copy link
Contributor

No description provided.

Upload
}

public enum ProtectionLevel
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some wikis may have more level. I used the English Wikipedia as a reference, the enum can be extended later.

Copy link
Owner

@CXuesong CXuesong Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've checked DB table and pr_level is a column of free text. Then probably you can use string as protection level, and use a another static class like ProtectionLevels to define common protection levels, like what I've been doing in LogActions class.

In the future we might consider introducing some utility structures like HttpMethod class for better strong-typing support.

@@ -85,6 +88,8 @@ public AllPagesGenerator(WikiSite site) : base(site)
{"apfilterlanglinks", LanguageLinkFilter.ToString("withlanglinks", "withoutlanglinks")},
{"apminsize", MinPageContentLength},
{"apmaxsize", MaxPageContentLength},
{"apprtype", ProtectionType != null && ProtectionType.Count != 0 ? string.Join('|', ProtectionType.Select(x => x.ToString().ToLower())) : null},
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use MediaWikiHelper.JoinValues instead of string.Join('|', ...).

Upload
}

public enum ProtectionLevel
Copy link
Owner

@CXuesong CXuesong Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've checked DB table and pr_level is a column of free text. Then probably you can use string as protection level, and use a another static class like ProtectionLevels to define common protection levels, like what I've been doing in LogActions class.

In the future we might consider introducing some utility structures like HttpMethod class for better strong-typing support.

@@ -110,4 +115,19 @@ public enum PropertyFilterOption
/// </summary>
WithoutProperty,
}

public enum ProtectionType
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as ProtectionLevel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants