mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
XOMW: Rename XomwTitle to XomwTitleOld [#632]
This commit is contained in:
parent
8807dcfbeb
commit
7b00918941
@ -24,4 +24,7 @@ public class XophpInt_ {
|
||||
public static int intval(String val) {
|
||||
return Int_.Parse_or(val, 0);
|
||||
}
|
||||
public static int cast(Object val) {
|
||||
return Int_.Cast(val);
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.mediawiki.includes.XomwTitleOld;
|
||||
|
||||
public class XophpObject_ {
|
||||
public static final Object False = null; // handles code like "if ($var === false)" where var is an Object;
|
||||
public static boolean is_true(Object val) {return val != null;}
|
||||
@ -82,4 +84,9 @@ public class XophpObject_ {
|
||||
public static final double NULL_DOUBLE = Double_.MinValue;
|
||||
public static final byte[] NULL_BRY = null;
|
||||
public static Object coalesce(Object val, Object if_null) {return val == null ? if_null : val;}
|
||||
|
||||
// REF.PHP:https://www.php.net/manual/en/function.is-object.php
|
||||
public static boolean is_object(Object o) {
|
||||
return o != null;
|
||||
}
|
||||
}
|
||||
|
@ -27,12 +27,12 @@ class XomwWikiPagePropertyOrderProvider extends XomwWikiTextPropertyOrderProvide
|
||||
/**
|
||||
* @var Title
|
||||
*/
|
||||
private XomwTitle pageTitle;
|
||||
private XomwTitleOld pageTitle;
|
||||
|
||||
/**
|
||||
* @param Title pageTitle page name the ordered property list is on
|
||||
*/
|
||||
public XomwWikiPagePropertyOrderProvider(XomwTitle pageTitle) {
|
||||
public XomwWikiPagePropertyOrderProvider(XomwTitleOld pageTitle) {
|
||||
this.pageTitle = pageTitle;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,539 @@
|
||||
package gplx.xowa.mediawiki.includes.Revision;
|
||||
|
||||
// MW.SRC:1.33.1
|
||||
|
||||
import gplx.xowa.mediawiki.XophpString_;
|
||||
import gplx.xowa.mediawiki.includes.XomwTitleOld;
|
||||
|
||||
/**
|
||||
* Page revision base class.
|
||||
*
|
||||
* RevisionRecords are considered value objects, but they may use callbacks for lazy loading.
|
||||
* Note that while the base class has no setters, subclasses may offer a mutable interface.
|
||||
*
|
||||
* @since 1.31
|
||||
* @since 1.32 Renamed from MediaWiki\Storage\RevisionRecord
|
||||
*/
|
||||
abstract class XomwRevisionRecord {
|
||||
|
||||
// RevisionRecord deletion constants
|
||||
public static final int DELETED_TEXT = 1;
|
||||
public static final int DELETED_COMMENT = 2;
|
||||
public static final int DELETED_USER = 4;
|
||||
public static final int DELETED_RESTRICTED = 8;
|
||||
public static final int SUPPRESSED_USER = XomwRevisionRecord.DELETED_USER | XomwRevisionRecord.DELETED_RESTRICTED; // convenience
|
||||
public static final int SUPPRESSED_ALL = XomwRevisionRecord.DELETED_TEXT | XomwRevisionRecord.DELETED_COMMENT | XomwRevisionRecord.DELETED_USER |
|
||||
XomwRevisionRecord.DELETED_RESTRICTED; // convenience
|
||||
|
||||
// Audience options for accessors
|
||||
public static final int FOR_PUBLIC = 1;
|
||||
public static final int FOR_THIS_USER = 2;
|
||||
public static final int RAW = 3;
|
||||
|
||||
/** @var string Wiki ID; false means the current wiki */
|
||||
protected String mWiki = XophpString_.False;
|
||||
/** @var int|null */
|
||||
protected int mId;
|
||||
/** @var int */
|
||||
protected int mPageId;
|
||||
/** @var UserIdentity|null */
|
||||
// protected $mUser;
|
||||
/** @var bool */
|
||||
protected boolean mMinorEdit = false;
|
||||
/** @var string|null */
|
||||
protected String mTimestamp;
|
||||
/** @var int using the DELETED_XXX and SUPPRESSED_XXX flags */
|
||||
protected int mDeleted = 0;
|
||||
/** @var int|null */
|
||||
protected int mSize;
|
||||
/** @var string|null */
|
||||
protected String mSha1;
|
||||
/** @var int|null */
|
||||
protected int mParentId;
|
||||
/** @var CommentStoreComment|null */
|
||||
// protected mComment;
|
||||
|
||||
/** @var Title */
|
||||
protected XomwTitleOld mTitle; // TODO: we only need the title for permission checks!
|
||||
|
||||
// /** @var RevisionSlots */
|
||||
// protected $mSlots;
|
||||
//
|
||||
// /**
|
||||
// * @note Avoid calling this constructor directly. Use the appropriate methods
|
||||
// * in RevisionStore instead.
|
||||
// *
|
||||
// * @param Title $title The title of the page this Revision is associated with.
|
||||
// * @param RevisionSlots $slots The slots of this revision.
|
||||
// * @param bool|string $wikiId the wiki ID of the site this Revision belongs to,
|
||||
// * or false for the local site.
|
||||
// *
|
||||
// * @throws MWException
|
||||
// */
|
||||
// function __construct( Title $title, RevisionSlots $slots, $wikiId = false ) {
|
||||
// Assert::parameterType( 'string|boolean', $wikiId, '$wikiId' );
|
||||
//
|
||||
// this.mTitle = $title;
|
||||
// this.mSlots = $slots;
|
||||
// this.mWiki = $wikiId;
|
||||
//
|
||||
// // XXX: this is a sensible default, but we may not have a Title object here in the future.
|
||||
// this.mPageId = $title->getArticleID();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Implemented to defy serialization.
|
||||
// *
|
||||
// * @throws LogicException always
|
||||
// */
|
||||
// public function __sleep() {
|
||||
// throw new LogicException( __CLASS__ . ' is not serializable.' );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param RevisionRecord $rec
|
||||
// *
|
||||
// * @return bool True if this RevisionRecord is known to have same content as $rec.
|
||||
// * False if the content is different (or not known to be the same).
|
||||
// */
|
||||
// public function hasSameContent( RevisionRecord $rec ) {
|
||||
// if ( $rec === $this ) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if ( this.getId() !== null && this.getId() === $rec->getId() ) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// // check size before hash, since size is quicker to compute
|
||||
// if ( this.getSize() !== $rec->getSize() ) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// // instead of checking the hash, we could also check the content addresses of all slots.
|
||||
//
|
||||
// if ( this.getSha1() === $rec->getSha1() ) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the Content of the given slot of this revision.
|
||||
// * Call getSlotNames() to get a list of available slots.
|
||||
// *
|
||||
// * Note that for mutable Content objects, each call to this method will return a
|
||||
// * fresh clone.
|
||||
// *
|
||||
// * MCR migration note: this replaces Revision::getContent
|
||||
// *
|
||||
// * @param string $role The role name of the desired slot
|
||||
// * @param int $audience
|
||||
// * @param User|null $user
|
||||
// *
|
||||
// * @throws RevisionAccessException if the slot does not exist or slot data
|
||||
// * could not be lazy-loaded.
|
||||
// * @return Content|null The content of the given slot, or null if access is forbidden.
|
||||
// */
|
||||
// public function getContent( $role, $audience = XomwRevisionRecord.FOR_PUBLIC, User $user = null ) {
|
||||
// // XXX: throwing an exception would be nicer, but would a further
|
||||
// // departure from the signature of Revision::getContent(), and thus
|
||||
// // more complex and error prone refactoring.
|
||||
// if ( !this.audienceCan( XomwRevisionRecord.DELETED_TEXT, $audience, $user ) ) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// $content = this.getSlot( $role, $audience, $user )->getContent();
|
||||
// return $content->copy();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns meta-data for the given slot.
|
||||
// *
|
||||
// * @param string $role The role name of the desired slot
|
||||
// * @param int $audience
|
||||
// * @param User|null $user
|
||||
// *
|
||||
// * @throws RevisionAccessException if the slot does not exist or slot data
|
||||
// * could not be lazy-loaded.
|
||||
// * @return SlotRecord The slot meta-data. If access to the slot content is forbidden,
|
||||
// * calling getContent() on the SlotRecord will throw an exception.
|
||||
// */
|
||||
// public function getSlot( $role, $audience = XomwRevisionRecord.FOR_PUBLIC, User $user = null ) {
|
||||
// $slot = this.mSlots->getSlot( $role );
|
||||
//
|
||||
// if ( !this.audienceCan( XomwRevisionRecord.DELETED_TEXT, $audience, $user ) ) {
|
||||
// return SlotRecord::newWithSuppressedContent( $slot );
|
||||
// }
|
||||
//
|
||||
// return $slot;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns whether the given slot is defined in this revision.
|
||||
// *
|
||||
// * @param string $role The role name of the desired slot
|
||||
// *
|
||||
// * @return bool
|
||||
// */
|
||||
// public function hasSlot( $role ) {
|
||||
// return this.mSlots->hasSlot( $role );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the slot names (roles) of all slots present in this revision.
|
||||
// * getContent() will succeed only for the names returned by this method.
|
||||
// *
|
||||
// * @return string[]
|
||||
// */
|
||||
// public function getSlotRoles() {
|
||||
// return this.mSlots->getSlotRoles();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the slots defined for this revision.
|
||||
// *
|
||||
// * @return RevisionSlots
|
||||
// */
|
||||
// public function getSlots() {
|
||||
// return this.mSlots;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the slots that originate in this revision.
|
||||
// *
|
||||
// * Note that this does not include any slots inherited from some earlier revision,
|
||||
// * even if they are different from the slots in the immediate parent revision.
|
||||
// * This is the case for rollbacks: slots of a rollback revision are inherited from
|
||||
// * the rollback target, and are different from the slots in the parent revision,
|
||||
// * which was rolled back.
|
||||
// *
|
||||
// * To find all slots modified by this revision against its immediate parent
|
||||
// * revision, use RevisionSlotsUpdate::newFromRevisionSlots().
|
||||
// *
|
||||
// * @return RevisionSlots
|
||||
// */
|
||||
// public function getOriginalSlots() {
|
||||
// return new RevisionSlots( this.mSlots->getOriginalSlots() );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns slots inherited from some previous revision.
|
||||
// *
|
||||
// * "Inherited" slots are all slots that do not originate in this revision.
|
||||
// * Note that these slots may still differ from the one in the parent revision.
|
||||
// * This is the case for rollbacks: slots of a rollback revision are inherited from
|
||||
// * the rollback target, and are different from the slots in the parent revision,
|
||||
// * which was rolled back.
|
||||
// *
|
||||
// * @return RevisionSlots
|
||||
// */
|
||||
// public function getInheritedSlots() {
|
||||
// return new RevisionSlots( this.mSlots->getInheritedSlots() );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Get revision ID. Depending on the concrete subclass, this may return null if
|
||||
// * the revision ID is not known (e.g. because the revision does not yet exist
|
||||
// * in the database).
|
||||
// *
|
||||
// * MCR migration note: this replaces Revision::getId
|
||||
// *
|
||||
// * @return int|null
|
||||
// */
|
||||
// public function getId() {
|
||||
// return this.mId;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Get parent revision ID (the original previous page revision).
|
||||
// * If there is no parent revision, this returns 0.
|
||||
// * If the parent revision is undefined or unknown, this returns null.
|
||||
// *
|
||||
// * @note As of MW 1.31, the database schema allows the parent ID to be
|
||||
// * NULL to indicate that it is unknown.
|
||||
// *
|
||||
// * MCR migration note: this replaces Revision::getParentId
|
||||
// *
|
||||
// * @return int|null
|
||||
// */
|
||||
// public function getParentId() {
|
||||
// return this.mParentId;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the nominal size of this revision, in bogo-bytes.
|
||||
// * May be calculated on the fly if not known, which may in the worst
|
||||
// * case may involve loading all content.
|
||||
// *
|
||||
// * MCR migration note: this replaces Revision::getSize
|
||||
// *
|
||||
// * @throws RevisionAccessException if the size was unknown and could not be calculated.
|
||||
// * @return int
|
||||
// */
|
||||
// abstract public function getSize();
|
||||
//
|
||||
// /**
|
||||
// * Returns the base36 sha1 of this revision. This hash is derived from the
|
||||
// * hashes of all slots associated with the revision.
|
||||
// * May be calculated on the fly if not known, which may in the worst
|
||||
// * case may involve loading all content.
|
||||
// *
|
||||
// * MCR migration note: this replaces Revision::getSha1
|
||||
// *
|
||||
// * @throws RevisionAccessException if the hash was unknown and could not be calculated.
|
||||
// * @return string
|
||||
// */
|
||||
// abstract public function getSha1();
|
||||
|
||||
/**
|
||||
* Get the page ID. If the page does not yet exist, the page ID is 0.
|
||||
*
|
||||
* MCR migration note: this replaces Revision::getPage
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public int getPageId() {
|
||||
return this.mPageId;
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * Get the ID of the wiki this revision belongs to.
|
||||
// *
|
||||
// * @return string|false The wiki's logical name, of false to indicate the local wiki.
|
||||
// */
|
||||
// public function getWikiId() {
|
||||
// return this.mWiki;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the title of the page this revision is associated with as a LinkTarget object.
|
||||
// *
|
||||
// * MCR migration note: this replaces Revision::getTitle
|
||||
// *
|
||||
// * @return LinkTarget
|
||||
// */
|
||||
// public function getPageAsLinkTarget() {
|
||||
// return this.mTitle;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Fetch revision's author's user identity, if it's available to the specified audience.
|
||||
// * If the specified audience does not have access to it, null will be
|
||||
// * returned. Depending on the concrete subclass, null may also be returned if the user is
|
||||
// * not yet specified.
|
||||
// *
|
||||
// * MCR migration note: this replaces Revision::getUser
|
||||
// *
|
||||
// * @param int $audience One of:
|
||||
// * RevisionRecord::FOR_PUBLIC to be displayed to all users
|
||||
// * RevisionRecord::FOR_THIS_USER to be displayed to the given user
|
||||
// * RevisionRecord::RAW get the ID regardless of permissions
|
||||
// * @param User|null $user User object to check for, only if FOR_THIS_USER is passed
|
||||
// * to the $audience parameter
|
||||
// * @return UserIdentity|null
|
||||
// */
|
||||
// public function getUser( $audience = XomwRevisionRecord.FOR_PUBLIC, User $user = null ) {
|
||||
// if ( !this.audienceCan( XomwRevisionRecord.DELETED_USER, $audience, $user ) ) {
|
||||
// return null;
|
||||
// } else {
|
||||
// return this.mUser;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Fetch revision comment, if it's available to the specified audience.
|
||||
// * If the specified audience does not have access to the comment,
|
||||
// * this will return null. Depending on the concrete subclass, null may also be returned
|
||||
// * if the comment is not yet specified.
|
||||
// *
|
||||
// * MCR migration note: this replaces Revision::getComment
|
||||
// *
|
||||
// * @param int $audience One of:
|
||||
// * RevisionRecord::FOR_PUBLIC to be displayed to all users
|
||||
// * RevisionRecord::FOR_THIS_USER to be displayed to the given user
|
||||
// * RevisionRecord::RAW get the text regardless of permissions
|
||||
// * @param User|null $user User object to check for, only if FOR_THIS_USER is passed
|
||||
// * to the $audience parameter
|
||||
// *
|
||||
// * @return CommentStoreComment|null
|
||||
// */
|
||||
// public function getComment( $audience = XomwRevisionRecord.FOR_PUBLIC, User $user = null ) {
|
||||
// if ( !this.audienceCan( XomwRevisionRecord.DELETED_COMMENT, $audience, $user ) ) {
|
||||
// return null;
|
||||
// } else {
|
||||
// return this.mComment;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * MCR migration note: this replaces Revision::isMinor
|
||||
// *
|
||||
// * @return bool
|
||||
// */
|
||||
// public function isMinor() {
|
||||
// return (bool)this.mMinorEdit;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * MCR migration note: this replaces Revision::isDeleted
|
||||
// *
|
||||
// * @param int $field One of DELETED_* bitfield constants
|
||||
// *
|
||||
// * @return bool
|
||||
// */
|
||||
// public function isDeleted( $field ) {
|
||||
// return ( this.getVisibility() & $field ) == $field;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Get the deletion bitfield of the revision
|
||||
// *
|
||||
// * MCR migration note: this replaces Revision::getVisibility
|
||||
// *
|
||||
// * @return int
|
||||
// */
|
||||
// public function getVisibility() {
|
||||
// return (int)this.mDeleted;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * MCR migration note: this replaces Revision::getTimestamp.
|
||||
// *
|
||||
// * May return null if the timestamp was not specified.
|
||||
// *
|
||||
// * @return string|null
|
||||
// */
|
||||
// public function getTimestamp() {
|
||||
// return this.mTimestamp;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Check that the given audience has access to the given field.
|
||||
// *
|
||||
// * MCR migration note: this corresponds to Revision::userCan
|
||||
// *
|
||||
// * @param int $field One of XomwRevisionRecord.DELETED_TEXT,
|
||||
// * XomwRevisionRecord.DELETED_COMMENT,
|
||||
// * XomwRevisionRecord.DELETED_USER
|
||||
// * @param int $audience One of:
|
||||
// * RevisionRecord::FOR_PUBLIC to be displayed to all users
|
||||
// * RevisionRecord::FOR_THIS_USER to be displayed to the given user
|
||||
// * RevisionRecord::RAW get the text regardless of permissions
|
||||
// * @param User|null $user User object to check. Required if $audience is FOR_THIS_USER,
|
||||
// * ignored otherwise.
|
||||
// *
|
||||
// * @return bool
|
||||
// */
|
||||
// public function audienceCan( $field, $audience, User $user = null ) {
|
||||
// if ( $audience == XomwRevisionRecord.FOR_PUBLIC && this.isDeleted( $field ) ) {
|
||||
// return false;
|
||||
// } elseif ( $audience == XomwRevisionRecord.FOR_THIS_USER ) {
|
||||
// if ( !$user ) {
|
||||
// throw new InvalidArgumentException(
|
||||
// 'A User object must be given when checking FOR_THIS_USER audience.'
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// if ( !this.userCan( $field, $user ) ) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Determine if the current user is allowed to view a particular
|
||||
// * field of this revision, if it's marked as deleted.
|
||||
// *
|
||||
// * MCR migration note: this corresponds to Revision::userCan
|
||||
// *
|
||||
// * @param int $field One of XomwRevisionRecord.DELETED_TEXT,
|
||||
// * XomwRevisionRecord.DELETED_COMMENT,
|
||||
// * XomwRevisionRecord.DELETED_USER
|
||||
// * @param User $user User object to check
|
||||
// * @return bool
|
||||
// */
|
||||
// protected function userCan( $field, User $user ) {
|
||||
// // TODO: use callback for permission checks, so we don't need to know a Title object!
|
||||
// return XomwRevisionRecord.userCanBitfield( this.getVisibility(), $field, $user, this.mTitle );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Determine if the current user is allowed to view a particular
|
||||
// * field of this revision, if it's marked as deleted. This is used
|
||||
// * by various classes to avoid duplication.
|
||||
// *
|
||||
// * MCR migration note: this replaces Revision::userCanBitfield
|
||||
// *
|
||||
// * @param int $bitfield Current field
|
||||
// * @param int $field One of XomwRevisionRecord.DELETED_TEXT = File::DELETED_FILE,
|
||||
// * XomwRevisionRecord.DELETED_COMMENT = File::DELETED_COMMENT,
|
||||
// * XomwRevisionRecord.DELETED_USER = File::DELETED_USER
|
||||
// * @param User $user User object to check
|
||||
// * @param Title|null $title A Title object to check for per-page restrictions on,
|
||||
// * instead of just plain userrights
|
||||
// * @return bool
|
||||
// */
|
||||
// public static function userCanBitfield( $bitfield, $field, User $user, Title $title = null ) {
|
||||
// if ( $bitfield & $field ) { // aspect is deleted
|
||||
// if ( $bitfield & XomwRevisionRecord.DELETED_RESTRICTED ) {
|
||||
// $permissions = [ 'suppressrevision', 'viewsuppressed' ];
|
||||
// } elseif ( $field & XomwRevisionRecord.DELETED_TEXT ) {
|
||||
// $permissions = [ 'deletedtext' ];
|
||||
// } else {
|
||||
// $permissions = [ 'deletedhistory' ];
|
||||
// }
|
||||
// $permissionlist = implode( ', ', $permissions );
|
||||
// if ( $title === null ) {
|
||||
// wfDebug( "Checking for $permissionlist due to $field match on $bitfield\n" );
|
||||
// return $user->isAllowedAny( ...$permissions );
|
||||
// } else {
|
||||
// $text = $title->getPrefixedText();
|
||||
// wfDebug( "Checking for $permissionlist on $text due to $field match on $bitfield\n" );
|
||||
// foreach ( $permissions as $perm ) {
|
||||
// if ( $title->userCan( $perm, $user ) ) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
// } else {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns whether this RevisionRecord is ready for insertion, that is, whether it contains all
|
||||
// * information needed to save it to the database. This should trivially be true for
|
||||
// * RevisionRecords loaded from the database.
|
||||
// *
|
||||
// * Note that this may return true even if getId() or getPage() return null or 0, since these
|
||||
// * are generally assigned while the revision is saved to the database, and may not be available
|
||||
// * before.
|
||||
// *
|
||||
// * @return bool
|
||||
// */
|
||||
// public function isReadyForInsertion() {
|
||||
// // NOTE: don't check getSize() and getSha1(), since that may cause the full content to
|
||||
// // be loaded in order to calculate the values. Just assume these methods will not return
|
||||
// // null if mSlots is not empty.
|
||||
//
|
||||
// // NOTE: getId() and getPageId() may return null before a revision is saved, so don't
|
||||
// //check them.
|
||||
//
|
||||
// return this.getTimestamp() !== null
|
||||
// && this.getComment( XomwRevisionRecord.RAW ) !== null
|
||||
// && this.getUser( XomwRevisionRecord.RAW ) !== null
|
||||
// && this.mSlots->getSlotRoles() !== [];
|
||||
// }
|
||||
//
|
||||
}
|
||||
|
||||
///**
|
||||
// * Retain the old class name for backwards compatibility.
|
||||
// * @deprecated since 1.32
|
||||
// */
|
||||
//class_alias( RevisionRecord::class, 'MediaWiki\Storage\RevisionRecord' );
|
@ -124,7 +124,7 @@ public class XomwLinker {
|
||||
// 'https': Force a full URL with https:// as the scheme.
|
||||
// 'stubThreshold' => (int): Stub threshold to use when determining link classes.
|
||||
// @return String HTML <a> attribute
|
||||
public void Link(Bry_bfr bfr, XomwTitle target, byte[] html, Xomw_atr_mgr custom_attribs, Xomw_qry_mgr query, Xomw_opt_mgr options) {
|
||||
public void Link(Bry_bfr bfr, XomwTitleOld target, byte[] html, Xomw_atr_mgr custom_attribs, Xomw_qry_mgr query, Xomw_opt_mgr options) {
|
||||
// XO.MW.UNSUPPORTED:MW has different renderers -- presumably for forcing "https:" and others; XO only has one
|
||||
//if (options != null) {
|
||||
// // Custom options, create new LinkRenderer
|
||||
@ -190,7 +190,7 @@ public class XomwLinker {
|
||||
* @return String
|
||||
*/
|
||||
// XO.MW:SYNC:1.29; DATE:2017-02-08
|
||||
public void makeSelfLinkObj(Bry_bfr bfr, XomwTitle nt, byte[] html, byte[] query, byte[] trail, byte[] prefix) {
|
||||
public void makeSelfLinkObj(Bry_bfr bfr, XomwTitleOld nt, byte[] html, byte[] query, byte[] trail, byte[] prefix) {
|
||||
// MW.HOOK:SelfLinkBegin
|
||||
if (html == Bry_.Empty) {
|
||||
html = tmp.Add_bry_escape_html(nt.getPrefixedText()).To_bry_and_clear();
|
||||
@ -236,7 +236,7 @@ public class XomwLinker {
|
||||
// * @param LinkTarget $target
|
||||
// * @return LinkTarget
|
||||
// */
|
||||
public static XomwTitle normaliseSpecialPage(XomwTitle target) {
|
||||
public static XomwTitleOld normaliseSpecialPage(XomwTitleOld target) {
|
||||
// if (target.Ns().Id_is_special() && !target.Is_external()) {
|
||||
// list($name, $subpage) = SpecialPageFactory::resolveAlias($target->getDBkey());
|
||||
// if (!$name) {
|
||||
@ -331,7 +331,7 @@ public class XomwLinker {
|
||||
// @since 1.20
|
||||
// @return String HTML for an image, with links, wrappers, etc.
|
||||
// XO.MW:SYNC:1.29; DATE:2017-02-08
|
||||
public void makeImageLink(Bry_bfr bfr, XomwEnv env, XomwParserCtx pctx, XomwParserIface parser, XomwTitle title, XomwFile file, Xomw_params_frame frameParams, Xomw_params_handler handlerParams, Object time, byte[] query, int widthOption) {
|
||||
public void makeImageLink(Bry_bfr bfr, XomwEnv env, XomwParserCtx pctx, XomwParserIface parser, XomwTitleOld title, XomwFile file, Xomw_params_frame frameParams, Xomw_params_handler handlerParams, Object time, byte[] query, int widthOption) {
|
||||
// XO.MW.HOOK:ImageBeforeProduceHTML
|
||||
|
||||
if (file != null && !file.allowInlineDisplay()) {
|
||||
@ -534,7 +534,7 @@ public class XomwLinker {
|
||||
* @return String
|
||||
*/
|
||||
// XO.MW:SYNC:1.29; DATE:2017-02-08
|
||||
private void makeThumbLink2(Bry_bfr bfr, XomwEnv env, XomwParserCtx pctx, XomwTitle title, XomwFile file, Xomw_params_frame frameParams, Xomw_params_handler handlerParams, Object time, byte[] query) {
|
||||
private void makeThumbLink2(Bry_bfr bfr, XomwEnv env, XomwParserCtx pctx, XomwTitleOld title, XomwFile file, Xomw_params_frame frameParams, Xomw_params_handler handlerParams, Object time, byte[] query) {
|
||||
boolean exists = file != null && file.exists();
|
||||
|
||||
int page = handlerParams.page;
|
||||
@ -1367,7 +1367,7 @@ public class XomwLinker {
|
||||
* @return String
|
||||
*/
|
||||
// XO.MW:SYNC:1.29; DATE:2017-02-08
|
||||
public void normalizeSubpageLink(XomwLinker_NormalizeSubpageLink rv, XomwTitle context_title, byte[] target, byte[] text) {
|
||||
public void normalizeSubpageLink(XomwLinker_NormalizeSubpageLink rv, XomwTitleOld context_title, byte[] target, byte[] text) {
|
||||
// Valid link forms:
|
||||
// Foobar -- normal
|
||||
// :Foobar -- override special treatment of prefix (images, language links)
|
||||
|
@ -33,7 +33,7 @@ class XomwLinker_NormalizeSubpageLink_fxt {
|
||||
this.env = XomwEnv_fxt.NewTest();
|
||||
}
|
||||
public void Test__normalize_subpage_link(String page_title_str, String link, String text, String expd_link, String expd_text) {
|
||||
mgr.normalizeSubpageLink(normalize_subpage_link, XomwTitle.newFromText(env, Bry_.new_u8(page_title_str)), Bry_.new_u8(link), Bry_.new_u8(text));
|
||||
mgr.normalizeSubpageLink(normalize_subpage_link, XomwTitleOld.newFromText(env, Bry_.new_u8(page_title_str)), Bry_.new_u8(link), Bry_.new_u8(text));
|
||||
Gftest.Eq__str(expd_link, String_.new_u8(normalize_subpage_link.link));
|
||||
Gftest.Eq__str(expd_text, String_.new_u8(normalize_subpage_link.text));
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public class XomwMessage {
|
||||
/**
|
||||
* @var Title Title Object to use as context.
|
||||
*/
|
||||
private XomwTitle title = null;
|
||||
private XomwTitleOld title = null;
|
||||
|
||||
/**
|
||||
* @var Content Content Object representing the message.
|
||||
|
@ -15,6 +15,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
|
||||
import gplx.xowa.mediawiki.includes.dao.*;
|
||||
import gplx.xowa.mediawiki.includes.libs.rdbms.database.XomwIDatabase;
|
||||
import gplx.xowa.mediawiki.includes.linkers.XomwLinkTarget;
|
||||
// MW.SRC:1.33.1
|
||||
/**
|
||||
* @+deprecated since 1.31, use RevisionRecord, RevisionStore, and BlobStore instead.
|
||||
@ -85,42 +87,46 @@ public class XomwRevision implements XomwIDBAccessObject {
|
||||
// return $store;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Load a page revision from a given revision ID number.
|
||||
// * Returns null if no such revision can be found.
|
||||
// *
|
||||
// * $flags include:
|
||||
// * Revision::READ_LATEST : Select the data from the master
|
||||
// * Revision::READ_LOCKING : Select & synchronized the data from the master
|
||||
// *
|
||||
// * @param int $id
|
||||
// * @param int $flags (optional)
|
||||
// * @return Revision|null
|
||||
// */
|
||||
// public static function newFromId( $id, $flags = 0 ) {
|
||||
/**
|
||||
* Load a page revision from a given revision ID number.
|
||||
* Returns null if no such revision can be found.
|
||||
*
|
||||
* $flags include:
|
||||
* Revision::READ_LATEST : Select the data from the master
|
||||
* Revision::READ_LOCKING : Select & synchronized the data from the master
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $flags (optional)
|
||||
* @return Revision|null
|
||||
*/
|
||||
public static XomwRevision newFromId(int id) {return newFromId(id, 0);}
|
||||
public static XomwRevision newFromId(int id, int flags) {
|
||||
// $rec = self::getRevisionLookup()->getRevisionById($id, $flags);
|
||||
// return $rec ? new Revision($rec, $flags) : null;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Load either the current, or a specified, revision
|
||||
// * that's attached to a given link target. If not attached
|
||||
// * to that link target, will return null.
|
||||
// *
|
||||
// * $flags include:
|
||||
// * Revision::READ_LATEST : Select the data from the master
|
||||
// * Revision::READ_LOCKING : Select & synchronized the data from the master
|
||||
// *
|
||||
// * @param LinkTarget $linkTarget
|
||||
// * @param int $id (optional)
|
||||
// * @param int $flags Bitfield (optional)
|
||||
// * @return Revision|null
|
||||
// */
|
||||
// public static function newFromTitle( LinkTarget $linkTarget, $id = 0, $flags = 0 ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load either the current, or a specified, revision
|
||||
* that's attached to a given link target. If not attached
|
||||
* to that link target, will return null.
|
||||
*
|
||||
* $flags include:
|
||||
* Revision::READ_LATEST : Select the data from the master
|
||||
* Revision::READ_LOCKING : Select & synchronized the data from the master
|
||||
*
|
||||
* @param LinkTarget $linkTarget
|
||||
* @param int $id (optional)
|
||||
* @param int $flags Bitfield (optional)
|
||||
* @return Revision|null
|
||||
*/
|
||||
public static XomwRevision newFromTitle(XomwLinkTarget linkTarget) {return newFromTitle(linkTarget, 0, 0);}
|
||||
public static XomwRevision newFromTitle(XomwLinkTarget linkTarget, int id, int flags) {
|
||||
// $rec = self::getRevisionLookup()->getRevisionByTitle($linkTarget, $id, $flags);
|
||||
// return $rec ? new Revision($rec, $flags) : null;
|
||||
// }
|
||||
//
|
||||
return null;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Load either the current, or a specified, revision
|
||||
// * that's attached to a given page ID.
|
||||
@ -611,15 +617,16 @@ public class XomwRevision implements XomwIDBAccessObject {
|
||||
// public function getRevisionRecord() {
|
||||
// return $this->mRecord;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Get revision ID
|
||||
// *
|
||||
// * @return int|null
|
||||
// */
|
||||
// public function getId() {
|
||||
|
||||
/**
|
||||
* Get revision ID
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public int getId() {
|
||||
// return $this->mRecord->getId();
|
||||
// }
|
||||
return -1;
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * Set the revision ID
|
||||
@ -1292,30 +1299,31 @@ public class XomwRevision implements XomwIDBAccessObject {
|
||||
//
|
||||
// return self::getRevisionStore()->userWasLastToEdit($db, $pageId, $userId, $since);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Load a revision based on a known page ID and current revision ID from the DB
|
||||
// *
|
||||
// * This method allows for the use of caching, though accessing anything that normally
|
||||
// * requires permission checks (aside from the text) will trigger a small DB lookup.
|
||||
// * The title will also be loaded if $pageIdOrTitle is an integer ID.
|
||||
// *
|
||||
// * @param IDatabase $db ignored!
|
||||
// * @param int|Title $pageIdOrTitle Page ID or Title Object
|
||||
// * @param int $revId Known current revision of this page. Determined automatically if not given.
|
||||
// * @return Revision|boolean Returns false if missing
|
||||
// * @since 1.28
|
||||
// */
|
||||
// public static function newKnownCurrent( IDatabase $db, $pageIdOrTitle, $revId = 0 ) {
|
||||
// $title = $pageIdOrTitle instanceof Title
|
||||
// ? $pageIdOrTitle
|
||||
// : Title::newFromID( $pageIdOrTitle );
|
||||
//
|
||||
// if ( !$title ) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
|
||||
/**
|
||||
* Load a revision based on a known page ID and current revision ID from the DB
|
||||
*
|
||||
* This method allows for the use of caching, though accessing anything that normally
|
||||
* requires permission checks (aside from the text) will trigger a small DB lookup.
|
||||
* The title will also be loaded if $pageIdOrTitle is an integer ID.
|
||||
*
|
||||
* @param IDatabase $db ignored!
|
||||
* @param int|Title $pageIdOrTitle Page ID or Title Object
|
||||
* @param int $revId Known current revision of this page. Determined automatically if not given.
|
||||
* @return Revision|boolean Returns false if missing
|
||||
* @since 1.28
|
||||
*/
|
||||
public static XomwRevision newKnownCurrent(XomwIDatabase $db, Object pageIdOrTitle, int revId) { // $revId = 0
|
||||
XomwTitleOld title = XophpType_.instance_of(pageIdOrTitle, XomwTitleOld.class)
|
||||
? (XomwTitleOld)pageIdOrTitle
|
||||
: XomwTitleOld.newFromID(XophpInt_.cast(pageIdOrTitle));
|
||||
|
||||
if (!XophpObject_.is_true(title)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// $record = self::getRevisionLookup()->getKnownCurrentRevision($title, $revId);
|
||||
// return $record ? new Revision($record) : false;
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
4949
400_xowa/src/gplx/xowa/mediawiki/includes/XomwTitleOld.java
Normal file
4949
400_xowa/src/gplx/xowa/mediawiki/includes/XomwTitleOld.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -16,13 +16,13 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
|
||||
import org.junit.*; import gplx.core.tests.*;
|
||||
public class XomwTitle_tst {
|
||||
private final XomwTitle_fxt fxt = new XomwTitle_fxt();
|
||||
private final XomwTitleOld_fxt fxt = new XomwTitleOld_fxt();
|
||||
@Test public void Alphanum() {fxt.Test__find_fwd_while_title("0aB" , 3);}
|
||||
@Test public void Angle() {fxt.Test__find_fwd_while_title("0a<" , 2);}
|
||||
}
|
||||
class XomwTitle_fxt {
|
||||
class XomwTitleOld_fxt {
|
||||
public void Test__find_fwd_while_title(String src_str, int expd) {
|
||||
byte[] src_bry = Bry_.new_u8(src_str);
|
||||
Gftest.Eq__int(expd, XomwTitle.Find_fwd_while_title(src_bry, 0, src_bry.length, XomwTitle.Title_chars_valid()));
|
||||
Gftest.Eq__int(expd, XomwTitleOld.Find_fwd_while_title(src_bry, 0, src_bry.length, XomwTitleOld.Title_chars_valid()));
|
||||
}
|
||||
}
|
||||
|
@ -243,8 +243,8 @@ public abstract class XomwAbstractContent implements XomwContent {
|
||||
*
|
||||
* @see Content::getRedirectChain
|
||||
*/
|
||||
public XomwTitle[] getRedirectChain() {
|
||||
// XomwTitle title = this.getRedirectTarget();
|
||||
public XomwTitleOld[] getRedirectChain() {
|
||||
// XomwTitleOld title = this.getRedirectTarget();
|
||||
// if (title == null) {
|
||||
// return null;
|
||||
// }
|
||||
@ -253,7 +253,7 @@ public abstract class XomwAbstractContent implements XomwContent {
|
||||
//
|
||||
// List_adp titles = List_adp_.New_by_many(title);
|
||||
// while (--recurse > 0) {
|
||||
// XomwTitle newtitle = null;
|
||||
// XomwTitleOld newtitle = null;
|
||||
// if (title.isRedirect()) {
|
||||
// $page = WikiPage::factory(title);
|
||||
// $newtitle = $page.getRedirectTarget();
|
||||
@ -261,7 +261,7 @@ public abstract class XomwAbstractContent implements XomwContent {
|
||||
// break;
|
||||
// }
|
||||
// // Redirects to some special pages are not permitted
|
||||
// if (Type_.Eq_by_obj(newtitle, typeof(XomwTitle)) && newtitle.isValidRedirectTarget()) {
|
||||
// if (Type_.Eq_by_obj(newtitle, typeof(XomwTitleOld)) && newtitle.isValidRedirectTarget()) {
|
||||
// // The new title passes the checks, so make that our current
|
||||
// // title so that further recursion can be checked
|
||||
// title = newtitle;
|
||||
@ -271,7 +271,7 @@ public abstract class XomwAbstractContent implements XomwContent {
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return (XomwTitle[])titles.To_ary_and_clear(typeof(XomwTitle));
|
||||
// return (XomwTitleOld[])titles.To_ary_and_clear(typeof(XomwTitleOld));
|
||||
throw Err_.new_unimplemented();
|
||||
}
|
||||
|
||||
@ -542,29 +542,29 @@ public abstract class XomwAbstractContent implements XomwContent {
|
||||
|
||||
public abstract boolean isCountable(boolean hasLinks);
|
||||
|
||||
public abstract XomwParserOutput getParserOutput(XomwTitle title, int revId,
|
||||
public abstract XomwParserOutput getParserOutput(XomwTitleOld title, int revId,
|
||||
XomwParserOptions options, boolean generateHtml);
|
||||
|
||||
public abstract Object getSecondaryDataUpdates(XomwTitle title, XomwContent old,
|
||||
public abstract Object getSecondaryDataUpdates(XomwTitleOld title, XomwContent old,
|
||||
boolean recursive, XomwParserOutput parserOutput);
|
||||
|
||||
public abstract XomwTitle getRedirectTarget();
|
||||
public abstract XomwTitleOld getRedirectTarget();
|
||||
|
||||
public abstract XomwTitle getUltimateRedirectTarget();
|
||||
public abstract XomwTitleOld getUltimateRedirectTarget();
|
||||
|
||||
public abstract boolean isRedirect();
|
||||
|
||||
public abstract XomwContent updateRedirect(XomwTitle target);
|
||||
public abstract XomwContent updateRedirect(XomwTitleOld target);
|
||||
|
||||
public abstract XomwContent getSection(String sectionId);
|
||||
|
||||
public abstract byte[] replaceSection(String sectionId, XomwContent with, String sectionTitle);
|
||||
|
||||
public abstract XomwContent preSaveTransform(XomwTitle title, Object user, XomwParserOptions parserOptions);
|
||||
public abstract XomwContent preSaveTransform(XomwTitleOld title, Object user, XomwParserOptions parserOptions);
|
||||
|
||||
public abstract XomwContent addSectionHeader(byte[] header);
|
||||
|
||||
public abstract XomwContent preloadTransform(XomwTitle title, XomwParserOptions parserOptions, Object[] ary);
|
||||
public abstract XomwContent preloadTransform(XomwTitleOld title, XomwParserOptions parserOptions, Object[] ary);
|
||||
|
||||
public abstract Object prepareSave(Object page, int flags, int parentRevId, Object user);
|
||||
|
||||
|
@ -269,7 +269,7 @@ public interface XomwContent {
|
||||
* @return ParserOutput
|
||||
*/
|
||||
// generateHtml = true
|
||||
XomwParserOutput getParserOutput(XomwTitle title, int revId,
|
||||
XomwParserOutput getParserOutput(XomwTitleOld title, int revId,
|
||||
XomwParserOptions options, boolean generateHtml);
|
||||
|
||||
// TODO: make RenderOutput and RenderOptions super classes
|
||||
@ -307,7 +307,7 @@ public interface XomwContent {
|
||||
* @since 1.21
|
||||
*/
|
||||
// DFLT: recursive = true
|
||||
Object getSecondaryDataUpdates(XomwTitle title, XomwContent old,
|
||||
Object getSecondaryDataUpdates(XomwTitleOld title, XomwContent old,
|
||||
boolean recursive, XomwParserOutput parserOutput);
|
||||
|
||||
/**
|
||||
@ -320,7 +320,7 @@ public interface XomwContent {
|
||||
*
|
||||
* @return Title[]|null List of Titles, with the destination last.
|
||||
*/
|
||||
XomwTitle[] getRedirectChain();
|
||||
XomwTitleOld[] getRedirectChain();
|
||||
|
||||
/**
|
||||
* Construct the redirect destination from this content and return a Title,
|
||||
@ -332,7 +332,7 @@ public interface XomwContent {
|
||||
*
|
||||
* @return Title|null The corresponding Title.
|
||||
*/
|
||||
XomwTitle getRedirectTarget();
|
||||
XomwTitleOld getRedirectTarget();
|
||||
|
||||
/**
|
||||
* Construct the redirect destination from this content and return the
|
||||
@ -349,7 +349,7 @@ public interface XomwContent {
|
||||
*
|
||||
* @return Title|null
|
||||
*/
|
||||
XomwTitle getUltimateRedirectTarget();
|
||||
XomwTitleOld getUltimateRedirectTarget();
|
||||
|
||||
/**
|
||||
* Returns whether this Content represents a redirect.
|
||||
@ -372,7 +372,7 @@ public interface XomwContent {
|
||||
* @return Content A new Content Object with the updated redirect (or $this
|
||||
* if this Content Object isn't a redirect)
|
||||
*/
|
||||
XomwContent updateRedirect(XomwTitle target);
|
||||
XomwContent updateRedirect(XomwTitleOld target);
|
||||
|
||||
/**
|
||||
* Returns the section with the given ID.
|
||||
@ -416,7 +416,7 @@ public interface XomwContent {
|
||||
*
|
||||
* @return Content
|
||||
*/
|
||||
XomwContent preSaveTransform(XomwTitle title, Object user, XomwParserOptions parserOptions );
|
||||
XomwContent preSaveTransform(XomwTitleOld title, Object user, XomwParserOptions parserOptions );
|
||||
|
||||
/**
|
||||
* Returns a new WikitextContent Object with the given section heading
|
||||
@ -443,7 +443,7 @@ public interface XomwContent {
|
||||
*
|
||||
* @return Content
|
||||
*/
|
||||
XomwContent preloadTransform(XomwTitle title, XomwParserOptions parserOptions, Object[] ary);
|
||||
XomwContent preloadTransform(XomwTitleOld title, XomwParserOptions parserOptions, Object[] ary);
|
||||
|
||||
/**
|
||||
* Prepare Content for saving. Called before Content is saved by WikiPage::doEditContent() and in
|
||||
|
@ -224,7 +224,7 @@ public abstract class XomwContentHandler {
|
||||
*
|
||||
* @return ContentHandler
|
||||
*/
|
||||
// public static XomwContentHandler getForTitle(XomwTitle title) {
|
||||
// public static XomwContentHandler getForTitle(XomwTitleOld title) {
|
||||
// int modelId = title.getContentModel();
|
||||
//
|
||||
// return ContentHandler.getForModelID(modelId);
|
||||
|
@ -617,7 +617,7 @@ public class XomwFileRepo {
|
||||
* @param Title title
|
||||
* @return String
|
||||
*/
|
||||
public byte[] getNameFromTitle(XomwTitle title) {
|
||||
public byte[] getNameFromTitle(XomwTitleOld title) {
|
||||
// global wgContLang;
|
||||
// if (this.initialCapital != XomwNamespace::isCapitalized(NS_FILE)) {
|
||||
// name = title.getUserCaseDBKey();
|
||||
|
@ -69,7 +69,7 @@ public class XomwFile {
|
||||
public XomwFileRepo repo;
|
||||
|
||||
/** @var Title|String|boolean */
|
||||
private XomwTitle title;
|
||||
private XomwTitleOld title;
|
||||
|
||||
// /** @var String Text of last error */
|
||||
// protected lastError;
|
||||
@ -265,7 +265,7 @@ public class XomwFile {
|
||||
// return strcmp(a.getName(), b.getName());
|
||||
// }
|
||||
|
||||
public XomwFile(XomwEnv env, XomwTitle title, XomwFileRepo repo) {
|
||||
public XomwFile(XomwEnv env, XomwTitleOld title, XomwFileRepo repo) {
|
||||
this.env = env;
|
||||
this.title = title;
|
||||
// change title.getDBKey to normalizeTitle
|
||||
@ -306,7 +306,7 @@ public class XomwFile {
|
||||
*
|
||||
* @return Title
|
||||
*/
|
||||
public XomwTitle getTitle() {
|
||||
public XomwTitleOld getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
|
@ -15,5 +15,5 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes.filerepo.file; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.filerepo.*;
|
||||
public interface XomwFileFinder {
|
||||
XomwFile Find_file(XomwTitle ttl);
|
||||
XomwFile Find_file(XomwTitleOld ttl);
|
||||
}
|
||||
|
@ -20,12 +20,12 @@ public class XomwFileFinderMock implements XomwFileFinder {
|
||||
public XomwFileFinderMock(XomwEnv env) {this.env = env;}
|
||||
private final Hash_adp_bry hash = Hash_adp_bry.cs();
|
||||
public void Clear() {hash.Clear();}
|
||||
public XomwFile Find_file(XomwTitle ttl) {
|
||||
public XomwFile Find_file(XomwTitleOld ttl) {
|
||||
return (XomwFile)hash.Get_by(ttl.getPrefixedDBkey());
|
||||
}
|
||||
public void Add(String title, XomwFileRepo repo, int w, int h, byte[] mime) {
|
||||
byte[] title_bry = Bry_.new_u8(title);
|
||||
XomwLocalFile file = new XomwLocalFile(env, XomwTitle.newFromText(env, title_bry), repo, w, h, mime);
|
||||
XomwLocalFile file = new XomwLocalFile(env, XomwTitleOld.newFromText(env, title_bry), repo, w, h, mime);
|
||||
hash.Add_if_dupe_use_nth(title_bry, file);
|
||||
}
|
||||
}
|
||||
|
@ -15,5 +15,5 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes.filerepo.file; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.filerepo.*;
|
||||
public class XomwFileFinderNoop implements XomwFileFinder {
|
||||
public XomwFile Find_file(XomwTitle ttl) {return null;}
|
||||
public XomwFile Find_file(XomwTitleOld ttl) {return null;}
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ public class XomwLocalFile extends XomwFile {// static final VERSION = 10; // c
|
||||
// ];
|
||||
// }
|
||||
|
||||
public XomwLocalFile(XomwEnv env, XomwTitle title, XomwFileRepo repo, int w, int h, byte[] mime) {super(env, title, repo);
|
||||
public XomwLocalFile(XomwEnv env, XomwTitleOld title, XomwFileRepo repo, int w, int h, byte[] mime) {super(env, title, repo);
|
||||
this.width = w;
|
||||
this.height = h;
|
||||
this.mime = mime;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -136,7 +136,7 @@ public class XomwLinkRenderer {
|
||||
* @return String
|
||||
*/
|
||||
public void makeLink(Bry_bfr bfr,
|
||||
XomwTitle target, byte[] text, Xomw_atr_mgr extraAttribs, Xomw_qry_mgr query) {
|
||||
XomwTitleOld target, byte[] text, Xomw_atr_mgr extraAttribs, Xomw_qry_mgr query) {
|
||||
// $title = Title::newFromLinkTarget($target); // does db lookup?
|
||||
if (target.isKnown()) {
|
||||
this.makeKnownLink(bfr, target, text, extraAttribs, query);
|
||||
@ -238,7 +238,7 @@ public class XomwLinkRenderer {
|
||||
* @return String
|
||||
*/
|
||||
public void makePreloadedLink(Bry_bfr bfr,
|
||||
XomwTitle target, byte[] text, byte[] classes, Xomw_atr_mgr extraAttribs, Xomw_qry_mgr query) {
|
||||
XomwTitleOld target, byte[] text, byte[] classes, Xomw_atr_mgr extraAttribs, Xomw_qry_mgr query) {
|
||||
// XO.MW.HOOK: this.runBeginHook --> 'HtmlPageLinkRendererBegin', 'LinkBegin'
|
||||
|
||||
target = this.normalizeTarget(target);
|
||||
@ -269,7 +269,7 @@ public class XomwLinkRenderer {
|
||||
* @return String
|
||||
*/
|
||||
public void makeKnownLink(Bry_bfr bfr,
|
||||
XomwTitle target, byte[] text, Xomw_atr_mgr extraAttribs, Xomw_qry_mgr query) {
|
||||
XomwTitleOld target, byte[] text, Xomw_atr_mgr extraAttribs, Xomw_qry_mgr query) {
|
||||
byte[] classes = Bry_.Empty;
|
||||
if (target.isExternal()) {
|
||||
classes = Bry__classes__extiw;
|
||||
@ -295,7 +295,7 @@ public class XomwLinkRenderer {
|
||||
* @return String
|
||||
*/
|
||||
public void makeBrokenLink(Bry_bfr bfr,
|
||||
XomwTitle target, byte[] text, Xomw_atr_mgr extraAttribs, Xomw_qry_mgr query) {
|
||||
XomwTitleOld target, byte[] text, Xomw_atr_mgr extraAttribs, Xomw_qry_mgr query) {
|
||||
// XO.MW.HOOK: Run legacy hook
|
||||
|
||||
// We don't want to include fragments for broken links, because they
|
||||
@ -341,7 +341,7 @@ public class XomwLinkRenderer {
|
||||
* @param boolean $isKnown
|
||||
* @return null|String
|
||||
*/
|
||||
private void buildAElement(Bry_bfr bfr, XomwTitle target, byte[] text, Xomw_atr_mgr attribs, boolean isKnown) {
|
||||
private void buildAElement(Bry_bfr bfr, XomwTitleOld target, byte[] text, Xomw_atr_mgr attribs, boolean isKnown) {
|
||||
// XO.MW.HOOK:HtmlPageLinkRendererEnd
|
||||
|
||||
byte[] htmlBry = text;
|
||||
@ -357,7 +357,7 @@ public class XomwLinkRenderer {
|
||||
* @return String non-escaped text
|
||||
*/
|
||||
// XO.MW:SYNC:1.29; DATE:2017-01-31
|
||||
private byte[] getLinkText(XomwTitle target) {
|
||||
private byte[] getLinkText(XomwTitleOld target) {
|
||||
byte[] prefixed_text = target.getPrefixedText();
|
||||
// If the target is just a fragment, with no title, we return the fragment
|
||||
// text. Otherwise, we return the title text itself.
|
||||
@ -367,7 +367,7 @@ public class XomwLinkRenderer {
|
||||
return prefixed_text;
|
||||
}
|
||||
|
||||
private byte[] getLinkUrl(XomwTitle target, Xomw_qry_mgr query) {
|
||||
private byte[] getLinkUrl(XomwTitleOld target, Xomw_qry_mgr query) {
|
||||
// TODO: Use a LinkTargetResolver service instead of Title
|
||||
// $title = Title::newFromLinkTarget($target);
|
||||
// if (this.forceArticlePath) {
|
||||
@ -392,7 +392,7 @@ public class XomwLinkRenderer {
|
||||
* @param LinkTarget $target
|
||||
* @return LinkTarget
|
||||
*/
|
||||
private XomwTitle normalizeTarget(XomwTitle target) {
|
||||
private XomwTitleOld normalizeTarget(XomwTitleOld target) {
|
||||
return XomwLinker.normaliseSpecialPage(target);
|
||||
}
|
||||
|
||||
@ -448,7 +448,7 @@ public class XomwLinkRenderer {
|
||||
* @param LinkTarget $target
|
||||
* @return String CSS class
|
||||
*/
|
||||
public byte[] getLinkClasses(XomwTitle target) {
|
||||
public byte[] getLinkClasses(XomwTitleOld target) {
|
||||
// Make sure the target is in the cache
|
||||
// $id = this.linkCache->addLinkObj($target);
|
||||
// if ($id == 0) {
|
||||
|
@ -0,0 +1,112 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2020 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.mediawiki.includes.linkers;
|
||||
|
||||
// MW.SRC:v1.33.1
|
||||
/**
|
||||
* @since 1.27
|
||||
*/
|
||||
public interface XomwLinkTarget {
|
||||
//
|
||||
// /**
|
||||
// * Get the namespace index.
|
||||
// * @since 1.27
|
||||
// *
|
||||
// * @return int Namespace index
|
||||
// */
|
||||
// public int getNamespace();
|
||||
//
|
||||
// /**
|
||||
// * Convenience function to test if it is in the namespace
|
||||
// * @since 1.27
|
||||
// *
|
||||
// * @param int $ns
|
||||
// * @return bool
|
||||
// */
|
||||
// public boolean inNamespace(int ns);
|
||||
//
|
||||
// /**
|
||||
// * Get the link fragment (i.e. the bit after the #) in text form.
|
||||
// * @since 1.27
|
||||
// *
|
||||
// * @return string link fragment
|
||||
// */
|
||||
// public String getFragment();
|
||||
//
|
||||
// /**
|
||||
// * Whether the link target has a fragment
|
||||
// * @since 1.27
|
||||
// *
|
||||
// * @return bool
|
||||
// */
|
||||
// public boolean hasFragment();
|
||||
//
|
||||
// /**
|
||||
// * Get the main part with underscores.
|
||||
// * @since 1.27
|
||||
// *
|
||||
// * @return string Main part of the link, with underscores (for use in href attributes)
|
||||
// */
|
||||
// public String getDBkey();
|
||||
//
|
||||
// /**
|
||||
// * Returns the link in text form, without namespace prefix or fragment.
|
||||
// * This is computed from the DB key by replacing any underscores with spaces.
|
||||
// * @since 1.27
|
||||
// *
|
||||
// * @return string
|
||||
// */
|
||||
// public String getText();
|
||||
//
|
||||
// /**
|
||||
// * Creates a new LinkTarget for a different fragment of the same page.
|
||||
// * It is expected that the same type of object will be returned, but the
|
||||
// * only requirement is that it is a LinkTarget.
|
||||
// * @since 1.27
|
||||
// *
|
||||
// * @param string $fragment The fragment name, or "" for the entire page.
|
||||
// *
|
||||
// * @return LinkTarget
|
||||
// */
|
||||
// public XomwLinkTarget createFragmentTarget(String fragment);
|
||||
//
|
||||
// /**
|
||||
// * Whether this LinkTarget has an interwiki component
|
||||
// * @since 1.27
|
||||
// *
|
||||
// * @return bool
|
||||
// */
|
||||
// public boolean isExternal();
|
||||
//
|
||||
// /**
|
||||
// * The interwiki component of this LinkTarget
|
||||
// * @since 1.27
|
||||
// *
|
||||
// * @return string
|
||||
// */
|
||||
// public String getInterwiki();
|
||||
//
|
||||
// /**
|
||||
// * Returns an informative human readable representation of the link target,
|
||||
// * for use in logging and debugging. There is no requirement for the return
|
||||
// * value to have any relationship with the input of TitleParser.
|
||||
// * @since 1.31
|
||||
// *
|
||||
// * @return string
|
||||
// */
|
||||
// public String __toString();
|
||||
|
||||
}
|
@ -46,7 +46,7 @@ class XomwImageHandler_fxt {
|
||||
return rv;
|
||||
}
|
||||
public void Init__file(String title, int w, int h) {
|
||||
this.file = new XomwLocalFile(env, XomwTitle.newFromText(env, Bry_.new_u8(title)), repo, w, h, XomwMediaHandlerFactory.Mime__image__png);
|
||||
this.file = new XomwLocalFile(env, XomwTitleOld.newFromText(env, Bry_.new_u8(title)), repo, w, h, XomwMediaHandlerFactory.Mime__image__png);
|
||||
}
|
||||
public void Test__normaliseParams(Xomw_params_handler prms, Xomw_params_handler expd) {
|
||||
// exec
|
||||
|
@ -18,7 +18,7 @@ package gplx.xowa.mediawiki.includes.page; import gplx.*; import gplx.xowa.*; im
|
||||
/**
|
||||
* Special handling for category pages
|
||||
*/
|
||||
public class XomwWikiCategoryPage extends XomwWikiPage { public XomwWikiCategoryPage(XomwTitle title) {super(title);
|
||||
public class XomwWikiCategoryPage extends XomwWikiPage { public XomwWikiCategoryPage(XomwTitleOld title) {super(title);
|
||||
}
|
||||
//
|
||||
// /**
|
||||
|
@ -29,7 +29,7 @@ public class XomwWikiFilePage extends XomwWikiPage { // /** @var File */
|
||||
// /** @var array */
|
||||
// protected $mDupes = null;
|
||||
|
||||
public XomwWikiFilePage(XomwTitle title) {super(title);
|
||||
public XomwWikiFilePage(XomwTitleOld title) {super(title);
|
||||
// $this->mDupes = null;
|
||||
// $this->mRepo = null;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class XomwWikiPage implements XomwPage, XomwIDBAccessObject {
|
||||
/**
|
||||
* @var Title
|
||||
*/
|
||||
public XomwTitle mTitle = null;
|
||||
public XomwTitleOld mTitle = null;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
@ -98,7 +98,7 @@ public class XomwWikiPage implements XomwPage, XomwIDBAccessObject {
|
||||
* Constructor and clear the article
|
||||
* @param Title title Reference to a Title Object.
|
||||
*/
|
||||
public XomwWikiPage(XomwTitle title) {
|
||||
public XomwWikiPage(XomwTitleOld title) {
|
||||
this.mTitle = title;
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ public class XomwWikiPage implements XomwPage, XomwIDBAccessObject {
|
||||
* @throws MWException
|
||||
* @return WikiPage|WikiCategoryPage|WikiFilePage
|
||||
*/
|
||||
public static XomwWikiPage factory(XomwTitle title) {
|
||||
public static XomwWikiPage factory(XomwTitleOld title) {
|
||||
int ns = title.getNamespace();
|
||||
|
||||
if (ns == XomwDefines.NS_MEDIA) {
|
||||
|
@ -227,7 +227,7 @@ public class XomwLinkHolderArray {
|
||||
* @param String $prefix [optional]
|
||||
* @return String
|
||||
*/
|
||||
public void makeHolder(Bry_bfr bfr, XomwTitle nt, byte[] text, byte[][] query, byte[] trail, byte[] prefix) {
|
||||
public void makeHolder(Bry_bfr bfr, XomwTitleOld nt, byte[] text, byte[][] query, byte[] trail, byte[] prefix) {
|
||||
if (nt == null) {
|
||||
// Fail gracefully
|
||||
bfr.Add_str_a7("<!-- ERROR -->").Add(prefix).Add(text).Add(trail);
|
||||
@ -739,7 +739,7 @@ public class XomwLinkHolderArray {
|
||||
// $this->doVariants( $colours );
|
||||
// }
|
||||
// }
|
||||
public void Test__add(XomwTitle ttl, byte[] capt) {
|
||||
public void Test__add(XomwTitleOld ttl, byte[] capt) {
|
||||
int key = parent.nextLinkID();
|
||||
XomwLinkHolderItem item = new XomwLinkHolderItem(ttl, capt, Bry_.Ary_empty);
|
||||
internals.Add(key, item);
|
||||
@ -767,12 +767,12 @@ class XomwLinkHolderList {
|
||||
public XomwLinkHolderItem Get_by(int key) {return ary[key];}
|
||||
}
|
||||
class XomwLinkHolderItem {
|
||||
public XomwLinkHolderItem(XomwTitle title, byte[] text, byte[][] query) {
|
||||
public XomwLinkHolderItem(XomwTitleOld title, byte[] text, byte[][] query) {
|
||||
this.title = title;
|
||||
this.text = text;
|
||||
this.query = query;
|
||||
}
|
||||
public XomwTitle Title() {return title;} private final XomwTitle title;
|
||||
public XomwTitleOld Title() {return title;} private final XomwTitleOld title;
|
||||
public byte[] Text() {return text;} private final byte[] text;
|
||||
public byte[] Pdbk() {return title.getPrefixedDBkey();}
|
||||
public byte[][] Query() {return query;} private final byte[][] query;
|
||||
|
@ -34,7 +34,7 @@ class XomwLinkHolderArray_fxt {
|
||||
this.holders = new XomwLinkHolderArray(parser);
|
||||
}
|
||||
public void Init__add(String ttl, String capt) {
|
||||
holders.Test__add(XomwTitle.newFromText(env, Bry_.new_u8(ttl)), Bry_.new_u8(capt));
|
||||
holders.Test__add(XomwTitleOld.newFromText(env, Bry_.new_u8(ttl)), Bry_.new_u8(capt));
|
||||
}
|
||||
public void Test__replace(String src, String expd) {
|
||||
if (apos) expd = gplx.langs.htmls.Gfh_utl.Replace_apos(expd);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,13 +16,13 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
package gplx.xowa.mediawiki.includes.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
||||
import gplx.xowa.mediawiki.includes.parsers.lnkis.*;
|
||||
public class XomwParserCtx {
|
||||
public XomwTitle Page_title() {return page_title;} private XomwTitle page_title;
|
||||
public XomwTitleOld Page_title() {return page_title;} private XomwTitleOld page_title;
|
||||
public Xomw_image_params Lnki_wkr__make_image__img_params = new Xomw_image_params();
|
||||
public byte[][] Lnki_wkr__make_image__match_magic_word = new byte[2][];
|
||||
public int[] Lnki_wkr__make_image__img_size = new int[2];
|
||||
public Xomw_params_mto Linker__makeImageLink__prms = new Xomw_params_mto();
|
||||
|
||||
public void Init_by_page(XomwTitle page_title) {
|
||||
public void Init_by_page(XomwTitleOld page_title) {
|
||||
this.page_title = page_title;
|
||||
}
|
||||
|
||||
|
@ -67,8 +67,8 @@ class XomwParser_fxt {
|
||||
Xowe_wiki wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
this.parser = new XomwParser(XomwEnv.NewTestByApp(app));
|
||||
parser.Init_by_wiki(wiki);
|
||||
parser.Init_by_page(XomwTitle.newFromText(parser.Env(), Bry_.new_a7("Page_1")));
|
||||
pctx.Init_by_page(XomwTitle.newFromText(parser.Env(), Bry_.new_a7("Page_1")));
|
||||
parser.Init_by_page(XomwTitleOld.newFromText(parser.Env(), Bry_.new_a7("Page_1")));
|
||||
pctx.Init_by_page(XomwTitleOld.newFromText(parser.Env(), Bry_.new_a7("Page_1")));
|
||||
}
|
||||
public void Test__parse(String src_str, String expd) {
|
||||
byte[] src_bry = Bry_.new_u8(src_str);
|
||||
|
@ -42,7 +42,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
private final XomwStripState strip_state;
|
||||
private XomwEnv env;
|
||||
private Xow_wiki wiki;
|
||||
private XomwTitle mPageTitle;
|
||||
private XomwTitleOld mPageTitle;
|
||||
// private final XomwLinker_NormalizeSubpageLink normalize_subpage_link = new XomwLinker_NormalizeSubpageLink();
|
||||
private final Bry_bfr tmp;
|
||||
private final XomwParserIface parser;
|
||||
@ -69,7 +69,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
this.env = env;
|
||||
this.wiki = wiki;
|
||||
if (title_chars_for_lnki == null) {
|
||||
title_chars_for_lnki = (boolean[])Array_.Clone(XomwTitle.Title_chars_valid());
|
||||
title_chars_for_lnki = (boolean[])Array_.Clone(XomwTitleOld.Title_chars_valid());
|
||||
// the % is needed to support urlencoded titles as well
|
||||
title_chars_for_lnki[Byte_ascii.Hash] = true;
|
||||
title_chars_for_lnki[Byte_ascii.Percent] = true;
|
||||
@ -155,7 +155,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
// PORTED.BGN: if (preg_match($e1, $line, $m)) && else if (preg_match($e1_img, $line, $m))
|
||||
// NOTE: both e1 and e1_img are effectively the same; e1_img allows nested "[["; EX: "[[A|b[[c]]d]]" will stop at "[[A|b"
|
||||
int ttl_bgn = cur;
|
||||
int ttl_end = XomwTitle.Find_fwd_while_title(src, cur, src_end, title_chars_for_lnki);
|
||||
int ttl_end = XomwTitleOld.Find_fwd_while_title(src, cur, src_end, title_chars_for_lnki);
|
||||
cur = ttl_end;
|
||||
int capt_bgn = -1, capt_end = -1;
|
||||
int nxt_lnki = -1;
|
||||
@ -253,7 +253,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
link = Bry_.Mid(link, 1);
|
||||
}
|
||||
// $nt = is_string( $unstrip ) ? Title::newFromText( $unstrip ) : null;
|
||||
XomwTitle nt = XomwTitle.newFromText(env, link);
|
||||
XomwTitleOld nt = XomwTitleOld.newFromText(env, link);
|
||||
|
||||
// Make subpage if necessary
|
||||
// boolean useSubpages = nt.Ns().Subpages_enabled();
|
||||
@ -261,7 +261,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
// Maybe_do_subpage_link(normalize_subpage_link, orig_link, text);
|
||||
// link = normalize_subpage_link.link;
|
||||
// text = normalize_subpage_link.text;
|
||||
// nt = XomwTitle.newFromText(link);
|
||||
// nt = XomwTitleOld.newFromText(link);
|
||||
// }
|
||||
// IGNORE: handled in rewrite above
|
||||
// else {
|
||||
@ -270,7 +270,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
|
||||
byte[] unstrip = strip_state.unstripNoWiki(link);
|
||||
if (!Bry_.Eq(unstrip, link))
|
||||
nt = XomwTitle.newFromText(env, unstrip);
|
||||
nt = XomwTitleOld.newFromText(env, unstrip);
|
||||
if (nt == null) {
|
||||
bfr.Add_mid(src, prv, lnki_bgn + 2); // $s .= $prefix . '[[' . $line;
|
||||
prv = cur = lnki_bgn + 2;
|
||||
@ -443,7 +443,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
}
|
||||
}
|
||||
}
|
||||
public void makeImage(XomwEnv env, XomwParserCtx pctx, Bry_bfr bfr, XomwTitle title, byte[] options_at_link, XomwLinkHolderArray holders) {
|
||||
public void makeImage(XomwEnv env, XomwParserCtx pctx, Bry_bfr bfr, XomwTitleOld title, byte[] options_at_link, XomwLinkHolderArray holders) {
|
||||
// Check if the options text is of the form "options|alt text"
|
||||
// Options are:
|
||||
// * thumbnail make a thumbnail with enlarge-icon and caption, alignment depends on lang
|
||||
@ -758,7 +758,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
* @param array $options Array of options to RepoGroup::findFile
|
||||
* @return array ( File or false, Title of file )
|
||||
*/
|
||||
public XomwFile fetchFileAndTitle(XomwTitle title, Hash_adp options) {
|
||||
public XomwFile fetchFileAndTitle(XomwTitleOld title, Hash_adp options) {
|
||||
XomwFile file = fetchFileNoRegister(title, options);
|
||||
|
||||
//$time = $file ? $file->getTimestamp() : false;
|
||||
@ -782,7 +782,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
* @param array $options Array of options to RepoGroup::findFile
|
||||
* @return File|boolean
|
||||
*/
|
||||
private XomwFile fetchFileNoRegister(XomwTitle title, Hash_adp options) {
|
||||
private XomwFile fetchFileNoRegister(XomwTitleOld title, Hash_adp options) {
|
||||
XomwFile file = null;
|
||||
// if ( isset( $options['broken'] ) ) {
|
||||
// file = false; // broken thumbnail forced by hook
|
||||
@ -799,7 +799,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
public void replaceLinkHolders(XomwParserBfr pbfr) {
|
||||
holders.replace(pbfr);
|
||||
}
|
||||
public void Make_known_link_holder(Bry_bfr bfr, XomwTitle nt, byte[] text, byte[] trail, byte[] prefix) {
|
||||
public void Make_known_link_holder(Bry_bfr bfr, XomwTitleOld nt, byte[] text, byte[] trail, byte[] prefix) {
|
||||
byte[][] split_trail = linker.splitTrail(trail);
|
||||
byte[] inside = split_trail[0];
|
||||
trail = split_trail[1];
|
||||
|
@ -96,7 +96,7 @@ class Xomw_lnki_wkr__fxt {
|
||||
|
||||
// ctx
|
||||
pctx = new XomwParserCtx();
|
||||
pctx.Init_by_page(XomwTitle.newFromText(env, Bry_.new_a7("Page_1")));
|
||||
pctx.Init_by_page(XomwTitleOld.newFromText(env, Bry_.new_a7("Page_1")));
|
||||
}
|
||||
public void Clear() {
|
||||
wkr.Clear_state();
|
||||
|
@ -71,7 +71,7 @@ class Xomw_magiclinks_wkr__fxt {
|
||||
public Xomw_magiclinks_wkr__fxt() {
|
||||
Xomw_regex_space regex_space = new Xomw_regex_space();
|
||||
XomwParser parser = new XomwParser(XomwEnv_fxt.NewTest());
|
||||
pctx.Init_by_page(XomwTitle.newFromText(parser.Env(), Bry_.new_a7("Page_1")));
|
||||
pctx.Init_by_page(XomwTitleOld.newFromText(parser.Env(), Bry_.new_a7("Page_1")));
|
||||
this.wkr = new Xomw_magiclinks_wkr(parser, parser.Sanitizer(), parser.Linker(), new Xomw_regex_boundary(regex_space), new Xomw_regex_url(regex_space));
|
||||
wkr.Init_by_wiki();
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ public abstract class XomwPPFrame {
|
||||
*
|
||||
* @return PPFrame
|
||||
*/
|
||||
public XomwPPFrame newChild(Object args, XomwTitle title) {return newChild(args, title, 0);}
|
||||
@gplx.Virtual public XomwPPFrame newChild(Object args, XomwTitle title, int indexOffset) {return null;}
|
||||
public XomwPPFrame newChild(Object args, XomwTitleOld title) {return newChild(args, title, 0);}
|
||||
@gplx.Virtual public XomwPPFrame newChild(Object args, XomwTitleOld title, int indexOffset) {return null;}
|
||||
|
||||
/**
|
||||
* Expand a document tree node, caching the result on its parent with the given key
|
||||
@ -141,7 +141,7 @@ public abstract class XomwPPFrame {
|
||||
* @param Title $title
|
||||
* @return boolean
|
||||
*/
|
||||
@gplx.Virtual public boolean loopCheck(XomwTitle title) {return false;}
|
||||
@gplx.Virtual public boolean loopCheck(XomwTitleOld title) {return false;}
|
||||
|
||||
/**
|
||||
* Return true if the frame is a template frame
|
||||
@ -203,5 +203,5 @@ public abstract class XomwPPFrame {
|
||||
*
|
||||
* @return Title
|
||||
*/
|
||||
@gplx.Virtual public XomwTitle getTitle() {return null;}
|
||||
@gplx.Virtual public XomwTitleOld getTitle() {return null;}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class XomwPPFrame_Hash extends XomwPPFrame { /**
|
||||
/**
|
||||
* @var Title
|
||||
*/
|
||||
public XomwTitle title;
|
||||
public XomwTitleOld title;
|
||||
public XophpArray titleCache;
|
||||
|
||||
/**
|
||||
@ -80,7 +80,7 @@ public class XomwPPFrame_Hash extends XomwPPFrame { /**
|
||||
* @throws MWException
|
||||
* @return PPTemplateFrame_Hash
|
||||
*/
|
||||
@Override public XomwPPFrame newChild(Object argsObj, XomwTitle title, int indexOffset) {
|
||||
@Override public XomwPPFrame newChild(Object argsObj, XomwTitleOld title, int indexOffset) {
|
||||
XophpArray namedArgs = XophpArray.New();
|
||||
XophpArray numberedArgs = XophpArray.New();
|
||||
if (!XophpObject_.is_true(title)) {
|
||||
@ -576,7 +576,7 @@ public class XomwPPFrame_Hash extends XomwPPFrame { /**
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@Override public boolean loopCheck(XomwTitle title) {
|
||||
@Override public boolean loopCheck(XomwTitleOld title) {
|
||||
return !this.loopCheckHash.isset(title.getPrefixedDBkeyStr());
|
||||
}
|
||||
|
||||
@ -594,7 +594,7 @@ public class XomwPPFrame_Hash extends XomwPPFrame { /**
|
||||
*
|
||||
* @return Title
|
||||
*/
|
||||
@Override public XomwTitle getTitle() {
|
||||
@Override public XomwTitleOld getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class XomwPPTemplateFrame_Hash extends XomwPPFrame_Hash { public XophpArray num
|
||||
*/
|
||||
// parent = false, numberedArgs = [], namedArgs = []; titl = false
|
||||
public XomwPPTemplateFrame_Hash(XomwPreprocessor preprocessor, XomwPPFrame_Hash parent, XophpArray numberedArgs,
|
||||
XophpArray namedArgs, XomwTitle title
|
||||
XophpArray namedArgs, XomwTitleOld title
|
||||
) {super(preprocessor);
|
||||
this.parent = parent;
|
||||
this.numberedArgs = numberedArgs;
|
||||
|
@ -45,7 +45,7 @@ public abstract class XomwPPFrame {
|
||||
*
|
||||
* @return PPFrame
|
||||
*/
|
||||
@gplx.Virtual public XomwPPFrame newChild(Object args, XomwTitle title, int indexOffset) {return null;}
|
||||
@gplx.Virtual public XomwPPFrame newChild(Object args, XomwTitleOld title, int indexOffset) {return null;}
|
||||
|
||||
/**
|
||||
* Expand a document tree node, caching the result on its parent with the given key
|
||||
@ -139,7 +139,7 @@ public abstract class XomwPPFrame {
|
||||
* @param Title $title
|
||||
* @return boolean
|
||||
*/
|
||||
@gplx.Virtual public boolean loopCheck(XomwTitle title) {return false;}
|
||||
@gplx.Virtual public boolean loopCheck(XomwTitleOld title) {return false;}
|
||||
|
||||
/**
|
||||
* Return true if the frame is a template frame
|
||||
@ -201,5 +201,5 @@ public abstract class XomwPPFrame {
|
||||
*
|
||||
* @return Title
|
||||
*/
|
||||
@gplx.Virtual public XomwTitle getTitle() {return null;}
|
||||
@gplx.Virtual public XomwTitleOld getTitle() {return null;}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class XomwPPFrame_Hash extends XomwPPFrame { // /**
|
||||
// /**
|
||||
// * @var Title
|
||||
// */
|
||||
// public XomwTitle title;
|
||||
// public XomwTitleOld title;
|
||||
// public XophpArray titleCache;
|
||||
//
|
||||
// /**
|
||||
@ -80,7 +80,7 @@ public class XomwPPFrame_Hash extends XomwPPFrame { // /**
|
||||
// * @throws MWException
|
||||
// * @return PPTemplateFrame_Hash
|
||||
// */
|
||||
// public override XomwPPFrame newChild(Object argsObj, XomwTitle title, int indexOffset) {
|
||||
// public override XomwPPFrame newChild(Object argsObj, XomwTitleOld title, int indexOffset) {
|
||||
// XophpArray namedArgs = XophpArray.New();
|
||||
// XophpArray numberedArgs = XophpArray.New();
|
||||
// if (!XophpObject_.is_true(title)) {
|
||||
@ -576,7 +576,7 @@ public class XomwPPFrame_Hash extends XomwPPFrame { // /**
|
||||
// *
|
||||
// * @return boolean
|
||||
// */
|
||||
// public override boolean loopCheck(XomwTitle title) {
|
||||
// public override boolean loopCheck(XomwTitleOld title) {
|
||||
// return !this.loopCheckHash.isset(title.getPrefixedDBkeyStr());
|
||||
// }
|
||||
//
|
||||
@ -594,7 +594,7 @@ public class XomwPPFrame_Hash extends XomwPPFrame { // /**
|
||||
// *
|
||||
// * @return Title
|
||||
// */
|
||||
// public override XomwTitle getTitle() {
|
||||
// public override XomwTitleOld getTitle() {
|
||||
// return this.title;
|
||||
// }
|
||||
//
|
||||
|
@ -31,7 +31,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
// */
|
||||
// // parent = false, numberedArgs = [], namedArgs = []; titl = false
|
||||
// public XomwPPTemplateFrame_Hash(XomwPreprocessor preprocessor, XomwPPFrame_Hash parent, XophpArray numberedArgs,
|
||||
// XophpArray namedArgs, XomwTitle title
|
||||
// XophpArray namedArgs, XomwTitleOld title
|
||||
// ) : super(preprocessor) {
|
||||
// this.parent = parent;
|
||||
// this.numberedArgs = numberedArgs;
|
||||
|
@ -314,7 +314,7 @@ public class XomwMediaWikiTitleCodec implements XomwTitleFormatter {
|
||||
if (Bry_.Len_eq_0(dbkey)) {
|
||||
// Empty self-links should point to the Main Page, to ensure
|
||||
// compatibility with cross-wiki transclusions and the like.
|
||||
XomwTitle mainPage = XomwTitle.newMainPage(mws.env);
|
||||
XomwTitleOld mainPage = XomwTitleOld.newMainPage(mws.env);
|
||||
XomwMediaWikiTitleCodecParts rv = new XomwMediaWikiTitleCodecParts(mainPage.getDBkey(), mainPage.getNamespace());
|
||||
rv.interwiki = mainPage.getInterwiki();
|
||||
rv.local_interwiki = true;
|
||||
|
@ -36,5 +36,5 @@ public interface XomwTitleParser {
|
||||
* @throws MalformedTitleException If the text is not a valid representation of a page title.
|
||||
* @return TitleValue
|
||||
*/
|
||||
XomwTitle parseTitle(byte[] text, int defaultNamespace);
|
||||
XomwTitleOld parseTitle(byte[] text, int defaultNamespace);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user