[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/update/common/scripts/ -> updateremoteid.php (source)

   1  #!/usr/bin/env php
   2  <?php
   3  //
   4  // Created on: <13-Apr-2004 14:19:36 amos>
   5  //
   6  // SOFTWARE NAME: eZ publish
   7  // SOFTWARE RELEASE: 3.9.0
   8  // BUILD VERSION: 17785
   9  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  10  // SOFTWARE LICENSE: GNU General Public License v2.0
  11  // NOTICE: >
  12  //   This program is free software; you can redistribute it and/or
  13  //   modify it under the terms of version 2.0  of the GNU General
  14  //   Public License as published by the Free Software Foundation.
  15  //
  16  //   This program is distributed in the hope that it will be useful,
  17  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  18  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19  //   GNU General Public License for more details.
  20  //
  21  //   You should have received a copy of version 2.0 of the GNU General
  22  //   Public License along with this program; if not, write to the Free
  23  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  24  //   MA 02110-1301, USA.
  25  //
  26  //
  27  
  28  include_once ( 'lib/ezutils/classes/ezcli.php' );
  29  include_once ( 'kernel/classes/ezscript.php' );
  30  
  31  $cli =& eZCLI::instance();
  32  $script =& eZScript::instance( array( 'description' => ( "eZ publish Remote ID Generator\n\n" .
  33                                                           "This script will go over all objects, classes and nodes and make sure they have a remote id,\n" .
  34                                                           "\n" .
  35                                                           "updateremoteid.php" ),
  36                                        'use-session' => false,
  37                                        'use-modules' => true,
  38                                        'use-extensions' => true ) );
  39  
  40  $script->startup();
  41  
  42  $options = $script->getOptions();
  43  $script->initialize();
  44  
  45  $db =& eZDB::instance();
  46  
  47  $contentINI =& eZINI::instance( 'content.ini' );
  48  
  49  include_once ( 'kernel/classes/ezcontentobjecttreenode.php' );
  50  include_once ( 'kernel/classes/ezcontentobject.php' );
  51  include_once ( 'kernel/classes/ezcontentclass.php' );
  52  
  53  $script->setIterationData( '.', '~' );
  54  
  55  // Handle classes
  56  
  57  $classList = eZContentClass::fetchList();
  58  $script->resetIteration( count( $classList ) );
  59  $cli->output( $cli->stylize( 'header', "Generating for classes" ) );
  60  
  61  foreach ( array_keys( $classList ) as $classKey )
  62  {
  63      $class =& $classList[$classKey];
  64      $class->remoteID();
  65      $script->iterate( $cli, true, "Generated remote ID for class " . $class->attribute( 'name' ) .
  66                        "(" . $class->attribute( 'id' ) . ")" );
  67  }
  68  
  69  $cli->output();
  70  
  71  // Handle nodes
  72  
  73  $nodeCount = eZContentObjectTreeNode::fetchListCount();
  74  $script->resetIteration( $nodeCount );
  75  $cli->output( $cli->stylize( 'header', "Generating for nodes" ) );
  76  
  77  $index = 0;
  78  while ( $index < $nodeCount )
  79  {
  80      $nodeList = eZContentObjectTreeNode::fetchList( true, $index, 50 );
  81      foreach ( array_keys( $nodeList ) as $nodeKey )
  82      {
  83          $node =& $nodeList[$nodeKey];
  84          $node->remoteID();
  85          $script->iterate( $cli, true, "Generated remote ID for node " . $node->attribute( 'name' ) .
  86                            "(" . $node->attribute( 'node_id' ) . ")" );
  87      }
  88      $index += count( $nodeList );
  89  }
  90  
  91  $cli->output();
  92  
  93  // Handle objects
  94  
  95  $objectCount = eZContentObject::fetchListCount();
  96  $script->resetIteration( $objectCount );
  97  $cli->output( $cli->stylize( 'header', "Generating for objects" ) );
  98  
  99  $index = 0;
 100  while ( $index < $objectCount )
 101  {
 102      $objectList = eZContentObject::fetchList( true, null, $index, 50 );
 103      foreach ( array_keys( $objectList ) as $objectKey )
 104      {
 105          $object =& $objectList[$objectKey];
 106          $object->remoteID();
 107          $script->iterate( $cli, true, "Generated remote ID for object " . $object->attribute( 'name' ) .
 108                            "(" . $object->attribute( 'id' ) . ")\n" .
 109                            "Status: (" . $object->attribute( 'status' ) . ")" );
 110      }
 111      $index += count( $objectList );
 112  }
 113  
 114  $script->shutdown();
 115  
 116  ?>


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