jenkins-bot has submitted this change and it was merged.

Change subject: Remove $wgTitle usage
......................................................................


Remove $wgTitle usage

Change-Id: Iff477668a4ab7a3aa0a10c6768dd1a297333f775
---
M AdvancedMeta.php
1 file changed, 14 insertions(+), 23 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/AdvancedMeta.php b/AdvancedMeta.php
index ee78b20..8dd82cc 100644
--- a/AdvancedMeta.php
+++ b/AdvancedMeta.php
@@ -142,7 +142,9 @@
         */
        public function onParserBeforeTidy( &$parser, &$text ) {
 
-               global $wgTitle, $wgUser, $wgRequest;
+               global $wgUser, $wgRequest;
+
+               $title = $parser->getTitle();
 
                // only run this hook for edit forms
                if ( !$wgRequest->getVal( 'action' ) == ( 'edit' || 'submit' ) 
) return false;
@@ -162,10 +164,10 @@
                                );
                } else {
                                // else just get the meta from the db
-                               $meta = $this->getMetaByArticleID( 
$wgTitle->getArticleID() );
+                               $meta = $this->getMetaByArticleID( 
$title->getArticleID() );
 
                                // no meta or creating a new article? make 
default values
-                               if ( empty( $meta ) || $wgTitle->getArticleID() 
== '0' ) {
+                               if ( empty( $meta ) || $title->getArticleID() 
== '0' ) {
                                                $meta = array(
                                                                'rindex' => '1',
                                                                'rfollow' => 
'1',
@@ -199,7 +201,7 @@
                                <br /><strong>" . wfMsg( 'ameta-titlealias' ) . 
"</strong><br />
                                <input type='text' name='wpTitleAlias' 
id='wpTitleAlias' value='{$meta['titlealias']}' size='64'>
 
-                               <br /><strong>Keywords:</strong> <small>" . 
wfMessage( 'ameta-keywordsadd', count( $addedkeywords ) )->text() . "<a 
href='javascript:;' title='" . wfMsg( 'ameta-keywordsmodify' ) . "'>" . 
htmlspecialchars( str_replace( "$1", $wgTitle, $addedkeywords ) ) . "</a>
+                               <br /><strong>Keywords:</strong> <small>" . 
wfMessage( 'ameta-keywordsadd', count( $addedkeywords ) )->text() . "<a 
href='javascript:;' title='" . wfMsg( 'ameta-keywordsmodify' ) . "'>" . 
htmlspecialchars( str_replace( "$1", $title, $addedkeywords ) ) . "</a>
                                </small><br />
                                <textarea tabindex='4' name='wpKeywords' 
id='wpKeywords' rows='1'
                                
cols='{$cols}'{$ew}>{$meta['keywords']}</textarea>
@@ -306,11 +308,12 @@
         * @return true
         */
        function onOutputPageBeforeHTML( &$out, &$text ) {
-               global $wgTitle, $wgArticleRobotPolicies, $wgDefaultRobotPolicy;
+               global $wgArticleRobotPolicies, $wgDefaultRobotPolicy;
 
-               $articleid = $wgTitle->getPrefixedText();
-               $addedkeywords = wfMsg( 'globalkeywords' ) == 
'&lt;globalkeywords&gt;' ? '' : wfMsg( 'globalkeywords' , $wgTitle );
-               $meta = $this->getMetaByArticleID( $wgTitle->getArticleID() );
+               $title = $out->getTitle();
+               $articleid = $title->getPrefixedText();
+               $addedkeywords = wfMsg( 'globalkeywords' ) == 
'&lt;globalkeywords&gt;' ? '' : wfMsg( 'globalkeywords' , $title );
+               $meta = $this->getMetaByArticleID( $title->getArticleID() );
 
                /* robots policies */
 
@@ -318,7 +321,7 @@
                $policy = $wgDefaultRobotPolicy;
 
                // fallback policy for pages that are not in the indexed 
namespaces and have no db info
-               if ( !in_array( $wgTitle->getnamespace(), $this->indexedPages ) 
) {
+               if ( !in_array( $title->getnamespace(), $this->indexedPages ) ) 
{
                   $policy = 'noindex,follow';
                }
 
@@ -361,10 +364,7 @@
         * @return true
         */
        function onBeforePageDisplay( &$out, &$text ) {
-
-               global $wgTitle;
-
-               $meta = $this->getMetaByArticleID( $wgTitle->getArticleID() );
+               $meta = $this->getMetaByArticleID( 
$out->getTitle()->getArticleID() );
 
                if ( empty( $meta ) ) {
                        return true;
@@ -410,16 +410,7 @@
        }
 
        private function canEditMeta() {
-
-               global $wgUser, $wgTitle;
-
-               //$ns = $wgTitle->getNamespace();
-
-               // redirect pages don't need metadata
-               // TODO: make work in MediaWiki < 1.13
-               //        if ($wgTitle->isRedirect()) {
-               //            return false;
-               //        }
+               global $wgUser;
 
                // does the user have permission?
                return ( in_array( $wgUser->getName(), $this->allowedUsers )

-- 
To view, visit https://gerrit.wikimedia.org/r/162151
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iff477668a4ab7a3aa0a10c6768dd1a297333f775
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/AdvancedMeta
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to