Upgrading CometChat

I needed to upgrade CometChat on a web site using Simple Machines Forum (SMF) where CometChat provides an online chat feature for users of the forum. The prior version of CometChat was very out-of-date at 4.4.0 - see Checking the version of CometChat installed on a forum for methods for checking the version - The SMF software was at the current version, 2.0.11. Before commencing the installation of the upgrade to the latest version of CometChat, I backed up the database for the SMF forum and all of its files. I then took the following steps to install the new version of CometChat.
  1. Unzip the contents of the cometchat_UNZIP_FIRST.zip file from the CometChat website. Within it, you will see the following files:

    cometchat.zip
    README.pdf
    smf.zip

  2. Log into the forum as an administrator.
  3. Click on Admin in the menu at the top of the forum's home page and select Package Manager.

    SMF - Admin

  4. Generic Category (English)120x600
    Click on Download Packages.

    SMF - Package Manager

  5. In the Upload a Package section of the page, click on the Choose File button.

    SMF - Upload a Package

  6. Browse to the location of the files you unzipped and select smf.zip , then click on the Upload Button.

    SMF - Upload SMF Package

  7. You should then see the message "The package has been uploaded successfully."

    SMF - CometChat Uploaded Successfully

    Click on the Install Mod link.

  8. If you see any Test failed messages you should try to resolve those.

    CometChat Package Installation
Error

    In this case, a test for insertion of code after the following line in ./Sources/Admin.php failed ( Details ):

    'current_theme' => array(

    So I examined the contents of the Admin.php file in the Sources directory for the forum. Within that file, I found the following code:

    				),
    'current_theme' => array(
    					'label' => $txt['theme_current_settings'],

    So the line was present in the file. Sometimes extra spaces, tabs, etc., which might have been placed in a file by the installation of some other mod, can cause the installation procedure for a mod not to locate a line for which it is searching. Or sometimes tabs, etc, which the install process is searching for have been removed. In this case I could easily manually insert the needed code. First I backed up the existing Admin.php file with the cp command preserving its permissions with the -a option.

    # cp -a Admin.php Admin.php.old

    But rather than just manually inserting the needed code in the appropriate spot in the file, I extracted the contents of the smf.zip file and examined the modifications.xml file to see exactly what the installation procedure was expecting to find. Within it, I saw the following code:

    			<search position="after"><![CDATA[
    				'current_theme' => array(
    ]]></search>

    It appeared that there were several tabs before 'current_theme' when I examined the file with the vi editor. I used the od command to view the characters that were being searched for in hexadecimal format. Using that command and piping its output into the grep command to isolate just the line with "current" on it, I saw the following:

    #  od -A x -t x1z -v modifications.xml | grep current
    000280 54 41 5b 0a 09 09 09 09 27 63 75 72 72 65 6e 74  >TA[.....'current<

    Examining an ASCII table and comparing the hexadecimal values shown by the od command for the relevant line, I saw there were four hexadecimal "09" characters before the "27", which represents the single quote character and the "63" which is the hexadecimal equivalent of a lowercase "c".

    You can also use the xxd command to view the contents of a file in hexadecimal and ASCII characters. E.g.:

    # xxd modifications.xml | grep current
    0000280: 5441 5b0a 0909 0909 2763 7572 7265 6e74  TA[.....'current

    To fix the issue with the Admin.php file, I deleted everything on the 'current_theme' => array( line up to the opening single quote then hit the tab key 4 times. Note: if you use the vi editor on a Linux or OS X system, you can use it to view a line in hexadecimal by calling xxd from within vi. I then saved the file, hit the back button on the browser I was using and then clicked on Install Mod again. This time, there was no error message for Admin.php, only a "Test failed" message for one test for Subs.php . So I then clicked on the icon showing a piece of paper with a pencil over it for the ./Sources/Subs.php failed test.

    As with the issue with the other file, I first made a backup copy of the relevant file with cp -a Subs.php Subs.php.old. Again, it appeared the code being searched for by the installation procedure was actually present in Sources.php. I.e., I saw the following lines in the file:

                            foreach (array_reverse($context['template_layers']) as $layer)
                    loadSubTemplate($layer . '_below', true);
    

    Examining the modifications.xml file from smf.zip with xxd, I saw the following:

    # xxd modifications.xml | grep "foreach"
    0000930: 4344 4154 415b 0a09 666f 7265 6163 6820  CDATA[..foreach

    The lowercase "for" is 66 6F 72 in hexadecimal. I see a 0a, which is a newline character followed by 09, which is the tab character. So then I checked that line in the Subs.php file in the Sources directory. I saw the following when I edited it in vi and called xxd from within vi to view that line:

    0000000: 0909 0966 6f72 6561 6368 2028 6172 7261  ...foreach (arra
    0000010: 795f 7265 7665 7273 6528 2463 6f6e 7465  y_reverse($conte
    0000020: 7874 5b27 7465 6d70 6c61 7465 5f6c 6179  xt['template_lay
    0000030: 6572 7327 5d29 2061 7320 246c 6179 6572  ers']) as $layer
    0000040: 290a                                     ).

    I could see that there were 3 tab characters, i.e., 090909 before the "foreach", so I deleted everything up to the foreach and inserted one tab character. I then save the file and hit the back button in my browser and clicked on Install Mod again. This time all tests passed and I could click on the Proceed button at the bottom of the page.

    SMF Mod Install Tests Successful

  9. When you see "Test successful" for all tests and the Install Now button appears, click on that button.

    SMF Install Mod

  10. You should then see the CometChat Administration Panel.

    CometChat_Admin_Panel

    You can access the CometChat Administration Panel in the future by going to Admin, then Features and Options, then selecting Configuration and then selecting CometChat Administration Panel from the dropdown menu.

    Configuration CometChat Admin
Panel

  11. You will see fields for a username and password; those aren't necessarily the same as for your forum administrator account. If you have forgotten, those, if you scroll to the right on the page, you will see a "Forgot Password?" link. If you click on it, you will be advised "Please manually edit cometchat/config.php and find ADMIN_USER & ADMIN_PASS".

    CometChat Forgot Password

    If you have forgotten the userid and password, look for lines similar to the following ones in cometchat/config.php.

    /* ADMIN START */
    
    define('ADMIN_USER','CometChatAdmin');
    define('ADMIN_PASS','ASecretPass');
    
    /* ADMIN END */

    To log into the CometChat Administration Panel, you can enter those in the username and password fields and click on Login.

  12. But to start the upgrade, click on "Upgarde [sic] CometChat". Perhaps "Upgarde" is a typo, since, though "upgarde" is Swedish for "upgrade", if you go to the CometChat Contact Us page, you will see a United States phone number next to a U.S. flag, but also a "+91" phone code, which is the country phone code for India and you will also see the flag of India displayed next to that number.

    SMF Upgarde CometChat

    When you click on "Upgarde CometChat", if you are prompted for another password, it will be for the forum administratorpassword for the forum. You will be taken to a page where you will be prompted to "Upload CometChat zip file". Click on the Choose File button to browse to the location of cometchat.zip and select that file, which you previously extracted from cometchat_UNZIP_FIRST.zip.

    Upload CometChat Zip

  13. Click on the Install Now button. If all goes well, the upgrade will be installed. For me, all did not go well. After clicking on Install Now , I would see "Uploading" followed by a pecentage that increased until I was taken back to the same "Upgarde CometChat" page I had been at previously with the "Upload CometChat zip file" field showing "No file chosen". I tried several times with the same result. I was using the Google Chrome browser, version 48.0.2564.109, but when I switched to Firefox 45.0.1 on a different system the results were the same.

    When I check the forum's error log, which is accessible by clicking on Admin then selecting Error Log, I see two entries for each installation attempt:

    http://example.com/index.php?action=admin;area=CometChat;sa=upgrade_cc; <text snipped>
    8: Undefined index: title  
    
    File: /home/jdoe/public_html/mysite/Themes/default/cometchat_templates/CometChat.template.php (generic_menu_dropdown_above sub template - eval?)
    Line: 291

    That error log entry is always followed by the following one:

    http://example.com/index.php?action=admin;area=CometChat;sa=upgrade_cc; <text snipped> 
    8: Undefined index: description  
    
    File: /home/jdoe/public_html/mysite/Themes/default/cometchat_templates/CometChat.template.php (generic_menu_dropdown_above sub template - eval?)
    Line: 303

    While checking the error log, I noticed the time stamps on log entries were off by one hour; I corrected that by changing the forum's timezone .

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px