1

i have custom module it not wordpress magento2-rc2. it get error

Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory. 
The following modules are outdated:
Xyaddons_Backinstock data: current version - none, required version - 2.0.0"

when i run command php -f bin/magento setup:upgrade get error same.

i check in Table setup_module in database

 module `Xyaddons_Backinstock   schema_version 2.0.0    data_version null 

module.xml in etc

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Xyaddons_Backinstock"  setup_version="2.0.0">
        <sequence>
            <module name="Magento_Backend"/>
        </sequence>
    </module>
</config>

this file registration.php

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Xyaddons_Backinstock',
    __DIR__
);

and file composer.json

{
    "autoload": {
        "files": [ "registration.php" ],
        "psr-4": {
            "Xyaddons\\Backinstock\\": ""
        }
    }
}

any help me thank so much.

2 Answers 2

1

You have to create registration.php file in root of your module. Inside this file you have to declare your magento namespace_modulename.

 \Magento\Framework\Component\ComponentRegistrar::register(
        \Magento\Framework\Component\ComponentRegistrar::MODULE,
        'Vendorname_Modulename', // you can put your module name like Magento_Checkout...
        __DIR__
    );

Also you have to declared registration in composer.json file.(for CLI) You have to find autoload and insert "files": [ "registration.php" ] code.

"autoload": {
        "files": [ "registration.php" ] ,
        "psr-4": {
            "Vendorname\\Modulename\\": ""
        }      
    }

Thanks.

9
  • i created two file registration.php and registration.php i root same you. but not success
    – xanka
    Commented Nov 16, 2015 at 8:59
  • you have to create only one file in root with namespace registration.php Commented Nov 16, 2015 at 9:01
  • yes. 2 file in Xyaddons/Backinstock/ registration.php , Xyaddons/Backinstock/ composer.json
    – xanka
    Commented Nov 16, 2015 at 9:05
  • plz can you show me, the registration.php file code and composer.json file code Commented Nov 16, 2015 at 9:06
  • i edited question
    – xanka
    Commented Nov 16, 2015 at 9:09
1

i am also facing same issue

{
    "name": "sugarcode/module-test",
    "description": "N/A",
    "require": {
        "php": "~5.5.0|~5.6.0|~7.0.0",
        "magento/module-config": "100.0.*",
        "magento/module-store": "100.0.*",
        "magento/module-backend": "100.0.*",
        "magento/module-customer": "100.0.*",
        "magento/module-cms": "100.0.*",
        "magento/framework": "100.0.*"
    },
    "type": "magento2-module",
    "version": "100.0.1",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "autoload": {
        "files": [
            "registration.php"
        ],
        "psr-4": {
            "Sugarcode\\Test\\": ""
        }
    }
}

app\code\Sugarcode\Test\registration.php

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Sugarcode_Test',
    __DIR__
);

app\code\Sugarcode\Test\etc\frontend\routes.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
    <router id="standard">
        <route id="test" frontName="test">
            <module name="Sugarcode_Test" />
        </route>
    </router>
</config>

in my controller i gave exit and echo the text still its redirecting to 404 page and also it will registered in setup_module table but my custom setup is not running no table was created i tried put exit in that insatll file and run upgrade cli but it dint exit it run fully

same module is worked in beta version but in 2.0.0 cr2 i added both file still its not working

can any one verfiy my .json and registration.php and correct me if i did wrong

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.