Typo3 – Easy upgrade of pibase extension to TYPO3 6.2 or 7.6

After upgrading a Typo3 4.5 Installation to Version 6.2 your old pibase extension may still running. Hmm .. at least mostly πŸ™‚
You just need to remove some requice_once statements and modify the ext_table.php to use the \TYPO3\CMS\Core\Utility\ExtensionManagementUtility class. Most of the other stuff is still there.
Once when you try to upgrade to version 7.6 you are in need to modify a bit more. But don’t worry. After all it isn’t that complicated. And by the way … you don’t need to wait until you upgrade. These changes are running very well even in an 6.2 installation.
So here is a small list of needed action to upgrade from 4.5 via 6.2 to 7.6 πŸ™‚

  • Remove lines starting with require_once that includes TYPO3 core files
  • Remove any t3lib_div::loadTCA(β€œtt_content”)
  • Replace any t3lib_extMgm:: with \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::
  • Replace any t3lib_div:: with \TYPO3\CMS\Core\Utility\GeneralUtility::
  • Replace any tslib_pibase with \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
  • Replace any tslib_cObj with TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer

Or just use these commands (which do all but the first of the list): Of course do a backup before!

find . -type f -print0 | xargs -0 sed -i 's#t3lib_div::loadTCA#//t3lib_div::loadTCA#g'
find . -type f -print0 | xargs -0 sed -i 's#t3lib_extMgm::#\\TYPO3\\CMS\\Core\\Utility\\ExtensionManagementUtility::#g'
find . -type f -print0 | xargs -0 sed -i 's#t3lib_div::#\\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::#g'
find . -type f -print0 | xargs -0 sed -i 's#tslib_pibase#\\TYPO3\\CMS\\Frontend\\Plugin\\AbstractPlugin#g'
find . -type f -print0 | xargs -0 sed -i 's#tslib_cObj#TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer#g'

You have more old class names in use? Just check yourself which is the new name: https://docs.typo3.org/typo3cms/CoreApiReference/6.2/ApiOverview/Namespaces/Index.html

Instead of makeInstance you should use the objectManager:

old:
$TSFE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController', $TYPO3_CONF_VARS, 0, 0);

new:
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$TSFE = $objectManager->get('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $TYPO3_CONF_VARS, $id, 0);

Some useful links

Typo3: Backend Search

After you upgraded from a Typo3 Version 4.5 LTS to Version 6.2 or higher you may wounder why the backend search is not working anymore as expected. Even in the list mode the result of extension records can be empty.
If it’s your own extension you can fix it very easy. Since Version 4.6 the search behavior was changed (see https://forge.typo3.org/issues/36452).
To re-enable the search function of your own extension records to have to add this line to your ext_table.php:

$TCA['name_of_table']['ctrl']['searchFields'] = 'col1, col2, col3';

Just include all columns which make sense. Clear the system cache and it’s done. Of course you need to do this for every table which you wanted to be searched πŸ™‚

Plesk centos update to mysql 5.6 oder higher

If you like to upgrade your mysql installation to a newer version you may try this:

First of all we need to add a repo with contains the new mysql version. I’ve chose the one of the IUS Community

Then we need to check what currently is installed:
# rpm -qa | grep mysql
mysql-server-5.5.48-1.el6.remi.x86_64
plesk-mysql-server-12.5.30-cos6.build1205150826.19.x86_64
mysql-libs-5.5.48-1.el6.remi.x86_64
mysql-5.5.48-1.el6.remi.x86_64
compat-mysql51-5.1.54-1.el6.remi.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
php-mysqlnd-5.6.19-1.el6.remi.x86_64

We need to remove the old stuff. Be sure to select only the parts we can really get rid off πŸ™‚ Never every remove the one which starts with plesk-mysql-server !

rpm -e --nodeps mysql-server-5.5.48-1.el6.remi.x86_64 mysql-libs-5.5.48-1.el6.remi.x86_64 mysql-5.5.48-1.el6.remi.x86_64 compat-mysql51-5.1.54-1.el6.remi.x86_64 compat-mysql51-5.1.54-1.el6.remi.x86_64

Now install the new one. In my case I want mysql 5.7:
yum install mysql57u-server.x86_64 mysql57u.x86_64

Since the databases are in the old format we need to upgrade them to work with the new server version:
mysql_upgrade -u admin -p`cat /etc/psa/.psa.shadow`

This may take a while. After that you should restart the mysql server.

If you every modified /etc/my.cnf you may should have a look since it may reset to the defaults. But don’t worry. The original one should be saved to my.cnf.rpmsave (or something similar).

That’s it!

Mouse movement awakes Windows from hibernate mode

I really like to you the hibernate mode of Windows. And it’s working very fine. However I recently added a new mouse device. First it seems to work but when I accidentally moved my mouse while the PC was in hibernate the computer restarted! The quickest way to find out which device is able to awake the computer and disabled it is to use the command line:

powercfg -devicequery wake_armed Will list all devices which are allowed to wake up the computer.
powercfg -devicequery wake_programmable will list all disallowed devices.

Now you just have to pick the right one from the allowed list and disable it with this command
powercfg -devicedisablewake deviceNname

For what ever reason I had to disable all devices until the movement of my mouse didn’t wake up the PC any longer.

Typo3 Replace old getPageLink in an extbase controller

If you wounder how to create links in an extbase controller instead of using the old pi_getPageLink methode you should have a look at this:

$this->controllerContext->getUriBuilder()->reset()
  ->setArguments([
    'tx_myext[action]'=>'show', 
    'tx_myext[param]'=>$model->getUid() ])
  ->setTargetPageUid($GLOBALS["TSFE"]->id)
  ->setCreateAbsoluteUri(true)
  ->buildFrontendUri();

To get more information you may search for getUriBuilder

Typo3 Problems with image gm convert and umlauts

If you have a problem when uploading images with umlauts in the file name you first stop may will be to check the config.local_all setting. The setting should match some value of the locale -a command of the server. Mose of the time it’s something like en_US.uft8 or de_DE.utf8.
But if you still getting errors like

/usr/local/bin/gm convert: Unable to open file ([image file name]) [No such file or directory].

You should also set systemLocale of the Typo3 configuration. The most simple way to do this is to use the Installation Tool/All Configuration:

$TYPO3_CONF_VARS['SYS']['systemLocale'] = 'de_DE.utf-8';

Plesk: mysql admin password

Since Version 10 it’s possible that the password of the mysql database of Plesk is, well they call it encrypted. This is basically fine, but may can run you in some trouble. For example if you like to install you own global phpMyAdmin installation and then try to log in as admin.

You’ll first try will be to use the same password as you will use when log in to Plesk. That will not work! Then you’ll may step over the ssh shell and type in

cat /etc/psa/.psa.shadow

This will give you something like

$AES-128-CBC$X...==

Yeah … that looks like the password is encrypted. As Plesk admin you know an other way to get the password

/usr/local/psa/bin/admin --show-password

This will output the password you already tried. Then you’ll dig around the internet and may find this cmd

mysql -uadmin -p`cat /etc/psa/.psa.shadow`

And … it’s working! You get access to mysql. Hmm … now you’re may a bit confuse. But thing about it. If you want to access your mysql database outside of Plesk you have to use the whole output of

cat /etc/psa/.psa.shadow

as password! Even if it look like it’s encrypted. This is your database password!

 
If you don’t like to have such a super long password and can live with a plain text password in the file /etc/psa/.psa.shadow you can change it back. But remember to repeat this every time you change the password via the Plesk panel πŸ™‚

/usr/local/psa/bin/init_conf -u -passwd 'some_password' -plain-password

 
Alternative you can add an other user with full admin rights to your database.

Typo3: “Cannot find tslib” and “Lock file could not be created”

Recently I had to move my Typo3 Installation from one server to new one. It should be easy to move. However the reality is another one πŸ˜‰ In specialty if you are using Plesk.

After I used the MigrationManager of Plesk the site wasn’t running. I got the message

Cannot find tslib/. Please set path by defining $configured_tslib_path in index.php.

A quick search showed up that the symbolic link of the global typo3 installation isn’t working. I’ve checked that but it was correct. But then I got an idea: The old installation was running on Plesk Version 9 and the new one on Version 11. In Version 9 you hat to the open_basedir youself via the vhost.conf file. Since Version 11 you can (and have to) do this via the web interface. So I changed the php setting of the subscription to {WEBSPACEROOT}/:{TMP}/:/srv/typo3 (where /srv/typo3 is the path to my global Typo3 installation) and I got a step further.

Next try to load the site. After a while just a blank page showed up. Quick view into the error_log show this message

Lock file could not be created
Exception thrown in file ...

This is an easy one: Just adjusted the permissions of you typo3temp directory and everything went fine.