コード例 #1
0
 public function modifyQuery(DpleQuery &$query)
 {
     /** Set the LIMIT clause. */
     $query->setOption('LIMIT', $this->count_);
 }
コード例 #2
0
 public function modifyQuery(DpleQuery &$query)
 {
     $dbr = $query->getDbr();
     $tableName = $dbr->tableName('revision');
     /** Add condition based on @ref $createdby_. */
     if ($this->createdby_) {
         $table = "{$tableName} AS rev_c";
         $query->addTables($table);
         $cond = $this->buildIn($this->createdby_);
         $query->addJoinCond($table, 'INNER JOIN', array('page_id = rev_c.rev_page', 'rev_c.rev_parent_id = 0'));
         $query->addConds("rev_c.rev_user {$cond}");
     }
     /** Add condition based on @ref $notCreatedby_. */
     if ($this->notCreatedby_) {
         $table = "{$tableName} AS rev_nc";
         $query->addTables($table);
         $cond = 'NOT' . $this->buildIn($this->notCreatedby_);
         $query->addJoinCond($table, 'INNER JOIN', array('page_id = rev_nc.rev_page', 'rev_nc.rev_parent_id = 0'));
         $query->addConds("rev_nc.rev_user {$cond}");
     }
     /** Add condition based on @ref $lastmodifiedby_. */
     if ($this->lastmodifiedby_) {
         $table = "{$tableName} AS rev_l";
         $query->addTables($table);
         $cond = $this->buildIn($this->lastmodifiedby_);
         $query->addJoinCond($table, 'INNER JOIN', array('page_latest = rev_l.rev_id'));
         $query->addConds("rev_l.rev_user {$cond}");
     }
     /** Add condition based on @ref $notLastmodifiedby_. */
     if ($this->notLastmodifiedby_) {
         $table = "{$tableName} AS rev_nl";
         $query->addTables($table);
         $cond = 'NOT' . $this->buildIn($this->notLastmodifiedby_);
         $query->addJoinCond($table, 'INNER JOIN', array('page_latest = rev_nl.rev_id'));
         $query->addConds("rev_nl.rev_user {$cond}");
     }
     /** Add condition based on @ref $modifiedby_. */
     if ($this->modifiedby_) {
         $table = "{$tableName} AS rev_m";
         $query->addTables($table);
         $cond = $this->buildIn($this->modifiedby_);
         $query->addJoinCond($table, 'INNER JOIN', array('page_id = rev_m.rev_page'));
         $query->addConds("rev_m.rev_user {$cond}");
         $query->setOption('DISTINCT');
     }
     /** Add condition based on @ref $notModifiedby_. */
     if ($this->notModifiedby_) {
         $table = "{$tableName} AS rev_nm";
         $query->addTables($table);
         $cond = $this->buildIn($this->notModifiedby_);
         $query->addJoinCond($table, 'LEFT OUTER JOIN', array('page_id = rev_nm.rev_page', "rev_nm.rev_user {$cond}"));
         $query->addConds(array('rev_nm.rev_page' => null));
         $query->setOption('DISTINCT');
     }
 }
コード例 #3
0
 public function modifyQuery(DpleQuery &$query)
 {
     /** Call parseOrdermethod(). */
     $this->ordermethod_ = $this->parseOrdermethod($this->ordermethod_);
     /** Set the ORDER BY clause based on $ordermethod_. */
     switch ($this->ordermethod_) {
         case 'lastedit':
             $sqlSort = 'page_touched';
             break;
         case 'length':
             $sqlSort = 'page_len';
             break;
         case 'created':
             $sqlSort = 'page_id';
             // Since they're never reused
             // and increasing
             break;
         case 'categorysortkey':
             $sqlSort = "cl1.cl_type {$this->sqlOrder_}, cl1.cl_sortkey";
             break;
         case 'categorysortkeyx':
             $sqlSort = "clx1.cl_type {$this->sqlOrder_}, clx1.cl_sortkey";
             break;
         case 'popularity':
             $sqlSort = 'page_counter';
             break;
         case 'title':
             $sqlSort = $query->getDbr()->strreplace('page_title', "'_'", "' '");
             break;
         case 'categoryadd':
             $sqlSort = 'cl1.cl_timestamp';
             break;
         case 'categoryaddx':
             $sqlSort = 'clx1.cl_timestamp';
             break;
     }
     $query->setOption('ORDER BY', "{$sqlSort} {$this->sqlOrder_}");
 }