public function setModules()
	{
		$moduleVendorPath	= Yii::getPathOfAlias('application.vendor.ommu');
		$installedModule	= $this->getModulesFromDir();
		$cacheModule		= file(Yii::getPathOfAlias('application.config').'/cache_module.php');
		$toBeInstalled		= array();
		
		$caches = array();
		foreach($cacheModule as $val) {
			$caches[] = trim($val);
		}

		if(!$installedModule)
			$installedModule = array();
		
		foreach($caches as $cache) {
			if(!in_array($cache, array_map("trim", $installedModule)))
				$this->deleteModuleDb($cache);
		}

		$moduleDb = $this->cacheModuleConfig(true);
		foreach($installedModule as $module) {
			$module = trim($module);
			if(!in_array($module, array_map("trim", $moduleDb))) {
				$config = $this->getModuleConfig($module);
				$moduleFile = join('/', array($moduleVendorPath, $module, ucfirst($module).'Module.php'));

				if($config && file_exists($moduleFile) && $module == $config['folder_name']) {
					$model=new OmmuPlugins;
					$model->folder = $module;
					$model->name = $config['name'];
					$model->desc = $config['description'];
					if($config['model'])
						$model->model = $config['model'];
					$model->save();
				}
			}
		}
		
		$this->generateModules();
	}
public function setModules()
	{
		$moduleVendorPath	= Yii::getPathOfAlias('application.vendor.ommu');
		$installedModule	= $this->getModulesFromDir();
		$cacheModule		= file(Yii::getPathOfAlias('application.config').'/cache_module.php');
		$toBeInstalled		= array();
		
		$caches = array();
		foreach($cacheModule as $val) {
			$caches[] = trim($val);
		}

		if(!$installedModule)
			$installedModule = array();
		
		foreach($caches as $cache) {
			if(!in_array($cache, array_map("trim", $installedModule)))
				$this->deleteModuleDb($cache);
		}

		$moduleDb = $this->cacheModuleConfig(true);
		foreach($installedModule as $module) {
			$module = trim($module);
			if(!in_array($module, array_map("trim", $moduleDb))) {
				$config = $this->getModuleConfig($module);
				$moduleFile = join('/', array($moduleVendorPath, $module, ucfirst($module).'Module.php'));

				if($config && file_exists($moduleFile) && $module == $config['folder_name']) {
					$model=new OmmuPlugins;
					$model->folder = $module;
					$model->name = $config['name'];
					$model->desc = $config['description'];
					if($config['model'])
						$model->model = $config['model'];
					$model->save();
				}
			}
		}
		
		$this->generateModules();
	}
public function setModules ( ) { $ moduleVendorPath = Yii :: getPathOfAlias ( 'application.vendor.ommu' ) ; $ installedModule = $ this -> getModulesFromDir ( ) ; $ cacheModule = file ( Yii :: getPathOfAlias ( 'application.config' ) . '/cache_module.php' ) ; $ toBeInstalled = array ( ) ; $ caches = array ( ) ; foreach ( $ cacheModule as $ val ) { $ caches [ ] = trim ( $ val ) ; } if ( ! $ installedModule ) $ installedModule = array ( ) ; foreach ( $ caches as $ cache ) { if ( ! in_array ( $ cache , array_map ( "trim" , $ installedModule ) ) ) $ this -> deleteModuleDb ( $ cache ) ; } $ moduleDb = $ this -> cacheModuleConfig ( true ) ; foreach ( $ installedModule as $ module ) { $ module = trim ( $ module ) ; if ( ! in_array ( $ module , array_map ( "trim" , $ moduleDb ) ) ) { $ config = $ this -> getModuleConfig ( $ module ) ; $ moduleFile = join ( '/' , array ( $ moduleVendorPath , $ module , ucfirst ( $ module ) . 'Module.php' ) ) ; if ( $ config && file_exists ( $ moduleFile ) && $ module == $ config [ 'folder_name' ] ) { $ model = new OmmuPlugins ; $ model -> folder = $ module ; $ model -> name = $ config [ 'name' ] ; $ model -> desc = $ config [ 'description' ] ; if ( $ config [ 'model' ] ) $ model -> model = $ config [ 'model' ] ; $ model -> save ( ) ; } } } $ this -> generateModules ( ) ; }
Install modul ke database
Install modul ke database