/
app_model.php
66 lines (62 loc) · 2.25 KB
/
app_model.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/***********************************************************
* File: user.php
* Description: Application Model - parent class of all model classes
*
* PHP versions 4 and 5
*
* METAREP : High-Performance Comparative Metagenomics Framework (http://www.jcvi.org/metarep)
* Copyright(c) J. Craig Venter Institute (http://www.jcvi.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @link http://www.jcvi.org/metarep METAREP Project
* @package metarep
* @version METAREP v 1.4.0
* @author Johannes Goll
* @lastmodified 2010-08-26
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
**/
class AppModel extends Model {
public $recursive = -1;
public $actsAs = array('Containable');
//overrrides paginate function to cache paginated views
// function paginate ($conditions, $fields, $order, $limit, $page = 1, $recursive = null, $extra = array()) {
// $args = func_get_args();
// $uniqueCacheId = '';
// foreach ($args as $arg) {
// $uniqueCacheId .= serialize($arg);
// }
// if (!empty($extra['contain'])) {
// $contain = $extra['contain'];
// }
// $uniqueCacheId = md5($uniqueCacheId);
// $pagination = Cache::read('pagination-'.$this->alias.'-'.$uniqueCacheId);
// if (empty($pagination)) {
// $pagination = $this->find('all', compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive', 'group', 'contain'));
// Cache::write('pagination-'.$this->alias.'-'.$uniqueCacheId, $pagination, 'paginate_cache');
// }
// return $pagination;
// }
//
// function paginateCount ($conditions = null, $recursive = 0, $extra = array()) {
// $args = func_get_args();
// $uniqueCacheId = '';
// foreach ($args as $arg) {
// $uniqueCacheId .= serialize($arg);
// }
// $uniqueCacheId = md5($uniqueCacheId);
// if (!empty($extra['contain'])) {
// $contain = $extra['contain'];
// }
//
// $paginationcount = Cache::read('paginationcount-'.$this->alias.'-'.$uniqueCacheId, 'paginate_cache');
// if (empty($paginationcount)) {
// $paginationcount = $this->find('count', compact('conditions', 'contain', 'recursive'));
// Cache::write('paginationcount-'.$this->alias.'-'.$uniqueCacheId, $paginationcount);
// }
// return $paginationcount;
// }
}
?>