From 25ba7ada356f0984c199585f31a1f79a0fcbd9e8 Mon Sep 17 00:00:00 2001 From: Robin van der Wiel Date: Mon, 22 Jul 2024 14:26:03 +0200 Subject: [PATCH 1/5] Revert changing SMW config variables Fixes https://github.com/SemanticMediaWiki/SemanticResultFormats/issues/842 --- formats/datatables/Hooks.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/formats/datatables/Hooks.php b/formats/datatables/Hooks.php index 4ecf1463..a6413f71 100644 --- a/formats/datatables/Hooks.php +++ b/formats/datatables/Hooks.php @@ -67,11 +67,11 @@ public static function onSMWStoreBeforeQueryResultLookupComplete( $store, $query } private static function getCount( $query, $queryEngine ) { - global $wgSmQMaxLimit, $wgSmQMaxInlineLimit; + global $smwgQMaxLimit, $smwgQMaxInlineLimit; $queryDescription = $query->getDescription(); $queryCount = new \SMWQuery( $queryDescription ); - $queryCount->setLimit( min( $wgSmQMaxLimit, $wgSmQMaxInlineLimit ) ); + $queryCount->setLimit( min( $smwgQMaxLimit, $smwgQMaxInlineLimit ) ); $queryCount->setQuerySource( \SMWQuery::MODE_COUNT ); $queryResult = $queryEngine->getQueryResult( $queryCount ); From 3258b181bc1badc593a05d79acdf57f53219d872 Mon Sep 17 00:00:00 2001 From: Robin van der Wiel Date: Mon, 22 Jul 2024 14:28:31 +0200 Subject: [PATCH 2/5] Correctly get SMW configuration variables --- formats/datatables/Api.php | 9 ++++----- formats/slideshow/SRF_SlideShowApi.php | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/formats/datatables/Api.php b/formats/datatables/Api.php index 23929eef..2ed3c1b0 100644 --- a/formats/datatables/Api.php +++ b/formats/datatables/Api.php @@ -237,7 +237,7 @@ public function execute() { } } - $smwgQMaxSize = $this->getConfig()->get(); + global $smwgQMaxSize; if ( !count( $queryDisjunction ) ) { $queryDisjunction = [ '' ]; @@ -276,8 +276,7 @@ public function execute() { // or SMW_OUTPUT_RAW $res = $printer->getResult( $results, $queryParams, SMW_OUTPUT_FILE ); - $smwgQMaxLimit = $this->getConfig()->get(); - $smwgQMaxInlineLimit = $this->getConfig()->get(); + global $smwgQMaxLimit, $smwgQMaxInlineLimit; // get count if ( !empty( $datatableData['search']['value'] ) || count( $queryConjunction ) ) { @@ -356,8 +355,8 @@ protected function getAllowedParams() { * @return string */ public function getVersion() { - $srfg = $this->getConfig()->get(); - $gitSha1 = SpecialVersion::getGitHeadSha1( $srfg ); + global $srfgIP; + $gitSha1 = SpecialVersion::getGitHeadSha1( $srfgIP ); return __CLASS__ . '-' . SRF_VERSION . ( $gitSha1 !== false ) ? ' (' . substr( $gitSha1, 0, 7 ) . ')' : ''; } diff --git a/formats/slideshow/SRF_SlideShowApi.php b/formats/slideshow/SRF_SlideShowApi.php index fcc4dcea..b7a400b8 100644 --- a/formats/slideshow/SRF_SlideShowApi.php +++ b/formats/slideshow/SRF_SlideShowApi.php @@ -175,8 +175,8 @@ protected function getParamDescription() { * @return string */ public function getVersion() { - $srfg = $this->getConfig()->get(); - $gitSha1 = SpecialVersion::getGitHeadSha1( $srfg ); + global $srfgIP; + $gitSha1 = SpecialVersion::getGitHeadSha1( $srfgIP ); return __CLASS__ . '-' . SRF_VERSION . ( $gitSha1 !== false ) ? ' (' . substr( $gitSha1, 0, 7 ) . ')' : ''; } From 389d954faa0e290e96b35effaa39777f6b174802 Mon Sep 17 00:00:00 2001 From: Robin van der Wiel Date: Mon, 22 Jul 2024 14:39:23 +0200 Subject: [PATCH 3/5] Add exclusions --- .phpcs.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.phpcs.xml b/.phpcs.xml index 10f250a2..51afa94c 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -22,10 +22,11 @@ + - + From e9d47893959d02a6fc4857f7e3554ec00c52d8a7 Mon Sep 17 00:00:00 2001 From: Robin van der Wiel Date: Mon, 22 Jul 2024 14:40:11 +0200 Subject: [PATCH 4/5] Change exclusion rule --- .phpcs.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.phpcs.xml b/.phpcs.xml index 51afa94c..9bbf406d 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -22,11 +22,12 @@ + - + From 2ee546c52483797b7790dd7695b5e6e1193d0b51 Mon Sep 17 00:00:00 2001 From: Robin van der Wiel Date: Wed, 14 Aug 2024 12:53:57 +0200 Subject: [PATCH 5/5] Revert changing $srfg to $wgSrfg --- formats/array/SRF_Array.php | 16 ++++----- formats/calendar/SRF_Calendar.php | 20 +++++------ formats/graphviz/SRF_Process.php | 38 ++++++++++----------- tests/phpunit/Integration/ResourcesTest.php | 4 +-- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/formats/array/SRF_Array.php b/formats/array/SRF_Array.php index 91404f4d..65ecff5b 100644 --- a/formats/array/SRF_Array.php +++ b/formats/array/SRF_Array.php @@ -290,8 +290,8 @@ protected function initializeCfgValue( $dfltVal, $dfltCacheKey ) { if ( $cache === null ) { // cache can't be initialized, propably function-reference in userconfig // but format is not used in inline context, use fallback in this case: - global $wgSrfgArraySepTextualFallbacks; - $cache = $wgSrfgArraySepTextualFallbacks[$dfltCacheKey]; + global $srfgArraySepTextualFallbacks; + $cache = $srfgArraySepTextualFallbacks[$dfltCacheKey]; } } return $cache; @@ -439,32 +439,32 @@ public function getParamDefinitions( array $definitions ) { ]; // separators (default values are defined in the following globals:) - global $wgSrfgArraySep, $wgSrfgArrayPropSep, $wgSrfgArrayManySep, $wgSrfgArrayRecordSep, $wgSrfgArrayHeaderSep; + global $srfgArraySep, $srfgArrayPropSep, $srfgArrayManySep, $srfgArrayRecordSep, $srfgArrayHeaderSep; $params['sep'] = [ 'message' => 'smw-paramdesc-sep', - 'default' => $this->initializeCfgValue( $wgSrfgArraySep, 'sep' ), + 'default' => $this->initializeCfgValue( $srfgArraySep, 'sep' ), ]; $params['propsep'] = [ 'message' => 'srf_paramdesc_propsep', - 'default' => $this->initializeCfgValue( $wgSrfgArrayPropSep, 'propsep' ), + 'default' => $this->initializeCfgValue( $srfgArrayPropSep, 'propsep' ), ]; $params['manysep'] = [ 'message' => 'srf_paramdesc_manysep', - 'default' => $this->initializeCfgValue( $wgSrfgArrayManySep, 'manysep' ), + 'default' => $this->initializeCfgValue( $srfgArrayManySep, 'manysep' ), ]; $params['recordsep'] = [ 'message' => 'srf_paramdesc_recordsep', - 'default' => $this->initializeCfgValue( $wgSrfgArrayRecordSep, 'recordsep' ), + 'default' => $this->initializeCfgValue( $srfgArrayRecordSep, 'recordsep' ), 'aliases' => [ 'narysep', 'rcrdsep', 'recsep' ], ]; $params['headersep'] = [ 'message' => 'srf_paramdesc_headersep', - 'default' => $this->initializeCfgValue( $wgSrfgArrayHeaderSep, 'headersep' ), + 'default' => $this->initializeCfgValue( $srfgArrayHeaderSep, 'headersep' ), 'aliases' => [ 'narysep', 'rcrdsep', 'recsep' ], ]; diff --git a/formats/calendar/SRF_Calendar.php b/formats/calendar/SRF_Calendar.php index 5454ec6d..9569b8f2 100644 --- a/formats/calendar/SRF_Calendar.php +++ b/formats/calendar/SRF_Calendar.php @@ -316,8 +316,8 @@ public function formatDateStr( $object ) { } public function displayCalendar( $events ) { - global $wgSrfgFirstDayOfWeek; - global $wgSrfgScriptPath; + global $srfgFirstDayOfWeek; + global $srfgScriptPath; $context = RequestContext::getMain(); $request = $context->getRequest(); @@ -332,7 +332,7 @@ public function displayCalendar( $events ) { 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen, print', - 'href' => $wgSrfgScriptPath + 'href' => $srfgScriptPath . '/formats/calendar/resources/ext.srf.calendar.css' ] ); @@ -385,16 +385,16 @@ public function displayCalendar( $events ) { 6 => wfMessage( 'friday' )->text(), 7 => wfMessage( 'saturday' )->text() ]; - if ( empty( $wgSrfgFirstDayOfWeek ) ) { + if ( empty( $srfgFirstDayOfWeek ) ) { $firstDayOfWeek = 1; $lastDayOfWeek = 7; } else { $firstDayOfWeek = - array_search( $wgSrfgFirstDayOfWeek, $weekDayNames ); + array_search( $srfgFirstDayOfWeek, $weekDayNames ); if ( $firstDayOfWeek === false ) { - // Bad value for $wgSrfgFirstDayOfWeek! - print 'Warning: Bad value for $wgSrfgFirstDayOfWeek "' . - '(' . $wgSrfgFirstDayOfWeek . '")'; + // Bad value for $srfgFirstDayOfWeek! + print 'Warning: Bad value for $srfgFirstDayOfWeek "' . + '(' . $srfgFirstDayOfWeek . '")'; $firstDayOfWeek = 1; } if ( $firstDayOfWeek == 1 ) { @@ -516,10 +516,10 @@ public function displayCalendar( $events ) {