Migration from 1.8 to 1.9
Revision 1.9 contains changes, that introduce a new API to some of the components. For this reason,
it is necessary to adapt your applications. The following chapters describe the necessary updates
and they contains hints on the new features.
As you can take from the release notes, the deprected class
variablenHandler was
removed. As a replacement, the
RequestHandler
was introduced in 1.8 and it provides similar functionality.
The migration from
variablenHandler to the
RequestHandler is quite
easy regarding the nearly identical API. To do so, each statement of the type
PHP-Code
$myVar = variablenHandler::registerLocal(...);
must be replaced with
PHP-Code
$myVar = RequestHandler::getValues(...);
Further, the import statement, must be changed from
PHP-Code
import('tools::variablen','variablenHandler');
to
PHP-Code
import('tools::request','RequestHandler');
The changes thus can be dony by "
search&replace".
The switch from the deprecated component
filesystemHandler to the brand new
FilesystemManager is a little bit more challenging. Not only the name of the class
is different, but also the methods and their signature have changed.
The following table depicts the changes of the methods:
| Method of the filesystemHandler (old) |
Method of the FilesystemManager (new) |
| deleteFolderRecursive($folder = '') |
deleteFolder($folder[,$recursive = true]) |
| deleteWorkDir() |
deleteFolder($folder[,$recursive = false]) |
| changeWorkDir([$folder = '.']) |
- |
| renameFile($fileName,$newFileName) |
renameFile($sourceFile,$targetFile[,$force = false]) |
| getAffectedFiles() |
- |
| deleteFiles($files = array()) |
- |
| - |
removeFile($file) |
| copyFile($sourceFile,$targetFile) |
copyFile($sourceFile,$targetFile[,$force = false]) |
| showFileSize($$file) |
- |
| showDirContent() |
getFolderContent($folder[,$fullpath = false]) |
| showDirSize() |
showFolderSize($folder) |
| showDirContentCount() |
- |
| showFileAttributes($file) |
getFileAttributes($file[,$attributeName = null)] |
| deleteWorkDir() |
- |
| isFileNameUnique($folder,$fileName) |
- |
Notes:
-
renameFile(): $sourceFile and $targetFile must contain qualified
path names. If the third param, is set to true, the existing target file will be overwritten.
-
removeFile(): $file must contain a qualified path name.
-
copyFile(): $sourceFile and $targetFile must contain qualified
path names. If the third param, is set to true, the existing target file will be overwritten.
-
The uploadFile() method has still the same signature, but the target name of the
uploaded file must be checked by the developer (e.g. for allowed characters). Further, the function
returns true in case of success and false in case of an error but not the name
of the uploaded file as of revision 1.8 or earlier.
-
The getFileAttributes() function returns a associative array of file attributes.
If the second param is set to the name of an attribute, the value is returned instead of the
whole list.
-
The FilesystemManager component only contains static methods.
The usage of the new class can be taken from the
API documentation or the
class reference table
Release 1.9 contains several compatibility changes to the pager module.
In order to use the pager with the
GenericORMapper, the database access is now done by the
ConnectionManager. Further, the
SessionManager was introduced to cache the results
of the pager in order to gain performance.
To use these extensions, the existing configuration files must be adde two new parameters. These are:
APF-Template
Pager.DatabaseConnection = "<ConnectionKey>"
Pager.CacheInSession = "true|false"
The first directive indicates the database connection to use (see
ConnectionManager
for details), the second one defines, if the pager results should be stored in the session.
The refactoring includes changes to the API as well. The following table gives an overview of the
the modifications:
| Method of the pagerManager (old) |
Method of the PagerManager (new) |
| loadEntries() |
loadEntries([$addStmtParams=array()]) |
|
loadEntriesByAppDataComponent(
&$DataComponent,
$LoadMethod)
|
loadEntriesByAppDataComponent(
&$dataComponent,
$loadMethod[,
$addStmtParams=array()])
|
| getPager() |
getPager([$addStmtParams=array()]) |
Notes:
-
The mos important change is, that the additional params applied to the pager must now be present
as an argument with all load methods.
-
Another important change is, that the fabric class was renamed from pagerManagerFabric
to PagerManagerFabric. This means, thet the creation of the pager can be
achieved with the following code snippet:
PHP-Code
$pMF = &$this->__getServiceObject('modules::pager::biz','PagerManagerFabric');
$pM = &$pMF->getPagerManager('{CONFIG_SECTION}');
The new API of the
ImageManager included exactly two static methods. In order to
migrate to the new version of the class, the two old methods
generateThumbnail() and
resizeImage() have to be replaced by the new
resizeImage() function. Second,
all calles to the
showImageAttributes() method must be exchanged with
getImageAttributes().
Please note, thet the
getImageAttributes() now uses different keys for the image attributes.
Details can be taken from the
class reference table.
Comments
Do you want to add a comment to the article above, or do you want to post additional hints? So please click
here. Comments already posted can be found below.
There are no comments belonging to this article.