[ Index ] |
|
Code source de Dotclear 2.0-beta6 |
1 <?php 2 # ***** BEGIN LICENSE BLOCK ***** 3 # This file is part of DotClear. 4 # Copyright (c) 2005 Olivier Meunier and contributors. All rights 5 # reserved. 6 # 7 # DotClear is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # DotClear is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with DotClear; if not, write to the Free Software 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 # 21 # ***** END LICENSE BLOCK ***** 22 23 function dotclearUpgrade(&$core) 24 { 25 $upfile = dirname(__FILE__).'/upgrade-'.$core->con->driver().'.xml'; 26 27 $rs = $core->con->select('SELECT version FROM '.$core->prefix."version WHERE module='core'"); 28 29 if (version_compare($rs->f(0),DC_VERSION,'<') == 1) 30 { 31 if (is_readable($upfile)) 32 { 33 $xsql = new xmlsql($core->con,file_get_contents($upfile)); 34 $xsql->replace('{{PREFIX}}',$core->prefix); 35 36 try 37 { 38 # Database upgrade 39 $xsql->execute($rs->f(0)); 40 41 /* Some other upgrades 42 ------------------------------------ */ 43 # Populate media_dir field (since 2.0-beta3.3) 44 if (version_compare($rs->f(0),'2.0-beta3.3','<')) 45 { 46 $strReq = 'SELECT media_id, media_file FROM '.$core->prefix.'media '; 47 $rs_m = $core->con->select($strReq); 48 while($rs_m->fetch()) { 49 $cur = $core->con->openCursor($core->prefix.'media'); 50 $cur->media_dir = dirname($rs_m->media_file); 51 $cur->update('WHERE media_id = '.(integer) $rs_m->media_id); 52 } 53 } 54 55 $cur = $core->con->openCursor($core->prefix.'version'); 56 $cur->module = 'core'; 57 $cur->version = (string) DC_VERSION; 58 $cur->update("WHERE module='core'"); 59 $core->blogDefaults(); 60 return true; 61 } 62 catch (Exception $e) 63 { 64 throw new Exception(__('Something went wrong with auto upgrade:'). 65 ' '.$e->getMessage()); 66 } 67 } 68 } 69 } 70 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Feb 23 22:16:06 2007 | par Balluche grâce à PHPXref 0.7 |