Ejemplo n.º 1
0
 /** purgeEverything inherited */
 function getHistory($limit = null, $start = null, $end = null, $inc = true)
 {
     $dbr = $this->repo->getSlaveDB();
     $tables = array('oldimage');
     $fields = OldLocalS3File::selectFields();
     $conds = $opts = $join_conds = array();
     $eq = $inc ? '=' : '';
     $conds[] = "oi_name = " . $dbr->addQuotes($this->title->getDBkey());
     if ($start) {
         $conds[] = "oi_timestamp <{$eq} " . $dbr->addQuotes($dbr->timestamp($start));
     }
     if ($end) {
         $conds[] = "oi_timestamp >{$eq} " . $dbr->addQuotes($dbr->timestamp($end));
     }
     if ($limit) {
         $opts['LIMIT'] = $limit;
     }
     // Search backwards for time > x queries
     $order = !$start && $end !== null ? 'ASC' : 'DESC';
     $opts['ORDER BY'] = "oi_timestamp {$order}";
     $opts['USE INDEX'] = array('oldimage' => 'oi_name_timestamp');
     wfRunHooks('LocalS3File::getHistory', array(&$this, &$tables, &$fields, &$conds, &$opts, &$join_conds));
     $res = $dbr->select($tables, $fields, $conds, __METHOD__, $opts, $join_conds);
     $r = array();
     while ($row = $dbr->fetchObject($res)) {
         if ($this->repo->oldFileFromRowFactory) {
             $r[] = call_user_func($this->repo->oldFileFromRowFactory, $row, $this->repo);
         } else {
             $r[] = OldLocalS3File::newFromRow($row, $this->repo);
         }
     }
     if ($order == 'ASC') {
         $r = array_reverse($r);
         // make sure it ends up descending
     }
     return $r;
 }
Ejemplo n.º 2
0
 function newFromArchiveName($title, $archiveName)
 {
     return OldLocalS3File::newFromArchiveName($title, $this, $archiveName);
 }