Permalink
Browse files

Removes unneeded watch methods. Correctly sets document ID in getDocu…

…mentPageTitle().
  • Loading branch information...
jimsafley committed Jun 9, 2011
1 parent 3a08aa3 commit d2ed01326028d136357194d8a068c38496388ed1
Showing with 20 additions and 70 deletions.
  1. +20 −70 lib/Scripto/Document.php
View
@@ -147,7 +147,7 @@ public function setPage($pageId)
$this->_talkPageInfo = $this->_getPageInfo('Talk:' . $baseTitle);
$this->_pageId = $pageId;
- $this->_pageTitle = $this->_adapter->getDocumentPageTitle($pageId);
+ $this->_pageTitle = $this->_adapter->getDocumentPageTitle($this->_id, $pageId);
$this->_baseTitle = $baseTitle;
}
@@ -479,47 +479,33 @@ public function unprotectTalkPage()
}
/**
- * Watch the current transcription page.
- */
- public function watchTranscriptionPage()
- {
- if (is_null($this->_pageId)) {
- throw new Scripto_Exception('The document page must be set before watching the transcription page.');
- }
- $this->_watchPage($this->_baseTitle);
- }
-
- /**
- * Watch the current talk page.
- */
- public function watchTalkPage()
- {
- if (is_null($this->_pageId)) {
- throw new Scripto_Exception('The document page must be set before watching the talk page.');
- }
- $this->_watchPage('Talk:' . $this->_baseTitle);
- }
-
- /**
- * Unatch the current transcription page.
+ * Watch the current page.
+ *
+ * Watching a transcription page implies watching its talk page.
+ *
+ * @uses Scripto_Service_MediaWiki::watch()
*/
- public function unwatchTranscriptionPage()
+ public function watchPage()
{
if (is_null($this->_pageId)) {
- throw new Scripto_Exception('The document page must be set before unwatching the transcription page.');
+ throw new Scripto_Exception('The document page must be set before watching the page.');
}
- $this->_unwatchPage($this->_baseTitle);
+ $this->_mediawiki->watch($this->_baseTitle);
}
/**
- * Unwatch the current talk page.
+ * Unwatch the current page.
+ *
+ * Unwatching a transcription page implies unwatching its talk page.
+ *
+ * @uses Scripto_Service_MediaWiki::watch()
*/
- public function unwatchTalkPage()
+ public function unwatchPage()
{
if (is_null($this->_pageId)) {
- throw new Scripto_Exception('The document page must be set before unwatching the talk page.');
+ throw new Scripto_Exception('The document page must be set before unwatching the page.');
}
- $this->_unwatchPage('Talk:' . $this->_baseTitle);
+ $this->_mediawiki->watch($this->_baseTitle, array('unwatch' => true));
}
/**
@@ -549,32 +535,18 @@ public function isProtectedTalkPage()
}
/**
- * Determine whether the current user is watching the current transcription
- * page.
+ * Determine whether the current user is watching the current page.
*
* @return bool
*/
- public function isWatchedTranscriptionPage()
+ public function isWatchedPage()
{
if (is_null($this->_pageId)) {
- throw new Scripto_Exception('The document page must be set before determining whether the current user is watching the transcription page.');
+ throw new Scripto_Exception('The document page must be set before determining whether the current user is watching the page.');
}
return $this->_transcriptionPageInfo['watched'];
}
- /**
- * Determine whether the current user is watching the current talk page.
- *
- * @return bool
- */
- public function isWatchedTalkPage()
- {
- if (is_null($this->_pageId)) {
- throw new Scripto_Exception('The document page must be set before determining whether the current user is watching the talk page.');
- }
- return $this->_talkPageInfo['watched'];
- }
-
/**
* Determine whether all of this document's transcription pages were already
* exported to the external system.
@@ -766,28 +738,6 @@ protected function _unprotectPage($title, $protectToken)
$this->_mediawiki->protect($title, $protections, $protectToken);
}
- /**
- * Watch the specified page.
- *
- * @uses Scripto_Service_MediaWiki::watch()
- * @param string $title
- */
- protected function _watchPage($title)
- {
- $this->_mediawiki->watch($title);
- }
-
- /**
- * Unwatch the specified page.
- *
- * @uses Scripto_Service_MediaWiki::watch()
- * @param string $title
- */
- protected function _unwatchPage($title)
- {
- $this->_mediawiki->watch($title, array('unwatch' => true));
- }
-
/**
* Get information for the specified page.
*

0 comments on commit d2ed013

Please sign in to comment.