(bear with me, this is long. Also, note that where you see error output from the SQL ODBC driver it is because I manually added and error check and die() because I could not get a logged error any other way)
First,
Joomla 3.3.6 on Windows 2012 R2 with IIS 8 using MSSQL 2012 for the DB
Second,
The extension installer is experiencing catastrophic failure when attempting to install a component. The sqlsrv back-end does not have adequate, or apparently working, error or exception handling for failed queries. Every time a query fails Joomla hard-crashes and no logging options I could find in PHP, IIS, or Joomla can log it. I didn't find a bug report for this, but I'm not sure how I'd log it, exactly.
(for reference, libraries\joomla\database\driver\sqlsrv.php line 612 executes the query, the error handling code after appears to be throwing an exception that isn't being properly caught by whatever is calling it.)
Onward...
I was experiencing the above problem trying to install a specific component. After examining the component's manifest and files more closely I found my first problem - it only includes SQL scripts for MySQL. So, I re-wrote the SQL install, uninstall, and upgrade scripts to work with MS SQL (2012 anyway, tested and working).
In the XML manifest I found the following section
Code: Select all
<install>
<sql>
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
</sql>
</install>
<uninstall>
<sql>
<file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
</sql>
</uninstall>
<update>
<schemas>
<schemapath type="mysql">sql/updates/mysql</schemapath>
</schemas>
</update>
The NEW XML became
Code: Select all
<install>
<sql>
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
<file driver="sqlsrv" charset="utf8">sql/install.sqlsrv.utf8.sql</file>
</sql>
</install>
<uninstall>
<sql>
<file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
<file driver="sqlsrv" charset="utf8">sql/uninstall.sqlsrv.utf8.sql</file>
</sql>
</uninstall>
<update>
<schemas>
<schemapath type="mysql">sql/updates/mysql</schemapath>
<schemapath type="sqlsrv">sql/updates/sqlsrv</schemapath>
</schemas>
</update>
Code: Select all
[install] => SimpleXMLElement Object
(
[sql] => SimpleXMLElement Object
(
[file] => Array
(
[0] => sql/install.mysql.utf8.sql
[1] => sql/install.sqlsrv.utf8.sql
)
)
)
[uninstall] => SimpleXMLElement Object
(
[sql] => SimpleXMLElement Object
(
[file] => Array
(
[0] => sql/uninstall.mysql.utf8.sql
[1] => sql/uninstall.sqlsrv.utf8.sql
)
)
)
[update] => SimpleXMLElement Object
(
[schemas] => SimpleXMLElement Object
(
[schemapath] => Array
(
[0] => sql/updates/mysql
[1] => sql/updates/sqlsrv
)
)
)
Another print_r
Code: Select all
SimpleXMLElement Object ( [file] => Array ( [0] => sql/install.mysql.utf8.sql [1] => sql/install.sqlsrv.utf8.sql ) )
Given the above I simply (temporarily) removed the MySQL scripts from the component and re-ran the installer and ... BOOM! again
Code: Select all
INSERT INTO [xi8ob_extensions] ([name],[type],[element],[folder],[client_id],[enabled],[access],[protected],[manifest_cache],[params]) VALUES ('com_shconfig','component','com_shconfig','','1','1','0','0','{"name":"com_shconfig","type":"component","creationDate":"May 2013","author":"Shaun Maunder","copyright":"Copyright (C) 2013 Shaun Maunder. All rights Reserved.","authorEmail":"[email protected]","authorUrl":"www.shmanic.com",version":"2.0.2.2","description":"COM_SHCONFIG_XML_DESCRIPTION","group":""}','{}')
Array
(
)
Array
(
[0] => Array
(
[0] => 23000
[SQLSTATE] => 23000
[1] => 515
[code] => 515
[2] => [Microsoft][ODBC [drive] 11 for SQL Server][SQL Server]Cannot insert the value NULL into column 'custom_data', table 'joomla.dbo.xi8ob_extensions'; column does not allow nulls. INSERT fails.
[message] => [Microsoft][ODBC [drive] 11 for SQL Server][SQL Server]Cannot insert the value NULL into column 'custom_data', table 'joomla.dbo.xi8ob_extensions'; column does not allow nulls. INSERT fails.
)
[1] => Array
(
[0] => 01000
[SQLSTATE] => 01000
[1] => 3621
[code] => 3621
[2] => [Microsoft][ODBC [drive] 11 for SQL Server][SQL Server]The statement has been terminated.
[message] => [Microsoft][ODBC [drive] 11 for SQL Server][SQL Server]The statement has been terminated.
)
)
[/code]
(stupid forum! The first TWO /code tags are being intepreted as CODE and ignored!)
If I edit libraries\cms\installer\adapter\component.php at line 479 and manually add
Code: Select all
$row->set('custom_data', '');
This has exposed me, repeatedly, to the sqlsrv back-end's (Joomla's, not PHP's) seeming inability to handle a failed query. NONE of the above problems should have resulted in a hard crash.
tl;dr
1.) sqlsrv back-end doesn't handle errors correctly, or is throwing unhandled exceptions causing crashes.
2.) the extension installer is told but neither cares about or remembers which DB back-end an extension is intended for, which results in nearly untraceable failures on some configurations. Moreover, the Joomla Extensions directory doesn't list which DB an extension is intended for, which will lead to the above problem. Given that the extension itself uses the Joomla DB backend after it is installed, the installer should Do-The-Right-Thing(TM) and allow a developer to include SQL scripts for more than one back-end and, further, refuse to install incompatible extensions and then notify the user of the incompatibility.