[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 #!/usr/bin/env php 2 <?php 3 // 4 // Definition of updatecrc32 5 // 6 // Created on: <17-Jan-2006 16:05:43 dl> 7 // 8 // SOFTWARE NAME: eZ publish 9 // SOFTWARE RELEASE: 3.9.0 10 // BUILD VERSION: 17785 11 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 12 // SOFTWARE LICENSE: GNU General Public License v2.0 13 // NOTICE: > 14 // This program is free software; you can redistribute it and/or 15 // modify it under the terms of version 2.0 of the GNU General 16 // Public License as published by the Free Software Foundation. 17 // 18 // This program is distributed in the hope that it will be useful, 19 // but WITHOUT ANY WARRANTY; without even the implied warranty of 20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 // GNU General Public License for more details. 22 // 23 // You should have received a copy of version 2.0 of the GNU General 24 // Public License along with this program; if not, write to the Free 25 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 26 // MA 02110-1301, USA. 27 // 28 // 29 30 /*! \file updatecrc32.php 31 */ 32 33 set_time_limit ( 0 ); 34 35 include_once ( 'lib/ezutils/classes/ezcli.php' ); 36 include_once ( 'kernel/classes/ezscript.php' ); 37 38 $cli =& eZCLI::instance(); 39 $script =& eZScript::instance( array( 'description' => ( "eZ publish crc32 polynomial update script.\n\n" . 40 "Will go trough and update crc32 polynomial form signed int\n". 41 "to unsigned int.\n" . 42 "\n" . 43 "updatecrc32.php" ), 44 'use-session' => false, 45 'use-modules' => false, 46 'use-extensions' => true ) ); 47 48 $script->startup(); 49 50 $options = $script->getOptions( "[db-user:][db-password:][db-database:][db-type:|db-driver:][sql]", 51 "", 52 array( 'db-host' => "Database host", 53 'db-user' => "Database user", 54 'db-password' => "Database password", 55 'db-database' => "Database name", 56 'db-driver' => "Database driver", 57 'db-type' => "Database driver, alias for --db-driver", 58 'sql' => "Display sql queries" 59 ) ); 60 $script->initialize(); 61 62 $dbUser = $options['db-user'] ? $options['db-user'] : false; 63 $dbPassword = $options['db-password'] ? $options['db-password'] : false; 64 $dbHost = isset( $options['db-host'] ) && $options['db-host'] ? $options['db-host'] : false; 65 $dbName = $options['db-database'] ? $options['db-database'] : false; 66 $dbImpl = $options['db-driver'] ? $options['db-driver'] : false; 67 $showSQL = $options['sql'] ? true : false; 68 69 include_once ( 'lib/ezdb/classes/ezdb.php' ); 70 include_once ( 'kernel/classes/ezcontentobjecttreenode.php' ); 71 72 $db =& eZDB::instance(); 73 74 if ( $dbHost or $dbName or $dbUser or $dbImpl ) 75 { 76 $params = array(); 77 if ( $dbHost !== false ) 78 $params['server'] = $dbHost; 79 if ( $dbUser !== false ) 80 { 81 $params['user'] = $dbUser; 82 $params['password'] = ''; 83 } 84 if ( $dbPassword !== false ) 85 $params['password'] = $dbPassword; 86 if ( $dbName !== false ) 87 $params['database'] = $dbName; 88 $db =& eZDB::instance( $dbImpl, $params, true ); 89 eZDB::setInstance( $db ); 90 } 91 92 $db->setIsSQLOutputEnabled( $showSQL ); 93 94 95 // Update ezpolicy_limitation_value.value for 'SiteAccess' limitation. 96 $query = "SELECT ezpolicy_limitation_value.id, ezpolicy_limitation_value.value 97 FROM ezpolicy_limitation_value, ezpolicy_limitation 98 WHERE ezpolicy_limitation.id = ezpolicy_limitation_value.limitation_id AND 99 ezpolicy_limitation.identifier = 'SiteAccess' AND 100 ezpolicy_limitation_value.value < 0"; 101 102 $limitationValues = $db->arrayQuery( $query ); 103 104 foreach( $limitationValues as $limitationValue ) 105 { 106 $value = $limitationValue['value']; 107 $value = sprintf( '%u', $value ); 108 $db->query( "UPDATE ezpolicy_limitation_value SET value='$value' WHERE id={$limitationValue['id']}" ); 109 } 110 111 $script->shutdown(); 112 113 ?>
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 |