Can I Create config files with namespaces in Yii2 or do I just create a model from my settings table? - yii2

This is a question about using config files for my configuration or rather saving the configurations on my settings table on the database. The configurations change as they include usernames and passwords for APIs I am using. I have thought of saving sensitive information to config file and other settings to database. Is it really possible for me to create a config file in #app\config folder and declare global variable $cfg[] which I can call from all controllers and views? Another question withing this same question is, is it a security risk to use the database for configuration settings like API username and password?

If you are using advanced templates you can use param.php or local-param.phpcper management of global parameters that can be used any place you want. If these parameters are common to both the frontend backend it is appropriate indicate in the \ common.
For storing passwords in the database, or for their conservation in the configuration file param is purely a personal choice. I'm running through the files param very comfortable. The fact of creating a database table its model, controller, and CRUD is very easy with Yii2 especially using the automatic generator gii. Over the years I found the tables of database configurations rather awkward unless you use as structures and key value persistent and also why I found the facilities configuration Yii2 very practical

Related

Which database am I using in TYPO3?

I have created a lot of different instances of TYPO3 versions and have not cleverly named my databases. Is there a way to find out which databse I am using with my current project (TYPO3 v9.5.12)?
If you're an Admin/System Maintainer, you can open the TYPO3 backend module "Environment". The first module card "Environment Overview" will give you the name of the currently used database, among some other information.
As an alternative, you can open /typo3conf/LocalConfiguration.php, where the current database is configured. There you could also change the database, if needed.

How to reuse existing user/group data in Activiti?

I have a webapp which has user/group functions, and existing user/group data.
I want to use Activiti the process engine, however, it seems Activiti manage user/group info itself.
Should I:
Refactor my existing webapp, to reuse the user/group data from Activiti, or
Write some adapter code, to make Activiti reuse user/group data in my existing database? Maybe, another implmentation of RepositoryService, IdentityService, etc., and recompile? It seems RepositionServiceImpl is hard coded in the Activiti sources, and there isn't a setRepositionService() method in ProcessEngine.
I can't rename the existing db tables, because there are some other apps using them.
I have read the user guide, but I didn't found any information on how to integrate Activiti with existing apps.
I don't know what version you are currently using, but I used your second option successfully with version 5.5, overriding some Activiti classes:
Extend GroupManager and UserManager (from package org.activiti.engine.impl.persistence.entity), and implement the methods you need, using the required DAOs/EntityManager/whatever pointing to your database. Code here: GroupManager / UserManager.
Implement org.activiti.engine.impl.interceptor.SessionFactory.SessionFactory, for groups and users. Check out code here: ActivitiGroupManagerFactory / ActivitiUserManagerFactory.
Finally, in your activity config you have to set your new SessionFactory classes. I was using spring, so there is my activiti-config bean code: activiti-config.xml (check line 14)
Hope this helps in some way :)
You can check the Lim Chee Kin code to integrate activiti with spring security https://github.com/limcheekin/activiti-spring-security and maybe you can reuse your user/group data with spring security this way you can reuse his code.

SSIS - 2008 - Use a single config table for multiple copies of the same package

I am somewhat new to SSIS.
I have to deliver a 'generic' SSIS package, that the client will make multiple copies of, deploy and schedule each copy for different source databases. I have a single SSIS Configuration table in a separate common database. I would like to use this single configuration table for all connections. However the challenge is with the configuration filter. When client makes a copy of my package, it will have the same configuration filter just like others. I would like to give an option to the client to change the configuration filter before deploying, because for this new copy, the source database can be different. I do not find an option to control this.
Is there a way to change the configuration filter from outside the package (without editing the executable .dtsx file)? Or is there a better approach that I can follow? I do not prefer XML configuration files, the primary reason being my packages are deployed onto SQL server.
Any help would be greatly appreciated.
-Shahul
Your preferred solution does not align well with the way that SSIS package configurations are typically used. See Jamie Thomson's answer to a similar question on the MSDN forums.
I have created a package with the same requirements for my company. It loads data from different sources and loads them into different destinations based on individual configurations for the instances. It is used as an internal ETL.
We have adapters that connect to different sources and pass data to a common staging table in XML format and the IETL Package loads this data into different tables depending on a number of different settings etc.
i.e. Multiple SSIS package instances can be executed with different configurations. You are on the right track. It can be achieved using SQL Server to hold configurations and XML Config file to hold the database info that has this configurations. When an instance of the package executes it will load the default values configured with the package, but needs to update all variables to reflect the purpose of the new instance.
I have created a Windows app to configure these instances and they settings in the database to make it really easy for the client or consultant to configure them without actually opening the package.

Mysql adapter for Zend_Translate

I'm currently in the planning phase of a rather large project that I'll develop in the Zend Framework. One of the problems I'm facing is that the customers will want to translate not only the content but also the interface. I'm currently using gettext and poedit to manage my language files but this is not an option for the customer as they, for one, wont have FTP access to the site.
Hence, I'm thinking of a mysql back end with an interface in the front end for the customer to manage his own translations of the interface. There is however still no mysql adapater for Zend_Translate.
So, does anybody now of an adapter script for Zend_Translate so it can work with a mysql table? Or any arguments against using mysql and possible other solutions for this problem?
You could solve this problem on different ways:
Extend Zend_Translate_Adapter to create your own. All new adapters are only responsible from getting the translations out from the source. That is, you would need only to fetch the translations from the database. Look at other adapters and see how they are implemented.
Fetch the data from the database and pass it to Zend_Translate_Adapter_Array
Use Zend_Translate_Adapter_Csv or Ini. As there would be more reading the writing on the translations, this solution would cut down the number of queries to the database. When the client adds a new language or changes an existing one, simply write it to a file, not the database.
If you decide to go with the database adapter, maybe you could "tag" somehow the translations, so that on the home page you fetch only the translations for the home page, on the contact page only the translations for the contact page...
HTH!
Default Zend adapters handle caching well, so I'd stick to them, unless you really need database.
Instead storing the translation data in the database, you may directly operate on the translation files (e.g. po templates). This would be the best choice if you just needed to add (append to file) new translation strings.
You may use Zend_Translate's option to log untranslated messages (to file or any log adapter, including database),
and then handle the logs, or even create listener translating the saved strings.
Here's how: http://cloetensbrecht.be/zend_translate_mysql.html

Where do you store your misc project settings?

Some projects have properties have miscellaneous settings such as: "AllowPayments", "ShowSideBar", "SectionTitle". Really things that don't necessarily fit in to other objects.
How do you guys store these kinds of values? ApplicationSettings? Flat File? Database table?
How do you access them? Static object with properties? DB call?
Would either of these change if you were in a load balanced environment where you would have to synchronize the files across multiple servers?
Environment
ASP.NET 2.0
For me it depends on the context the setting is. If it relates to the data and the domain, i store in the database, if it relates the the application i store in the web.config.
App.Config, or a custom xml configuration file and config service. Key value pair mappings keeps things very simple.
Since you didn't tell which environment you use:
In .NET applications, I use the ApplicationSettings system from Visual Studio. This way you can configure the settings with default values in the designer, and a strongly-typed class to access the values is generated. I usually add a second ApplicationSettings element with the name Persistent in addition to the default Settings, with anything the user configures to go in the Settings object and anything I just save (i.e. window position) to the Persistent object.
This goes for desktop applications.