$this->mContentObject = $content;
$this->mRevIdFetched = $this->mRevision->getId();
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $articlePage = $this;
+
ContentHandler::runLegacyHooks(
'ArticleAfterFetchContentObject',
- [ &$this, &$this->mContentObject ],
+ [ &$articlePage, &$this->mContentObject ],
'1.21'
);
while ( !$outputDone && ++$pass ) {
switch ( $pass ) {
case 1:
- Hooks::run( 'ArticleViewHeader', [ &$this, &$outputDone, &$useParserCache ] );
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $articlePage = $this;
+ Hooks::run( 'ArticleViewHeader', [ &$articlePage, &$outputDone, &$useParserCache ] );
break;
case 2:
# Early abort if the page doesn't exist
$redirectTargetUrl = $this->getTitle()->getLinkURL( $query );
if ( isset( $this->mRedirectedFrom ) ) {
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $articlePage = $this;
+
// This is an internally redirected page view.
// We'll need a backlink to the source page for navigation.
- if ( Hooks::run( 'ArticleViewRedirect', [ &$this ] ) ) {
+ if ( Hooks::run( 'ArticleViewRedirect', [ &$articlePage ] ) ) {
$redir = Linker::linkKnown(
$this->mRedirectedFrom,
null,
* @param int $oldid Revision ID of this article revision
*/
public function setOldSubtitle( $oldid = 0 ) {
- if ( !Hooks::run( 'DisplayOldSubtitle', [ &$this, &$oldid ] ) ) {
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $articlePage = $this;
+
+ if ( !Hooks::run( 'DisplayOldSubtitle', [ &$articlePage, &$oldid ] ) ) {
return;
}
&& !$this->mRedirectedFrom && !$this->getTitle()->isRedirect();
// Extension may have reason to disable file caching on some pages.
if ( $cacheable ) {
- $cacheable = Hooks::run( 'IsFileCacheable', [ &$this ] );
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $articlePage = $this;
+ $cacheable = Hooks::run( 'IsFileCacheable', [ &$articlePage ] );
}
}
protected function pageData( $dbr, $conditions, $options = [] ) {
$fields = self::selectFields();
- Hooks::run( 'ArticlePageDataBefore', [ &$this, &$fields ] );
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $wikiPage = $this;
+
+ Hooks::run( 'ArticlePageDataBefore', [ &$wikiPage, &$fields ] );
$row = $dbr->selectRow( 'page', $fields, $conditions, __METHOD__, $options );
* @return bool
*/
public function doPurge( $flags = self::PURGE_ALL ) {
- if ( !Hooks::run( 'ArticlePurge', [ &$this ] ) ) {
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $wikiPage = $this;
+
+ if ( !Hooks::run( 'ArticlePurge', [ &$wikiPage ] ) ) {
return false;
}
$user = $user ?: $wgUser;
$flags = $this->checkFlags( $flags );
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $wikiPage = $this;
+
// Trigger pre-save hook (using provided edit summary)
$hookStatus = Status::newGood( [] );
- $hook_args = [ &$this, &$user, &$content, &$summary,
+ $hook_args = [ &$wikiPage, &$user, &$content, &$summary,
$flags & EDIT_MINOR, null, null, &$flags, &$hookStatus ];
// Check if the hook rejected the attempted save
if ( !Hooks::run( 'PageContentSave', $hook_args )
'oldrevision' => $meta['oldRevision']
]
);
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $wikiPage = $this;
// Trigger post-save hook
- $params = [ &$this, &$user, $content, $summary, $flags & EDIT_MINOR,
+ $params = [ &$wikiPage, &$user, $content, $summary, $flags & EDIT_MINOR,
null, null, &$flags, $revision, &$status, $meta['baseRevId'],
$meta['undidRevId'] ];
ContentHandler::runLegacyHooks( 'ArticleSaveComplete', $params );
) {
// Update links, etc.
$this->doEditUpdates( $revision, $user, [ 'created' => true ] );
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $wikiPage = $this;
// Trigger post-create hook
- $params = [ &$this, &$user, $content, $summary,
+ $params = [ &$wikiPage, &$user, $content, $summary,
$flags & EDIT_MINOR, null, null, &$flags, $revision ];
ContentHandler::runLegacyHooks( 'ArticleInsertComplete', $params, '1.21' );
Hooks::run( 'PageContentInsertComplete', $params );
}
}
- Hooks::run( 'ArticleEditUpdates', [ &$this, &$editInfo, $options['changed'] ] );
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $wikiPage = $this;
+
+ Hooks::run( 'ArticleEditUpdates', [ &$wikiPage, &$editInfo, $options['changed'] ] );
- if ( Hooks::run( 'ArticleEditUpdatesDeleteFromRecentchanges', [ &$this ] ) ) {
+ if ( Hooks::run( 'ArticleEditUpdatesDeleteFromRecentchanges', [ &$wikiPage ] ) ) {
// Flush old entries from the `recentchanges` table
if ( mt_rand( 0, 9 ) == 0 ) {
JobQueueGroup::singleton()->lazyPush( RecentChangesUpdateJob::newPurgeJob() );
if ( !$recipient ) {
wfDebug( __METHOD__ . ": invalid username\n" );
} else {
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $wikiPage = $this;
+
// Allow extensions to prevent user notification
// when a new message is added to their talk page
- if ( Hooks::run( 'ArticleEditUpdateNewTalk', [ &$this, $recipient ] ) ) {
+ if ( Hooks::run( 'ArticleEditUpdateNewTalk', [ &$wikiPage, $recipient ] ) ) {
if ( User::isIP( $shortTitle ) ) {
// An anonymous user
$recipient->setNewtalk( true, $revision );
$nullRevision = null;
if ( $id ) { // Protection of existing page
- if ( !Hooks::run( 'ArticleProtect', [ &$this, &$user, $limit, $reason ] ) ) {
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $wikiPage = $this;
+
+ if ( !Hooks::run( 'ArticleProtect', [ &$wikiPage, &$user, $limit, $reason ] ) ) {
return Status::newGood();
}
__METHOD__
);
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $wikiPage = $this;
+
Hooks::run( 'NewRevisionFromEditComplete',
[ $this, $nullRevision, $latest, $user ] );
- Hooks::run( 'ArticleProtectComplete', [ &$this, &$user, $limit, $reason ] );
+ Hooks::run( 'ArticleProtectComplete', [ &$wikiPage, &$user, $limit, $reason ] );
} else { // Protection of non-existing page (also known as "title protection")
// Cascade protection is meaningless in this case
$cascade = false;
return $status;
}
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $wikiPage = $this;
+
$user = is_null( $user ) ? $wgUser : $user;
if ( !Hooks::run( 'ArticleDelete',
- [ &$this, &$user, &$reason, &$error, &$status, $suppress ]
+ [ &$wikiPage, &$user, &$reason, &$error, &$status, $suppress ]
) ) {
if ( $status->isOK() ) {
// Hook aborted but didn't set a fatal status