[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/cronjobs/ -> indexcontent.php (source)

   1  <?php
   2  //
   3  // Created on: <18-Mar-2004 17:12:43 dr>
   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 indexcontent.php
  28  */
  29  
  30  include_once ( 'kernel/classes/ezsearch.php' );
  31  include_once ( 'kernel/classes/ezcontentobject.php' );
  32  include_once ( 'lib/ezdb/classes/ezdb.php' );
  33  
  34  if ( !$isQuiet )
  35  {
  36      $cli->output( "Starting processing pending search engine modifications" );
  37  }
  38  
  39  $contentObjects = array();
  40  $db =& eZDB::instance();
  41  
  42  $offset = 0;
  43  $limit = 50;
  44  
  45  while( true )
  46  {
  47      $entries = $db->arrayQuery( "SELECT param FROM ezpending_actions WHERE action = 'index_object'",
  48                                  array( 'limit' => $limit,
  49                                         'offset' => $offset ) );
  50      $inSQL = '';
  51  
  52      if ( is_array( $entries ) && count( $entries ) != 0 )
  53      {
  54          $db->begin();
  55          foreach ( $entries as $entry )
  56          {
  57              $objectID = $entry['param'];
  58  
  59              if ( $inSQL != '' )
  60              {
  61                  $inSQL .= ', ';
  62              }
  63              $inSQL .=(int) $objectID;
  64  
  65              $cli->output( "\tIndexing object ID #$objectID" );
  66              $object = eZContentObject::fetch( $objectID );
  67              if ( $object )
  68              {
  69                  eZSearch::removeObject( $object );
  70                  eZSearch::addObject( $object );
  71              }
  72          }
  73  
  74          $db->query( "DELETE FROM ezpending_actions WHERE action = 'index_object' AND param IN ($inSQL)" );
  75          $db->commit();
  76      }
  77      else
  78      {
  79          break; // No valid result from ezpending_actions
  80      }
  81  }
  82  
  83  if ( !$isQuiet )
  84  {
  85      $cli->output( "Done" );
  86  }
  87  
  88  ?>


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