Jump to content

Module's path


lutol

Recommended Posts

Hi

Can anyone tell me where I can find an installed module path? I have installed some other module on localhost, but when I moved presta to server and tried to uninstall after while I can't. I found in the error log that it tries to open the module from the path which is on localhost. I've searched the database and can't find where this path is placed. 

 

Link to comment
Share on other sites

2 hours ago, lutol said:

Hi

Can anyone tell me where I can find an installed module path? I have installed some other module on localhost, but when I moved presta to server and tried to uninstall after while I can't. I found in the error log that it tries to open the module from the path which is on localhost. I've searched the database and can't find where this path is placed. 

 

Have you cleared cache?

Link to comment
Share on other sites

Yes, I did, but I had also cache disabled. 

I get an error in file src/Adapter/Module/Module.php line: 

require_once $this->disk->get('path').DIRECTORY_SEPARATOR.$this->attributes->get('name').'.php';
    protected function instanciateLegacyModule()
    {
        // Temporary: This test prevents an error when switching branches with the cache. Can be removed at the next release (when we will be sure that it is defined)
        $path = $this->disk->get('path', ''); // Variable needed for empty() test
        if (empty($path)) {
            $this->disk->set('path', _PS_MODULE_DIR_.DIRECTORY_SEPARATOR.$this->attributes->get('name'));
        }
        // End of temporary content
        require_once $this->disk->get('path').DIRECTORY_SEPARATOR.$this->attributes->get('name').'.php';
        $this->instance = LegacyModule::getInstanceByName($this->attributes->get('name'));
    }

I can't find out how the presta gets that path...

Link to comment
Share on other sites

5 minutes ago, lutol said:

Yes, I did, but I had also cache disabled. 

I get an error in file src/Adapter/Module/Module.php line: 


require_once $this->disk->get('path').DIRECTORY_SEPARATOR.$this->attributes->get('name').'.php';

    protected function instanciateLegacyModule()
    {
        // Temporary: This test prevents an error when switching branches with the cache. Can be removed at the next release (when we will be sure that it is defined)
        $path = $this->disk->get('path', ''); // Variable needed for empty() test
        if (empty($path)) {
            $this->disk->set('path', _PS_MODULE_DIR_.DIRECTORY_SEPARATOR.$this->attributes->get('name'));
        }
        // End of temporary content
        require_once $this->disk->get('path').DIRECTORY_SEPARATOR.$this->attributes->get('name').'.php';
        $this->instance = LegacyModule::getInstanceByName($this->attributes->get('name'));
    }

I can't find out how the presta gets that path...

The only thing you have to do when you move a store is to check table `ps_shop_url` and regenerate .htaccess. If you have done this and cleared cache, I don't know what could be the problem. 

 

Which error do you get? Maybe is server configuration.

Link to comment
Share on other sites

8 minutes ago, joseantgv said:

The only thing you have to do when you move a store is to check table `ps_shop_url` and regenerate .htaccess. If you have done this and cleared cache, I don't know what could be the problem. 

 

Which error do you get? Maybe is server configuration.

Yes, I did it. Generally everything works fine except that I can't uninstall any (I think) module (I tried to uninstall also prestashop module like LinkList and I can't). I get this error:

Quote

PHP Fatal error:  require_once(): Failed opening required

and that leads me to the file and function which I posted earlier. I'm trying to find how the presta reads the path in that line... but I can't so far.

Link to comment
Share on other sites

I solved the problem, so for others if you get any problems with Module section go first to:

var/cache/prod/doctrine/

and delete cb folder or even the whole doctrine folder (it will rebuild). Now I can disable or uninstall all modules. I had also error 500 when I clicked Notifications tab (I didn't really care about that because I didn't use) but after I've deleted cb folder it all started to work again. I wounder why the button Clear Cache doesn't work for all the cache that presta uses and why there is this cache if I had it disabled from the beginning.

Link to comment
Share on other sites

  • 1 month later...
On 1/3/2019 at 6:21 PM, lutol said:

I solved the problem, so for others if you get any problems with Module section go first to:


var/cache/prod/doctrine/

and delete cb folder or even the whole doctrine folder (it will rebuild). Now I can disable or uninstall all modules. I had also error 500 when I clicked Notifications tab (I didn't really care about that because I didn't use) but after I've deleted cb folder it all started to work again. I wounder why the button Clear Cache doesn't work for all the cache that presta uses and why there is this cache if I had it disabled from the beginning.

 

Hello

i have same problem after moving website from test server to final server on 1.7.5, i have cleared all caches but your solution doesn't work for me

03-Mar-2019 00:26:51 UTC] PHP Warning:  require_once(..public_html/modules/contactform/recaptcha.php): failed to open stream: No such file or directory in ../public_html/src/Adapter/Module/Module.php on line 354

 

and 354 is  

require_once $this->disk->get('path') . DIRECTORY_SEPARATOR . $this->attributes->get('name') . '.php';
        $this->instance = LegacyModule::getInstanceByName($this->attributes->get('name'));

 

Any idea how to fix? thx

 

Link to comment
Share on other sites

  • 3 weeks later...

Running this shell script solved this problem (and solves many others related to cache):

Disclaimer: I didn't code it, nor can't recall where I got it 🤔. But works great, specially when you move a site to different server/domain. Tried on 1.7.4.2
 

#!/bin/bash
base_dir='./'

# Clear class index in case any override changed
rm ${base_dir}/cache/class_index.php

declare -a cache_dirs=(
    "cache/smarty/compile"
    "cache/smarty/cache"
    "cache/cachefs"
    "img/tmp" # You might want to keep tmp images
    "themes/*/cache"
    "var/cache")

# Clear all cache folder, ignoring 'index.php'
for dir in "${cache_dirs[@]}"
do
    echo Cleaning ${base_dir}/${dir}...
    find ${base_dir}/${dir} -type f ! -name index.php -delete
done

 

Link to comment
Share on other sites

  • 8 months later...
  • 4 months later...
On 23/3/2019 at 23:32, Mercader Virtual said:

L'esecuzione di questo script shell ha risolto questo problema (e risolto molti altri relativi alla cache):

Disclaimer: non l'ho codificato, né riesco a ricordare dove l'ho preso 🤔 . Ma funziona benissimo, specialmente quando sposti un sito su un server / dominio diverso. Provato il 1.7.4.2
 





 

salve sono nuovo in questo mondo dove lo lancio questo script shell

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...