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

1.25 / WikiPage::getCount is gone #47

Closed
mwjames opened this issue Jun 17, 2015 · 26 comments
Closed

1.25 / WikiPage::getCount is gone #47

mwjames opened this issue Jun 17, 2015 · 26 comments

Comments

@mwjames
Copy link
Contributor

mwjames commented Jun 17, 2015

I'm guessing

https://github.com/SemanticMediaWiki/SemanticExtraSpecialProperties/blob/master/src/Annotator/ExtraPropertyAnnotator.php#L206-L209

    private function makeNumberOfPageViewsDataItem() {
        if ( !$this->configuration['wgDisableCounters'] && $this->getWikiPage()->getCount() ) {
            return new DINumber( $this->getWikiPage()->getCount() );
        }
    }

will fail now that WikiPage::getCount() is gone in 1.25 (wikimedia/mediawiki@90d90da#diff-a0f7feeaae57e9d2c735c8919c16ad15)

See also https://gerrit.wikimedia.org/r/#/c/221427/.

@kghbln Maybe something to follow-up? / https://www.mediawiki.org/wiki/Extension:HitCounters

@kghbln
Copy link
Member

kghbln commented Jun 17, 2015

Indeed it will be nice to have a check for the presence of the HitCounters extension. Hope to do a field test if both extensions play soon.

@kghbln
Copy link
Member

kghbln commented Jun 17, 2015

Nope, they do not play. SESP creates the respective table for the views however no views a piped into it. The special property for views does not show up.

@mwjames
Copy link
Contributor Author

mwjames commented Jun 17, 2015

I expected it to crash since $this->getWikiPage()->getCount() would lead to a fatal in 1.25 for when $GLOBALS['wgDisableCounters'] = true.

SESP creates the respective table for the views however no views a piped into it. The special property for views does not show up.

As expected because SESP only looks for $this->getWikiPage()->getCount() and as far as I know Extension:HitCounters does not extend WikiPage::getCount.

@kghbln
Copy link
Member

kghbln commented Jun 17, 2015

Ah, so the way out should be provided by the HitCounters extension. I will give Mark a ping about it and depending on his assessment we will probably kill this in SESP or not if there is no other way.

@mwjames
Copy link
Contributor Author

mwjames commented Jun 17, 2015

@hexmode Any chance of getting Composer support for Extension:HitCounters otherwise making the whole git download thing in combination with extensions that require WikiPage::getCount are going to be a pain.

@kghbln
Copy link
Member

kghbln commented Jun 17, 2015

@mwjames Thanks for pinging @hexmode :)

@mwjames
Copy link
Contributor Author

mwjames commented Jun 17, 2015

@hexmode What is the replacement for WikiPage::getCount?

@hexmode
Copy link
Member

hexmode commented Jun 17, 2015

@hexmode What is the replacement for WikiPage::getCount?

HitCounters::getCount( $title )

@hexmode
Copy link
Member

hexmode commented Jun 17, 2015

mwjames writes:

@hexmode Any chance of getting Composer support for
Extension:HitCounters

Certainly, but I don't have time right now. I'd happily take a patch...

@mwjames mwjames added this to the SESP 1.4 milestone Jun 20, 2015
@cicalese
Copy link
Contributor

cicalese commented Sep 8, 2015

It would be helpful to me for this issue to be resolved. What is the next step in moving it forward? Is composer support in HitCounters the only limitation?

@kghbln
Copy link
Member

kghbln commented Sep 8, 2015

From what I got out of this implementing HitCounters::getCount( $title ) instead of WikiPage::getCount is the thing to be done here. I guess composer support for HitCounters is a nice to have, but will not get the 'number of views' property back.

@mwjames
Copy link
Contributor Author

mwjames commented Sep 8, 2015

What is the next step in moving it forward? Is composer support in HitCounters the only limitation?

It would certainly help to clarify the dependency together with a spaghetti check that contains something like (under the expectation that HitCounters::getCount is a stable accessors):

        $count = null;

        if ( class_exists( '\HitCounters' ) ) {
            $count = \HitCounters::getCount( $this->getWikiPage()->getTitle() );
        } elseif ( method_exists( $this->getWikiPage(), 'getCount' ) ) {
            $count = $this->getWikiPage()->getCount();
        }

        if ( !$this->configuration['wgDisableCounters'] && is_numeric( $count ) ) {
            return new DINumber( $count );
        }

@hexmode
Copy link
Member

hexmode commented Sep 8, 2015

I still don't have time to work on composer support HitCounters, but, as I said, I would take a patch.

It looks like this could be resolved if someone were to create a pull request with the "spaghetti check" that @mwjames suggested. Or maybe @mwjames was already going to do that?

@kghbln
Copy link
Member

kghbln commented Sep 8, 2015

Adding composter support is probably something for @paladox He worked on the HitCounters extension in the past too. Just a suggestion though.

@mwjames
Copy link
Contributor Author

mwjames commented Sep 8, 2015

Or maybe @mwjames was already going to do that?

No.

@paladox
Copy link

paladox commented Sep 8, 2015

@kghbln do you mean adding composer support to HitCounters. If so apparently composer support is no longer being added to mediawiki extensions and skins only being used for test per @legoktm when I tried adding the support to confirmaccount the patch was reverted due to support not being added.

@kghbln
Copy link
Member

kghbln commented Sep 8, 2015

Thanks for the insight @paladox I am in an land of confusion now but I guess this is just the way it is. Dunno what to say or write.

@kghbln
Copy link
Member

kghbln commented Sep 8, 2015

Let's focus on the actual issue: #47 (comment)

@mwjames
Copy link
Contributor Author

mwjames commented Sep 8, 2015

composer support is no longer being added to mediawiki extensions and skins only being used for test per @legoktm

I am in an land of confusion now but I guess this is just the way it is. Dunno what to say or write.

This what the WMF has decided, this isn't true for SMW or its extension and since we don't adhere a WMF regime we will not stop supporting this just because someone decided to do so.

@paladox
Copy link

paladox commented Sep 8, 2015

Ok.

@cicalese
Copy link
Contributor

cicalese commented Sep 8, 2015

So, if I test mwjames' suggested patch above with HitCounters,and it works, and I submit a pull request with the modified code, will the pull request be merged even if HitCounters does not yet support composer?

@mwjames
Copy link
Contributor Author

mwjames commented Sep 8, 2015

... and I submit a pull request with the modified code, will the pull request be merged even if ...

Of course (given that tests are passed).

PS: Any contribution and engagement is welcome.

@cicalese
Copy link
Contributor

cicalese commented Sep 8, 2015

Great! I will do so.

@cicalese
Copy link
Contributor

cicalese commented Sep 8, 2015

The suggested code worked great with one minor modification to include the HitCounters namespace.

@JeroenDeDauw
Copy link
Member

@cicalese will you submit this as a pull request?

@cicalese
Copy link
Contributor

cicalese commented Sep 8, 2015

Sorry! I forgot the last step in creating the pull request. It is submitted now.

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

No branches or pull requests

6 participants