Upgrade PIA 2.8 > 2.9

Support for the Plugin Architecture

Moderators: Developers, Moderators

Post Reply
gjubin
Posts: 4
Joined: Tue Dec 18, 2007 3:34 am

Upgrade PIA 2.8 > 2.9

Post by gjubin »

Hi admin of Cacti,

My method used when I upgrade PIA 2.8 to 2.9 :

1. cd /var/www/cacti
2. wget http://www.cacti.net/downloads/pia/cact ... 2.9.tar.gz
3. tar -xzvf cacti-plugin-0.8.7g-PA-v2.9.tar.gz
4. cp include/config.php include/config.php.old
5. cp –R cacti-plugin-arch/files-0.8.7g/* .
6. cp include/config.php.bak include/config.php

This error :
7. mysql -u root -p cacti < cacti-plugin-arch/pa.sql

ERROR 1050 (42S01) at line 5: Table 'plugin_config' already exists

It's true. I have already a database pa.sql BUT How to do update ?

or then it is not necessary to do update this database ?
Because the database of PIA 2.8 and 2.9 is it the same ?

Can you help me ?
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Upgrade PIA 2.8 > 2.9

Post by noname »

There is no difference between 2.8 and 2.9 in "pa.sql",
so I guess it is not necessary to import that again.

But PIA-2.9 was created from Cacti (0.8.7g) with official patches.
If you overwrote existing files by files-0.8.7g/* but not yet applied official patches,
try to apply them now.
(NOTICE: please backup your Cacti files before doing that!)

Probably some patches will show "Hunk xx FAILED" --- maybe it's ignorable.
But if you have concerns, perform "patch -p1 -N --dry-run < xxxx.patch" before applying actually.
gjubin
Posts: 4
Joined: Tue Dec 18, 2007 3:34 am

Re: Upgrade PIA 2.8 > 2.9

Post by gjubin »

OK thanks.

yes, i show many "HUNK ..."
How can I check ? or be sure it's good ?

Code: Select all

root@bbs-monitor:/home/gjubin/archive/cacti-plugin-arch# patch -p1 -N --dry-run < cacti-plugin-0.8.7g-PA-v2.9.diff 
patching file auth_changepassword.php
Hunk #1 FAILED at 59.
1 out of 1 hunk FAILED -- saving rejects to file auth_changepassword.php.rej
patching file auth_login.php
Hunk #1 FAILED at 124.
Hunk #2 FAILED at 189.
Hunk #3 FAILED at 264.
Hunk #4 FAILED at 303.
4 out of 4 hunks FAILED -- saving rejects to file auth_login.php.rej
patching file cli/add_graph_template.php
Hunk #1 FAILED at 144.
1 out of 1 hunk FAILED -- saving rejects to file cli/add_graph_template.php.rej
patching file cli/add_tree.php
Hunk #1 FAILED at 33.
1 out of 1 hunk FAILED -- saving rejects to file cli/add_tree.php.rej
patching file cli/host_update_template.php
Hunk #1 FAILED at 136.
1 out of 1 hunk FAILED -- saving rejects to file cli/host_update_template.php.rej
patching file data_sources.php
Hunk #1 FAILED at 44.
Hunk #2 FAILED at 402.
Hunk #3 FAILED at 545.
Hunk #4 FAILED at 683.
Hunk #5 FAILED at 975.
Hunk #6 FAILED at 1310.
6 out of 6 hunks FAILED -- saving rejects to file data_sources.php.rej
patching file graph_image.php
Hunk #1 FAILED at 44.
1 out of 1 hunk FAILED -- saving rejects to file graph_image.php.rej
patching file graph.php
Hunk #1 FAILED at 32.
Hunk #2 FAILED at 77.
Hunk #3 FAILED at 100.
Hunk #4 FAILED at 113.
Hunk #5 FAILED at 215.
Hunk #6 FAILED at 247.
6 out of 6 hunks FAILED -- saving rejects to file graph.php.rej
patching file graphs_new.php
Hunk #1 FAILED at 511.
1 out of 1 hunk FAILED -- saving rejects to file graphs_new.php.rej
patching file graphs.php
Hunk #1 FAILED at 45.
Hunk #2 FAILED at 362.
Hunk #3 FAILED at 514.
3 out of 3 hunks FAILED -- saving rejects to file graphs.php.rej
patching file host.php
Hunk #1 FAILED at 44.
Hunk #2 FAILED at 137.
Hunk #3 FAILED at 305.
Hunk #4 FAILED at 450.
Hunk #5 FAILED at 532.
Hunk #6 FAILED at 643.
Hunk #7 FAILED at 1107.
7 out of 7 hunks FAILED -- saving rejects to file host.php.rej
patching file images/disable_icon.png
patching file images/enable_icon_disabled.png
patching file images/enable_icon.png
patching file images/install_icon_disabled.png
patching file images/install_icon.png
patching file images/uninstall_icon.gif
patching file images/view_none.gif
patching file include/auth.php
Hunk #1 FAILED at 26.
Hunk #2 FAILED at 72.
Hunk #3 FAILED at 83.
3 out of 3 hunks FAILED -- saving rejects to file include/auth.php.rej
patching file include/bottom_footer.php
Hunk #1 FAILED at 21.
Hunk #2 FAILED at 32.
2 out of 2 hunks FAILED -- saving rejects to file include/bottom_footer.php.rej
patching file include/config.php
Hunk #1 FAILED at 30.
1 out of 1 hunk FAILED -- saving rejects to file include/config.php.rej
patching file include/global_arrays.php
Hunk #1 FAILED at 22.
Hunk #2 FAILED at 654.
2 out of 2 hunks FAILED -- saving rejects to file include/global_arrays.php.rej
patching file include/global_constants.php
Hunk #1 FAILED at 173.
1 out of 1 hunk FAILED -- saving rejects to file include/global_constants.php.rej
patching file include/global_form.php
Hunk #1 FAILED at 22.
Hunk #2 FAILED at 1190.
2 out of 2 hunks FAILED -- saving rejects to file include/global_form.php.rej
patching file include/global.php
Hunk #1 FAILED at 93.
Hunk #2 FAILED at 188.
Hunk #3 FAILED at 205.
3 out of 3 hunks FAILED -- saving rejects to file include/global.php.rej
patching file include/global_settings.php
Hunk #1 FAILED at 1190.
1 out of 1 hunk FAILED -- saving rejects to file include/global_settings.php.rej
patching file include/plugins.php
patching file include/top_graph_header.php
Hunk #1 FAILED at 25.
Hunk #2 FAILED at 52.
Hunk #3 FAILED at 106.
Hunk #4 FAILED at 114.
Hunk #5 FAILED at 143.
5 out of 5 hunks FAILED -- saving rejects to file include/top_graph_header.php.rej
patching file include/top_header.php
Hunk #1 FAILED at 22.
Hunk #2 FAILED at 65.
Hunk #3 FAILED at 73.
Hunk #4 FAILED at 86.
4 out of 4 hunks FAILED -- saving rejects to file include/top_header.php.rej
patching file index.php
Hunk #1 FAILED at 25.
Hunk #2 FAILED at 46.
2 out of 2 hunks FAILED -- saving rejects to file index.php.rej
patching file lib/api_automation_tools.php
Hunk #1 FAILED at 22.
1 out of 1 hunk FAILED -- saving rejects to file lib/api_automation_tools.php.rej
patching file lib/api_device.php
Hunk #1 FAILED at 137.
Hunk #2 FAILED at 176.
2 out of 2 hunks FAILED -- saving rejects to file lib/api_device.php.rej
patching file lib/api_graph.php
Hunk #1 FAILED at 82.
Hunk #2 FAILED at 95.
2 out of 2 hunks FAILED -- saving rejects to file lib/api_graph.php.rej
patching file lib/api_tree.php
Hunk #1 FAILED at 44.
1 out of 1 hunk FAILED -- saving rejects to file lib/api_tree.php.rej
patching file lib/auth.php
Hunk #1 FAILED at 121.
Hunk #2 FAILED at 152.
2 out of 2 hunks FAILED -- saving rejects to file lib/auth.php.rej
patching file lib/data_query.php
Hunk #1 FAILED at 56.
Hunk #2 FAILED at 215.
2 out of 2 hunks FAILED -- saving rejects to file lib/data_query.php.rej
patching file lib/functions.php
Hunk #1 FAILED at 1689.
Hunk #2 FAILED at 1701.
Hunk #3 FAILED at 1780.
3 out of 3 hunks FAILED -- saving rejects to file lib/functions.php.rej
patching file lib/html_form.php
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 530.
Hunk #3 FAILED at 722.
3 out of 3 hunks FAILED -- saving rejects to file lib/html_form.php.rej
patching file lib/html.php
Hunk #1 FAILED at 144.
Hunk #2 FAILED at 177.
Hunk #3 FAILED at 268.
Hunk #4 FAILED at 638.
Hunk #5 FAILED at 706.
Hunk #6 FAILED at 715.
Hunk #7 FAILED at 744.
Hunk #8 FAILED at 764.
8 out of 8 hunks FAILED -- saving rejects to file lib/html.php.rej
patching file lib/html_tree.php
Hunk #1 FAILED at 543.
Hunk #2 FAILED at 985.
Hunk #3 FAILED at 1189.
3 out of 3 hunks FAILED -- saving rejects to file lib/html_tree.php.rej
patching file lib/plugins.php
patching file lib/poller.php
Hunk #1 FAILED at 344.
1 out of 1 hunk FAILED -- saving rejects to file lib/poller.php.rej
patching file lib/rrd.php
Hunk #1 FAILED at 419.
Hunk #2 FAILED at 539.
Hunk #3 FAILED at 1376.
Hunk #4 FAILED at 1384.
4 out of 4 hunks FAILED -- saving rejects to file lib/rrd.php.rej
patching file lib/template.php
Hunk #1 FAILED at 786.
1 out of 1 hunk FAILED -- saving rejects to file lib/template.php.rej
patching file lib/variables.php
Hunk #1 FAILED at 183.
1 out of 1 hunk FAILED -- saving rejects to file lib/variables.php.rej
patching file plugins/index.php
patching file plugins.php
patching file poller.php
Hunk #1 FAILED at 108.
Hunk #2 FAILED at 303.
Hunk #3 FAILED at 427.
Hunk #4 FAILED at 446.
Hunk #5 FAILED at 493.
5 out of 5 hunks FAILED -- saving rejects to file poller.php.rej
patching file user_admin.php
Hunk #1 FAILED at 57.
Hunk #2 FAILED at 402.
Hunk #3 FAILED at 444.
Hunk #4 FAILED at 889.
4 out of 4 hunks FAILED -- saving rejects to file user_admin.php.rej
patching file utilities.php
Hunk #1 FAILED at 123.
Hunk #2 FAILED at 1644.
2 out of 2 hunks FAILED -- saving rejects to file utilities.php.rej
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Upgrade PIA 2.8 > 2.9

Post by noname »

gjubin wrote: yes, i show many "HUNK ..."
How can I check ? or be sure it's good ?

Code: Select all

root@bbs-monitor:/home/gjubin/archive/cacti-plugin-arch# patch -p1 -N --dry-run < cacti-plugin-0.8.7g-PA-v2.9.diff 
...
Oops, you are trying to re-apply (same) plugin patch to the files which patched already.
I'm referring about patches for Cacti itself (not plugin patch).

Anyway, now I've verified for the below 2 situations.
A) Cacti 0.8.7g (not applied official patches) + PIA 2.8 + overwrote PIA 2.9 pre-patched files [= your case]
B) Cacti 0.8.7g + official patches + PIA 2.9 (apply cacti-plugin-0.8.7g-PA-v2.9.diff)

Both are most identical. It's no need to apply official patches.

But somehow 1 file ('lib/html_form.php') is different..

Code: Select all

% diff cacti-0.8.7g_pia2.9/lib/html_form.php cacti-plugin-arch_v2.9/files-0.8.7g/lib/html_form.php
2d1
< // $Id: html_form.php 2993 2010-10-14 14:30:36Z ladams $
534,540d532
<       if (isset($_SESSION["sess_error_fields"])) {
<               if (!empty($_SESSION["sess_error_fields"][$form_name])) {
<                       $class .= (strlen($class) ? " ":"") . "txtErrorTextBox";
<                       unset($_SESSION["sess_error_fields"][$form_name]);
<               }
<       }
<
So I suggest that you should modify your 'lib/html_form.php',
from

Code: Select all

function form_text_area($form_name, $form_previous_value, $form_rows, $form_columns, $form_default_value, $class = "", $on_change = "") {
	if ($form_previous_value == "") {
		$form_previous_value = $form_default_value;
	}

	if (isset($_SESSION["sess_field_values"])) {
	...
to

Code: Select all

function form_text_area($form_name, $form_previous_value, $form_rows, $form_columns, $form_default_value, $class = "", $on_change = "") {
	if ($form_previous_value == "") {
		$form_previous_value = $form_default_value;
	}

	if (isset($_SESSION["sess_error_fields"])) {
		if (!empty($_SESSION["sess_error_fields"][$form_name])) {
			$class .= (strlen($class) ? " ":"") . "txtErrorTextBox";
			unset($_SESSION["sess_error_fields"][$form_name]);
		}
	}

	if (isset($_SESSION["sess_field_values"])) {
	...
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Upgrade PIA 2.8 > 2.9

Post by gandalf »

When upgrading from PIA 2.8 to 2.9, you should use full file replacement
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests