r95946 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95945‎ | r95946 | r95947 >
Date:07:49, 1 September 2011
Author:dantman
Status:ok
Tags:
Comment:
Add Title::isSubpageOf to use when you want to make tests like $title->isSubpageOf( $someUserpage );
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -3860,6 +3860,18 @@
38613861 }
38623862
38633863 /**
 3864+ * Check if this title is a subpage of another title
 3865+ *
 3866+ * @param $title Title
 3867+ * @return Bool
 3868+ */
 3869+ public function isSubpageOf( Title $title ) {
 3870+ return $this->getInterwiki() === $title->getInterwiki()
 3871+ && $this->getNamespace() == $title->getNamespace()
 3872+ && strpos( $this->getDBkey(), $title->getDBkey() . '/' ) === 0;
 3873+ }
 3874+
 3875+ /**
38643876 * Callback for usort() to do title sorts by (namespace, title)
38653877 *
38663878 * @param $a Title

Follow-up revisions

RevisionCommit summaryAuthorDate
r95949Followup r95947, undo accidental revert of r95946.dantman08:34, 1 September 2011

Status & tagging log