I am using WordPress integration and after upgrading to Evo 1.0.15 I was getting the 'could not load DBAPI class' error.
I tracked it down to a change in document.parser.class.inc.php here:
/**
* Loads an extension from the extenders folder.
* You can load any extension creating a boot file:
* MODX_MANAGER_PATH."includes/extenders/{$extname}.extenders.inc.php"
* $extname - extension name in lowercase
*
* @return boolean
*/
function loadExtension($extname) {
$extname = trim(str_replace(array('..','/','\\'),'',strtolower($extname)));
$filename = MODX_MANAGER_PATH."includes/extenders/{$extname}.extenders.inc.php";
return is_file($filename) ? include $filename : false;
}
Note that $extname is followed by '.extenders.inc.php'
I replaced this section of code with this code from an older version of ModX (1.0.10):
// loads an extension from the extenders folder
function loadExtension($extname) {
global $database_type;
switch ($extname) {
// Database API
case 'DBAPI' :
if (!include_once MODX_BASE_PATH . 'manager/includes/extenders/dbapi.' . $database_type . '.class.inc.php')
return false;
$this->db= new DBAPI;
return true;
break;
// Manager API
case 'ManagerAPI' :
if (!include_once MODX_BASE_PATH . 'manager/includes/extenders/manager.api.class.inc.php')
return false;
$this->manager= new ManagerAPI;
return true;
break;
default :
return false;
}
}
Note the correct reference to '.class.inc.php' as the dbapi file is named dbapi.mysql.class.inc.php.
After replacing this code, I'm no longer getting the error. I'm not sure if this is going to cause issues anywhere else in ModX yet (it appears its already breaking things in the manager).
So my question is, why does the DBAPI load fine when called directly, but not through the .extenders config file?
[ed. note: lt_dan last edited this post 9 years, 3 months ago.]