<?php
-
/**
- * Created on May 12, 2007
*
- * API for MediaWiki 1.8+
+ *
+ * Created on May 12, 2007
*
* Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
*
*
* 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
+ *
+ * @file
*/
if ( !defined( 'MEDIAWIKI' ) ) {
$this->run();
}
+ public function getCacheMode( $params ) {
+ return 'public';
+ }
+
public function executeGenerator( $resultPageSet ) {
$this->run( $resultPageSet );
}
+ /**
+ * @param $resultPageSet ApiPageSet
+ * @return
+ */
private function run( $resultPageSet = null ) {
if ( $this->getPageSet()->getGoodTitleCount() == 0 ) {
return; // nothing to do
$this->addTables( $this->table );
$this->addWhereFld( $this->prefix . '_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
$this->addWhereFld( $this->prefix . '_namespace', $params['namespace'] );
-
+
if ( !is_null( $params[$this->titlesParam] ) ) {
$lb = new LinkBatch;
foreach ( $params[$this->titlesParam] as $t ) {
$this->addOption( 'USE INDEX', "{$this->prefix}_from" );
$this->addOption( 'LIMIT', $params['limit'] + 1 );
- $db = $this->getDB();
$res = $this->select( __METHOD__ );
if ( is_null( $resultPageSet ) ) {
$count = 0;
- 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...
} else {
$titles = array();
$count = 0;
- 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...
}
$resultPageSet->populateFromTitles( $titles );
}
-
- $db->freeResult( $res );
}
public function getAllowedParams() {
public function getVersion() {
return __CLASS__ . ': $Id$';
}
-}
\ No newline at end of file
+}