Make WikiPage::prepareTextForEdit() emit deprecation warnings
[lhc/web/wiklou.git] / includes / page / WikiPage.php
index 2308ef0..8748856 100644 (file)
@@ -693,7 +693,7 @@ class WikiPage implements Page, IDBAccessObject {
         * @deprecated since 1.21, getContent() should be used instead.
         */
        public function getText( $audience = Revision::FOR_PUBLIC, User $user = null ) {
-               ContentHandler::deprecated( __METHOD__, '1.21' );
+               wfDeprecated( __METHOD__, '1.21' );
 
                $this->loadLastEdit();
                if ( $this->mLastRevision ) {
@@ -1577,7 +1577,7 @@ class WikiPage implements Page, IDBAccessObject {
         * @deprecated since 1.21: use doEditContent() instead.
         */
        public function doEdit( $text, $summary, $flags = 0, $baseRevId = false, $user = null ) {
-               ContentHandler::deprecated( __METHOD__, '1.21' );
+               wfDeprecated( __METHOD__, '1.21' );
 
                $content = ContentHandler::makeContent( $text, $this->getTitle() );
 
@@ -2075,7 +2075,7 @@ class WikiPage implements Page, IDBAccessObject {
         * @return object
         */
        public function prepareTextForEdit( $text, $revid = null, User $user = null ) {
-               ContentHandler::deprecated( __METHOD__, '1.21' );
+               wfDeprecated( __METHOD__, '1.21' );
                $content = ContentHandler::makeContent( $text, $this->getTitle() );
                return $this->prepareContentForEdit( $content, $revid, $user );
        }
@@ -2396,41 +2396,6 @@ class WikiPage implements Page, IDBAccessObject {
                }
        }
 
-       /**
-        * Edit an article without doing all that other stuff
-        * The article must already exist; link tables etc
-        * are not updated, caches are not flushed.
-        *
-        * @param Content $content Content submitted
-        * @param User $user The relevant user
-        * @param string $comment Comment submitted
-        * @param bool $minor Whereas it's a minor modification
-        * @param string $serialFormat Format for storing the content in the database
-        */
-       public function doQuickEditContent(
-               Content $content, User $user, $comment = '', $minor = false, $serialFormat = null
-       ) {
-
-               $serialized = $content->serialize( $serialFormat );
-
-               $dbw = wfGetDB( DB_MASTER );
-               $revision = new Revision( [
-                       'title'      => $this->getTitle(), // for determining the default content model
-                       'page'       => $this->getId(),
-                       'user_text'  => $user->getName(),
-                       'user'       => $user->getId(),
-                       'text'       => $serialized,
-                       'length'     => $content->getSize(),
-                       'comment'    => $comment,
-                       'minor_edit' => $minor ? 1 : 0,
-               ] ); // XXX: set the content object?
-               $revision->insertOn( $dbw );
-               $this->updateRevisionOn( $dbw, $revision );
-
-               Hooks::run( 'NewRevisionFromEditComplete', [ $this, $revision, false, $user ] );
-
-       }
-
        /**
         * Update the article's restriction field, and leave a log entry.
         * This works for protection both existing and non-existing pages.
@@ -2882,12 +2847,14 @@ class WikiPage implements Page, IDBAccessObject {
         * @param bool $u2 Unused
         * @param array|string &$error Array of errors to append to
         * @param User $user The deleting user
+        * @param array $tags Tags to apply to the deletion action
         * @return Status Status object; if successful, $status->value is the log_id of the
         *   deletion log entry. If the page couldn't be deleted because it wasn't
         *   found, $status is a non-fatal 'cannotdelete' error
         */
        public function doDeleteArticleReal(
-               $reason, $suppress = false, $u1 = null, $u2 = null, &$error = '', User $user = null
+               $reason, $suppress = false, $u1 = null, $u2 = null, &$error = '', User $user = null,
+               $tags = []
        ) {
                global $wgUser, $wgContentHandlerUseDB;
 
@@ -3026,6 +2993,7 @@ class WikiPage implements Page, IDBAccessObject {
                $logEntry->setPerformer( $user );
                $logEntry->setTarget( $logTitle );
                $logEntry->setComment( $reason );
+               $logEntry->setTags( $tags );
                $logid = $logEntry->insert();
 
                $dbw->onTransactionPreCommitOrIdle(
@@ -3499,7 +3467,7 @@ class WikiPage implements Page, IDBAccessObject {
                $dbr = wfGetDB( DB_REPLICA );
                $res = $dbr->select( 'categorylinks',
                        [ 'cl_to AS page_title, ' . NS_CATEGORY . ' AS page_namespace' ],
-                       // Have to do that since DatabaseBase::fieldNamesWithAlias treats numeric indexes
+                       // Have to do that since Database::fieldNamesWithAlias treats numeric indexes
                        // as not being aliases, and NS_CATEGORY is numeric
                        [ 'cl_from' => $id ],
                        __METHOD__ );
@@ -3550,7 +3518,7 @@ class WikiPage implements Page, IDBAccessObject {
                // NOTE: stub for backwards-compatibility. assumes the given text is
                // wikitext. will break horribly if it isn't.
 
-               ContentHandler::deprecated( __METHOD__, '1.21' );
+               wfDeprecated( __METHOD__, '1.21' );
 
                $handler = ContentHandler::getForModelID( CONTENT_MODEL_WIKITEXT );
                $oldContent = is_null( $oldtext ) ? null : $handler->unserializeContent( $oldtext );
@@ -3735,7 +3703,7 @@ class WikiPage implements Page, IDBAccessObject {
         *
         * @param Content|null $content Optional Content object for determining the
         *   necessary updates.
-        * @return DataUpdate[]
+        * @return DeferrableUpdate[]
         */
        public function getDeletionUpdates( Content $content = null ) {
                if ( !$content ) {