Changeset 153 for trunk/bin


Ignore:
Timestamp:
Jun 7, 2006 8:41:19 PM (18 years ago)
Author:
scdev
Message:

Q - decided to use standard instantiation for Prefs and Cache instead of singleton methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/module_maker/skel/admin.php

    r152 r153  
    3434
    3535// Configure the prefs object.
    36 $prefs =& Prefs::getInstance('%NAME_PLURAL%');
    37 $prefs->setParam(array('persistent' => false));
     36$tmp_prefs = new Prefs('%NAME_PLURAL%');
     37$tmp_prefs->setParam(array('persistent' => false));
    3838
    3939// Configure the cache object.
    40 $cache =& Cache::getInstance('%NAME_PLURAL%');
     40$cache = new Cache('%NAME_PLURAL%');
    4141$cache->setParam(array('enable' => true));
    4242
     
    255255{
    256256    global $lock;
     257    global $cache;
    257258    $db =& DB::getInstance();
    258     $cache =& Cache::getInstance('%NAME_PLURAL%');
    259259   
    260260    $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id);
     
    290290{
    291291    global $auth;
     292    global $cache;
    292293    $db =& DB::getInstance();
    293     $cache =& Cache::getInstance('%NAME_PLURAL%');
    294294   
    295295    // Remove any stale cached list data.
     
    311311{
    312312    global $auth, $lock;
     313    global $cache;
    313314    $app =& App::getInstance();
    314     $cache =& Cache::getInstance('%NAME_PLURAL%');
    315315   
    316316    $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%']);
     
    338338    global $page;
    339339    global $so;
     340    global $tmp_prefs;
     341    global $cache;
    340342    $db =& DB::getInstance();   
    341     $prefs =& Prefs::getInstance('%NAME_PLURAL%');
    342     $cache =& Cache::getInstance('%NAME_PLURAL%');
    343343   
    344344    $where_clause = '';
     
    390390    // without knowing the hash.
    391391    $cache_hash = md5($sql . '|' . $page->total_items);
    392     if ($prefs->get('cache_hash') != $cache_hash) {
     392    if ($tmp_prefs->get('cache_hash') != $cache_hash) {
    393393        $cache->delete('list');
    394         $prefs->set('cache_hash', $cache_hash);
     394        $tmp_prefs->set('cache_hash', $cache_hash);
    395395    }
    396396
     
    416416function updateRank($ranks)
    417417{
     418    global $cache;
    418419    $db =& DB::getInstance();
    419     $cache =& Cache::getInstance('%NAME_PLURAL%');
    420420   
    421421    if (!is_array($ranks)) {
Note: See TracChangeset for help on using the changeset viewer.