mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-20 10:09:09 +00:00
60 lines
964 B
PHP
60 lines
964 B
PHP
<?php
|
|
|
|
class db_benchmarks extends CActiveRecord
|
|
{
|
|
public static function model($className=__CLASS__)
|
|
{
|
|
return parent::model($className);
|
|
}
|
|
|
|
public function tableName()
|
|
{
|
|
return 'benchmarks';
|
|
}
|
|
|
|
public function rules()
|
|
{
|
|
return array(
|
|
array('vendorid, algo', 'safe', 'on'=>'search'),
|
|
);
|
|
}
|
|
|
|
public function relations()
|
|
{
|
|
return array(
|
|
);
|
|
}
|
|
|
|
public function attributeLabels()
|
|
{
|
|
return array(
|
|
);
|
|
}
|
|
|
|
public function search()
|
|
{
|
|
$criteria = new CDbCriteria;
|
|
|
|
$t = $this->getTableAlias(false);
|
|
|
|
$criteria->compare("$t.algo",$this->algo);
|
|
$criteria->compare("$t.vendorid",$this->vendorid);
|
|
|
|
$sort = array('defaultOrder'=>"$t.time DESC");
|
|
|
|
$criteria->limit = 150;
|
|
if (empty($this->algo) || $this->algo == 'all') {
|
|
$criteria->limit = 50;
|
|
}
|
|
|
|
$dataProvider = new CActiveDataProvider($this, array(
|
|
'criteria'=>$criteria,
|
|
'pagination'=>array('pageSize'=>50),
|
|
'sort'=>$sort,
|
|
));
|
|
|
|
return $dataProvider;
|
|
}
|
|
|
|
}
|
|
|