Strange bug (hooks editing themselves)
#1
Posted 18 November 2009 - 05:14 PM
I did some basic things and re-cached stuff, to no avail. I then checked my hooks folder, and to my surprise my actionOverloader was overloading some 3rd party hook , instead of public_forums_post_post.
I hadn't touched that file in like a month though (since I installed it), yet some other application managed to change it. That messed up my mod, however I just changed it back and re-uploaded it, and its still working as of now.
Any reason to why?
#2
Posted 18 November 2009 - 06:04 PM
What *should* have happened was something like your first hook extends the third party hook you installed, then that hook extends public_forums_post_post. In the end it would be like
hook_a extends hook_b
...
hook_b extends public_forums_post_post
and IPB would do new hook_a()
Brandon Farber
Developer / Senior Support
If it sounds like fun, it's not allowed on the bus!

Invision Power Services, Inc.
#4
Posted 18 November 2009 - 07:56 PM
No problem.
If you uninstalled that hook, but the class hadn't reset properly, submit that as a bug (assuming you uninstalled it through the ACP normally, etc.).
Brandon Farber
Developer / Senior Support
If it sounds like fun, it's not allowed on the bus!

Invision Power Services, Inc.
#5
Posted 18 November 2009 - 08:00 PM
try it!
#6
Posted 19 November 2009 - 12:30 PM
Brandon Farber
Developer / Senior Support
If it sounds like fun, it's not allowed on the bus!

Invision Power Services, Inc.
#7
Posted 30 December 2009 - 05:23 PM
bfarber, on 19 November 2009 - 12:30 PM, said:
As a developer in a large group of developers, how would you detemine that a class has been already extended and by what class without looking at every IPB hooks_files record on every site to be installed?
By the way php classes can be extended more than once as in this example:
<?PHP
class employee
{
protected $empname;
protected $empage;
function setdata($empname,$empage)
{
$this->empname = $empname;
$this->empage = $empage;
}
function outputData(){}
}
class EmployeeData extends employee //extending abstract class
{
function __construct($name,$age)
{
$this->setdata($name,$age);
}
function outputData()
{
echo $this->empname;
echo $this->empage;
}
}
class EmployeeD extends employee //extending abstract class
{
function __construct($name,$age)
{
$this->setdata($name,$age);
}
function outputData()
{
echo $this->empname;
echo $this->empage;
}
}
$a = new EmployeeData("Hitesh","24");
$a->outputData();
$b = new EmployeeD("Jones","30");
$b->outputData();
?>
It is not the preferred method but when developing hooks while others are developing hooks without any communication it would seem to be the only way.
I am waiting for an answer as I have already run into this problem numerous times and having to go to every site that installs it to find the other class really defeats th idea of having classes.
Thanks in advance
Villabus
#8
Posted 30 December 2009 - 05:56 PM
Say you have 1 hook installed that's like
class myhook extends public_forums_forums_topics
Then you install another hook that's
class metoo extends public_forums_forums_topics
When IPB goes to write the hook .php files to the hooks folder, it should actually change that second file to be
class metoo extends myhook
Then we instantiate metoo
Brandon Farber
Developer / Senior Support
If it sounds like fun, it's not allowed on the bus!

Invision Power Services, Inc.
#9
Posted 30 December 2009 - 06:34 PM
bfarber, on 30 December 2009 - 05:56 PM, said:
Say you have 1 hook installed that's like
class myhook extends public_forums_forums_topics
Then you install another hook that's
class metoo extends public_forums_forums_topics
When IPB goes to write the hook .php files to the hooks folder, it should actually change that second file to be
class metoo extends myhook
Then we instantiate metoo
It doesn't work that way. That is why iBotPeaches hook stopped working.
I just did 2 for class public_forums_moderate_moderate and both ended up written exactly as coded:
Quote
{
Quote
{
As a test This was the code to be executed.
Quote
switch ( $this->request['do'] )
{
case '40':
$this->showForma();
break;
}
parent::doExecute( $registry );
Quote
switch ( $this->request['do'] )
{
case '41':
$this->showFormb();
break;
}
parent::doExecute( $registry );
Both work individually installed. If installed together the last one installed only works.
I have the latest ver of 3.05 installed.
#10
Posted 01 January 2010 - 10:49 AM
Brandon Farber
Developer / Senior Support
If it sounds like fun, it's not allowed on the bus!

Invision Power Services, Inc.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













