Filip has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/326326 )

Change subject: Replaced "Article::doEdit()" deprecated in MediaWiki 1.21
......................................................................

Replaced "Article::doEdit()" deprecated in MediaWiki 1.21

Replaced "Article" class with "WikiPage", and replaced "doEdit" with 
"doEditContent"

Bug: T151973
Change-Id: I05428c3ec6e7308dca836a535a7fb927b7718601
---
M classes/RDFIO_SMWPageWriter.php
1 file changed, 25 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/RDFIO 
refs/changes/26/326326/1

diff --git a/classes/RDFIO_SMWPageWriter.php b/classes/RDFIO_SMWPageWriter.php
index 3254c08..cfffcd2 100644
--- a/classes/RDFIO_SMWPageWriter.php
+++ b/classes/RDFIO_SMWPageWriter.php
@@ -9,26 +9,26 @@
        public function import( $wikiPages ) {
 
                foreach ( $wikiPages as $wikiTitle => $wikiPage ) {
-                       
+
                        // Sanitize the title a bit
                        $wikiTitle = str_replace('[','',$wikiTitle);
                        $wikiTitle = str_replace(']','',$wikiTitle);
-                       
+
                        $facts = $wikiPage['facts'];
                        $equivuris = $wikiPage['equivuris'];
-                       
+
                        # Populate the facts array also with the equivalent URI 
"facts"
                        foreach ( $equivuris as $equivuri ) {
                                $facts[] = array( 'p' => "Equivalent URI", 'o' 
=> $equivuri );
                        }
-                       
+
                        $mwTitleObj = Title::newFromText( $wikiTitle );
-                       
+
                        if ( !$mwTitleObj->exists() ) {
-                               // Create stub article 
-                               $this->writeToArticle( $wikiTitle, '', 'Article 
Created by RDFIO' );
-                       } 
-                       
+                               // Create stub page
+                               $this->writeToPage( $wikiTitle, '', 'Page 
Created by RDFIO' );
+                       }
+
                        $womWikiPage = WOMProcessor::getPageObject( $mwTitleObj 
);
                        $womPropertyObjs = array();
 
@@ -42,9 +42,9 @@
                                }
                        } catch( Exception $e ) {
                                // @TODO Take better care of this?
-                               // echo( '<pre>Exception when talking to WOM: ' 
. $e->getMessage() . '</pre>' ); 
+                               // echo( '<pre>Exception when talking to WOM: ' 
. $e->getMessage() . '</pre>' );
                        }
-                       
+
                        $newPropertiesAsWikiText = "\n";
 
                        foreach ( $facts as $fact ) {
@@ -55,34 +55,37 @@
                                        $newWomPropertyObj = new 
WOMPropertyModel( $pred, $obj, '' );
                                        $newPropertyAsWikiText = 
$newWomPropertyObj->getWikiText();
                                        $newPropertiesAsWikiText .= 
$newPropertyAsWikiText . "\n";
-                                       
+
                                        $wikiContent = 
$womWikiPage->getWikiText() . $newPropertiesAsWikiText;
                                } else {
                                        $womPropertyObj = 
$womPropertyObjs[$pred];
-                                       
+
                                        // Store the old wiki text for the 
fact, in order to replace later
                                        $oldPropertyText = 
$womPropertyObj->getWikiText();
-                                       
+
                                        // Create an updated property
                                        $objTitle = Title::newFromText( $obj );
                                        $newSMWPageValue = 
SMWWikiPageValue::makePageFromTitle( $objTitle );
                                        $womPropertyObj->setSMWDataValue( 
$newSMWPageValue );
                                        $newPropertyText = 
$womPropertyObj->getWikiText();
-                                               
+
                                        // Replace the existing property with 
new value
                                        $wikiContent = 
$womWikiPage->getWikiText();
                                        $wikiContent = str_replace( 
$oldPropertyText, $newPropertyText, $wikiContent );
                                }
-                       }                       
-                       // Write changes (or additions) to article
-                       $this->writeToArticle($wikiTitle, $wikiContent, 'Update 
by RDFIO');
+                       }
+                       // Write changes (or additions) to WikiPage
+                       $this->writeToPage($wikiTitle, $wikiContent, 'Update by 
RDFIO');
                }
        }
-       
-       protected function writeToArticle( $wikiTitle, $content, $summary ) {
+
+       protected function writeToPage( $wikiTitle, $content, $summary ) {
                $mwTitleObj = Title::newFromText( $wikiTitle );
-               $mwArticleObj = new Article( $mwTitleObj );
-               $mwArticleObj->doEdit( $content, $summary );
+               $mwPageObj = WikiPage::factory( $mwTitleObj );
+               $mwPageObj->doEditContent(
+                       ContentHandler::makeContent( $content, $mwTitleObj ),
+                       $summary
+               );
        }
 
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I05428c3ec6e7308dca836a535a7fb927b7718601
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/RDFIO
Gerrit-Branch: master
Gerrit-Owner: Filip <r...@protonmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to