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

phpcs: enable: Generic.Files.LineLength.TooLong #150

Merged
merged 33 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
fe7610d
phpcs: enable: `Generic.Files.LineLength.TooLong`
Universal-Omega Mar 22, 2022
fa78fe9
Update createTemplate.php
Universal-Omega Mar 22, 2022
46d1114
Update Parse.php
Universal-Omega Mar 22, 2022
a7f8ae9
Update Parse.php
Universal-Omega Mar 22, 2022
e6efee7
Update Parse.php
Universal-Omega Mar 22, 2022
c835088
CI: lint code to MediaWiki standards
Mar 22, 2022
8c8f04e
Update Parse.php
Universal-Omega Mar 22, 2022
ca4ba68
Merge branch 'master' into Universal-Omega-patch-2
Universal-Omega Jan 14, 2023
d900250
Update createTemplate.php
Universal-Omega Jan 14, 2023
a6f0fa8
name
Universal-Omega Feb 8, 2025
60695b4
Merge branch 'master' into Universal-Omega-patch-2
Universal-Omega Feb 8, 2025
4bc1847
Split line
Universal-Omega Feb 8, 2025
e628e44
Split line
Universal-Omega Feb 8, 2025
bb3b7ba
Split line
Universal-Omega Feb 8, 2025
b653893
Split line
Universal-Omega Feb 8, 2025
8f84d05
Split line
Universal-Omega Feb 8, 2025
3ddbc20
Split lines
Universal-Omega Feb 8, 2025
9bc2553
Split lines
Universal-Omega Feb 8, 2025
25e9a1a
CI: lint code to MediaWiki standards
Feb 8, 2025
e31204f
Split lines
Universal-Omega Feb 8, 2025
e0eef4b
Split lines
Universal-Omega Feb 8, 2025
bce1004
Split lines
Universal-Omega Feb 8, 2025
4ce2927
Split lines
Universal-Omega Feb 8, 2025
1bf160f
Split line
Universal-Omega Feb 8, 2025
a699909
Split lines
Universal-Omega Feb 8, 2025
69ab30a
Split lines
Universal-Omega Feb 8, 2025
a558bbc
Split lines
Universal-Omega Feb 8, 2025
8de32a0
Split lines
Universal-Omega Feb 8, 2025
e64fa43
CI: lint code to MediaWiki standards
Feb 8, 2025
af337bf
Split line
Universal-Omega Feb 8, 2025
c7a6af3
Split lines
Universal-Omega Feb 8, 2025
106e29d
Split lines
Universal-Omega Feb 8, 2025
c8822d1
Split lines
Universal-Omega Feb 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<ruleset>
<file>.</file>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="Generic.Files.LineLength.TooLong" />
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
</rule>
Expand Down
32 changes: 28 additions & 4 deletions includes/Parse.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ public function parse( $input, Parser $parser, &$reset, &$eliminate, $isParserTa

$restrictionStore = MediaWikiServices::getInstance()->getRestrictionStore();
// Check if DPL shall only be executed from protected pages.
if ( Config::getSetting( 'runFromProtectedPagesOnly' ) === true && $title && !$restrictionStore->isProtected( $title, 'edit' ) ) {
// Ideally we would like to allow using a DPL query if the query istelf is coded on a template page which is protected. Then there would be no need for the article to be protected. However, how can one find out from which wiki source an extension has been invoked???
if (
Config::getSetting( 'runFromProtectedPagesOnly' ) === true &&

Check warning

Code scanning / Phpmd (reported by Codacy)

Static access leads to hard to test code Warning

Avoid using static access to class 'MediaWiki\Extension\DynamicPageList3\Config' in method 'parse'.
$title && !$restrictionStore->isProtected( $title, 'edit' )
) {
// Ideally we would like to allow using a DPL query if the query istelf is coded on a template page which is protected.
// Then there would be no need for the article to be protected. However, how can one find out from which wiki source an extension has been invoked???
$this->logger->addMessage( Hooks::FATAL_NOTPROTECTED, $title->getPrefixedText() );

return $this->getFullOutput();
Expand Down Expand Up @@ -744,7 +748,15 @@ private function doQueryErrorChecks() {

// addeditdate=true but not (ordermethod=...,firstedit or ordermethod=...,lastedit)
// firstedit (resp. lastedit) -> add date of first (resp. last) revision
if ( $this->parameters->getParameter( 'addeditdate' ) && !array_intersect( $orderMethods, [ 'firstedit', 'lastedit' ] ) && ( $this->parameters->getParameter( 'allrevisionsbefore' ) || $this->parameters->getParameter( 'allrevisionssince' ) || $this->parameters->getParameter( 'firstrevisionsince' ) || $this->parameters->getParameter( 'lastrevisionbefore' ) ) ) {
if (
$this->parameters->getParameter( 'addeditdate' ) &&
!array_intersect( $orderMethods, [ 'firstedit', 'lastedit' ] ) && (
$this->parameters->getParameter( 'allrevisionsbefore' ) ||
$this->parameters->getParameter( 'allrevisionssince' ) ||
$this->parameters->getParameter( 'firstrevisionsince' ) ||
$this->parameters->getParameter( 'lastrevisionbefore' )
)
) {
$this->logger->addMessage( Hooks::FATAL_WRONGORDERMETHOD, 'addeditdate=true', 'firstedit | lastedit' );

return false;
Expand All @@ -769,7 +781,19 @@ private function doQueryErrorChecks() {
}

// add*** parameters have no effect with 'mode=category' (only namespace/title can be viewed in this mode)
if ( $this->parameters->getParameter( 'mode' ) == 'category' && ( $this->parameters->getParameter( 'addcategories' ) || $this->parameters->getParameter( 'addeditdate' ) || $this->parameters->getParameter( 'addfirstcategorydate' ) || $this->parameters->getParameter( 'addpagetoucheddate' ) || $this->parameters->getParameter( 'incpage' ) || $this->parameters->getParameter( 'adduser' ) || $this->parameters->getParameter( 'addauthor' ) || $this->parameters->getParameter( 'addcontribution' ) || $this->parameters->getParameter( 'addlasteditor' ) ) ) {
if (
$this->parameters->getParameter( 'mode' ) === 'category' && (
$this->parameters->getParameter( 'addcategories' ) ||
$this->parameters->getParameter( 'addeditdate' ) ||
$this->parameters->getParameter( 'addfirstcategorydate' ) ||
$this->parameters->getParameter( 'addpagetoucheddate' ) ||
$this->parameters->getParameter( 'incpage' ) ||
$this->parameters->getParameter( 'adduser' ) ||
$this->parameters->getParameter( 'addauthor' ) ||
$this->parameters->getParameter( 'addcontribution' ) ||
$this->parameters->getParameter( 'addlasteditor' )
)
) {
$this->logger->addMessage( Hooks::WARN_CATOUTPUTBUTWRONGPARAMS );
}

Expand Down
5 changes: 4 additions & 1 deletion maintenance/createTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ protected function doDBUpdates() {
$updater = $page->newPageUpdater( User::newSystemUser( 'DynamicPageList3 extension' ) );
$content = $page->getContentHandler()->makeContent( '<noinclude>This page was automatically created. It serves as an anchor page for all \'\'\'[[Special:WhatLinksHere/Template:Extension_DPL|invocations]]\'\'\' of [https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:DynamicPageList3 Extension:DynamicPageList3].</noinclude>', $title );
$updater->setContent( SlotRecord::MAIN, $content );
$comment = CommentStoreComment::newUnsavedComment( 'Autogenerated DynamicPageList3\'s necessary template for content inclusion.' );

$comment = CommentStoreComment::newUnsavedComment(
'Autogenerated DynamicPageList3\'s necessary template for content inclusion.'
);

$updater->saveRevision(
$comment,
Expand Down