Project

General

Profile

« Previous | Next » 

Revision 1269

Added by Dietmar over 14 years ago

Ticket #869 Droplet-Engine does'nt work in some case
continue update header info

View differences:

upgrade-script.php
1 1
<?php
2
/****************************************************************************
3
* SVN Version information:
2
/*
4 3
*
5
* $Id$ 
4
*                       About WebsiteBaker
6 5
*
7
*****************************************************************************
8
*                          WebsiteBaker
9
*
10
* WebsiteBaker Project <http://www.websitebaker2.org/>
11
* Copyright (C) 2009, Website Baker Org. e.V.
12
*         http://start.websitebaker2.org/impressum-datenschutz.php
13
* Copyright (C) 2004-2009, Ryan Djurovich
14
*
15
*                        About WebsiteBaker
16
*
17 6
* Website Baker is a PHP-based Content Management System (CMS)
18 7
* designed with one goal in mind: to enable its users to produce websites
19 8
* with ease.
20 9
*
21
*****************************************************************************
22

  
23
*****************************************************************************
24
*                        LICENSE INFORMATION
10
*                       LICENSE INFORMATION
25 11
*
26 12
* WebsiteBaker is free software; you can redistribute it and/or
27 13
* modify it under the terms of the GNU General Public License
......
36 22
* You should have received a copy of the GNU General Public License
37 23
* along with this program; if not, write to the Free Software
38 24
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
39
****************************************************************************
40

  
41
*****************************************************************************
25
*
42 26
*                   WebsiteBaker Extra Information
43 27
*
44
*  added line 385-386 update postfiles to new format
45 28
*
46
*
47
*****************************************************************************/
48

  
29
*/
49 30
/**
50 31
 *
51
 * @category     backend
52
 * @package      installation
53
 * @author       Ryan Djurovich
54
 * @copyright    2004-2009, Ryan Djurovich
55
 * @copyright    2009, Website Baker Org. e.V.
56
 * @version      $Id$
57
 * @platform     WebsiteBaker 2.8.x
58
 * @requirements >= PHP 4.3.4
59
 * @license      http://www.gnu.org/licenses/gpl.html
32
 * @category        backend
33
 * @package         installation
34
 * @author          WebsiteBaker Project
35
 * @copyright       2004-2009, Ryan Djurovich
36
 * @copyright       2009-2010, Website Baker Org. e.V.
37
 * @link			http://www.websitebaker2.org/
38
 * @license         http://www.gnu.org/licenses/gpl.html
39
 * @platform        WebsiteBaker 2.8.x
40
 * @requirements    PHP 4.3.4 and higher
41
 * @version         $Id$
42
 * @filesource		$HeadURL: $
43
 * @lastmodified    $Date: $
60 44
 *
61
 *
62 45
 */
63 46

  
64 47
@require_once('config.php');
......
112 95
    return $data;
113 96
}
114 97

  
115
// check existings tables for upgrade or install
116
$result = $database->query( "SHOW TABLES FROM ".DB_NAME);
98
 // check existings tables for upgrade or install
99
/*
100
$get_result = mysql_list_tables (DB_NAME); */
101
$get_result = $database->query( "SHOW TABLES FROM ".DB_NAME);
117 102
$all_tables = array();
118
while ($data = $result->fetchRow())
103
if($get_result->numRows() > 0)
119 104
{
120
    $tmp = str_replace(TABLE_PREFIX, '', $data[0]);
121
    if(in_array($tmp,$table_list))
105
    while ($data = $get_result->fetchRow())
122 106
    {
123
        $all_tables[] = $tmp;
107
        $tmp = str_replace(TABLE_PREFIX, '', $data[0]);
108
        if(in_array($tmp,$table_list))
109
        {
110
            $all_tables[] = $tmp;
111
        }
124 112
    }
125
}
113
    }
126 114

  
115

  
127 116
function show_array($array=array())
128 117
{
129 118
    print '<pre>';
......
212 201
<?php
213 202
	status_msg('<strong>Notice:</strong><br />You need to confirm that you have created a manual backup of the /pages directory and the MySQL database before you can proceed.', 'warning', 'div');
214 203
	echo '<br /><br />';
215
	exit;
204
    echo "</div>
205
    </body>
206
    </html>
207
    ";
208
	exit();
216 209
}
217 210

  
218 211
echo '<h2>Step 2: Updating database entries</h2>';
......
221 214
require_once(WB_PATH.'/framework/functions.php');
222 215
require_once(WB_PATH.'/framework/class.admin.php');
223 216
$admin = new admin('Addons', 'modules', false, false);
217
require_once(WB_PATH.'/framework/initialize.php');
224 218

  
225 219
$OK   = '<span class="ok">OK</span>';
226 220
$FAIL = '<span class="error">FAILED</span>';
227
$check_text = 'total ';
228
// $check_tables = mysqlCheckTables( DB_NAME ) ;
229
if(sizeof($all_tables) == 22)
230
{
231
    echo '<h4>NOTICE: Your database '.DB_NAME.' has '.sizeof($all_tables).' '.$check_text.' tables from '.sizeof($table_list).' included in package</h4>';
232
}
233
else
234
{
235
    status_msg('<strong>WARNING:</strong><br />can\'t run Upgrade, missing tables', 'warning', 'div');
236
	echo '<h4>List missing tables, please check</h4>';
237
    $result = array_diff ( $table_list, $all_tables );
238
    while ( list ( $key, $val ) = each ( $result ) )
221

  
222
    $check_text = 'total ';
223
    // $check_tables = mysqlCheckTables( DB_NAME ) ;
224

  
225
    if(sizeof($all_tables) == 22)
239 226
    {
240
        echo TABLE_PREFIX.$val.' '.$FAIL.'<br>';
227
        echo '<h4>NOTICE: Your database '.DB_NAME.' has '.sizeof($all_tables).' '.$check_text.' tables from '.sizeof($table_list).' included in package '.$OK.'</h4>';
241 228
    }
229
    else
230
    {
231
        status_msg('<strong>WARNING:</strong><br />can\'t run Upgrade, missing tables', 'warning', 'div');
232
    	echo '<h4>List missing tables, please check</h4>';
233
        $result = array_diff ( $table_list, $all_tables );
234
        while ( list ( $key, $val ) = each ( $result ) )
235
        {
236
            echo TABLE_PREFIX.$val.' '.$FAIL.'<br>';
237
        }
242 238

  
243
	echo '<br /><form action="'. $_SERVER['PHP_SELF'] .'">';
244
	echo '<input type="submit" value="kick me back" style="float:left;" />';
245
	echo '</form><br /><br />';
246
    exit;
247
}
248

  
239
    	echo '<br /><form action="'. $_SERVER['PHP_SELF'] .'">';
240
    	echo '<input type="submit" value="kick me back" style="float:left;" />';
241
    	echo '</form><br /><br />';
242
        echo "</div>
243
        </body>
244
        </html>
245
        ";
246
        exit();
247
    }
249 248
// function to add a var/value-pair into settings-table
250 249
function db_add_key_value($key, $value) {
251 250
	global $database; global $OK; global $FAIL;
......
349 348
$database->query($sql);
350 349
echo ($database->query($sql)) ? " $OK<br />" : " $FAIL<br />";
351 350

  
352
/**********************************************************
353
 *  - Update settings of News Modul
354
 */
355 351

  
356
// These are the default setting
357
$header = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"loop-header\">'."\n";
358
$post_loop = '<tr class=\"post_top\">
352
if (version_compare(VERSION, '2.8.0') <= 0)
353
{
354
    /**********************************************************
355
     *  - Update settings of News Modul
356
     */
357

  
358
    // These are the default setting
359
    $header = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"loop-header\">'."\n";
360
    $post_loop = '<tr class=\"post_top\">
359 361
<td class=\"post_title\"><a href=\"[LINK]\">[TITLE]</a></td>
360 362
<td class=\"post_date\">[PUBLISHED_TIME], [PUBLISHED_DATE]</td>
361 363
</tr>
......
365 367
<span style=\"visibility:[SHOW_READ_MORE];\"><a href=\"[LINK]\">[TEXT_READ_MORE]</a></span>
366 368
</td>
367 369
</tr>';
368
$footer = '</table>
370
    $footer = '</table>
369 371
<table cellpadding="0" cellspacing="0" class="page-header" style="display: [DISPLAY_PREVIOUS_NEXT_LINKS]">
370 372
<tr>
371 373
<td class="page-left">[PREVIOUS_PAGE_LINK]</td>
......
373 375
<td class="page-right">[NEXT_PAGE_LINK]</td>
374 376
</tr>
375 377
</table>';
376
$post_header = addslashes('<table cellpadding="0" cellspacing="0" class="post-header">
378
    $post_header = addslashes('<table cellpadding="0" cellspacing="0" class="post-header">
377 379
<tr>
378 380
<td><h1>[TITLE]</h1></td>
379 381
<td rowspan="3" style="display: [DISPLAY_IMAGE]">[GROUP_IMAGE]</td>
......
385 387
<td class="group-page"><a href="[BACK]">[PAGE_TITLE]</a> &gt;&gt; <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td>
386 388
</tr>
387 389
</table>');
388
$post_footer = '<p>[TEXT_LAST_CHANGED]: [MODI_DATE] [TEXT_AT] [MODI_TIME]</p>
390
    $post_footer = '<p>[TEXT_LAST_CHANGED]: [MODI_DATE] [TEXT_AT] [MODI_TIME]</p>
389 391
<a href=\"[BACK]\">[TEXT_BACK]</a>';
390
$comments_header = addslashes('<br /><br />
392
    $comments_header = addslashes('<br /><br />
391 393
<h2>[TEXT_COMMENTS]</h2>
392 394
<table cellpadding="2" cellspacing="0" class="comment-header">');
393
$comments_loop = addslashes('<tr>
395
    $comments_loop = addslashes('<tr>
394 396
<td class="comment_title">[TITLE]</td>
395 397
<td class="comment_info">[TEXT_BY] [DISPLAY_NAME] [TEXT_ON] [DATE] [TEXT_AT] [TIME]</td>
396 398
</tr>
397 399
<tr>
398 400
<td colspan="2" class="comment_text">[COMMENT]</td>
399 401
</tr>');
400
$comments_footer = '</table>
402
    $comments_footer = '</table>
401 403
<br /><a href=\"[ADD_COMMENT_URL]\">[TEXT_ADD_COMMENT]</a>';
402
$comments_page = '<h1>[TEXT_COMMENT]</h1>
404
    $comments_page = '<h1>[TEXT_COMMENT]</h1>
403 405
<h2>[POST_TITLE]</h2>
404 406
<br />';
405 407

  
406
if(in_array('mod_news_settings', $all_tables))
407
{
408
    // Insert default settings into database
409
    $query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings where section_id != 0 and page_id != 0");
410
    while($result = $query_dates->fetchRow())
408
    if(in_array('mod_news_settings', $all_tables))
411 409
    {
410
        // Insert default settings into database
411
        $query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings where section_id != 0 and page_id != 0");
412
        while($result = $query_dates->fetchRow())
413
        {
412 414

  
413
    	echo "<br /><u>Add default settings to database for news section_id= ".$result['section_id']."</u><br />";
414
    	$section_id = $result['section_id'];
415
        	echo "<br /><u>Add default settings to database for news section_id= ".$result['section_id']."</u><br />";
416
        	$section_id = $result['section_id'];
415 417

  
416
    	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `header` = '$header' WHERE `section_id` = $section_id")) {
417
    		echo 'Database data header added successfully';
418
    	}
419
    	echo mysql_error().'<br />';
418
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `header` = '$header' WHERE `section_id` = $section_id")) {
419
        		echo 'Database data header added successfully';
420
        	}
421
        	echo mysql_error().'<br />';
420 422

  
421
    	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_loop` = '$post_loop' WHERE `section_id` = $section_id")) {
422
    		echo 'Database data post_loop added successfully';
423
    	}
424
    	echo mysql_error().'<br />';
423
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_loop` = '$post_loop' WHERE `section_id` = $section_id")) {
424
        		echo 'Database data post_loop added successfully';
425
        	}
426
        	echo mysql_error().'<br />';
425 427

  
426
    	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `footer` = '$footer' WHERE `section_id` = $section_id")) {
427
    		echo 'Database data footer added successfully';
428
    	}
429
    	echo mysql_error().'<br />';
428
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `footer` = '$footer' WHERE `section_id` = $section_id")) {
429
        		echo 'Database data footer added successfully';
430
        	}
431
        	echo mysql_error().'<br />';
430 432

  
431
    	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_header` = '$post_header' WHERE `section_id` = $section_id")) {
432
    		echo 'Database data post_header added successfully';
433
    	}
434
    	echo mysql_error().'<br />';
433
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_header` = '$post_header' WHERE `section_id` = $section_id")) {
434
        		echo 'Database data post_header added successfully';
435
        	}
436
        	echo mysql_error().'<br />';
435 437

  
436
    	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_footer` = '$post_footer' WHERE `section_id` = $section_id")) {
437
    		echo 'Database data post_footer added successfully';
438
    	}
439
    	echo mysql_error().'<br />';
438
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_footer` = '$post_footer' WHERE `section_id` = $section_id")) {
439
        		echo 'Database data post_footer added successfully';
440
        	}
441
        	echo mysql_error().'<br />';
440 442

  
441
    	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_header` = '$comments_header' WHERE `section_id` = $section_id")) {
442
    		echo 'Database data comments_header added successfully';
443
    	}
444
    	echo mysql_error().'<br />';
443
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_header` = '$comments_header' WHERE `section_id` = $section_id")) {
444
        		echo 'Database data comments_header added successfully';
445
        	}
446
        	echo mysql_error().'<br />';
445 447

  
446
    	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_loop` = '$comments_loop' WHERE `section_id` = $section_id")) {
447
    		echo 'Database data comments_loop added successfully';
448
    	}
449
    	echo mysql_error().'<br />';
448
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_loop` = '$comments_loop' WHERE `section_id` = $section_id")) {
449
        		echo 'Database data comments_loop added successfully';
450
        	}
451
        	echo mysql_error().'<br />';
450 452

  
451
    	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_footer` = '$comments_footer' WHERE `section_id` = $section_id")) {
452
    		echo 'Database data comments_footer added successfully';
453
    	}
454
    	echo mysql_error().'<br />';
453
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_footer` = '$comments_footer' WHERE `section_id` = $section_id")) {
454
        		echo 'Database data comments_footer added successfully';
455
        	}
456
        	echo mysql_error().'<br />';
455 457

  
456
    	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_page` = '$comments_page' WHERE `section_id` = $section_id")) {
457
    		echo 'Database data comments_page added successfully';
458
    	}
459
    	echo mysql_error().'<br />';
458
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_page` = '$comments_page' WHERE `section_id` = $section_id")) {
459
        		echo 'Database data comments_page added successfully';
460
        	}
461
        	echo mysql_error().'<br />';
460 462

  
463
        }
461 464
    }
465
    else
466
    {
467
        echo 'Missing database table '.TABLE_PREFIX.'mod_news_settings '.$FAIL.'<br />';
468
    }
469

  
470
    if(file_exists(WB_PATH."/modules/news/upgrade.php"))
471
    {
472
        echo '<h4>Upgrade existings postfiles to new format</h4><br />';
473
        // change old postfiles to new postfiles
474
        require_once(WB_PATH."/modules/news/upgrade.php");
462 475
}
463
else
464
{
465
    echo 'Missing database table '.TABLE_PREFIX.'mod_news_settings '.$FAIL.'<br />';
466 476
}
467 477

  
468
if(file_exists(WB_PATH."/modules/news/upgrade.php"))
469
{
470
    echo '<h4>Upgrade existings postfiles to new format</h4><br />';
471
    // change old postfiles to new postfiles
472
    require_once(WB_PATH."/modules/news/upgrade.php");
473
}
474 478
/**********************************************************
475 479
 *  - Set Version to WB 2.8.1
476 480
 */
......
550 554
echo '<p>&nbsp;</p>';
551 555

  
552 556
?>
553
	
554 557
</div>
555 558
</body>
556 559
</html>

Also available in: Unified diff