How to install patches and correct errors

26.4. How to install patches and correct errors

From time to time it occurs that some functions of a certain PHP-Nuke version contain bugs, or that some others are in need of an update. Here we will briefly discuss the most common problems that arise in such situations.

Tip Use the Forums!
 

If you are in search of a solution to a common problem, your first move should be to consult a Forum, like those of the authors: PHP-Nuke Forum of spaghettibrain (Claudio), or PHP-Nuke Forum of karakas-online (Chris). Of course, you should always use the search function of the Forums first, before asking a question that has been possibly asked (and answered) many times already.

Here is an example of the installation of a patch:

Generally a patch consists of one or more files that will overwrite the buggy existing ones. The "installation" of the patch is thus nothing more than the simple overwriting of those files: foobar.php (12Kb) will overwrite the existing file foobar.php (13Kb) (notice that the name is the same, but the size differs). It is a good practice not to overwrite the old file, thus deleting it completely, but to move it to something like foobar.old or foobar.orig, so that you can easily restore it, should the new version present unexpected problems.

Example of a manual correction in the code:

Suppose our file consists of a number of lines:

$qdb = "WHERE topic='$new_topic'";
$sql_a = "SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'";
$result_a = $db->sql_query($sql_a)
$row_a = $db->sql_fetchrow($result_a);
$numrows_a = $db->sql_numrows($result_a);
$topic_title = $row_a[topictext];

and we are told that we must replace the fourth one with

$result_a = $db->sql_query($sql_a);

then, after we do this and save the file, our new file will look like:

$qdb = "WHERE topic='$new_topic'";
$sql_a = "SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'";
$result_a = $db->sql_query($sql_a);
$row_a = $db->sql_fetchrow($result_a);
$numrows_a = $db->sql_numrows($result_a);
$topic_title = $row_a[topictext];

(Can you see the difference? )

Most decent text editors (see Chapter 11) will display the line number for your orientation during such operations.


Help us make a better PHP-Nuke HOWTO!

Want to contribute to this HOWTO? Have a suggestion or a solution to a problem that was not treated here? Post your comments on my PHP-Nuke Forum!

Chris Karakas, Maintainer PHP-Nuke HOWTO

 

Site Info v2.2.2

Last SeenLast Seen
Server TrafficServer Traffic
  • Total: 338,843,576
  • Today: 14,180
Server InfoServer Info
  • Oct 17, 2017
  • 04:14 am PDT
 
 

Daily Inspiration