adodb-lite syntax fails after upgrade

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

adodb-lite syntax fails after upgrade

Post by rotezecke »

Hi, i just upgrade from 2.1.6 to 2.2.1 with the phar installer. i think everyhing went fine. something must have changed with adodb though. after a bit of head scratching (nothing in any error logs) I narrowed it down to this line

Code: Select all

 $result = $db->Execute($query);

Edit: Not true, see next post
Here the whole block. The $count test (in this instance) is not really needed, but I have many other plugins that now need reviewing.

Code: Select all

  $config = cmsms()->GetConfig();
  require($config['root_path'].'/ms_config/db.php');
  $osCsid = $_COOKIE["osCsid"];

  $db = ADONewConnection('mysqli');
  $db->Connect($db_host,$db_user,$db_pw,$db_db);
  $query = "SELECT value FROM sessions WHERE sesskey = \"$osCsid\"";

  $result = $db->Execute($query);
  
  $count = $result->RecordCount();
  if ($count > 0) {
    while($result && !$result->EOF) { 
      $data['value'] = $result->fields['value'];
      $result->MoveNext();
    }//end while
  }
  adodb_connect();  
HTML output stops when getting to such a plugin with $result->RecordCount(). There's nothing in the php error logs, despite E_ALL. Change log for 2.2 mentions
Implement new database abstraction library that is compatible with (functionality wise) but improves upon adodb-lite.
Do you have any more info on what exactly changed? Why does it fail? As far as I can tell $result->RecordCount() is still a valid function? Thanks



----------------------------------------------

Cms Version: 2.2.1

Installed Modules:

AdminSearch: 1.0.3
CGBlog: 1.14.4
CGExtensions: 1.55.5
CGSimpleSmarty: 2.1.6
CGSmartImage: 1.21.9
CMSContentManager: 1.1.5
CMSMailer: 6.2.14
Captcha: 0.5.5
CmsJobManager: 0.1
DesignManager: 1.1.2
FileManager: 1.6.3
FilePicker: 1.0.alpha
FormBuilder: 0.8.1.6
JQueryTools: 1.4.0.1
MenuManager: 1.50.3
MicroTiny: 2.1.1
ModuleManager: 2.1
Navigator: 1.0.6
News: 2.51.1
Search: 1.51.1


Config Information:

php_memory_limit:
max_upload_size: 2000000
url_rewriting: mod_rewrite
page_extension: .html
query_var: page
auto_alias_content: true
locale:
set_names: true
timezone: Australia/Sydney
permissive_smarty: false


Php Information:

phpversion: 5.6.30-0+deb8u1
md5_function: On (True)
json_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_ALL: 32767
E_STRICT: 2048
E_DEPRECATED: 8192
test_file_timedifference: No time difference found
test_db_timedifference: No time difference found
create_dir_and_file: 1
memory_limit: 128M
max_execution_time: 30
register_globals: Off (False)
output_buffering: 4096
disable_functions: pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority,
open_basedir:
test_remote_url: Success
file_uploads: On (True)
post_max_size: 8M
upload_max_filesize: 2M
session_save_path: /var/lib/php5/sessions (1733)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)
check_ini_set: On (True)
curl: On


Performance Information:

allow_browser_cache: Off (False)
browser_cache_expiry: 0
php_opcache: On (True)
smarty_cache: Off (False)
smarty_compilecheck: Off (False)
auto_clear_cache_age: On (True)

Server Information:

Server Software: Apache/2.4.10 (Debian)
Server Api: apache2handler
Server Os: Linux 3.16.0-4-amd64 On x86_64
Server Db Type: MySQL (mysqli)
Server Db Version: 5.5.55
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable


Permission Information:

tmp: /var/www/cmsms/tmp (0777)
tmp_cache: /var/www/cmsms/tmp/cache (0777)
templates_c: /var/www/cmsms/tmp/templates_c (0777)
modules: /var/www/cmsms/modules (0777)
uploads: /var/www/cmsms/uploads (0777)
File Creation Mask (umask): /var/www/cmsms/tmp/cache (0777)
config_file: 0644

----------------------------------------------
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: adodb-lite syntax fails after upgrade

Post by rotezecke »

ok, it's not the RecordCount(), it's the connection itself.

Code: Select all

 $config = cmsms()->GetConfig();
  require($config['root_path'].'/ms_config/db.php');
//the config file is found and loaded

Code: Select all

 $db = ADONewConnection('mysqli');
  $db->Connect($db_host,$db_user,$db_pw,$db_db);
//no output for $db->ErrorMsg();
//$db_db holds the correct value for the database i am trying to connect to.

Code: Select all

 $query = "SELECT value FROM sessions WHERE sesskey = 'aaa'";
  $result = $db->Execute($query);
//$db->ErrorMsg(); tells me that table.sessions in CMSMS does not exist. I never connect to the other database but stay with CMSMS db. How do I connect to another database in 2.2?
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: adodb-lite syntax fails after upgrade

Post by rotezecke »

I noticed that the directory
/lib/adodb_lite/adodbSQL_drivers/
only holds 4 sub directories named postgres, postgres7, postgres8, postgres64 and no mysqli folder. Checksum does not miss this folder, and when I copied the mysqli folder from 2.1.6 it didnt fix the problem. still cannot connect to external DB.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: adodb-lite syntax fails after upgrade

Post by calguy1000 »

CMSMS 2.2+ no longer uses adodb or adodb-lite. It uses a new database abstraction library that is 'largely' compatible with adodb-lite. i.e: in all of my modules I have not had to change a line of code.

Now. One difference in the API's is in creating connections to the database. You create them by creating a new Connection object using:

\CMSMS\Database\Connection::Initialize()

It is well documented here: https://apidoc.cmsmadesimple.org/classe ... ction.html
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: adodb-lite syntax fails after upgrade

Post by rotezecke »

Thanks. Could you maybe give an example on how to connect to an external database? I do not understand where/how to pass in the database credentials. i had a look in a few modules but of course they all connect to CMSMS database.

also, does adodb_connect() still work to re-connect? if not, what should i replace it with?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: adodb-lite syntax fails after upgrade

Post by calguy1000 »

I whipped together this quick test in a UDT... took about 2 minutes

Code: Select all

$cs = new \CMSMS\Database\ConnectionSpec;
$cs->type = 'mysqli';
$cs->host = 'localhost';
$cs->dbname = 'wptmp';
$cs->username = 'my_username';
$cs->password = 'my_password';

$db = \CMSMS\Database\Connection::initialize( $cs );
$sql = 'SHOW TABLES';
$list = $db->GetCol($sql);
debug_display($list);
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: adodb-lite syntax fails after upgrade

Post by calguy1000 »

The adodb_connect() function still exists (for compatibility reasons) but is an empty stub.

Because we no longer use globals, it is technically not necessary.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: adodb-lite syntax fails after upgrade

Post by rotezecke »

Thanks, much appreciated.
Locked

Return to “[locked] Installation, Setup and Upgrade”