16. Ready to Retire - Legacy
• Located at libraries/legacy
• Collection of CMS specific and legacy
classes
• Eases transition during CMS 3.x
• Includes legacy MVC, package specific
exceptions, JTableContent, and many CMS
specific form fields and HTML helpers
17. Rookie Code - New
Features
• MVC structure • Crypt Package
• JLanguageStemmer • Basic HTML5
support in
• JDocumentImage JDocument
• Improved • DB Union
autoloader
• JFilesystemPatcher
18. Refactored Database
Package
• Legacy JDatabase • New
deprecated JDatabaseFactory
• New base is • Lazy connection
JDatabaseDriver handling
• Countable and • Partial sub-query
Iterator support support
• Three new drivers
First, to give an idea in numbers about how active development has been on the Platform, here’s some stats about the changes in Platform 12.1. Almost 1,000 commits were made to the Platform in the 342 pull requests submitted by 51 different contributors. Including the Platform documentation and test suite, over 96,000 lines were modified over the course of the last four months.\n
- Support for PHP 5.2 has been dropped as it is a EOL product. To get around a bug with our language handling and PHP 5.3.0, 5.3.1 is our minimum version requirement at this time.\n\n- To migrate from the legacy error handling, much work has gone into converting the use of JError and JDatabase’s error handling logic to using PHP Exceptions.\n\n- The MooTools compatibility layer which enabled backwards compatibility to MooTools 1.2 has been removed. Scripts should be updated to be compatible with MooTools 1.4.\n\n- Many classes that extended JObject no longer do so. A full list is available on docs.joomla.org in the “Potential B/C issues in J! 3.0” article.\n\n- In the CMS, the DS constant has been removed. PHP is able to handle the mixed use of slashes without issue. If for some reason you really need it, you can use PHP's DIRECTORY_SEPARATOR constant.\n\n\n
\n
- Support for extension manifests with the <install> base tag has been removed. Since 1.6, extensions should be using <extension> as their base tag, except for language packs which use <metafile>.\n\n- Automatic loading of non-MVC style files such as admin.content.html.php has been removed. Extensions wishing to continue using these style files will need to load them on their own. Best practice would be to refactor your extension to use the MVC structure.\n\n- Support for the pre-1.6 file structure for plugins has been removed. All plugins must now be in separate folders within their plugin types.\n\n- Legacy support for modules named without the mod_ prefix has been removed. This is holdover from J! 1.0.\n\n- Support for com_install and com_install, and the associated install_script and uninstall_script tags in extension manifests, has been removed. Extensions should instead use a script file. All extension types except for language, library, and templates support these classes.\n\n- Support for client=both in the <metafile> tag of language packs has been removed. Those distributing language packs should specify the client (site or administrator) and install the packs for each client separately. Best practice for distributing language packs for both applications would be to use a package extension.\n
Within JFactory, the getXMLParser and _create** methods have been removed. getXMLParser is replaced by getFeedParser, and the _create** methods are replaced by non-underscored methods. Lastly, support for the no_html parameter, which was used in JFactory::getDocument, has been removed, and the method now returns only a JDocumentHtml instance.\n
JAccess&#x2019; getActions method has been deprecated. Replacing it are two new methods, getActionsFromFile and getActionsFromData. The file method attempts to load the data from a specified file, while the data method works directly with a SimpleXMLElement instance.\n
The Application package (referring to what is now considered legacy) has been cleaned up a bit to remove code dealing with CMS 1.0 and 1.5 conventions.\n\nIn JApplicationHelper, the methods dealing with loading files using older naming conventions (i.e. admin.content.html.php and toolbar.content.php) have been completely removed.\n\nIn JController, the setAccessControl method which dealt with the CMS 1.5 ACL has been removed as well as the authorize (with a z) method. The latter is replaced by the authorise (with a s) method, though this too is now deprecated and set to be removed soon.\n
In addition to the database package having been refactored (more on that later), several deprecated methods have been removed. On the screen are just a few of those methods and listed next to them are their replacement methods. In addition to these methods, also removed are the addQuoted, hasUTF, explain, isQuoted, and queryBatch methods. Right now, the getErrorNum, getErrorMsg, and stderr methods remain in the legacy JDatabase class, but these are deprecated in favor of catching the RuntimeExceptions that are thrown.\n
Several methods have been removed from the HTML package. The JHtmlBehavior::framework() method replaces JHtml::core() and JHtmlBehavior::mootools(). In JHtmlGrid, the access method which was coupled into CMS 1.5 ACL has been removed.\n\nIn JHtmlList, the access, category, and specificordering methods have been removed. The first is replaced by JHtmlAccess::assetgrouplist(), the category method is replaced by JHtmlCategory, and specificordering by the ordering method in the same class.\n
In the Log package, the addEntry and getInstance methods have been removed. In place of the getInstance method, users should create their log using the addLogger method. Entries should be written using JLog&#x2019;s add method.\n
JUtility itself earned its own slide since all methods but one were removed from the class. The only two without replacements are array_unshift_ref and dump. The getHash and isWinOS methods are now in the JApplication legacy class, sendMail and sendAdminMail are now handled by JMail, getToken is now handled by JSession, and return_bytes is handled by JHtmlNumber::bytes().\n
Here&#x2019;s some of the other methods in the Utilities package that were removed.\n\nIn JDate, the setOffset method, which dealt with setting timezones for CMS 1.5, has been removed in favor of setTimezone. The toFormat method has been replaced by format. Lastly, the toMySQL method has been replaced by toSql as an improved method for formatting timestamps for the various databases.\n\nJXmlElement itself has now been deprecated and is slotted for removal with Platform 13.3. Users should now access data directly from SimpleXMLElement instead. Aside from this deprecation, the previously deprecated data and getAttribute methods have both been removed without an API replacement.\n
The legacy tree is a tree of classes that are ready to be retired from the Platform. Located at libraries/legacy, this tree is a collection of classes that are either CMS specific (such as JHelp) or are legacy in nature (such as the previously deprecated JError and JRequest classes). This tree exists to help the CMS transition to Platform 12 by making these classes available to developers still, but their use is discouraged in many cases as these classes will go away with a future CMS and Platform version (note that CMS classes will eventually be moved to libraries/cms).\n
Platform 12 has brought about some great new features that the CMS will be able to take advantage of in the 3.x series, with the biggest one being new MVC structure.\n\nThe stemmer classes used with the Smart Search component have been ported into the Language package on the platform.\n\nThe autoloader has been vastly improved upon in Platform 12. It allows other libraries to register their prefix, enabling the libraries to be autoloaded instead of using require statements. Multiple paths can also be assigned to a single prefix (i.e. the J prefix assigned to libraries/cms, joomla, and legacy).\n\nA new class has been added to the Filesystem package that allows users to work with DIFFs between files.\n\nA replacement for JSimpleCrypt has been added in the form of the Crypt package. It offers improved encryption and decryption support to the Platform and offers four &#x201C;ciphers&#x201D; at the moment.\n\nIn JDocument, basic support for checking for HTML5 has been added. Downstream users can set the HTML5 state when using a JDocumentHtml instance, which enables template developers to set the HTML5 state and extension developers to better create output supporting their environment.\n\nIn JDatabaseQuery, support has been added for the UNION element. This allows users to build queries using UNION or UNION DISTINCT.\n
During Platform 12.1 development, the database package underwent a heavy review and refactor. The end result is that three new database drivers were added and the class structure was reorganized to add flexibility and be proactive for future development. All of the legacy JDatabase child classes will still be present through CMS 3.x to allow for backwards compatibility during the transition.\n\nAlong with the refactor, several new features are added to the package. Through the new JDatabaseIterator, support is present for PHP&#x2019;s Countable and Iterator interfaces. As well is a new JDatabaseFactory with support for retrieving the child objects for any of the database drivers (importer, exporter, iterator).\n\nThe drivers now use a lazy connection method. The API checks to ensure a connection is not already established before doing so and properly disconnects upon completion. Also supported is the drivers attempting to reconnect to servers which have had their connections dropped.\n\nThanks to Gabrielle, who&#x2019;s gone to great lengths to get the PostgreSQL driver added to the Platform, there is now partial support for sub-queries in the database package. Currently, it is only supported by the INSERT and FROM elements.\n