Make Pibase extension compatible to TYPO3 6.2.x

1) Remove the line starting with “require_once”, that includes TYPO3 core files
For Ex:
require_once(PATH_tslib.’class.tslib_pibase.php’);
require_once(PATH_t3lib.’class.t3lib_tsparser.php’);

But keep the “require_once” line that includes custom class from current extension
For Ex:
require_once (PATH_site.”/typo3conf/ext/myextension/library/class.mylibclass.php”);

2. Download the TYPO3 source, in my case I am referring to TYPO3 6.2.2
Open the file “typo3-6.2.2\sysext\core\Migrations\Code\LegacyClassesForIde.php”.

This file has very important information regarding migrations.

3. Open the pi1.php file of the extension that you are going to update.

4. Replace the class names by referring to LegacyClassesForIde.php of TYPO3 core.
For Ex:
Replace “tslib_pibase” with “\TYPO3\CMS\Frontend\Plugin\AbstractPlugin”.
To do this, search for “tslib_pibase” on “LegacyClassesForIde.php” and replace with the part next to “extends”
“abstract class tslib_pibase extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {}”

So
“class tx_myextension_pi1 extends tslib_pibase {”
becomes
“class tx_myextension_pi1 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {”

5. Similarly replace “t3lib_div” with “\TYPO3\CMS\Core\Utility\GeneralUtility”.
We can do search and replace all occurrences.

6. Similarly replace “t3lib_extMgm” with “\TYPO3\CMS\Core\Utility\ExtensionManagementUtility”
and repeat this step until all the replacement availabilities are replaced.

7. And for custom class inclusions, replace
require_once (PATH_site.”/typo3conf/ext/myextension/library/class.mylibclass.php”);
with
require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(‘myextension’).’library/class.mylibclass.php’);
“PATH_site” may not work in some cases.

8. Replace
t3lib_div::makeInstance(‘t3lib_TSparser’);
with
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(‘TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser’);
The paths comes in quotes should have double back slashes.

9. Remove the line
t3lib_div::loadTCA(“tt_content”);
that may be there in ext_tables.php
In TYPO3 6.2 version, all TCA are auto loaded. So we need not load again.

How to get an old TYPO3 Extension from Repository

In some cases we may need to get an old TYPO3 extension, this may be for several reasons.

In order to do this, we can follow any of the following methods:

METHOD 1:

  1. Go to http://www.typo3.org/extensions then search for your extension, say tt_news
  2. Just copy yhe download link of the t3x file, and now my link looked as below: http://typo3.org/fileadmin/ter/t/t/tt_news_3.0.1.t3x
  3. We need the version 2.5.2, so change the version number of above URL to as follows:
    http://typo3.org/fileadmin/ter/t/t/tt_news_2.5.2.t3x

METHOD 2:

This is one way, the other way is when we use the update manager within TYPO3 BE, we get a drop down to select the version, and load it’s detail. Then we can install/update the necessary version. Sometimes the drop down may not have the needed version, so Method 1 may work in such cases!

METHOD3:

Most extensions were also under version control on typo3 forge, even here we can get the old files. We may however get some files/updates/changes that were not really published to the Extension Repository. So this may be slightly risky as well. Generally the first two methods are much more easier.

Disable js_css_optimizer when using feeditadvanced

I recently noticed that the extension feeditadvanced when used alog with js_css_optimizer gives an error stating that a CSS file is missing!

This is probably caused because feeditadvanced did nt take into consideration the css files that are created by the js_css_optimizer.

Normally we do not need js_css_optimizer if we would like to edit content. So added a quick solution that disables the js_css_optimizer when using on feeditadvanced.

You will need to edit the following file:

typo3conf\ext\feeditadvanced\hooks\class.tx_feeditadvanced_pagerenderer.php

Open this and add the following 3 lines of code inside the IF Condition of the function preProcessPageRenderer():

unset($GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘cssCompressHandler’]);
unset($GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘jsCompressHandler’]);
unset($GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘concatenateHandler’]);

Full code for preProcessPageRenderer():

public function preProcessPageRenderer($params, $parentObject) {

if ($parentObject->getConcatenateFiles() && (t3lib_div::_GP(‘eID’) === ‘feeditadvanced’) && $GLOBALS[‘TBE_TEMPLATE’]) {

unset($GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘cssCompressHandler’]);
unset($GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘jsCompressHandler’]);
unset($GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘concatenateHandler’]);

$compressor = t3lib_div::makeInstance(‘t3lib_compressor’);
$cssOptions = array(‘baseDirectories’ => $GLOBALS[‘TBE_TEMPLATE’]->getSkinStylesheetDirectories());
$params[‘cssFiles’] = $compressor->concatenateCssFiles($params[‘cssFiles’], $cssOptions);
}
}

It would have been great if css files created by js_css_optimizer are used within feeditadvanced, unfortunately that is not the case at present.
Till then I hope we may use the above code.