Changeset 222 for ez_publish/myutils/trunk/cronjobs/planet.php
- Timestamp:
- 07/25/08 22:26:49 (4 months ago)
- Files:
-
- 1 modified
-
ez_publish/myutils/trunk/cronjobs/planet.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ez_publish/myutils/trunk/cronjobs/planet.php
r218 r222 27 27 * @version 1.0 28 28 */ 29 30 $beginScript = microtime(true); 29 31 30 32 //include_once( 'kernel/classes/ezrssimport.php' ); … … 39 41 //include_once( "extension/myutils/classes/myutilsfunction.php" ); 40 42 41 42 43 $iniPlanet = eZINI::instance( "planet.ini" ); 44 $bloggeurGID = $iniPlanet->variable( "PlanetInfo", "UserGroupNodeID" ); 45 $rssImportArray = eZContentObjectTreeNode::fetch( $bloggeurGID ); 46 $rssImportArray = $rssImportArray->children (); 43 global $logInfo; 44 45 $iniSite = eZINI::instance( "site.ini" ); 46 $iniPlanet = eZINI::instance( "planet.ini" ); 47 $bloggeurGID = $iniPlanet->variable( "PlanetInfo", "UserGroupNodeID" ); 48 49 $logInfo = array( 50 'countTotalBillets' => 0, 51 'countTotalBlogs' => 0, 52 'blogOK' => 0, 53 'blogKO' => 0, 54 'logName' => $iniPlanet->variable( "PlanetLog", "LogName" ), 55 'logDir' => $iniSite->variable( "FileSettings", "VarDir" ) . "/log" 56 ); 57 58 $rssImportArray = eZContentObjectTreeNode::fetch( $bloggeurGID ); 59 $rssImportArray = $rssImportArray->children (); 60 $logInfo['countTotalBlogs'] = count( $rssImportArray ); 61 62 eZLog::write( "========== BEGIN | " . $logInfo['countTotalBlogs'] . " blogs ==========", $logInfo['logName'], $logInfo['logDir'] ); 47 63 48 64 … … 57 73 if( empty($rssSource)) 58 74 { 59 $cli->output( 'RSSImport '.$rssImport->attribute( 'name' ).': Escape.' ); 75 if ( !$isQuiet ) 76 { 77 $cli->output( 'RSSImport '. $rssImport->attribute( 'name' ) .': Escape.' ); 78 } 79 eZLog::write( "====> " . $rssImport->attribute( 'name' ) . " : no RSS feeds", $logInfo['logName'], $logInfo['logDir'] ); 80 $logInfo['blogKO']++; 60 81 } 61 82 else … … 75 96 $cli->output( 'RSSImport '.$rssImport->attribute( 'name' ).': Failed to open RSS feed file: '.$rssSource ); 76 97 } 98 eZLog::write( "====> " . $rssImport->attribute( 'name' ) . " : Failed to open RSS feed file", $logInfo['logName'], $logInfo['logDir'] ); 99 $logInfo['blogKO']++; 77 100 continue; 78 101 } … … 88 111 $cli->output( 'RSSImport '.$rssImport->attribute( 'name' ).': Invalid RSS document.' ); 89 112 } 113 eZLog::write( "====> " . $rssImport->attribute( 'name' ) . " : Invalid RSS document", $logInfo['logName'], $logInfo['logDir'] ); 114 $logInfo['blogKO']++; 90 115 continue; 91 116 } … … 115 140 $cli->output( 'RSSImport '.$rssImport->attribute( 'name' ).': Invalid RSS version missmatch. Please reconfigure import.' ); 116 141 } 142 eZLog::write( $rssImport->attribute( 'name' ) . " : Invalid RSS version missmatch. Please reconfigure import", $logInfo['logName'], $logInfo['logDir'] ); 143 $logInfo['blogKO']++; 117 144 continue; 118 145 } … … 138 165 eZStaticCache::executeActions(); 139 166 140 167 $endScript = microtime(true); 168 $executionTime = round($endScript - $beginScript, 4); 169 170 eZLog::write( "========== END | " . $executionTime . "s | " . $logInfo['countTotalBlogs'] . " blogs : " . $logInfo['blogOK'] . " OK, " . $logInfo['blogKO'] . " KO | " . $logInfo['countTotalBillets'] . " billets ==========\n", 171 $logInfo['logName'], 172 $logInfo['logDir'] ); 173 174 175 176 177 178 /************************************************************************** Fonction */ 141 179 142 180 /** … … 148 186 function rssImport1( $root, $rssImport, $cli ) 149 187 { 150 global $isQuiet ;188 global $isQuiet, $logInfo; 151 189 152 190 $addCount = 0; … … 166 204 $cli->output( 'RSSImport '.$rssImport->attribute( 'name' ).': End. '.$addCount.' objects added' ); 167 205 } 206 eZLog::write( $rssImport->attribute( 'name' ) . " (RSS1) : $addCount objects added", $logInfo['logName'], $logInfo['logDir'] ); 207 $logInfo['countTotalBillets'] += $addCount; 208 $logInfo['blogOK']++; 168 209 } 169 210 … … 172 213 /** 173 214 * Parse RSS 2.0 feed 215 * 174 216 * @param DOM root node 175 217 * @param RSS Import item … … 178 220 function rssImport2( $root, $rssImport, $cli ) 179 221 { 180 global $isQuiet ;222 global $isQuiet, $logInfo; 181 223 182 224 $addCount = 0; … … 195 237 $cli->output( 'RSSImport '.$rssImport->attribute( 'name' ).': End. '.$addCount.' objects added' ); 196 238 } 239 eZLog::write( $rssImport->attribute( 'name' ) . " (RSS2) : $addCount objects added", $logInfo['logName'], $logInfo['logDir'] ); 240 $logInfo['countTotalBillets'] += $addCount; 241 $logInfo['blogOK']++; 197 242 } 198 243 … … 201 246 /** 202 247 * Import specifiec rss item into content tree 248 * 203 249 * @param RSS item xml element 204 250 * @param $rssImport Object … … 423 469 424 470 471 425 472 /** 426 * 473 * Enter description here... 427 474 * 428 475 * @param array $importDescriptionArray … … 566 613 } 567 614 615 568 616 ?>
