*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*/
$this->addTables( 'iwlinks' );
$this->addWhereFld( 'iwl_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
+
if ( !is_null( $params['continue'] ) ) {
$cont = explode( '|', $params['continue'] );
if ( count( $cont ) != 3 ) {
$res = $this->select( __METHOD__ );
$count = 0;
- $db = $this->getDB();
- while ( $row = $db->fetchObject( $res ) ) {
+ foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that
// there are additional pages to be had. Stop here...
break;
}
$entry = array( 'prefix' => $row->iwl_prefix );
+
+ if ( !is_null( $params['url'] ) ) {
+ $title = Title::newFromText( "{$row->iwl_prefix}:{$row->iwl_title}" );
+ if ( $title ) {
+ $entry = array_merge( $entry, array( 'url' => $title->getFullURL() ) );
+ }
+ }
+
ApiResult::setContent( $entry, $row->iwl_title );
$fit = $this->addPageSubItem( $row->iwl_from, $entry );
if ( !$fit ) {
break;
}
}
- $db->freeResult( $res );
+ }
+
+ public function getCacheMode( $params ) {
+ return 'public';
}
public function getAllowedParams() {
return array(
+ 'url' => null,
'limit' => array(
ApiBase::PARAM_DFLT => 10,
ApiBase::PARAM_TYPE => 'limit',
public function getParamDescription() {
return array(
+ 'url' => 'Whether to get the full URL',
'limit' => 'How many interwiki links to return',
'continue' => 'When more results are available, use this to continue',
);
public function getVersion() {
return __CLASS__ . ': $Id$';
}
-}
\ No newline at end of file
+}