1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Plugin php file changes not taking effect

Discussion in 'XenForo Questions and Support' started by Ingenious, Apr 23, 2013.

  1. Ingenious

    Ingenious Well-Known Member

    I created a basic plugin from one of the tutorials, to just look for an advert hook and then display a random banner.

    This has been working fine for months but now I have an odd problem - I cannot make any changes to it!

    The plugin looks for a specific hook then includes advert.php.

    advert.php is a file that generates a random number and then includes another random file, such as banner1.php, banner2.php, banner3.php and so on.

    No matter what changes I make to advert.php, they won't show, it keeps running as if the old version is there. No matter what changes I make to banner1.php (etc) they won't show either. I can even delete these files from the server, and the banners still run! How is this possible?

    Yet if I change the plugin to include say advertnew.php instead of advert.php, then upload advertnew.php, the new file does indeed work. So the plugin file itself can be changed. Just every one of the existing included files, cannot.

    I have ruled out my FTP because if I use a different PC and download the advert.php file, the changes I made are all there and correct. They just seem to be ignored by the server.

    Why? Is there some sort of caching going on here? There is no caching defined in my config (I am on shared hosting anyway).

    Anyone have any clues please?

    In case anyone asks why don't I just rename the file as this works, the problem is I have around 30 advert files which all need changing, so that's a lot to rename and redo, I just want to edit the .php files and for these changes to work, as they should!
  2. James

    James Well-Known Member

    That sounds complicated. A file that includes another file that generates a random number then includes yet another file?! That could do with some simplifying to begin with.

    It's strange for it to randomly not work, can you think of any changes you made around that time? Maybe another admin disabled the add-on?
    Ingenious likes this.
  3. Ingenious

    Ingenious Well-Known Member

    The plugin works fine, as I said above changes to the plugin code take effect, changes to the included php files don't.

    If I amend the plugin code to include a brand new file, it works, I can then edit that file, and the changes show each time I upload the new version of that file.

    Also if I include a brand new file, then delete it, the forum crashes (as it can't find that file), but if I delete one of the original included files, it still works, as if it's not deleted. Scary!

    And any changes to the original included files, don't show up.

    It's almost as if the forum or the server has said "These files haven't changed for ages, let's cache them".

    And yes it's a terrible way of including random banners and I shall probably have to rewrite it to include all the code within the plugin, as obviously something's not working on my set-up with included files.

    But I would like to try and get to the bottom of it.
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Do you have an opcode cache on the server like APC or Zend Optimizer? The cache might be failing to update. A server restart will usually fix that.
  5. Ingenious

    Ingenious Well-Known Member

    The host has said "No we do not offer any caching tools on the cloud as the ones mentioned". They are basically saying it's not them.

    If I can delete an included php file and there it is, still running, something somewhere must be caching it you would think?
  6. Ingenious

    Ingenious Well-Known Member

    Some developments to this Jake.

    My host has acknowledged that I have correctly changed the included php files and have no idea why they don't work, they say they have no caching in operation and this must be a Xenforo related issue.

    I've had to work around this as I need to make some changes to advert banners and this will be fluid for a few weeks, I can't afford to have any changes cached again. With that in mind, I have learned some PHP code and redone the plugin, so it no longer includes files, but generates the random banner within the plugin.

    So I have fixed it this way, but would still be grateful if anyone can shed any light as to why a file included in a plugin in this manner appears to have been cached and cannot be changed:

    $contents .= ob_get_contents();
  7. Ingenious

    Ingenious Well-Known Member

Share This Page