public function rollBackAction()
    {

        $success = 0;
        $errors = [];
        $installHelper = $this->getServiceLocator()->get('InstallerHelper');
        $container = new Container('melisinstaller');

        if (!empty($container->getArrayCopy()) && in_array(array_keys($container['steps']), [$this->steps])) {
            $tablesInstalled = isset($container['db_install_tables']) ? $container['db_install_tables'] : [];
            $siteModule = 'module/MelisSites/' . $container['cms_data']['website_module'] . '/';
            $dbConfigFile = 'config/autoload/platforms/' . $installHelper->getMelisPlatform() . '.php';
            $config = include($dbConfigFile);
            // drop table
            $installHelper->setDbAdapter($config['db']);

            foreach ($tablesInstalled as $table) {

                if ($installHelper->isDbTableExists($table)) {
                    $installHelper->executeRawQuery("DROP TABLE " . trim($table));
                }
            }

            // delete site module
            if (file_exists($siteModule)) {
                unlink($siteModule);
            }

            //delete db config file
            if (file_exists($dbConfigFile)) {
                unlink($dbConfigFile);
            }

            // clear session
            $container->getManager()->destroy();

            $success = 1;
        }

        return new JsonModel([
            'success' => $success,
        ]);
    }
public function rollBackAction()
    {

        $success = 0;
        $errors = [];
        $installHelper = $this->getServiceLocator()->get('InstallerHelper');
        $container = new Container('melisinstaller');

        if (!empty($container->getArrayCopy()) && in_array(array_keys($container['steps']), [$this->steps])) {
            $tablesInstalled = isset($container['db_install_tables']) ? $container['db_install_tables'] : [];
            $siteModule = 'module/MelisSites/' . $container['cms_data']['website_module'] . '/';
            $dbConfigFile = 'config/autoload/platforms/' . $installHelper->getMelisPlatform() . '.php';
            $config = include($dbConfigFile);
            // drop table
            $installHelper->setDbAdapter($config['db']);

            foreach ($tablesInstalled as $table) {

                if ($installHelper->isDbTableExists($table)) {
                    $installHelper->executeRawQuery("DROP TABLE " . trim($table));
                }
            }

            // delete site module
            if (file_exists($siteModule)) {
                unlink($siteModule);
            }

            //delete db config file
            if (file_exists($dbConfigFile)) {
                unlink($dbConfigFile);
            }

            // clear session
            $container->getManager()->destroy();

            $success = 1;
        }

        return new JsonModel([
            'success' => $success,
        ]);
    }
public function rollBackAction ( ) { $ success = 0 ; $ errors = [ ] ; $ installHelper = $ this -> getServiceLocator ( ) -> get ( 'InstallerHelper' ) ; $ container = new Container ( 'melisinstaller' ) ; if ( ! empty ( $ container -> getArrayCopy ( ) ) && in_array ( array_keys ( $ container [ 'steps' ] ) , [ $ this -> steps ] ) ) { $ tablesInstalled = isset ( $ container [ 'db_install_tables' ] ) ? $ container [ 'db_install_tables' ] : [ ] ; $ siteModule = 'module/MelisSites/' . $ container [ 'cms_data' ] [ 'website_module' ] . '/' ; $ dbConfigFile = 'config/autoload/platforms/' . $ installHelper -> getMelisPlatform ( ) . '.php' ; $ config = include ( $ dbConfigFile ) ; // drop table $ installHelper -> setDbAdapter ( $ config [ 'db' ] ) ; foreach ( $ tablesInstalled as $ table ) { if ( $ installHelper -> isDbTableExists ( $ table ) ) { $ installHelper -> executeRawQuery ( "DROP TABLE " . trim ( $ table ) ) ; } } // delete site module if ( file_exists ( $ siteModule ) ) { unlink ( $ siteModule ) ; } //delete db config file if ( file_exists ( $ dbConfigFile ) ) { unlink ( $ dbConfigFile ) ; } // clear session $ container -> getManager ( ) -> destroy ( ) ; $ success = 1 ; } return new JsonModel ( [ 'success' => $ success , ] ) ; }
Execute this when setup has errors or setup has failed
Execute this when setup has errors or setup has failed