xoops forums

SMEDrieben

Not too shy to talk
Posted on: 2011/11/27 11:40
SMEDrieben
SMEDrieben (Show more)
Not too shy to talk
Posts: 148
Since: 2009/6/17
#1

Deprecated since Xoops 2.5.4: how can I solve this

I upgraded from 2.5.3 to 2.5.4 using the upgrade package. My test system generates quite a lot of "deprecated" classes or functions:

'/class/xoopstory.php' is deprecated since XOOPS 2.5.4please create your own class instead.
'/class/xoopstopic.php' is deprecated since XOOPS 2.5.4please create your own class instead.
'/class/user.php' is deprecated since XOOPS 2.5.4please use 'kernel/user.php' instead.


Furthermore, I have 65 identical messages:

'Database::getInstance();' is deprecated since XOOPS 2.5.4please use 'XoopsDatabaseFactory::getDatabaseConnection();' instead.


How can I solve these messages ? What module could be the culprit ?

SME Drieben

Mamba

Moderator
Posted on: 2011/11/27 11:52
Mamba
Mamba (Show more)
Moderator
Posts: 10393
Since: 2004/4/23
#2

Re: Deprecated since Xoops 2.5.4: how can solve this

Quote:
How can I solve these messages ? What module could be the culprit ?

Hopefully the module authors will update soon their modules. Several of the developers are now working together on the "Basic Module Pack", and those modules should have those issues solved.

If you want to solve it yourself, it all depends on the deprecated function, but many of them will be solved by simple Search & Replace in the /modules folder (using something like InfoRapid Search & Replace). For example:

Database::getInstance(); ==> XoopsDatabaseFactory::getDatabaseConnection();
/class/xoopsuser.php ==> /kernel/user.php
/class/xoopsobject.php ==> /kernel/object.php
/class/xoopsmodule.php ==> /kernel/module.php

/class/xoopstory.php and /class/xoopstopic.php will require more work. I think, it's only in News, and ZySpec is looking into it.

For the time being, you can ignore those messages. But the authors have to fix the modules before we go to XOOPS 2.6.0, otherwise they won't work there.
Please support XOOPS & DONATE
Use 2.5.8 | Debug | Requests | Bugs

SMEDrieben

Not too shy to talk
Posted on: 2011/11/27 12:42
SMEDrieben
SMEDrieben (Show more)
Not too shy to talk
Posts: 148
Since: 2009/6/17
#3

Re: Deprecated since Xoops 2.5.4: how can I solve this

Thanks for your quick response !

What is your favourite Find/Search and Replace program or tool ? I still use "AF9 Replace some bytes". The disadvantage of this tool is that files in subfolders must be added manually. Are you aware of a tool that searches a module map (e.g. news) and all files in subfolders ?

Thanks !

Drieben

trabis

Core Developer
Posted on: 2011/11/27 16:08
trabis
trabis (Show more)
Core Developer
Posts: 2268
Since: 2006/9/1 1
#4

Re: Deprecated since Xoops 2.5.4: how can I solve this

Quote:

SMEDrieben wrote:

Are you aware of a tool that searches a module map (e.g. news) and all files in subfolders ?


As Mamba suggested, InfoRapid is pretty good, I used it lot of times:
http://www.inforapid.de/html/searchreplace.htm

kris_fr

Theme Designer
Posted on: 2011/11/27 19:40
kris_fr
kris_fr (Show more)
Theme Designer
Posts: 1009
Since: 2005/12/31
#5

Re: Deprecated since Xoops 2.5.4: how can I solve this

Best tool is Notepad++

Mamba

Moderator
Posted on: 2011/11/27 20:03
Mamba
Mamba (Show more)
Moderator
Posts: 10393
Since: 2004/4/23
#6

Re: Deprecated since Xoops 2.5.4: how can I solve this

Quote:
Best tool is Notepad++

While Notepad is very good for editing, and I am using it quite often, InfoRapid Search & Replace seems to be much faster in the search/replace.

Actually, very often I am using both of them - while I am working on code in Notepad++, I don't want to have the extra search window, as it takes too much space. So having a separate search application is very handy

The only thing that I am missing is the capability to search UTF-8 characters, like the Asian/Arabic alphabets. Here Notepad++ works better, but for regular code, InfoRapid Search & Replace is excellent.
Please support XOOPS & DONATE
Use 2.5.8 | Debug | Requests | Bugs

SMEDrieben

Not too shy to talk
Posted on: 2011/11/27 20:41
SMEDrieben
SMEDrieben (Show more)
Not too shy to talk
Posts: 148
Since: 2009/6/17
#7

Re: Deprecated since Xoops 2.5.4: how can I solve this

Thanks ! Notepad++ is already one of my favourites. InfoRapid Search & Replace is exactly the tool I was looking for !

It works ! Most deprecation messages have disappeared.

SMEDrieben

SMEDrieben

Not too shy to talk
Posted on: 2011/11/27 21:05
SMEDrieben
SMEDrieben (Show more)
Not too shy to talk
Posts: 148
Since: 2009/6/17
#8

Re: Deprecated since Xoops 2.5.4: how can I solve this

There are some other deprecations. E.g.:

Function xoops_getLinkedUnameFromId() is deprecated, use XoopsUserUtility::getUnameFromId() instead


Simple replacement of this function generated a fatal error in wfdownloads:

Fatal error: Class 'XoopsUserUtility' not found in C:xampplitehtdocspublic_htmlmoduleswfdownloadsclassdownload.php on line 240


What should be done with:

Class 'XoopsTree' is deprecatedcheck 'XoopsObjectTree' in tree.php


Thanks !

SMEDrieben

trabis

Core Developer
Posted on: 2011/11/27 22:16
trabis
trabis (Show more)
Core Developer
Posts: 2268
Since: 2006/9/1 1
#9

Re: Deprecated since Xoops 2.5.4: how can I solve this

Quote:

SMEDrieben wrote:

Function xoops_getLinkedUnameFromId() is deprecated, use XoopsUserUtility::getUnameFromId() instead


Simple replacement of this function generated a fatal error in wfdownloads:

Fatal error: Class 'XoopsUserUtility' not found in C:xampplitehtdocspublic_htmlmoduleswfdownloadsclassdownload.php on line 240



On 2.5.x you need to load the class before you use it.
Please use xoops_load('XoopsUserUtility'); before making any call to it.
On 2.6.x there will be no need to load core classes, they are autoloaded.

Quote:

What should be done with:

Class 'XoopsTree' is deprecatedcheck 'XoopsObjectTree' in tree.php



It depends on the module and your developer skills. My guess is that modules using XoopsTree do not have classes extending XoopsObject. You would have to change module classes and make them 'blue' (as in blue move).

The easier way (and dirty) to remove that messages and to have your modules running, is the following:
- Copy class/xoopstree.php into your module/class folder and replace all file includes to use that new path.
- Open the file and rename 'class XoopsTree' into class 'ModulenameTree'
- Remove the xoopsLogger->addDeprecated line from the file.
- Rename XoopsTree calls into 'ModulenameTree'

Roby73

Friend of XOOPS
Posted on: 2011/11/27 22:32
Roby73
Roby73 (Show more)
Friend of XOOPS
Posts: 262
Since: 2011/6/15
#10

Re: Deprecated since Xoops 2.5.4: how can I solve this

Quote:
/class/xoopstory.php and /class/xoopstopic.php will require more work. I think, it's only in News, and ZySpec is looking into it.


To resolve momentarily the problem i include the file xoopstory.php and xoopstopic.php in the module...
In this mode there are the problems with new xoops version?

Some modules are not supported, i do not know how as upgrade these.