X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryLinks.php;h=65975b23e2286b4b43147e59c6e9dd25b0366bb6;hb=5b1a5aa76327d9391c468e29e46063540d132537;hp=5f5cf92cdbd38fb086455a7f4104d8a9a5c45eee;hpb=a90a0783de6c6a817abec4f947598024243b02ca;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryLinks.php b/includes/api/ApiQueryLinks.php index 5f5cf92cdb..65975b23e2 100644 --- a/includes/api/ApiQueryLinks.php +++ b/includes/api/ApiQueryLinks.php @@ -1,9 +1,8 @@ @gmail.com * @@ -19,8 +18,10 @@ * * 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' ) ) { @@ -65,6 +66,10 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { $this->run(); } + public function getCacheMode( $params ) { + return 'public'; + } + public function executeGenerator( $resultPageSet ) { $this->run( $resultPageSet ); } @@ -85,7 +90,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { $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 ) { @@ -138,12 +143,11 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { $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... @@ -165,7 +169,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { } 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... @@ -233,4 +237,4 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { public function getVersion() { return __CLASS__ . ': $Id$'; } -} \ No newline at end of file +}