I'm developing a CRM and i need to access customers database. whole CRM uses mysql to store data. but customers data stored in ms sqlserver.
by default to add another database in codeigniter,it should added from config file. but i want to add it using controller(like cms as wordpress,joomla,etc).
well you cannot update database settings dynamically, as they're loaded long before the controller is initialized.
However, what you could do is, add another set of database config, write into the database.php file using codeigniter file helper using this link.
write_file(APP_PATH.'/config/database.php', $data, 'r+');
Basically you open the file in write mode and set the database config into it.
This is one way of doing it. Just an idea.
Related
I've developed an app which fetches data from an API based on Laravel 5.5. The marketing landingpage of the app is based on Craft CMS Version 3. The marketing website and the API and the databases of both systems are running on the same server.
I want to generate landingpages for each row of table X of the Laravel database.
www.website.com/awesome-landingpage-about-{slug}
What is the best approach to realize this?
I don't want to fetch the data directly from Laravel's database
I don't want to synchronize the Craft CMS database with the Laravel (add/remove the rows from the laravel's database as entries to Craft)
It would be awesome to be able to have an entry-type "Landingpage" where we can optionally create a landingpage, referencing to an ID of the laravel table and add additional content for the landingpages.
Would be a JSON-API from Laravel to Craft CMS Plugin a good performant idea?
One option would be to use a Dynamic Route and just fetch the data from 127.0.0.1 (because same server) from the template file? Or is there a smarter way in Craft CMS?
Let's start of by:
"I don't want to fetch the data directly from Laravel's database"
I'm assuming you don't want to write code in CraftCMS to access another project's database. Good. IF you plan on having them do seperate jobs and use Laravel API for fetching data alone, let it handle it's own database.
"I don't want to synchronize the Craft CMS database with the Laravel (add/remove the rows from the laravel's database as entries to Craft)"
So, this is my question:
You want to be able to create landing pages based of Laravel's rows alone or based of Laravel's database row's and CraftCMS's?
It all comes down to how well you want to abstract both frameworks.
I would probably tell laravel to accept requests from authenticated user (a CraftCMS User) or from localhosts (from within the machine alone) and I'd create endpoints to add/remove/edit/get data at my disposal. I'd then fetch rows from Laravel and combine with my own (assume I'm the CMS).
Even in an intranet network, the request to tell laravel to access the database is longer than to access the database from CraftCMS, so you should expect a dependency between the two projects.
For point 3, you'll have to store information on each database about something. On CraftCMS's to store at least the ID's it's going to request to laravel and laravel will have to get an endpoint where it can insert new stuff, if you're planning on having additional content there.
I'm not entirely sure if I got the idea you're trying to show when you say "add additional content for the landing pages" but I'd try to keep it simple and abstract it's uses, Laravel to store this 'information' that the CMS shouldn't handle in the first place (or you can work out some extra tables and import them to the other database).
Impact performance? Depends on the ammount of data you've got
I've been trying to duplicate Odoo's datebase in order to create a production database and a testing one. How can I do this? Once this is ready, how do I know which database I am working at?
You can do database related operation like create new , duplicate , drop, backup database or restore database from odoo ui it self.
http://server_address:port/web/database/manager
Here you will get all the option to manage database from ui.
just click on database manager just below the password field of login page then you can see Menu Named 'DUPLICATE' just click on that then there are two fields write there the source database name and new(Duplicated) Database and then click on Duplicate button on header. It duplicates DB in Seconds
I am in the process of moving my local website onto a live webhost and am having some confusion while exporting my database tables from phpMyAdmin.
I attached a screenshot for reference.
It seems as if there are two database tables that are being used for my website, I'm not sure how this happened though. What I am trying to figure out is which database table is the one that I need to export along with all my Joomla files?
I went into my htdocs to check the configuration.php file and it says that the database prefix is xxx (i made this up) BUT when I go look into that database table (on phpMyAdmin) the dates of creation don't match up but are current in the "other database table."
Thank you for your help.
Screenshot for reference
To ascertain which is the correct database, create a new user via the Joomla interface, then have a look at the users Joomla table via phpMyAdmin, in both databases, to see in which database the user got created.
This information can be found in your site's admin at Site => Global Configuration => Server
I looked up for some plugins and I found that most of them ask to create manually one more table in database, or store their settings in some file.
What is the best way? Thanks.
PS I really don't think that the client want to create anything manually in his DB.
UPDATED
For now I'm using Special Page with form on it, and store settings as serialized data in file.
As the install manual says, having shell access to the server is a requirement.
There are workarounds but don't expect everything to work.
I have a configuration-table(id,name,value), containing some configuration variables for my symfony application such as email_expiration_duration. I want to write a service to read these configuration varibales from symfony application.
I want cache the data in app/cache folder.
That means I will read the data from database only if the data is not in cache.
I will clear the cached data whenever the configuration value changes.
How can I do it in symfony2?
If you want to store this information in a file you manually create in the app/cache folder, you may use the following solution: https://stackoverflow.com/a/13410635/1443490
If you don't want/need to care about what folder is used inside the app/cache folder and your project already uses Doctrine, you can follow this solution: https://stackoverflow.com/a/8900283/1443490