Redaxscript\Module::uninstall PHP Method

uninstall() public method

uninstall the module
Since: 2.6.0
public uninstall ( )
    public function uninstall()
    {
        if (array_key_exists('alias', static::$_moduleArray)) {
            Db::forTablePrefix('modules')->where('alias', static::$_moduleArray['alias'])->deleteMany();
            /* drop from sql */
            $directory = 'modules/' . static::$_moduleArray['alias'] . '/database';
            if (is_dir($directory)) {
                $installer = new Installer(Config::getInstance());
                $installer->init($directory);
                $installer->rawDrop();
            }
        }
    }

Usage Example

コード例 #1
0
ファイル: ModuleTest.php プロジェクト: ITw3/redaxscript
 /**
  * testUninstall
  *
  * @since 2.2.0
  */
 public function testUninstall()
 {
     /* setup */
     $module = new Module(array('alias' => 'test'));
     $module->uninstall();
     /* result */
     Db::clearCache();
     $result = Db::forPrefixTable('modules')->where('alias', 'test')->findOne();
     /* compare */
     $this->assertFalse(is_object($result));
 }
All Usage Examples Of Redaxscript\Module::uninstall