[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Created on: <24-Mar-2006 15:36:53 amos> 4 // 5 // SOFTWARE NAME: eZ publish 6 // SOFTWARE RELEASE: 3.9.0 7 // BUILD VERSION: 17785 8 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 9 // SOFTWARE LICENSE: GNU General Public License v2.0 10 // NOTICE: > 11 // This program is free software; you can redistribute it and/or 12 // modify it under the terms of version 2.0 of the GNU General 13 // Public License as published by the Free Software Foundation. 14 // 15 // This program is distributed in the hope that it will be useful, 16 // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 // GNU General Public License for more details. 19 // 20 // You should have received a copy of version 2.0 of the GNU General 21 // Public License along with this program; if not, write to the Free 22 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 23 // MA 02110-1301, USA. 24 // 25 // 26 27 /*! \file internal_drafts_cleanup.php 28 */ 29 30 include_once ( 'lib/ezutils/classes/ezini.php' ); 31 include_once ( 'kernel/classes/ezcontentobjectversion.php' ); 32 33 if ( !$isQuiet ) 34 $cli->output( "Cleaning up internal drafts..." ); 35 36 // Remove all temporary internal drafts 37 $ini =& eZINI::instance( 'content.ini' ); 38 $internalDraftsCleanUpLimit = $ini->hasVariable( 'VersionManagement', 'InternalDraftsCleanUpLimit' ) ? 39 $ini->variable( 'VersionManagement', 'InternalDraftsCleanUpLimit' ) : 0; 40 $durationSetting = $ini->hasVariable( 'VersionManagement', 'InternalDraftsDuration' ) ? 41 $ini->variable( 'VersionManagement', 'InternalDraftsDuration' ) : array( 'hours' => 24 ); // by default, only remove drafts older than 1 day 42 43 $isDurationSet = false; 44 $duration = 0; 45 if ( is_array( $durationSetting ) ) 46 { 47 if ( isset( $durationSetting[ 'days' ] ) and is_numeric( $durationSetting[ 'days' ] ) ) 48 { 49 $duration += $durationSetting[ 'days' ] * 60 * 60 * 24; 50 $isDurationSet = true; 51 } 52 if ( isset( $durationSetting[ 'hours' ] ) and is_numeric( $durationSetting[ 'hours' ] ) ) 53 { 54 $duration += $durationSetting[ 'hours' ] * 60 * 60; 55 $isDurationSet = true; 56 } 57 if ( isset( $durationSetting[ 'minutes' ] ) and is_numeric( $durationSetting[ 'minutes' ] ) ) 58 { 59 $duration += $durationSetting[ 'minutes' ] * 60; 60 $isDurationSet = true; 61 } 62 if ( isset( $durationSetting[ 'seconds' ] ) and is_numeric( $durationSetting[ 'seconds' ] ) ) 63 { 64 $duration += $durationSetting[ 'seconds' ]; 65 $isDurationSet = true; 66 } 67 } 68 69 if ( $isDurationSet ) 70 { 71 $expiryTime = mktime() - $duration; 72 $processedCount = eZContentObjectVersion::removeVersions( EZ_VERSION_STATUS_INTERNAL_DRAFT, $internalDraftsCleanUpLimit, $expiryTime ); 73 74 if ( !$isQuiet ) 75 $cli->output( "Cleaned up " . $processedCount . " internal drafts" ); 76 } 77 else 78 { 79 if ( !$isQuiet ) 80 $cli->output( "Lifetime is not set for internal drafts (see your ini-settings, content.ini, VersionManagement section)." ); 81 } 82 83 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |