BnGSvc Posted September 24, 2005 Share Posted September 24, 2005 (edited) I'm getting close.. I can FEEL it!!! :blink: I am now getting the message Invalid conf file. Error in addcode section #11 The line of code that produces that error is: if(!$addcode[$loop_index]['FILE']['@']['NAME'] || !$addcode[$loop_index]['FIND']['#'] || !$addcode[$loop_index]['ADD']['#'] || ( (!$addcode[$loop_index]['FINDLINENUMBERS']['@']['START'] || !$addcode[$loop_index]['FINDLINENUMBERS']['@']['END']) && $addcode[$loop_index]['FINDLINENUMBERS']['@']['TYPE'] != 'new')) NOT logic gives me a headache!! :'( I believe this is saying that the addcode must have a FILE element with a NAME attribute, a FIND element, an ADD element, and a FINDLINENUMBERS element with START, END or TYPE attribute. (I see the valid value for TYPE here is "new". How is that used?) Anything else produces the error listed above. Maybe I've sat here and looked at the code too long. But I don't see what is wrong. What do you think? Here is the code for block 11: <addcode> <file name="includes/languages/english/product_reviews_info.php" /> <find><![CDATA[ define('TEXT_CLICK_TO_ENLARGE', 'Click to enlarge'); ]]></find> <add><![CDATA[ // ***************************************** // begin: CallForPrice contribution ref#8579 // ***************************************** define('TEXT_CALL_FOR_PRICE', 'Call for Price'); // *************************************** // end: CallForPrice contribution ref#8579 // *************************************** ]]></add> <findlinenumbers start="21" end="21" /> </addcode> Edited September 24, 2005 by BnGSvc Quote Link to comment Share on other sites More sharing options...
BnGSvc Posted September 24, 2005 Share Posted September 24, 2005 WOW!!! :D I finally got it to work.. I kept fooling with it until it accepted my format. BUT!!!!!! On all my updates I put comment lines around the actual lines of code. As in the example below. In EVERY case it only inserted the LAST line of each block of code!!! So, what did I do wrong this time???? <addcode> <file name="includes/languages/english/product_reviews_info.php" /> <find><![CDATA[ define('TEXT_CLICK_TO_ENLARGE', 'Click to enlarge'); ]]></find> <add><![CDATA[ // ***************************************** // begin: CallForPrice contribution ref#8579 // ***************************************** define('TEXT_CALL_FOR_PRICE', 'Call for Price'); // *************************************** // end: CallForPrice contribution ref#8579 // *************************************** ]]></add> <findlinenumbers start="21" end="21" /> </addcode> In this example all that was inserted in the code was // *************************************** Quote Link to comment Share on other sites More sharing options...
rinon Posted September 24, 2005 Author Share Posted September 24, 2005 WOW!!! :D I finally got it to work.. I kept fooling with it until it accepted my format. BUT!!!!!! On all my updates I put comment lines around the actual lines of code. As in the example below. In EVERY case it only inserted the LAST line of each block of code!!! So, what did I do wrong this time???? <addcode> <file name="includes/languages/english/product_reviews_info.php" /> <find><![CDATA[ define('TEXT_CLICK_TO_ENLARGE', 'Click to enlarge'); ]]></find> <add><![CDATA[ // ***************************************** // begin: CallForPrice contribution ref#8579 // ***************************************** define('TEXT_CALL_FOR_PRICE', 'Call for Price'); // *************************************** // end: CallForPrice contribution ref#8579 // *************************************** ]]></add> <findlinenumbers start="21" end="21" /> </addcode> In this example all that was inserted in the code was // *************************************** <{POST_SNAPBACK}> You may have just found the bug I've been trying to find/document/fix since I released this package! You see, it doesn't happen to me. I will look into this asap. In the mean time, are the <findreplace> sections working? And what version of php are you using? Thanks. -Rinon Quote Link to comment Share on other sites More sharing options...
BnGSvc Posted September 25, 2005 Share Posted September 25, 2005 You may have just found the bug I've been trying to find/document/fix since I released this package! You see, it doesn't happen to me. I will look into this asap. In the mean time, are the <findreplace> sections working? And what version of php are you using? Thanks. -Rinon It appears the problem is in the XML parser. I put a print_r in the contrib_installer.php module to dump the addcode and findreplace arrays. In all of the find, replace and add sections for findreplace as well as addcode, where the input has multiple lines of code, the array returned by the parser only contains the very last line of code. I am using PHP v4.3.2 with Zend engine v1.3.0 I'd like to make a suggestion. It would be nice to have a "Verify" option to be able to have the installer go through the entire process (where it is possible) without making any updates. It would help developers of the CIPs check out their changes and not actually make the updates until they are ready. It would promote modularized development of the change packages. Glenn Quote Link to comment Share on other sites More sharing options...
BnGSvc Posted September 26, 2005 Share Posted September 26, 2005 I have been playing around with the code today. My problem is I am a Java programmer and just getting into php so I have to go through a lot of steps that a more experienced php programmer wouldn't. In dumping the $addcode and $findreplace arrays it appears to me the parser is not working properly. So I started looking at the xml_parser.php module. In the dataHandler function at line 82 is has the following code: $array_ref['#'] = $data; Since the dataHandler is called for EACH line of data it finds under a tag that just doesn't seem right. So I changed the code to: $array_ref['#'] .= $data; And low and behold it started picking up all the lines of text. So I think that is part of the fix. But I think there are a few other issues with that. First, since the data is coming in one line at a time the new line character has been stripped. So I changed the line to: $array_ref['#'] .= $data . "\n"; Which seemed to fix that complication. One last issue with dataHandler is that it does an ltrim of each data line thus taking out all white space the programmer has put in. I think you should reconsider that action. IMHO the update module should leave the new code EXACTLY as it was added to the update file. You should probably verify that these are the right fixes. They seem to be working right, but it could be difficult to tell. Now that it is picking up all the changes I have run into another minor issue. The update wasn't right. The installer appears to be adding new line characters every time it encounters a right bracket (]); It's difficult to tell from the examples below because of wrapping. But in the sample of the changed code each ] actually starts on a new line in the updated module. This will probably be wrapped up with the rework of the way it handles white space. In one case the code in the xml looks like this: ** The wrapping of the text distorts the appearance of the original code. The code starting with "<td class=" is all on one line through the "</td>". <?php // ***************************************** // begin: CallForPrice contribution ref#8579 // ***************************************** ?> <td class="pageHeading" align="right" valign="top"> <?php (CALL_FOR_PRICE_AMT > -1 && $product_info['products_price'] == CALL_FOR_PRICE_AMT) ? echo '<a href="' . tep_href_link(FILENAME_CONTACT_US, 'enquiry=Price Inquiry%0D%0A%0D%0AProduct Id: ' . $listing_values['products_id'] . '%0D%0AProduct Name: ' . $listing_values['products_name'] . '%0D%0AProduct Url: ' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing_values['products_id'] .'%0D%0A%0D%0A') . '') . '>' . TEXT_CALL_FOR_PRICE . '</a>' : echo $products_price; ?></td> <?php // ***************************************** // end: CallForPrice contribution ref#8579 // ***************************************** ?> What got inserted looks like this: <?php // ***************************************** // begin: CallForPrice contribution ref#8579 // ***************************************** ?> <td class="pageHeading" align="right" valign="top"> <?php (CALL_FOR_PRICE_AMT > -1 && $product_info['products_price' ] == CALL_FOR_PRICE_AMT) ? echo '<a href="' . tep_href_link(FILENAME_CONTACT_US, 'enquiry=Price Inquiry%0D%0A%0D%0AProduct Id: ' . $listing_values['products_id' ] . '%0D%0AProduct Name: ' . $listing_values['products_name' ] . '%0D%0AProduct Url: ' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing_value['products_id' ] .'%0D%0A%0D%0A') . '') . '>' . TEXT_CALL_FOR_PRICE . '</a>' : echo $products_price; ?></td> <?php // ***************************************** // end: CallForPrice contribution ref#8579 // ***************************************** ?> I haven't gone through all the updates and tested the changes yet. I'll let you know what I find. I may decide to go back and take out that ltrim and re-install the changes first. Glenn Quote Link to comment Share on other sites More sharing options...
rinon Posted September 26, 2005 Author Share Posted September 26, 2005 <snip> I haven't gone through all the updates and tested the changes yet. I'll let you know what I find. I may decide to go back and take out that ltrim and re-install the changes first. Glenn You're definitely on the right track, thanks. This behavior has changed in PHP5, so that's why I didn't catch this. As soon as I get a chance, I'll fix this and release a new package. Let me know what you come up with, and I can check and integrate your changes (with credit going to you for getting this horrible bug fixed, of course). Thanks again. - Rinon Quote Link to comment Share on other sites More sharing options...
Guest Posted October 1, 2005 Share Posted October 1, 2005 Hi, I am sure my installation is incomplete but I can see it the COnfiguration Panel. It failed to install the included sample catalog. Then I tried to uninstall it as per README. I think I did all the uninstallation steps. THe installation is confirmed incomplete when contrib_install.php is not in languages/english folder. I am now trying to reinstall (follow step by step) it failed on me with the follwing error. Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/httpd/vhosts/domain.biz/httpdocs/catalog/admin/includes/functions/database.php:13) in /home/httpd/vhosts/domain.biz/httpdocs/catalog/admin/includes/functions/database.php on line 13 What did I do wrong here? Thank you Quote Link to comment Share on other sites More sharing options...
bluew4 Posted October 1, 2005 Share Posted October 1, 2005 Contrib Installer Download here ( <a href='http://www.oscommerce.com/community/contributions,3286' target='_blank'>http://www.oscommerce.com/community/contributions,3286 )</a> Contrib Installer is an easy way to install contributions for osCommerce without manually editting files. Installing a contribution with Contrib Installer requires a simple package which describes the contribution. I have included the Image Check contribution as an example. I am currently working on supporting other contributions (need help here!), so hopefully there will soon be Contrib Installer packages for many other contributions. If you want to help with making packages (it's very easy), that would be wonderful. For more info see the README.txt file in the package. Right now, the biggest help I need is making installation packages of other contributions. Please take a look at the example_contribution in the zip file and see if you can make packages of your favorite contributions. If you need any help on how to do this, just ask. Hi, I have been leaving messages all over this forum. I need some to install this contribution -http://www.oscommerce.com/community/contributions,282/category,all/search,gift and I don't have a clue as to who, what, when or where to start. Please Help, Margie Quote Link to comment Share on other sites More sharing options...
rinon Posted October 1, 2005 Author Share Posted October 1, 2005 Hi,I have been leaving messages all over this forum. I need some to install this contribution -http://www.oscommerce.com/community/contributions,282/category,all/search,gift and I don't have a clue as to who, what, when or where to start. Please Help, Margie Right now, there is no CIP (contrib installer package) for the "Credit Class & Gift Voucher" contribution. This means that you cannot use the Contrib Installer to install this (yet). Perhaps I will make a CIP for this contribution, but I doubt that I can get to it soon, since I'm first trying to fix the bugs in the installer code before making new CIP's. So I think your best bet would be to ask for help on this thread: http://www.oscommerce.com/forums/index.php?showtopic=158518. Sorry you can't use the Contrib Installer for this (yet). - Rinon Quote Link to comment Share on other sites More sharing options...
Guest Posted October 2, 2005 Share Posted October 2, 2005 Hi,I am sure my installation is incomplete but I can see it the COnfiguration Panel. It failed to install the included sample catalog. Then I tried to uninstall it as per README. I think I did all the uninstallation steps. THe installation is confirmed incomplete when contrib_install.php is not in languages/english folder. I am now trying to reinstall (follow step by step) it failed on me with the follwing error. Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/httpd/vhosts/domain.biz/httpdocs/catalog/admin/includes/functions/database.php:13) in /home/httpd/vhosts/domain.biz/httpdocs/catalog/admin/includes/functions/database.php on line 13 What did I do wrong here? Thank you How to fix it? Quote Link to comment Share on other sites More sharing options...
rinon Posted October 2, 2005 Author Share Posted October 2, 2005 Hi,I am sure my installation is incomplete but I can see it the COnfiguration Panel. It failed to install the included sample catalog. Then I tried to uninstall it as per README. I think I did all the uninstallation steps. THe installation is confirmed incomplete when contrib_install.php is not in languages/english folder. I am now trying to reinstall (follow step by step) it failed on me with the follwing error. Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/httpd/vhosts/domain.biz/httpdocs/catalog/admin/includes/functions/database.php:13) in /home/httpd/vhosts/domain.biz/httpdocs/catalog/admin/includes/functions/database.php on line 13 What did I do wrong here? Thank you Sorry I didn't get a chance to look at this earlier. What page is giving you this error? - Rinon Quote Link to comment Share on other sites More sharing options...
Guest Posted October 3, 2005 Share Posted October 3, 2005 Sorry I didn't get a chance to look at this earlier. What page is giving you this error? - Rinon Rinon, I get the error when executing the contrib_installer.php (first page). Thnx Quote Link to comment Share on other sites More sharing options...
bobeisenberg Posted October 14, 2005 Share Posted October 14, 2005 Hi. I'm new to website design and have just loaded the contrib installer. When I try to install any packages, I get the following error message: Warning: opendir (catalog/contributions/): failed to open dir: No such file or directory in catalog/admin/contrib_installer.php on line 832 Warning: readdir(): supplied argument is not a valid Directory resource in catalog/admin/contrib_installer.php on line 833 Warning: closedir(): supplied argument is not a valid Directory resource in catalog/admin/contrib_installer.php on line 838 The contributions directory is correctly referred to in the contrib installer path, and I have no idea what to do. Please can anyone help. Bob. Quote Link to comment Share on other sites More sharing options...
rinon Posted October 14, 2005 Author Share Posted October 14, 2005 Hi. I'm new to website design and have just loaded the contrib installer. When I try to install any packages, I get the following error message: Warning: opendir (catalog/contributions/): failed to open dir: No such file or directory in catalog/admin/contrib_installer.php on line 832 Warning: readdir(): supplied argument is not a valid Directory resource in catalog/admin/contrib_installer.php on line 833 Warning: closedir(): supplied argument is not a valid Directory resource in catalog/admin/contrib_installer.php on line 838 The contributions directory is correctly referred to in the contrib installer path, and I have no idea what to do. Please can anyone help. Bob. It appears that your contrib installer path is not set correctly. It must be the absolute path to the directory where the contributions are stored, not the relative path. What is it set to now? What are the file permissions on this directory? - Rinon Quote Link to comment Share on other sites More sharing options...
bobeisenberg Posted October 15, 2005 Share Posted October 15, 2005 It appears that your contrib installer path is not set correctly. It must be the absolute path to the directory where the contributions are stored, not the relative path. What is it set to now? What are the file permissions on this directory? - Rinon The contributions directory is outside the public_html directory. The absolute path is /home/bobnanne/contributions/, and osCommerce is /home/bobnanne/public_html/catalog. The permissions on the contributions directory are 755. In Administration - Configuration - Contrib Installer, the absolute path is set as above. Quote Link to comment Share on other sites More sharing options...
Guest Posted October 17, 2005 Share Posted October 17, 2005 Hey Rinon, I'm a newbie with OsCommerce but wanted to share with you an idea regarding Contrib Installer. At our company we use SugarCRM, an open-source CRM package. SugarCRM has recently implemented something similar to the Contrib Installer and it's really great to install patchs, contributions and upgrades. I don't know how they do it but I think it's worth a shot to check it out because it's working nicely. Great contribution, keep it up. All the best, Ricardo Quote Link to comment Share on other sites More sharing options...
Solti Posted October 26, 2005 Share Posted October 26, 2005 Hi, very good job. I want to ask you to make some changes which will help to deail with conflicts. Can Contrib Installer add comments after each changed lines with module name? Example: //AdminPage v.1.1.1 I think it will helps. Or Contrib Installer can comment all replaced code. So Contrib Installer leave all old code as comments and add new code. Quote Link to comment Share on other sites More sharing options...
Vlad Savitsky Posted October 27, 2005 Share Posted October 27, 2005 Hi, rinon! I'm making a CIP and have some problem with it. 1. Installer can't make a directories. Installer says that "I need write permission for: /www/osc/includes/languages/russian". This folder doesn't exist. 2. Than I try to add to files that doesn't exist in 2MS2.2. This is language files that not included in stantand edition. How should I solve this problems? Quote =============================== Never give up! Never give up! Never give up! Link to comment Share on other sites More sharing options...
brucesenator Posted October 30, 2005 Share Posted October 30, 2005 I installed the .php files, but I cannot figure out the following: (1) In Step 3 - the necessary changes to contrib_installer.php (2) What to run (if anything) under phpMyAdmin regarding sql series (3) Where to access the Contribution Installer in the Admin panel. **NOTE: The Readme.txt file for this contribution needs to be updated for these clarifications. Thanks, Bruce Senator Quote Link to comment Share on other sites More sharing options...
rinon Posted October 31, 2005 Author Share Posted October 31, 2005 Hi, very good job.I want to ask you to make some changes which will help to deail with conflicts. Can Contrib Installer add comments after each changed lines with module name? Example: //AdminPage v.1.1.1 I think it will helps. Or Contrib Installer can comment all replaced code. So Contrib Installer leave all old code as comments and add new code. This is already being added to the next version, thanks. Hi, rinon!I'm making a CIP and have some problem with it. 1. Installer can't make a directories. Installer says that "I need write permission for: /www/osc/includes/languages/russian". This folder doesn't exist. 2. Than I try to add to files that doesn't exist in 2MS2.2. This is language files that not included in stantand edition. How should I solve this problems? What are the permissions of the includes/languages directory? The error message should probably referr to the /includes/languages/ not the /includes/languages/russian directory if I understand you correctly. If you want to add files you must use the <addfile> tag (as in the example install.xml) and put the file in a subdirectory of the CIP directory called catalog. Example: CIP is in contributions/example/ File you want to add is "file.php" and you want to put it in the includes/functions/ directory. Then.... Put file.php in this directory: contributions/example/catalog/includes/functions/ and use the <addfile> tag in the install.xml file. HTH, and let me know if you've got more problems/questions. I installed the .php files, but I cannot figure out the following: (1) In Step 3 - the necessary changes to contrib_installer.php (2) What to run (if anything) under phpMyAdmin regarding sql series (3) Where to access the Contribution Installer in the Admin panel. **NOTE: The Readme.txt file for this contribution needs to be updated for these clarifications. Thanks, Bruce Senator (1) There are no changes to the code at all, you just have to open that page in your web browser (like you were visiting your admin interface) and follow the automated instructions (similar to the original installation/configuration of osCommerce itself). (2) Absolutely nothing! I tried to make this install as easy as possible, so the Step 3 (going to the page in your web browser, see (1) above) actually does all the needed SQL queries. (3) It will be in Tools->Contrib Installer. The configuration for it (which you shouldn't need to ever visit unless you change where CIP's (Contrib Installer Packages) are stored) is in Configuration->Contrib Installer. Also re: your question on what goes into the contributions/ directory: To install contributions with the Contrib Installer, there must be a CIP (Contrib Installer Package) available for it. To use this CIP you unzip it to the contributions/ directory and it will automatically show up on the Contrib Installer page (see (3) above). As of right now, there aren't many CIP's available, and the Installer itself is still being tested and improved, but hopefully the number of available CIP's will increase. If you want a list of available CIP's check out this post: http://www.oscommerce.com/forums/index.php?s=&...ndpost&p=673748. From now on I have been asked by the osCommerce team to place all CIP's on the Contrib Installer download page, so you will be able to get them all from that page in the future. Hope that answers everyones' questions at the moment, sorry I haven't been able to reply or do a whole lot on the project lately, but I am continuing development on it. I have another developer who is helping me, and we have several new ideas, the biggest one being a redesign of the multiple language handling that is currently in progress. - Rinon Quote Link to comment Share on other sites More sharing options...
Vlad Savitsky Posted November 1, 2005 Share Posted November 1, 2005 Hi, I've made some changes to Contrib Installer. 1. Separate css and Javascript from php-code. 2. Separate HTML and installer-code. 3. Separate language strings. 4. One function works with one tag. What for? I want CI do nothing if errors so I separate checking and installation processes. I want to add more tags and this changes will help to do it easyer. Tags: php - just use eval to content of php tag. This solves many problems with conditions in xml and with creating folders and etc. del_dir, copy_dir, copy_file, del_file, and may be more. Also want to sugest to do an CI XML specification. May be tomorrow I'll try to do CI more object oriented. :-) Quote =============================== Never give up! Never give up! Never give up! Link to comment Share on other sites More sharing options...
Vlad Savitsky Posted November 3, 2005 Share Posted November 3, 2005 Hi, all. Uploaded new 1.0 version. Try NEW CONTRIB_INSTALLER v1.0 !!! ================================ This is BETA. Full package. Stable version is 0.5d. Changes: - some checks before install: --- xml check --- permissions check --- conflicts check - self install from xml-file. So can be made self UNinstall. -new tag PHP. Can be used any code (see contributions/contrib_installer/install.xml) - code was reordered and more structurized - and more... God bless you in using this package. ================================ ToDo: - resolving conflicts - contrib dependencies - new tags (del_dir, del_file and etc.) http://solti.com.ua newest version 1.0 on: http://www.oscommerce.com/community/contributions,3286 Quote =============================== Never give up! Never give up! Never give up! Link to comment Share on other sites More sharing options...
rmyles Posted November 3, 2005 Share Posted November 3, 2005 (edited) Hi, This is a great Idea! I'm having a little trouble with the latest version. In the admin section after setting the path to the contributions directory I'm greeted with the following message: Could not open XML input from /public_html/test_area/contributions/contrib_installer/install.xml Not sure what this means... Ron Edited November 3, 2005 by rmyles Quote Link to comment Share on other sites More sharing options...
Vlad Savitsky Posted November 4, 2005 Share Posted November 4, 2005 Hi, I'm having a little trouble with the latest version. In the admin section after setting the path to the contributions directory I'm greeted with the following message: Could not open XML input from /public_html/test_area/contributions/contrib_installer/install.xml Not sure what this means... Check: 1. if install.xml is not exists (but if so you must get a message "Could not copy....") 2. Folders /public_html/test_area/contributions/contrib_installer have a write permissions. (in script used 0777 for all this folders but 0775 for /public_html/test_area) Fix Set the right permissions by hand or find this in admin/contrib_installer.php: if(!is_dir(dirname($contrib_dir))) { if(!@mkdir(dirname($contrib_dir))) echo "Can't make dir: ".dirname($contrib_dir)."<hr>"; chmod(dirname($contrib_dir), 0775); } replase with: if(!is_dir(dirname($contrib_dir))) { if(!@mkdir(dirname($contrib_dir))) echo "Can't make dir: ".dirname($contrib_dir)."<hr>"; chmod(dirname($contrib_dir), 0777); } May be you should change an owner or group. Apache usually works as "nobody" and creates files/folders as "nobody". Check it too. Quote =============================== Never give up! Never give up! Never give up! Link to comment Share on other sites More sharing options...
rmyles Posted November 4, 2005 Share Posted November 4, 2005 I've just noticed that the path in the error message is different than the path used to upload the files. So in effect the file isn't there, but should it be? The instructions (or the path in the cont download package) say to upload to catalog/Admin/contrib_installer.php but the message is looking for it in catalog/contrib_installer.php Could that be the problem? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.