( ! ) Warning: session_start(): open(/var/lib/php/session/sess_rkr2t6nli1a3954jishcdi9h01, O_RDWR) failed: No such file or directory (2) in /var/www/bitweaver/live/users/includes/bit_setup_inc.php on line 82
Call Stack
#TimeMemoryFunctionLocation
10.0001232848{main}( ).../page_history.php:0
20.0001234904require_once( '/var/www/bitweaver/live/kernel/includes/setup_inc.php' ).../page_history.php:16
30.02031909072BitSystem->scanPackages( ).../setup_inc.php:141
40.02222177352BitSystem->loadPackage( ).../BitSystem.php:1183
50.02222180384include_once( '/var/www/bitweaver/live/users/includes/bit_setup_inc.php' ).../BitSystem.php:1109
60.02252584632session_start ( ).../bit_setup_inc.php:82

( ! ) Warning: session_write_close(): open(/var/lib/php/session/sess_rkr2t6nli1a3954jishcdi9h01, O_RDWR) failed: No such file or directory (2) in /var/www/bitweaver/live/kernel/includes/classes/BitSystem.php on line 580
Call Stack
#TimeMemoryFunctionLocation
10.0001232848{main}( ).../page_history.php:0
20.05434992552BitSystem->display( ).../page_history.php:57
30.05474994544BitSystem->preDisplay( ).../BitSystem.php:505
40.05595009200session_write_close ( ).../BitSystem.php:580

( ! ) Warning: session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in /var/www/bitweaver/live/kernel/includes/classes/BitSystem.php on line 580
Call Stack
#TimeMemoryFunctionLocation
10.0001232848{main}( ).../page_history.php:0
20.05434992552BitSystem->display( ).../page_history.php:57
30.05474994544BitSystem->preDisplay( ).../BitSystem.php:505
40.05595009200session_write_close ( ).../BitSystem.php:580
- bitweaver

History of ClassStructure

Comparing versions
Version 4Current version
Some detail:

All bitweaver classes follow the same structure. The basic class inheritance looks like:

  • class BitFeature - Cool feature such as Wiki or Blog or Article, etc...
  • --> class BitContent - Virtual Base class upon which all "content" oriented classes derive (wiki, article, etc. )
  • ----> class BitBase - a few utility functions common to every Bit class
  • ------> class BitDB - little changed from current core

An instantiated class should typically represent a single object, such as a wiki page or article. Aggregate data functions are currently in the same class. Perhaps a derived BitFeatureGroup class might be designed, but this is uncertain for now.

A few rules of thumb:
  1. There should be _NO_ presentation code (no smarty assignments, no html generation, etc) in any class derived from BitBase. Two notable exceptions might be extreme error conditions or convenient $rs->GetMenu() calls
  2. All derived class should support a core set of methods. In real OO land, there would be several pure virtual functions named: load, store, verify, expunge (delete has a naming conflict with native php function). These functions should always follow these names so derived classes can properly call into base methods

Example: imaginary BitFeature derived class, see BitPage for real example

<?php
 
class BitFeature extends BitBase
 
{
  
// member var that hold corresponding data
  
var mRow;

    function 
BitFeature$iFeatureID NULL ) {
        
// be sure to call base constructor!!!
        
BitBase::BitBase();
        
$this->mFeatureID $iFeatureID;
    }

    function 
load() {
        if( 
$this->mFeatureID ) {
            
$this->mRow = {... select data from db where feature_id=$this->mFeatureID ...}
        }
        return( 
count$this->mErrors ) == );
    }

    
// This verifies data integrity. NOTE: pass by reference is crucial, because
    // some modifications might be necessary (length truncation, etc.);
    
function verify( &$inParams ) {
        
// clean up variables
        
foreach( array_keys($inParams) as $key ) {
            
$inParams[[$key] = trim$inParams[[$key] );
        }

        if( empty( 
$inParams[['required_column'] ) ) {
            
$this->mErrors[['required_column'] = SOME_ERROR_MESSAGE;
        } elseif( 
strlen$inParams[['required_column'] ) > FEATURE_LENGTH ) {
            
$inParams[['required_column'] = substring$inParams[['required_column'],
                                                      
0FEATURE_LENGTH );
        }

        {... continue 
testing hash values various conditions ...}

        return( 
count$this->mErrors ) == );
    }

    
//    this method stores the data.
    
function store( &$inParams ) {
        
// ALWAYS call our verify first to ensure data is safe to go into db
        
if( $this->verify$inParams ) ) {
                
$this->mDB->StartTrans();
            if( 
data exists ) {
               {... 
update existing rows ...}
            } else {
                {... 
insert new row ...}
            }
            
$this->mDB->CompleteTrans();
        }
        return( 
count$this->mErrors ) == );
    }

    
funciton expunge() {
        {... 
delete appropriate rows for this feature in all necessary tables ...}
        return( 
count$this->mErrors ) == );
    }
 }
?>

 
Some detail:

All bitweaver classes follow the same structure. The basic class inheritance looks like:

  • class BitFeature - Cool feature such as Wiki or Blog or Article, etc...
  • --> class LibertyAttachable - Virtual Base class which adds handling of attached files and resources.
  • ----> class LibertyContent - Virtual Base class upon which all "content" oriented classes derive (wiki, article, etc. )
  • ------> class BitBase - a few utility functions common to every Bit class, and includes member variable mDb, a shared BitDb database object for all objects derived from BitBase.

An instantiated class should typically represent a single object, such as a wiki page or article. Aggregate data functions are currently in the same class. Perhaps a derived BitFeatureGroup class might be designed, but this is uncertain for now.

A few rules of thumb:
  1. There should be _NO_ presentation code (no smarty assignments, no html generation, etc) in any class derived from BitBase. Two notable exceptions might be extreme error conditions or convenient $rs->GetMenu() calls
  2. All derived class should support a core set of methods. In real OO land, there would be several pure virtual functions named: load, store, verify, expunge (delete has a naming conflict with native php function). These functions should always follow these names so derived classes can properly call into base methods

Example: imaginary BitFeature derived class, see BitPage for real example

<?php
 
class BitFeature extends BitBase
 
{
  
// member var that hold corresponding data
  
var mRow;

    function 
BitFeature$iFeatureID NULL ) {
        
// be sure to call base constructor!!!
        
BitBase::BitBase();
        
$this->mFeatureID $iFeatureID;
    }

    function 
load() {
        if( 
$this->mFeatureID ) {
            
$this->mRow = {... select data from db where feature_id=$this->mFeatureID ...}
        }
        return 
count$this->mErrors ) == 0;
    }

    
// This verifies data integrity. NOTE: pass by reference is crucial, because
    // some modifications might be necessary (length truncation, etc.);
    
function verify( &$inParams ) {
        
// clean up variables
        
foreach( $inParams as $key => $value ) {
            
$inParams[$key] = trim$value );
        }

        if( empty( 
$inParams['required_column'] ) ) {
            
$this->mErrors['required_column'] = SOME_ERROR_MESSAGE;
        } elseif( 
strlen$inParams['required_column'] ) > FEATURE_LENGTH ) {
            
$inParams['required_column'] = substring$inParams['required_column'],
                                                      
0FEATURE_LENGTH );
        }

        {... continue 
testing hash values various conditions ...}

        return 
count$this->mErrors ) == 0;
    }

    
//    this method stores the data.
    
function store( &$inParams ) {
        
// ALWAYS call our verify first to ensure data is safe to go into db
        
if( $this->verify$inParams ) ) {
                
$this->mDB->StartTrans();
            if( 
data exists ) {
               {... 
update existing rows ...}
            } else {
                {... 
insert new row ...}
            }
            
$this->mDB->CompleteTrans();
        }
        return 
count$this->mErrors ) == 0;
    }

    
funciton expunge() {
        {... 
delete appropriate rows for this feature in all necessary tables ...}
        return 
count$this->mErrors ) == 0;
    }
 }
?>

Page History
Date/CommentUserIPVersion
28 Apr 2010 (08:16 UTC)
bugmenot169.232.246.1696
Current • Source
spiderr69.134.148.405
View • Compare • Difference • Source
spiderr66.93.240.2044
View • Compare • Difference • Source
spiderr66.93.240.2043
View • Compare • Difference • Source
SEWilco209.98.144.162
View • Compare • Difference • Source