[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/cronjobs/ -> unpublish.php (source)

   1  <?php
   2  //
   3  // Created on: <16-óÅÎ-2003 16:09:52 sp>
   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 unpublish.php
  28  */
  29  
  30  include_once ( "kernel/classes/ezcontentobjecttreenode.php" );
  31  
  32  
  33  
  34  // Check for extension
  35  include_once ( 'lib/ezutils/classes/ezextension.php' );
  36  include_once ( 'kernel/common/ezincludefunctions.php' );
  37  eZExtension::activateExtensions();
  38  // Extension check end
  39  
  40  include_once ( "lib/ezutils/classes/ezini.php" );
  41  $ini =& eZINI::instance( 'content.ini' );
  42  $unpublishClasses = $ini->variable( 'UnpublishSettings','ClassList' );
  43  
  44  $rootNodeIDList = $ini->variable( 'UnpublishSettings','RootNodeList' );
  45  
  46  $currrentDate = time();
  47  
  48  foreach( $rootNodeIDList as $nodeID )
  49  {
  50      $rootNode = eZContentObjectTreeNode::fetch( $nodeID );
  51  
  52      $articleNodeArray =& $rootNode->subTree( array( 'ClassFilterType' => 'include',
  53                                                      'ClassFilterArray' => $unpublishClasses ) );
  54  
  55      foreach ( array_keys( $articleNodeArray ) as $key )
  56      {
  57          $article =& $articleNodeArray[$key]->attribute( 'object' );
  58          $dataMap =& $article->attribute( 'data_map' );
  59  
  60          $dateAttribute =& $dataMap['unpublish_date'];
  61  
  62          if ( is_null( $dateAttribute ) )
  63              continue;
  64  
  65          $date = $dateAttribute->content();
  66          $articleRetractDate = $date->attribute( 'timestamp' );
  67          if ( $articleRetractDate > 0 && $articleRetractDate < $currrentDate )
  68          {
  69              // Clean up content cache
  70              include_once ( 'kernel/classes/ezcontentcachemanager.php' );
  71              eZContentCacheManager::clearContentCacheIfNeeded( $article->attribute( 'id' ) );
  72  
  73              $article->remove( $article->attribute( 'id' ), $articleNodeArray[$key]->attribute( 'node_id' ) );
  74          }
  75      }
  76  }
  77  
  78  
  79  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7