Disclaimer: This article is original article, if you need to reprint, please indicate if you have any questions, please go to bbs.tsinghua.edu.cn WebDEV version, due to the need to run PLOG on PHP5, online downloaded PLOG_0.3.2_cn package can not be used directly (not Didn't look at the Chinese, it should not be available. If you can't find information, you can only study itself, you will be lucky, you don't dare to share your experience, write a summary for people who have the same needs.
The following steps implement the use of PLOG_0.3.2_CN PHP5.0.2 Mysql4.1.7 (MySQLI "Database for Windows2000 Advanced Server System (Mysqli Library)
Modify the PLOG_0.3.2_CN source program 1. Modify /class/Object/Exception.class.php: Description: Remove the Exception class inside, remove the throw, catch function. Modifying the _ternalerrorhandler function (name does not matter, you can change it) Here you need to say, PHP5 provides the system's Exception class, so you don't have to define your own, and you can't define it yourself. Otherwise, you will have repeated definitions. Error handling class, just printing an error message, advanced features, please write it yourself. // Custom Error Processing Function / * * Parameters: $ E Exception Type * / Function _InternalErrorhandler ($ E) {Echo ('Error In File'. $ E-> getFile (). 'On line'.
$ E-> getLine (). ".
". 'Error Message: "'. $ E-> getMessage ().
'"AND Error Code:'. $ E-> getcode (). '.');
/ / Register our custom error handler $ old_error_handler = set_error_handler ("_internalerrorhandler);?>
2. Modify the /class/object/reflection.class.phpreflection class to rename _REflection Description: In the same time, PHP5 provides the reflection class. Here we make the class name slightly change the specific effect of reflection, please refer to the PHP5 manual for other code. Customized this class, I didn't take it off.
3./Class/Controller/controller.class.php The original new reflection () change to new _REflection () Description: This change corresponds to 2
4./Class/Database/adodb/adodb-iterator.inc.phpadodb_iterator class add function function valid () {return! $ This-> rs-> EOF;} Description: In fact, it should be named to Valid, afraid There are other code to call Hasmore, add one, two function functions are the same, which one can be called.
After doing the above changes, you can put PLOG_0.2 on PHP5. The following changes are to let PLOG use mysqli's library to replace the original MySQL library.
5./class/database/db.class.php(LINE 24) /class/dao/model.class.php (line 45) /wizard.php (line 397 in function connectdb) /register.php (line 52 in function connectDb) /class/plugin/pluginbase.class.php (line 171 in function connectDb) /class/config/configdbstorage.class.php (line 59 in function ConfigDbStorage) is to code all $ db = NewADOConnection ( 'mysql') , It is changed to $ db = newadoconnection ('mysqli'); this can also be changed to other database types you want, and PLOG supports database types still quite quiteer.
After I finished, I found that I didn't do how much change, but I spent a lot of time -_-, thinking that it is mainly not familiar with PHP5, accurately said that PHP5 is more than php4, the process of change, main reference O ' Reilly published "Upgrading.to.php.5", it should be said to have learned a lot * ^ _ ^ *
Due to nothing to do, it is not available to the package, and it is necessary to change the following in the above way.
I hope to help people who are looking for related materials. 2004-11-18 Snowphy attached: Upgrading to php 5by adam trachtenberg
Publisher: O'ReillyPub Date: July 2004isbn: 0-596-00636-5pages: 304