/**
* @var Content
+ * @since 1.WD
*/
var $mContentObject;
* This function has side effects! Do not use this function if you
* only want the real revision text if any.
*
- * @deprecated in 1.20; use getContentObject() instead
+ * @deprecated in 1.WD; use getContentObject() instead
*
* @return string The text of this revision
*/
public function getContent() {
- wfDeprecated( __METHOD__, '1.20' );
+ wfDeprecated( __METHOD__, '1.WD' );
$content = $this->getContentObject();
return ContentHandler::getContentText( $content );
}
* only want the real revision text if any.
*
* @return Content
+ *
+ * @since 1.WD
*/
protected function getContentObject() {
global $wgUser;
* Does *NOT* follow redirects.
*
* @return mixed string containing article contents, or false if null
- * @deprecated in 1.20, use getContentObject() instead
+ * @deprecated in 1.WD, use getContentObject() instead
*/
protected function fetchContent() { #BC cruft!
- wfDeprecated( __METHOD__, '1.20' );
+ wfDeprecated( __METHOD__, '1.WD' );
if ( $this->mContentLoaded && $this->mContent ) {
return $this->mContent;
* TODO: when is this null?
*
* @return Content|null
+ *
+ * @since 1.WD
*/
protected function fetchContentObject() {
if ( $this->mContentLoaded ) {
* @param $newtext
* @param $flags
* @return string
- * @deprecated since 1.20, use ContentHandler::getAutosummary() instead
+ * @deprecated since 1.WD, use ContentHandler::getAutosummary() instead
*/
public static function getAutosummary( $oldtext, $newtext, $flags ) {
return WikiPage::getAutosummary( $oldtext, $newtext, $flags );
* A content object represents page content, e.g. the text to show on a page.
* Content objects have no knowledge about how they relate to Wiki pages.
*
+ * @since 1.WD
*/
abstract class Content {
/**
- * Name of the content model this COntent object represents.
+ * Name of the content model this Content object represents.
* Use with CONTENT_MODEL_XXX constants
*
* @var String $model_name
* same as their serialized form. Examples would be JavaScript and CSS code. As of now,
* this also applies to wikitext (mediawiki's default content type), but wikitext
* content may be represented by a DOM or AST structure in the future.
+ *
+ * @since 1.WD
*/
abstract class ContentHandler {
* @param $def_text string
* @return mixed string on success, $def_text for invalid sections
* @private
- * @deprecated since 1.20
+ * @deprecated since 1.WD
*/
function getContent( $def_text = false ) { #FIXME: deprecated, replace usage!
+ wfDeprecated( __METHOD__, '1.WD' );
+
if ( $def_text !== null && $def_text !== false && $def_text !== '' ) {
$def_content = ContentHandler::makeContent( $def_text, $this->getTitle() );
} else {
* WikiPage::getContent( Revision::RAW ) except that when the page doesn't exist an empty
* content object is returned instead of null.
*
- * @since 1.20
+ * @since 1.WD
* @return string
*/
private function getCurrentContent() {
* Use this method before edit() to preload some text into the edit box
*
* @param $text string
- * @deprecated since 1.20
+ * @deprecated since 1.WD
*/
- public function setPreloadedText( $text ) { #FIXME: deprecated, use setPreloadedContent()
- wfDeprecated( __METHOD__, "1.20" );
+ public function setPreloadedText( $text ) {
+ wfDeprecated( __METHOD__, "1.WD" );
$content = ContentHandler::makeContent( $text, $this->getTitle() );
* Use this method before edit() to preload some content into the edit box
*
* @param $content Content
+ *
+ * @since 1.WD
*/
- public function setPreloadedContent( Content $content ) { #FIXME: use this!
+ public function setPreloadedContent( Content $content ) {
$this->mPreloadedContent = $content;
}
* an earlier setPreloadText() or by loading the given page.
*
* @param $preload String: representing the title to preload from.
+ *
* @return String
- * @deprecated since 1.20
+ *
+ * @deprecated since 1.WD, use getPreloadedContent() instead
*/
- protected function getPreloadedText( $preload ) { #FIXME: B/C only, replace usage!
- wfDeprecated( __METHOD__, "1.20" );
+ protected function getPreloadedText( $preload ) { #NOTE: B/C only, replace usage!
+ wfDeprecated( __METHOD__, "1.WD" );
$content = $this->getPreloadedContent( $preload );
$text = $content->serialize( $this->content_format ); #XXX: really use serialized form? use ContentHandler::getContentText() instead?!
return $text;
}
- protected function getPreloadedContent( $preload ) { #FIXME: use this!
+ /**
+ * Get the contents to be preloaded into the box, either set by
+ * an earlier setPreloadText() or by loading the given page.
+ *
+ * @param $preload String: representing the title to preload from.
+ *
+ * @return Content
+ *
+ * @since 1.WD
+ */
+ protected function getPreloadedContent( $preload ) { #@todo: use this!
global $wgUser;
if ( !empty( $this->mPreloadContent ) ) {
* @parma $editText string
*
* @return bool
- * @deprecated since 1.20
+ * @deprecated since 1.WD, use mergeChangesIntoContent() instead
*/
function mergeChangesInto( &$editText ){
- wfDebug( __METHOD__, "1.20" );
+ wfDebug( __METHOD__, "1.WD" );
$editContent = ContentHandler::makeContent( $editText, $this->getTitle(), $this->content_model, $this->content_format );
* @parma $editText string
*
* @return bool
- * @since since 1.20
+ * @since since 1.WD
*/
private function mergeChangesIntoContent( &$editContent ){
wfProfileIn( __METHOD__ );
* @param $user User object to check for, only if FOR_THIS_USER is passed
* to the $audience parameter
* @return String
- * @deprectaed in 1.20, use getContent() instead
+ * @deprectaed in 1.WD, use getContent() instead
*/
public function getText( $audience = self::FOR_PUBLIC, User $user = null ) { #FIXME: deprecated, replace usage! #FIXME: used a LOT!
- wfDeprecated( __METHOD__, '1.20' );
+ wfDeprecated( __METHOD__, '1.WD' );
$content = $this->getContent();
return ContentHandler::getContentText( $content ); # returns the raw content text, if applicable
* @param $user User object to check for, only if FOR_THIS_USER is passed
* to the $audience parameter
* @return Content
+ *
+ * @since 1.WD
*/
public function getContent( $audience = self::FOR_PUBLIC, User $user = null ) {
if( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_TEXT ) ) {
* Shorthand for ContentHandler::getForModelName( $this->getContentModelName() );
*
* @return ContentHandler
+ *
+ * @since 1.WD
*/
public function getContentHandler() {
return ContentHandler::getForModelName( $this->getContentModelName() );
* and the page's default if the page doesn't exist yet.
*
* @return int
+ *
+ * @since 1.WD
*/
public function getContentModelName() {
if ( $this->exists() ) {
* Revision::FOR_THIS_USER to be displayed to $wgUser
* Revision::RAW get the text regardless of permissions
* @return Content|null The content of the current revision
+ *
+ * @since 1.WD
*/
public function getContent( $audience = Revision::FOR_PUBLIC ) {
$this->loadLastEdit();
* Revision::FOR_THIS_USER to be displayed to $wgUser
* Revision::RAW get the text regardless of permissions
* @return String|false The text of the current revision
- * @deprecated as of 1.20, getContent() should be used instead.
+ * @deprecated as of 1.WD, getContent() should be used instead.
*/
public function getText( $audience = Revision::FOR_PUBLIC ) { #@todo: deprecated, replace usage!
- wfDeprecated( __METHOD__, '1.20' );
+ wfDeprecated( __METHOD__, '1.WD' );
$this->loadLastEdit();
if ( $this->mLastRevision ) {
* Get the text of the current revision. No side-effects...
*
* @return String|bool The text of the current revision. False on failure
- * @deprecated as of 1.20, getContent() should be used instead.
+ * @deprecated as of 1.WD, getContent() should be used instead.
*/
public function getRawText() { #@todo: deprecated, replace usage!
- wfDeprecated( __METHOD__, '1.20' );
+ wfDeprecated( __METHOD__, '1.WD' );
return $this->getText( Revision::RAW );
}
* Get the content of the current revision. No side-effects...
*
* @return Contet|false The text of the current revision
+ *
+ * @since 1.WD
*/
protected function getNativeData() { #FIXME: examine all uses carefully! caller must be aware of content model!
$content = $this->getContent( Revision::RAW );
* @param $undo Revision
* @param $undoafter Revision Must be an earlier revision than $undo
* @return mixed string on success, false on failure
- * @deprecated since 1.20: use ContentHandler::getUndoContent() instead.
+ * @deprecated since 1.WD: use ContentHandler::getUndoContent() instead.
*/
public function getUndoText( Revision $undo, Revision $undoafter = null ) { #FIXME: replace usages.
- wfDeprecated( __METHOD__, '1.20' );
+ wfDeprecated( __METHOD__, '1.WD' );
$this->loadLastEdit();
* @param $text String: new text of the section
* @param $sectionTitle String: new section's subject, only if $section is 'new'
* @param $edittime String: revision timestamp or null to use the current revision
- * @return Content new complete article content, or null if error
- * @deprecated since 1.20, use replaceSectionContent() instead
+ * @return String new complete article text, or null if error
+ *
+ * @deprecated since 1.WD, use replaceSectionContent() instead
*/
public function replaceSection( $section, $text, $sectionTitle = '', $edittime = null ) { #FIXME: use replaceSectionContent() instead!
- wfDeprecated( __METHOD__, '1.20' );
+ wfDeprecated( __METHOD__, '1.WD' );
$sectionContent = ContentHandler::makeContent( $text, $this->getTitle() ); #XXX: could make section title, but that's not required.
return ContentHandler::getContentText( $newContent ); #XXX: unclear what will happen for non-wikitext!
}
+ /**
+ * @param $section null|bool|int or a section number (0, 1, 2, T1, T2...)
+ * @param $content Content: new content of the section
+ * @param $sectionTitle String: new section's subject, only if $section is 'new'
+ * @param $edittime String: revision timestamp or null to use the current revision
+ *
+ * @return Content new complete article content, or null if error
+ *
+ * @since 1.WD
+ */
public function replaceSectionContent( $section, Content $sectionContent, $sectionTitle = '', $edittime = null ) {
wfProfileIn( __METHOD__ );
* revision: The revision object for the inserted revision, or null
*
* Compatibility note: this function previously returned a boolean value indicating success/failure
- * @deprecated since 1.20: use doEditContent() instead.
+ *
+ * @deprecated since 1.WD: use doEditContent() instead.
*/
public function doEdit( $text, $summary, $flags = 0, $baseRevId = false, $user = null ) { #FIXME: use doEditContent() instead
- #TODO: log use of deprecated function
+ wfDeprecated( __METHOD__, '1.WD' );
+
$content = ContentHandler::makeContent( $text, $this->getTitle() );
return $this->doEditContent( $content, $summary, $flags, $baseRevId, $user );
* new: Boolean indicating if the function attempted to create a new article
* revision: The revision object for the inserted revision, or null
*
- * Compatibility note: this function previously returned a boolean value indicating success/failure
+ * @since 1.WD
*/
public function doEditContent( Content $content, $summary, $flags = 0, $baseRevId = false,
User $user = null, $serialisation_format = null ) { #FIXME: use this
/**
* Prepare text which is about to be saved.
* Returns a stdclass with source, pst and output members
- * @deprecated in 1.20: use prepareContentForEdit instead.
+ *
+ * @deprecated in 1.WD: use prepareContentForEdit instead.
*/
public function prepareTextForEdit( $text, $revid = null, User $user = null ) { #FIXME: use prepareContentForEdit() instead #XXX: who uses this?!
#TODO: log use of deprecated function
* @param null $revid
* @param null|\User $user
* @param null $serialization_format
+ *
* @return bool|object
+ *
+ * @since 1.WD
*/
public function prepareContentForEdit( Content $content, $revid = null, User $user = null, $serialization_format = null ) { #FIXME: use this #XXX: really public?!
global $wgParser, $wgContLang, $wgUser;
* Purges pages that include this page if the text was changed here.
* Every 100th edit, prune the recent changes table.
*
- * @private
* @param $revision Revision object
* @param $user User object that did the revision
* @param $options Array of options, following indexes are used:
* @param $comment String: comment submitted
* @param $minor Boolean: whereas it's a minor modification
*
- * @deprecated since 1.20, use doEditContent() instead.
+ * @deprecated since 1.WD, use doEditContent() instead.
*/
public function doQuickEdit( $text, User $user, $comment = '', $minor = 0 ) {
- wfDeprecated( __METHOD__, "1.20" );
+ wfDeprecated( __METHOD__, "1.WD" );
$content = ContentHandler::makeContent( $text, $this->getTitle() );
return $this->doQuickEditContent( $content, $user, $comment , $minor );
* @param $newtext String|null: The submitted text of the page.
* @param $flags Int bitmask: a bitmask of flags submitted for the edit.
* @return string An appropriate autosummary, or an empty string.
- * @deprecated since 1.20, use ContentHandler::getAutosummary() instead
+ * @deprecated since 1.WD, use ContentHandler::getAutosummary() instead
*/
public static function getAutosummary( $oldtext, $newtext, $flags ) {
# NOTE: stub for backwards-compatibility. assumes the given text is wikitext. will break horribly if it isn't.
+ wfDeprecated( __METHOD__, '1.WD' );
+
$handler = ContentHandler::getForModelName( CONTENT_MODEL_WIKITEXT );
$oldContent = is_null( $oldtext ) ? null : $handler->unserializeContent( $oldtext );
$newContent = is_null( $newtext ) ? null : $handler->unserializeContent( $newtext );
* @param &$hasHistory Boolean: whether the page has a history
* @return mixed String containing deletion reason or empty string, or boolean false
* if no revision occurred
- * @deprecated since 1.20, use ContentHandler::getAutoDeleteReason() instead
+ * @deprecated since 1.WD, use ContentHandler::getAutoDeleteReason() instead
*/
public function getAutoDeleteReason( &$hasHistory ) {
#NOTE: stub for backwards-compatibility.
+ wfDeprecated( __METHOD__, '1.WD' );
+
$handler = ContentHandler::getForTitle( $this->getTitle() );
$handler->getAutoDeleteReason( $this->getTitle(), $hasHistory );
global $wgContLang;
*
* @param $old Content: old content
* @param $new Content: new content
+ *
+ * @since 1.WD
*/
function generateContentDiffBody( Content $old, Content $new ) {
#XXX: generate a warning if $old or $new are not instances of TextContent?
*
* @param $otext String: old text, must be already segmented
* @param $ntext String: new text, must be already segmented
- * @deprecated since 1.20, use generateContentDiffBody() instead!
+ * @deprecated since 1.WD, use generateContentDiffBody() instead!
*/
function generateDiffBody( $otext, $ntext ) {
- wfDeprecated( __METHOD__, "1.20" );
+ wfDeprecated( __METHOD__, "1.WD" );
return $this->generateTextDiffBody( $otext, $ntext );
}
/**
* Use specified text instead of loading from the database
- * @deprecated since 1.20
+ * @deprecated since 1.WD
*/
function setText( $oldText, $newText ) { #FIXME: no longer use this, use setContent()!
- wfDeprecated( __METHOD__, "1.20" );
+ wfDeprecated( __METHOD__, "1.WD" );
$oldContent = ContentHandler::makeContent( $oldText, $this->getTitle() );
$newContent = ContentHandler::makeContent( $newText, $this->getTitle() );
/**
* Use specified text instead of loading from the database
- * @since 1.20
+ * @since 1.WD
*/
function setContent( Content $oldContent, Content $newContent ) {
$this->mOldContent = $oldContent;
array( 'addField', 'revision', 'rev_sha1', 'patch-rev_sha1.sql' ),
array( 'addField', 'archive', 'ar_sha1', 'patch-ar_sha1.sql' ),
- // 1.20
- // content model stuff for WikiData
- array( 'addField', 'revision', 'rev_content_format', 'patch-revision-rev_content_format.sql' ),
- array( 'addField', 'revision', 'rev_content_model', 'patch-revision-rev_content_model.sql' ),
- array( 'addField', 'archive', 'ar_content_format', 'patch-archive-ar_content_format.sql' ),
- array( 'addField', 'archive', 'ar_content_model', 'patch-archive-ar_content_model.sql' ),
- array( 'addField', 'page', 'page_content_model', 'patch-page-page_content_model.sql' ),
// 1.20
array( 'addTable', 'config', 'patch-config.sql' ),
+
+ // 1.WD
+ array( 'addField', 'revision', 'rev_content_format', 'patch-revision-rev_content_format.sql' ),
+ array( 'addField', 'revision', 'rev_content_model', 'patch-revision-rev_content_model.sql' ),
+ array( 'addField', 'archive', 'ar_content_format', 'patch-archive-ar_content_format.sql' ),
+ array( 'addField', 'archive', 'ar_content_model', 'patch-archive-ar_content_model.sql' ),
+ array( 'addField', 'page', 'page_content_model', 'patch-page-page_content_model.sql' ),
);
}
}
array( 'addField', 'uploadstash', 'us_chunk_inx', 'patch-uploadstash_chunk.sql' ),
array( 'addfield', 'job', 'job_timestamp', 'patch-jobs-add-timestamp.sql' ),
- // 1.20
- // content model stuff for WikiData
- array( 'addField', 'revision', 'rev_content_format', 'patch-revision-rev_content_format.sql' ),
- array( 'addField', 'revision', 'rev_content_model', 'patch-revision-rev_content_model.sql' ),
- array( 'addField', 'archive', 'ar_content_format', 'patch-archive-ar_content_format.sql' ),
- array( 'addField', 'archive', 'ar_content_model', 'patch-archive-ar_content_model.sql' ),
- array( 'addField', 'page', 'page_content_model', 'patch-page-page_content_model.sql' ),
array( 'modifyField', 'user_former_groups', 'ufg_group', 'patch-ufg_group-length-increase.sql' ),
// 1.20
array( 'addTable', 'config', 'patch-config.sql' ),
array( 'addIndex', 'revision', 'page_user_timestamp', 'patch-revision-user-page-index.sql' ),
+
+ // 1.WD
+ array( 'addField', 'revision', 'rev_content_format', 'patch-revision-rev_content_format.sql' ),
+ array( 'addField', 'revision', 'rev_content_model', 'patch-revision-rev_content_model.sql' ),
+ array( 'addField', 'archive', 'ar_content_format', 'patch-archive-ar_content_format.sql' ),
+ array( 'addField', 'archive', 'ar_content_model', 'patch-archive-ar_content_model.sql' ),
+ array( 'addField', 'page', 'page_content_model', 'patch-page-page_content_model.sql' ),
);
}
array( 'addField', 'job', 'job_timestamp', 'patch-job_timestamp_field.sql' ),
array( 'addIndex', 'job', 'i02', 'patch-job_timestamp_index.sql' ),
- // 1.20
- // content model stuff for WikiData
- array( 'addField', 'revision', 'rev_content_format', 'patch-revision-rev_content_format.sql' ),
- array( 'addField', 'revision', 'rev_content_model', 'patch-revision-rev_content_model.sql' ),
- array( 'addField', 'archive', 'ar_content_format', 'patch-archive-ar_content_format.sql' ),
- array( 'addField', 'archive', 'ar_content_model', 'patch-archive-ar_content_model.sql' ),
- array( 'addField', 'page', 'page_content_model', 'patch-page-page_content_model.sql' ),
//1.20
array( 'addTable', 'config', 'patch-config.sql' ),
+ //1.WD
+ array( 'addField', 'revision', 'rev_content_format', 'patch-revision-rev_content_format.sql' ),
+ array( 'addField', 'revision', 'rev_content_model', 'patch-revision-rev_content_model.sql' ),
+ array( 'addField', 'archive', 'ar_content_format', 'patch-archive-ar_content_format.sql' ),
+ array( 'addField', 'archive', 'ar_content_model', 'patch-archive-ar_content_model.sql' ),
+ array( 'addField', 'page', 'page_content_model', 'patch-page-page_content_model.sql' ),
+
// KEEP THIS AT THE BOTTOM!!
array( 'doRebuildDuplicateFunction' ),
array( 'addField', 'uploadstash', 'us_chunk_inx', 'patch-uploadstash_chunk.sql' ),
array( 'addfield', 'job', 'job_timestamp', 'patch-jobs-add-timestamp.sql' ),
- // 1.20
- // content model stuff for WikiData
- array( 'addField', 'revision', 'rev_content_format', 'patch-revision-rev_content_format.sql' ),
- array( 'addField', 'revision', 'rev_content_model', 'patch-revision-rev_content_model.sql' ),
- array( 'addField', 'archive', 'ar_content_format', 'patch-archive-ar_content_format.sql' ),
- array( 'addField', 'archive', 'ar_content_model', 'patch-archive-ar_content_model.sql' ),
- array( 'addField', 'page', 'page_content_model', 'patch-page-page_content_model.sql' ),
array( 'modifyField', 'user_former_groups', 'ufg_group', 'patch-ug_group-length-increase.sql' ),
// 1.20
array( 'addTable', 'config', 'patch-config.sql' ),
array( 'addIndex', 'revision', 'page_user_timestamp', 'patch-revision-user-page-index.sql' ),
+
+ // 1.WD
+ array( 'addField', 'revision', 'rev_content_format', 'patch-revision-rev_content_format.sql' ),
+ array( 'addField', 'revision', 'rev_content_model', 'patch-revision-rev_content_model.sql' ),
+ array( 'addField', 'archive', 'ar_content_format', 'patch-archive-ar_content_format.sql' ),
+ array( 'addField', 'archive', 'ar_content_model', 'patch-archive-ar_content_model.sql' ),
+ array( 'addField', 'page', 'page_content_model', 'patch-page-page_content_model.sql' ),
);
}