Jump to content

Rebuilding plugin XML from plugins directory


Meddysong

Recommended Posts

When IPS4 first came out, I commissioned a dev to write a plugin for me. "Keep a copy because I delete my PMs after a while", he told me. I'm usually pretty good at keeping copies of my plugins but this one appears to have slipped through the net. I'm not sure how because I have a copy on my original site plus another on my second site. I now need it on my new third site and can't track it down anywhere.

I can see the relevant files in the plugins directly and copied them to the new site. But there was nothing to see under Plugins in the ACP, presumably because the system uploads info from the XML to say plugin X has been installed and its hooks are located under such and such a name.

Is there a way I can regenerate the plugin XML? 

Link to comment
Share on other sites

I suppose it's not a good thing that I've uploaded the dev files (only for my apps), made the relevant change to constants.php and it's landed me straight with

BadMethodCallException
NO_PLUGIN_TEMPLATE_FILE - clearCacheLink
  •  
  •  

I've never dared try Developer Mode and the fact it errored immediately isn't doing much to convince me that my apprehension was wrong!

The fault is triggered by line "throw new \BadMethodCallException( 'NO_PLUGIN_TEMPLATE_FILE - ' . $bit );" in /home/xxxxxxx/public_html/system/Theme/Dev/Template.php

/home/timeofft/public_html/system/Theme/Dev/Template.php
            /* Find the file */
            $file = NULL;
            if ( $this->sourceFolder === \IPS\ROOT_PATH . '/plugins' )
            {
                foreach ( new \GlobIterator( $this->sourceFolder . '/*/dev/html/' . $bit . '.phtml' ) as $file )
                {
                    break;
                }
            }
            else
            {
                $file = $this->sourceFolder . $bit . '.phtml';
            }
            
            /* Get the content or return an BadMethodCallException if the template doesn't exist */
            if ( $file === NULL or !file_exists( $file ) )
            {
                if ( !$file AND $this->sourceFolder === \IPS\ROOT_PATH . '/plugins' )
                {
                    throw new \BadMethodCallException( 'NO_PLUGIN_TEMPLATE_FILE - ' . $bit );
                }
                else
                {
                    throw new \BadMethodCallException( 'NO_TEMPLATE_FILE - ' . $file );
                }
            }
            
            $output = file_get_contents( $file );
            
            /* Parse the header tag */
            if ( !preg_match( '/^<ips:template parameters="(.+?)?"(\s+)?\/>(\r\n?|(\r\n?|\n))/', $output, $matches ) )
            {
                throw new \BadMethodCallException( 'NO_HEADER - ' . $file );
            }

Sorry, I think I've hit a stop before I've even started.

Link to comment
Share on other sites

You're seeing that error message because you're missing dev folders from one or more apps or plugins.   You'll have to disable those or use dev toolbox to regenerate the dev folder on those too.   

The board probably won't work through this process.   So you're going to have to pick a time where your users don't mind being down.    You should still have direct access to your admincp though.    

Link to comment
Share on other sites

16 hours ago, Dan C said:

Put one of the existing boards in dev mode and then use Dev Toolbox to regenerate the dev folder.   Then you should be able to download a fresh XML file for your plugin. 

Thank you, Dan. This has been a fascinating (and very daunting!) look behind the scenes. As you surmised, that error from earlier was caused by a plugin which I've since disabled.

I'm not sure how this process is supposed to work, though: Dev Toolbox > Generate Plugin Dev Folder expects me to upload the plugin XML in order to generate the folder from which I'll be able to download the XML which I no longer have. That seems pretty circular -- if I had the XML, I wouldn't need to try this process ?

I've tried a few other approaches, such as Plugins > [select plugin name] > Download (which fails because there's no /dev/html folder) and re-saving the hook (thinking that would rebuild everything but which is failing because "You don't have permission to access /admin/ on this server", which seems daft considering I'm accessing the ACP from that folder).

If I were to provide the content of the PHP file for the hook and the relevant classes to extend, properties and methods, would it be possible for someone to rebuild the plugin if I offered a small payment? (I've thought about trying this myself but can't actually see how to create a plugin and although the IPS Help Guides have a heading "Creating Plugins", there isn't an article to read.) 

Maybe next time I'll pay extra attention to keep the XML of custom plugins which I won't be able to download again ...

Link to comment
Share on other sites

2 hours ago, Meddysong said:

If I were to provide the content of the PHP file for the hook and the relevant classes to extend, properties and methods, would it be possible for someone to rebuild the plugin if I offered a small payment? (I've thought about trying this myself but can't actually see how to create a plugin and although the IPS Help Guides have a heading "Creating Plugins", there isn't an article to read.) 

Maybe next time I'll pay extra attention to keep the XML of custom plugins which I won't be able to download again ...

It would be indeed easy to re-create the plugin. 

Link to comment
Share on other sites

2 hours ago, Meddysong said:

If I were to provide the content of the PHP file for the hook and the relevant classes to extend, properties and methods, would it be possible for someone to rebuild the plugin

I sent you a DM.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...