maxf5 Posted August 25, 2017 Share Posted August 25, 2017 Hey guys, whenever i install a new modul it works but when i want to go in the settings of the module i get an error: ProcessWire 3.0.72 Link to comment Share on other sites More sharing options...
abdus Posted August 25, 2017 Share Posted August 25, 2017 Clearing module cache usually helps Here's the relevant part from PW core. // ProcessModule.module protected function renderEdit($moduleName, $moduleInfo) { // ... $moduleId = $this->modules->getModuleID($moduleName); // ... if(!$moduleId) { $this->error("Unknown module"); return $this->session->redirect('./'); } // ... } And getModuleID() method: // Modules.php public function getModuleID($class) { $id = 0; if(is_object($class)) { if($class instanceof Module) { $class = $this->getModuleClass($class); } else { // Class is not a module return $id; } } if(isset($this->moduleIDs[$class])) { $id = (int) $this->moduleIDs[$class]; } else foreach($this->moduleInfoCache as $key => $info) { if($info['name'] == $class) { $id = (int) $key; break; } } return $id; } If PW cannot get the module from the cache, it returns 0, which sets of the error you're receiving. 1 Link to comment Share on other sites More sharing options...
maxf5 Posted August 25, 2017 Author Share Posted August 25, 2017 @abdus sorry, doesn't help in this case.. It only happens with installed modules. Could there be issues with following? $config->dbCache = true; $config->sessionChallenge = true; $config->sessionFingerprint = true; Link to comment Share on other sites More sharing options...
abdus Posted August 25, 2017 Share Posted August 25, 2017 I'm still betting on cache. Modules.info cache holds information about which modules are installed. Mine looks like this: // Modules.info cache { "148": { "name": "AdminThemeDefault", "title": "Default", "version": 14, "autoload": "template=admin", "created": 1502621954, "configurable": 19, "namespace": "ProcessWire\\" }, "97": { "name": "FieldtypeCheckbox", "title": "Checkbox", "version": 101, "singular": 1, "created": 1502621954, "namespace": "ProcessWire\\", "permanent": true }, // ... } Try assigning an empty array to $config->preloadCacheNames in config.php to disable reading from module cache, and even manually removing Modules.info from caches table in DB. /** * Cache names to preload * * Consists of the cache name/token for any caches that we want to be preloaded at boot time. * This is an optimization that can reduce some database overhead. * * @var array * */ $config->preloadCacheNames = array( 'Modules.info', //'ModulesVerbose.info', 'ModulesVersions.info', 'Modules.wire/modules/', 'Modules.site/modules/', ); 1 Link to comment Share on other sites More sharing options...
maxf5 Posted August 25, 2017 Author Share Posted August 25, 2017 Oh sorry my fault.. my table modules in the db had no structure and all the new modules could'nt get an ID.. sorry for that. Now it works It happened when i repaired the database: 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now