eZ Publish  [4.0]
basket_cleanup.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of Basket_cleanup class
00004 //
00005 // Created on: <14-Jun-2005 14:44:49 amos>
00006 //
00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00008 // SOFTWARE NAME: eZ Publish
00009 // SOFTWARE RELEASE: 4.0.x
00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00011 // SOFTWARE LICENSE: GNU General Public License v2.0
00012 // NOTICE: >
00013 //   This program is free software; you can redistribute it and/or
00014 //   modify it under the terms of version 2.0  of the GNU General
00015 //   Public License as published by the Free Software Foundation.
00016 //
00017 //   This program is distributed in the hope that it will be useful,
00018 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //   GNU General Public License for more details.
00021 //
00022 //   You should have received a copy of version 2.0 of the GNU General
00023 //   Public License along with this program; if not, write to the Free
00024 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 //   MA 02110-1301, USA.
00026 //
00027 //
00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00029 //
00030 
00031 /*! \file basket_cleanup.php
00032 */
00033 
00034 //include_once( 'lib/ezutils/classes/ezini.php' );
00035 
00036 $ini = eZINI::instance();
00037 
00038 // Check if this should be run in a cronjob
00039 $useCronjob = $ini->variable( 'Session', 'BasketCleanup' ) == 'cronjob';
00040 if ( !$useCronjob )
00041     return;
00042 
00043 // Only do basket cleanup once in a while
00044 $freq = $ini->variable( 'Session', 'BasketCleanupAverageFrequency' );
00045 if ( mt_rand( 1, max( $freq, 1 ) ) != 1 )
00046     return;
00047 
00048 //include_once( 'kernel/classes/ezbasket.php' );
00049 //include_once( 'kernel/classes/ezdbgarbagecollector.php' );
00050 
00051 $maxTime = $ini->variable( 'Session', 'BasketCleanupTime' );
00052 $idleTime = $ini->variable( 'Session', 'BasketCleanupIdleTime' );
00053 $fetchLimit = $ini->variable( 'Session', 'BasketCleanupFetchLimit' );
00054 
00055 if ( !$isQuiet )
00056     $cli->output( "Cleaning up expired baskets" );
00057 eZDBGarbageCollector::collectBaskets( $maxTime, $idleTime, $fetchLimit );
00058 
00059 ?>